Commit e93c7dc0fa84baca2c3c31df6fa83ceccd5d40af
[dali_1.2.22] Merge branch 'devel/master'
Change-Id: Ia7debed3a9a2107c251247df4b519e19bfd60985
Showing
65 changed files
with
798 additions
and
416 deletions
build/tizen/CMakeLists.txt
| ... | ... | @@ -169,7 +169,7 @@ ENDIF(INTERNATIONALIZATION) |
| 169 | 169 | ########################################################################### |
| 170 | 170 | |
| 171 | 171 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE") |
| 172 | -SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") | |
| 172 | +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") | |
| 173 | 173 | |
| 174 | 174 | INCLUDE_DIRECTORIES(${ROOT_SRC_DIR}) |
| 175 | 175 | #INCLUDE_DIRECTORIES(${DEMO_SRC_DIR}) | ... | ... |
build/tizen/builder/CMakeLists.txt
| 1 | 1 | SET(BUILDER_SRC_DIR ${ROOT_SRC_DIR}/builder) |
| 2 | 2 | |
| 3 | 3 | SET(DALI_BUILDER_SRCS ${BUILDER_SRC_DIR}/dali-builder.cpp) |
| 4 | +SET(DALI_BUILDER_SRCS ${DALI_BUILDER_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") | |
| 4 | 5 | ADD_EXECUTABLE(dali-builder ${DALI_BUILDER_SRCS}) |
| 5 | 6 | TARGET_LINK_LIBRARIES(dali-builder ${REQUIRED_PKGS_LDFLAGS}) |
| 6 | 7 | INSTALL(TARGETS dali-builder DESTINATION ${BINDIR}) | ... | ... |
build/tizen/demo/CMakeLists.txt
| ... | ... | @@ -2,11 +2,7 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) |
| 2 | 2 | |
| 3 | 3 | AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) |
| 4 | 4 | |
| 5 | - | |
| 6 | -IF(NOT DEFINED DALI_APP_RES_DIR) | |
| 7 | - message([STATUS] "Setting application resource path from resource-location file") | |
| 8 | - SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") | |
| 9 | -ENDIF() | |
| 5 | +SET(DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") | |
| 10 | 6 | |
| 11 | 7 | ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) |
| 12 | 8 | TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie) | ... | ... |
build/tizen/examples/CMakeLists.txt
| ... | ... | @@ -15,10 +15,7 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) |
| 15 | 15 | |
| 16 | 16 | FOREACH(EXAMPLE ${SUBDIRS}) |
| 17 | 17 | FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") |
| 18 | - IF(NOT DEFINED DALI_APP_RES_DIR) | |
| 19 | - SET( SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") | |
| 20 | - | |
| 21 | - ENDIF() | |
| 18 | + SET(SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") | |
| 22 | 19 | ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) |
| 23 | 20 | TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie) |
| 24 | 21 | INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) | ... | ... |
build/tizen/resources-location.in
| 1 | 1 | /** |
| 2 | - * This file defines the location dali-demo resources | |
| 3 | - It is used exclusively for Ubuntu builds where an application resource directory is explicity defined. | |
| 2 | + * This file defines the location dali-demo resources. | |
| 3 | + * It is used for builds where an application resource directory is NOT explicity defined. | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | #include <cstdlib> | ... | ... |
com.samsung.dali-demo.xml
| ... | ... | @@ -184,4 +184,7 @@ |
| 184 | 184 | <ui-application appid="tooltip.example" exec="/usr/apps/com.samsung.dali-demo/bin/tooltip.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 185 | 185 | <label>Tooltip</label> |
| 186 | 186 | </ui-application> |
| 187 | + <ui-application appid="clipping.example" exec="/usr/apps/com.samsung.dali-demo/bin/clipping.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | |
| 188 | + <label>Clipping</label> | |
| 189 | + </ui-application> | |
| 187 | 190 | </manifest> | ... | ... |
demo/dali-demo.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -89,6 +89,7 @@ int DALI_EXPORT_API main(int argc, char **argv) |
| 89 | 89 | demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND)); |
| 90 | 90 | demo.AddExample(Example("fpp-game.example", DALI_DEMO_STR_TITLE_FPP_GAME)); |
| 91 | 91 | demo.AddExample(Example("tooltip.example", DALI_DEMO_STR_TITLE_TOOLTIP)); |
| 92 | + demo.AddExample(Example("clipping.example", DALI_DEMO_STR_TITLE_CLIPPING)); | |
| 92 | 93 | |
| 93 | 94 | demo.SortAlphabetically( true ); |
| 94 | 95 | ... | ... |
demo/dali-table-view.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -82,6 +82,13 @@ const Vector4 BUBBLE_COLOR[] = |
| 82 | 82 | }; |
| 83 | 83 | const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) ); |
| 84 | 84 | |
| 85 | +const char * const SHAPE_IMAGE_TABLE[] = | |
| 86 | +{ | |
| 87 | + DEMO_IMAGE_DIR "shape-circle.png", | |
| 88 | + DEMO_IMAGE_DIR "shape-bubble.png" | |
| 89 | +}; | |
| 90 | +const int NUMBER_OF_SHAPE_IMAGES( sizeof( SHAPE_IMAGE_TABLE ) / sizeof( SHAPE_IMAGE_TABLE[0] ) ); | |
| 91 | + | |
| 85 | 92 | const int NUM_BACKGROUND_IMAGES = 18; |
| 86 | 93 | const float BACKGROUND_SWIPE_SCALE = 0.025f; |
| 87 | 94 | const float BACKGROUND_SPREAD_SCALE = 1.5f; |
| ... | ... | @@ -732,16 +739,9 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) |
| 732 | 739 | |
| 733 | 740 | void DaliTableView::SetupBackground( Actor bubbleContainer ) |
| 734 | 741 | { |
| 735 | - // Create distance field shapes. | |
| 736 | - BufferImage distanceFields[2]; | |
| 737 | - Size imageSize( 512, 512 ); | |
| 738 | - | |
| 739 | - CreateShapeImage( CIRCLE, imageSize, distanceFields[0] ); | |
| 740 | - CreateShapeImage( BUBBLE, imageSize, distanceFields[1] ); | |
| 741 | - | |
| 742 | 742 | // Add bubbles to the bubbleContainer. |
| 743 | 743 | // Note: The bubbleContainer is parented externally to this function. |
| 744 | - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceFields ); | |
| 744 | + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES ); | |
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | void DaliTableView::InitialiseBackgroundActors( Actor actor ) |
| ... | ... | @@ -780,13 +780,13 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) |
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | |
| 783 | -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* distanceField ) | |
| 783 | +void DaliTableView::AddBackgroundActors( Actor layer, int count ) | |
| 784 | 784 | { |
| 785 | 785 | for( int i = 0; i < count; ++i ) |
| 786 | 786 | { |
| 787 | 787 | float randSize = Random::Range( 10.0f, 400.0f ); |
| 788 | - int distanceFieldType = static_cast<int>( Random::Range( 0.0f, 1.0f ) + 0.5f ); | |
| 789 | - ImageView dfActor = ImageView::New( distanceField[ distanceFieldType ] ); | |
| 788 | + int shapeType = static_cast<int>( Random::Range( 0.0f, NUMBER_OF_SHAPE_IMAGES - 1 ) + 0.5f ); | |
| 789 | + ImageView dfActor = ImageView::New( SHAPE_IMAGE_TABLE[ shapeType ] ); | |
| 790 | 790 | dfActor.SetSize( Vector2( randSize, randSize ) ); |
| 791 | 791 | dfActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 792 | 792 | |
| ... | ... | @@ -801,57 +801,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* di |
| 801 | 801 | layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors ); |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | -void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) | |
| 805 | -{ | |
| 806 | - // this bitmap will hold the alpha map for the distance field shader | |
| 807 | - distanceFieldOut = BufferImage::New( size.width, size.height, Pixel::A8 ); | |
| 808 | - | |
| 809 | - // Generate bit pattern | |
| 810 | - std::vector< unsigned char > imageDataA8; | |
| 811 | - imageDataA8.reserve( size.width * size.height ); // A8 | |
| 812 | - | |
| 813 | - switch( shapeType ) | |
| 814 | - { | |
| 815 | - case CIRCLE: | |
| 816 | - GenerateCircle( size, imageDataA8 ); | |
| 817 | - break; | |
| 818 | - case BUBBLE: | |
| 819 | - GenerateCircle( size, imageDataA8, true ); | |
| 820 | - break; | |
| 821 | - default: | |
| 822 | - break; | |
| 823 | - } | |
| 824 | - | |
| 825 | - PixelBuffer* buffer = distanceFieldOut.GetBuffer(); | |
| 826 | - if( buffer ) | |
| 827 | - { | |
| 828 | - GenerateDistanceFieldMap( &imageDataA8[ 0 ], size, buffer, size, 8.0f, size ); | |
| 829 | - distanceFieldOut.Update(); | |
| 830 | - } | |
| 831 | -} | |
| 832 | - | |
| 833 | -void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut, bool hollow ) | |
| 834 | -{ | |
| 835 | - const float radius = size.width * 0.5f * size.width * 0.5f; | |
| 836 | - Vector2 center( size.width / 2, size.height / 2 ); | |
| 837 | - | |
| 838 | - for( int h = 0; h < size.height; ++h ) | |
| 839 | - { | |
| 840 | - for( int w = 0; w < size.width; ++w ) | |
| 841 | - { | |
| 842 | - Vector2 pos( w, h ); | |
| 843 | - Vector2 dist = pos - center; | |
| 844 | - | |
| 845 | - float distance = ( dist.x * dist.x ) + ( dist.y * dist.y ); | |
| 846 | - | |
| 847 | - // If hollow, check the distance against a min & max value, otherwise just use the max value. | |
| 848 | - unsigned char fillByte = ( hollow ? ( ( distance <= radius ) && ( distance > ( radius * 0.7f ) ) ) : ( distance <= radius ) ) ? 0xFF : 0x00; | |
| 849 | - | |
| 850 | - distanceFieldOut.push_back( fillByte ); | |
| 851 | - } | |
| 852 | - } | |
| 853 | -} | |
| 854 | - | |
| 855 | 804 | ImageView DaliTableView::CreateLogo( std::string imagePath ) |
| 856 | 805 | { |
| 857 | 806 | ImageView logo = ImageView::New( imagePath ); | ... | ... |
demo/dali-table-view.h
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | #define DALI_DEMO_H |
| 3 | 3 | |
| 4 | 4 | /* |
| 5 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 6 | 6 | * |
| 7 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | 8 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -262,37 +262,8 @@ private: // Application callbacks & implementation |
| 262 | 262 | * |
| 263 | 263 | * @param[in] layer The layer to add the actors to |
| 264 | 264 | * @param[in] count The number of actors to generate |
| 265 | - * @param[in] distanceField A array (pointer) to 2 distance field types to use | |
| 266 | 265 | */ |
| 267 | - void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage* distanceField ); | |
| 268 | - | |
| 269 | - /** | |
| 270 | - * Create a bitmap with the specified shape and also output a distance field | |
| 271 | - * | |
| 272 | - * @param[in] shapeType The shape to generate | |
| 273 | - * @param[in] size The size of the bitmap to create | |
| 274 | - * @param[out] distanceFieldOut The return depth field alpha map | |
| 275 | - */ | |
| 276 | - void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut ); | |
| 277 | - | |
| 278 | - /** | |
| 279 | - * Generate a square bit pattern and depth field | |
| 280 | - * | |
| 281 | - * @param[in] size The size of the bitmap to create | |
| 282 | - * @param[out] imageOut The return bitmap | |
| 283 | - * @param[out] distanceFieldOut The return depth field alpha map | |
| 284 | - */ | |
| 285 | - void GenerateSquare( const Dali::Size& size, std::vector<unsigned char>& distanceFieldOut ); | |
| 286 | - | |
| 287 | - /** | |
| 288 | - * Generate a circle bit pattern and depth field | |
| 289 | - * | |
| 290 | - * @param[in] size The size of the bitmap to create | |
| 291 | - * @param[out] imageOut The return bitmap | |
| 292 | - * @param[out] distanceFieldOut The return depth field alpha map | |
| 293 | - * @param[in] hollow Optional - Set to true for a thick circle outline without fill | |
| 294 | - */ | |
| 295 | - void GenerateCircle( const Dali::Size& size, std::vector<unsigned char>& distanceFieldOut, bool hollow = false ); | |
| 266 | + void AddBackgroundActors( Dali::Actor layer, int count ); | |
| 296 | 267 | |
| 297 | 268 | /** |
| 298 | 269 | * Creates the logo. | ... | ... |
examples/animated-images/animated-images-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 19 | 20 | |
| 20 | 21 | #include "shared/utility.h" |
| 21 | 22 | |
| ... | ... | @@ -87,8 +88,8 @@ public: |
| 87 | 88 | |
| 88 | 89 | // Create a push button, and add it as child of the image view |
| 89 | 90 | Toolkit::PushButton animateButton = Toolkit::PushButton::New(); |
| 90 | - animateButton.SetUnselectedImage( PLAY_ICON ); | |
| 91 | - animateButton.SetSelectedImage( PLAY_ICON_SELECTED ); | |
| 91 | + animateButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON ); | |
| 92 | + animateButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED ); | |
| 92 | 93 | animateButton.SetParentOrigin( ParentOrigin::CENTER ); |
| 93 | 94 | animateButton.SetAnchorPoint( AnchorPoint::CENTER ); |
| 94 | 95 | animateButton.ClickedSignal().Connect( this, &AnimatedImageController::OnPlayButtonClicked ); | ... | ... |
examples/atlas/atlas-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | |
| 18 | 18 | #include <dali/dali.h> |
| 19 | 19 | #include <dali/devel-api/images/atlas.h> |
| 20 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 20 | 21 | |
| 21 | 22 | #include "shared/view.h" |
| 22 | 23 | #include <iostream> |
| ... | ... | @@ -72,8 +73,8 @@ public: |
| 72 | 73 | "Atlas" ); |
| 73 | 74 | |
| 74 | 75 | mLoseContextButton = Toolkit::PushButton::New(); |
| 75 | - mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE ); | |
| 76 | - mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED ); | |
| 76 | + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE ); | |
| 77 | + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED ); | |
| 77 | 78 | mLoseContextButton.ClickedSignal().Connect( this, &AtlasController::OnLoseContextButtonClicked ); |
| 78 | 79 | mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 79 | 80 | ... | ... |
examples/bubble-effect/bubble-effect-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | #include <dali/dali.h> |
| 19 | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | 20 | #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h> |
| 21 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 21 | 22 | #include "shared/view.h" |
| 22 | 23 | #include "shared/utility.h" |
| 23 | 24 | |
| ... | ... | @@ -108,8 +109,8 @@ private: |
| 108 | 109 | |
| 109 | 110 | // Add a button to change background. (right of toolbar) |
| 110 | 111 | mChangeBackgroundButton = Toolkit::PushButton::New(); |
| 111 | - mChangeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON ); | |
| 112 | - mChangeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED ); | |
| 112 | + mChangeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON ); | |
| 113 | + mChangeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED ); | |
| 113 | 114 | mChangeBackgroundButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); |
| 114 | 115 | toolBar.AddControl( mChangeBackgroundButton, |
| 115 | 116 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, |
| ... | ... | @@ -117,8 +118,8 @@ private: |
| 117 | 118 | DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 118 | 119 | // Add a button to change bubble shape. ( left of bar ) |
| 119 | 120 | mChangeBubbleShapeButton = Toolkit::PushButton::New(); |
| 120 | - mChangeBubbleShapeButton.SetUnselectedImage( CHANGE_BUBBLE_SHAPE_ICON ); | |
| 121 | - mChangeBubbleShapeButton.SetSelectedImage( CHANGE_BUBBLE_SHAPE_ICON_SELECTED ); | |
| 121 | + mChangeBubbleShapeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON ); | |
| 122 | + mChangeBubbleShapeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON_SELECTED ); | |
| 122 | 123 | mChangeBubbleShapeButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); |
| 123 | 124 | toolBar.AddControl( mChangeBubbleShapeButton, |
| 124 | 125 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, | ... | ... |
examples/builder/examples.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -25,6 +25,7 @@ |
| 25 | 25 | #include <dali-toolkit/devel-api/builder/builder.h> |
| 26 | 26 | #include <dali-toolkit/devel-api/builder/tree-node.h> |
| 27 | 27 | #include <dali-toolkit/devel-api/builder/json-parser.h> |
| 28 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 28 | 29 | #include <dali-toolkit/devel-api/controls/popup/popup.h> |
| 29 | 30 | #include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h> |
| 30 | 31 | |
| ... | ... | @@ -472,8 +473,8 @@ public: |
| 472 | 473 | |
| 473 | 474 | // Create an edit mode button. (left of toolbar) |
| 474 | 475 | Toolkit::PushButton backButton = Toolkit::PushButton::New(); |
| 475 | - backButton.SetUnselectedImage( EDIT_IMAGE ); | |
| 476 | - backButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); | |
| 476 | + backButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE ); | |
| 477 | + backButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED ); | |
| 477 | 478 | backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed); |
| 478 | 479 | backButton.SetLeaveRequired( true ); |
| 479 | 480 | mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ... | ... |
examples/buttons/buttons-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -164,7 +164,7 @@ class ButtonsController: public ConnectionTracker |
| 164 | 164 | mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 165 | 165 | mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 166 | 166 | mRadioButtonImage1.SetPosition( 0, DP(radioY) ); |
| 167 | - mRadioButtonImage1.SetSelected( true ); | |
| 167 | + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 168 | 168 | |
| 169 | 169 | imageSelectTableView.AddChild( mRadioButtonImage1, Toolkit::TableView::CellPosition( 0, 0 ) ); |
| 170 | 170 | imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); |
| ... | ... | @@ -204,7 +204,7 @@ class ButtonsController: public ConnectionTracker |
| 204 | 204 | |
| 205 | 205 | // Create select button |
| 206 | 206 | mUpdateButton = Toolkit::PushButton::New(); |
| 207 | - mUpdateButton.SetLabelText( "Select" ); | |
| 207 | + mUpdateButton.SetProperty( Toolkit::Button::Property::LABEL, "Select" ); | |
| 208 | 208 | mUpdateButton.SetName( "selectButton" ); |
| 209 | 209 | mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 210 | 210 | |
| ... | ... | @@ -267,7 +267,7 @@ class ButtonsController: public ConnectionTracker |
| 267 | 267 | radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 268 | 268 | radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 269 | 269 | radioButton.SetPosition( 0, 0 ); |
| 270 | - radioButton.SetSelected( true ); | |
| 270 | + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 271 | 271 | |
| 272 | 272 | radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton ); |
| 273 | 273 | |
| ... | ... | @@ -304,7 +304,7 @@ class ButtonsController: public ConnectionTracker |
| 304 | 304 | { |
| 305 | 305 | mCheckboxButton1 = Toolkit::CheckBoxButton::New(); |
| 306 | 306 | mCheckboxButton1.SetName( "checkbox1" ); |
| 307 | - mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" ); | |
| 307 | + mCheckboxButton1.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected" ); | |
| 308 | 308 | mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); |
| 309 | 309 | mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 310 | 310 | |
| ... | ... | @@ -314,8 +314,8 @@ class ButtonsController: public ConnectionTracker |
| 314 | 314 | { |
| 315 | 315 | mCheckboxButton2 = Toolkit::CheckBoxButton::New(); |
| 316 | 316 | mCheckboxButton2.SetName( "checkbox2" ); |
| 317 | - mCheckboxButton2.SetLabelText( "CheckBox2 is selected" ); | |
| 318 | - mCheckboxButton2.SetSelected( true ); | |
| 317 | + mCheckboxButton2.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected" ); | |
| 318 | + mCheckboxButton2.SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 319 | 319 | mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); |
| 320 | 320 | mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 321 | 321 | |
| ... | ... | @@ -325,7 +325,7 @@ class ButtonsController: public ConnectionTracker |
| 325 | 325 | { |
| 326 | 326 | mCheckboxButton3 = Toolkit::CheckBoxButton::New(); |
| 327 | 327 | mCheckboxButton3.SetName( "checkbox3" ); |
| 328 | - mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" ); | |
| 328 | + mCheckboxButton3.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected" ); | |
| 329 | 329 | mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); |
| 330 | 330 | mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 331 | 331 | |
| ... | ... | @@ -347,8 +347,8 @@ class ButtonsController: public ConnectionTracker |
| 347 | 347 | contentTable.Add( toggleBackground ); |
| 348 | 348 | |
| 349 | 349 | mToggleButton = Toolkit::PushButton::New(); |
| 350 | - mToggleButton.SetTogglableButton( true ); | |
| 351 | - mToggleButton.SetLabelText( "Unselected" ); | |
| 350 | + mToggleButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); | |
| 351 | + mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" ); | |
| 352 | 352 | mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 353 | 353 | mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 354 | 354 | mToggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected ); |
| ... | ... | @@ -373,13 +373,14 @@ class ButtonsController: public ConnectionTracker |
| 373 | 373 | Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); |
| 374 | 374 | if( pushButton ) |
| 375 | 375 | { |
| 376 | - if( button.IsSelected() ) | |
| 376 | + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 377 | + if( isSelected ) | |
| 377 | 378 | { |
| 378 | - pushButton.SetLabelText( "Selected" ); | |
| 379 | + pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Selected" ); | |
| 379 | 380 | } |
| 380 | 381 | else |
| 381 | 382 | { |
| 382 | - pushButton.SetLabelText( "Unselected" ); | |
| 383 | + pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" ); | |
| 383 | 384 | } |
| 384 | 385 | } |
| 385 | 386 | |
| ... | ... | @@ -388,33 +389,39 @@ class ButtonsController: public ConnectionTracker |
| 388 | 389 | |
| 389 | 390 | bool EnableSelectButton( Toolkit::Button button ) |
| 390 | 391 | { |
| 391 | - if( button.GetName() == "radioSelectEnable" && button.IsSelected() == true ) | |
| 392 | + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 393 | + if( !isSelected ) | |
| 392 | 394 | { |
| 393 | - mUpdateButton.SetDisabled( false ); | |
| 395 | + return true; | |
| 396 | + } | |
| 397 | + | |
| 398 | + if( button.GetName() == "radioSelectEnable" ) | |
| 399 | + { | |
| 400 | + mUpdateButton.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 394 | 401 | |
| 395 | - mRadioButtonImage1.SetDisabled( false ); | |
| 396 | - mRadioButtonImage2.SetDisabled( false ); | |
| 397 | - mRadioButtonImage3.SetDisabled( false ); | |
| 402 | + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 403 | + mRadioButtonImage2.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 404 | + mRadioButtonImage3.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 398 | 405 | |
| 399 | - mCheckboxButton1.SetDisabled( false ); | |
| 400 | - mCheckboxButton2.SetDisabled( false ); | |
| 401 | - mCheckboxButton3.SetDisabled( false ); | |
| 406 | + mCheckboxButton1.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 407 | + mCheckboxButton2.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 408 | + mCheckboxButton3.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 402 | 409 | |
| 403 | - mToggleButton.SetDisabled( false ); | |
| 410 | + mToggleButton.SetProperty( Toolkit::Button::Property::DISABLED, false ); | |
| 404 | 411 | } |
| 405 | - else if( button.GetName() == "radioSelectDisable" && button.IsSelected() == true ) | |
| 412 | + else if( button.GetName() == "radioSelectDisable" ) | |
| 406 | 413 | { |
| 407 | - mUpdateButton.SetDisabled( true ); | |
| 414 | + mUpdateButton.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 408 | 415 | |
| 409 | - mRadioButtonImage1.SetDisabled( true ); | |
| 410 | - mRadioButtonImage2.SetDisabled( true ); | |
| 411 | - mRadioButtonImage3.SetDisabled( true ); | |
| 416 | + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 417 | + mRadioButtonImage2.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 418 | + mRadioButtonImage3.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 412 | 419 | |
| 413 | - mCheckboxButton1.SetDisabled( true ); | |
| 414 | - mCheckboxButton2.SetDisabled( true ); | |
| 415 | - mCheckboxButton3.SetDisabled( true ); | |
| 420 | + mCheckboxButton1.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 421 | + mCheckboxButton2.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 422 | + mCheckboxButton3.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 416 | 423 | |
| 417 | - mToggleButton.SetDisabled( true ); | |
| 424 | + mToggleButton.SetProperty( Toolkit::Button::Property::DISABLED, true ); | |
| 418 | 425 | } |
| 419 | 426 | |
| 420 | 427 | return true; |
| ... | ... | @@ -422,15 +429,15 @@ class ButtonsController: public ConnectionTracker |
| 422 | 429 | |
| 423 | 430 | bool OnButtonClicked(Toolkit::Button button) |
| 424 | 431 | { |
| 425 | - if( mRadioButtonImage1.IsSelected() ) | |
| 432 | + if( mRadioButtonImage1.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 426 | 433 | { |
| 427 | 434 | mImage.SetImage( BIG_IMAGE_1 ); |
| 428 | 435 | } |
| 429 | - else if( mRadioButtonImage2.IsSelected() ) | |
| 436 | + else if( mRadioButtonImage2.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 430 | 437 | { |
| 431 | 438 | mImage.SetImage( BIG_IMAGE_2 ); |
| 432 | 439 | } |
| 433 | - else if( mRadioButtonImage3.IsSelected() ) | |
| 440 | + else if( mRadioButtonImage3.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 434 | 441 | { |
| 435 | 442 | mImage.SetImage( BIG_IMAGE_3 ); |
| 436 | 443 | } |
| ... | ... | @@ -439,39 +446,40 @@ class ButtonsController: public ConnectionTracker |
| 439 | 446 | |
| 440 | 447 | bool OnCheckBoxesSelected( Toolkit::Button button ) |
| 441 | 448 | { |
| 449 | + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 442 | 450 | if( button.GetName() == "checkbox1" ) |
| 443 | 451 | { |
| 444 | - if( button.IsSelected() ) | |
| 452 | + if( isSelected ) | |
| 445 | 453 | { |
| 446 | - button.SetLabelText("CheckBox1 is selected"); | |
| 454 | + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is selected"); | |
| 447 | 455 | } |
| 448 | 456 | else |
| 449 | 457 | { |
| 450 | - button.SetLabelText("CheckBox1 is unselected"); | |
| 458 | + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected"); | |
| 451 | 459 | } |
| 452 | 460 | } |
| 453 | 461 | |
| 454 | 462 | if( button.GetName() == "checkbox2" ) |
| 455 | 463 | { |
| 456 | - if( button.IsSelected() ) | |
| 464 | + if( isSelected ) | |
| 457 | 465 | { |
| 458 | - button.SetLabelText("CheckBox2 is selected"); | |
| 466 | + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected"); | |
| 459 | 467 | } |
| 460 | 468 | else |
| 461 | 469 | { |
| 462 | - button.SetLabelText("CheckBox2 is unselected"); | |
| 470 | + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is unselected"); | |
| 463 | 471 | } |
| 464 | 472 | } |
| 465 | 473 | |
| 466 | 474 | if( button.GetName() == "checkbox3" ) |
| 467 | 475 | { |
| 468 | - if( button.IsSelected() ) | |
| 476 | + if( isSelected ) | |
| 469 | 477 | { |
| 470 | - button.SetLabelText("CheckBox3 is selected"); | |
| 478 | + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is selected"); | |
| 471 | 479 | } |
| 472 | 480 | else |
| 473 | 481 | { |
| 474 | - button.SetLabelText("CheckBox3 is unselected"); | |
| 482 | + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected"); | |
| 475 | 483 | } |
| 476 | 484 | } |
| 477 | 485 | ... | ... |
examples/clipping/clipping-example.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 18 | +// EXTERNAL INCLUDES | |
| 19 | +#include <dali/dali.h> | |
| 20 | +#include <dali-toolkit/dali-toolkit.h> | |
| 21 | +#include <dali/devel-api/actors/actor-devel.h> | |
| 22 | +#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h> | |
| 23 | +#include <dali-toolkit/devel-api/visuals/text-visual-properties.h> | |
| 24 | + | |
| 25 | +// INTERNAL INCLUDES | |
| 26 | +#include "clipping-item-factory.h" | |
| 27 | + | |
| 28 | +using namespace Dali; | |
| 29 | +using namespace Dali::Toolkit; | |
| 30 | + | |
| 31 | +namespace | |
| 32 | +{ | |
| 33 | +const char * const APPLICATION_TITLE( "Clipping Controls" ); | |
| 34 | +const Vector3 APPLICATION_TITLE_PARENT_ORIGIN( 0.5f, 0.03f, 0.5f ); // Set the parent origin to a small percentage below the top (so the demo will scale for different resolutions). | |
| 35 | +const Vector3 ITEM_VIEW_LAYOUT_SIZE_SCALE( 0.75f, 0.5f, 0.75f ); | |
| 36 | +const float ITEM_VIEW_BORDER_SIZE = 2.0f; | |
| 37 | +const char * const BUTTON_LABEL( "Toggle Clipping Mode" ); | |
| 38 | +} // unnamed namespace | |
| 39 | + | |
| 40 | +/** | |
| 41 | + * @brief Demonstrates the control clipping of a UI Control. | |
| 42 | + * | |
| 43 | + * When an Actor is set to clip its children, the renderers have to be added manually in order to specify what its children | |
| 44 | + * need to clip to. UI Controls automate the creation of the renderers/visuals when they are set to clip their children. | |
| 45 | + * | |
| 46 | + * This example displays an item-view whose clipping mode is toggled without the need for adding any renderers to it. | |
| 47 | + */ | |
| 48 | +class ClippingExample : public ConnectionTracker | |
| 49 | +{ | |
| 50 | +public: | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * @brief Constructor. | |
| 54 | + * @param[in] application A reference to the Application class. | |
| 55 | + */ | |
| 56 | + ClippingExample( Application& application ) | |
| 57 | + : mApplication( application ) | |
| 58 | + { | |
| 59 | + // Connect to the Application's Init signal | |
| 60 | + mApplication.InitSignal().Connect( this, &ClippingExample::Create ); | |
| 61 | + } | |
| 62 | + | |
| 63 | +private: | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * @brief Called to initialise the application content. | |
| 67 | + * @param[in] application A reference to the Application class. | |
| 68 | + */ | |
| 69 | + void Create( Application& application ) | |
| 70 | + { | |
| 71 | + // Hide the indicator bar | |
| 72 | + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); | |
| 73 | + | |
| 74 | + // Connect to the stage's key signal to allow Back and Escape to exit. | |
| 75 | + Stage stage = Dali::Stage::GetCurrent(); | |
| 76 | + stage.KeyEventSignal().Connect( this, &ClippingExample::OnKeyEvent ); | |
| 77 | + | |
| 78 | + // Create a TextLabel for the application title. | |
| 79 | + Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE ); | |
| 80 | + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 81 | + label.SetParentOrigin( APPLICATION_TITLE_PARENT_ORIGIN ); | |
| 82 | + label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); | |
| 83 | + label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | |
| 84 | + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE ); | |
| 85 | + stage.Add( label ); | |
| 86 | + | |
| 87 | + // Create an item-view which clips its children. | |
| 88 | + mItemView = ItemView::New( mClippingItemFactory ); | |
| 89 | + mItemView.SetParentOrigin( ParentOrigin::CENTER ); | |
| 90 | + mItemView.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 91 | + mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); // Enable clipping. No need to create any renderers. | |
| 92 | + stage.Add( mItemView ); | |
| 93 | + | |
| 94 | + // Create a Spiral Layout and add it to the Item View. | |
| 95 | + mItemView.AddLayout( * DefaultItemLayout::New( DefaultItemLayout::SPIRAL ) ); | |
| 96 | + stage.GetRootLayer().SetBehavior( Layer::LAYER_3D ); // The item-view spiral layout requires Layer 3D behaviour. | |
| 97 | + | |
| 98 | + // Calculate the size we would like our item-view layout to be, and then activate the layout. | |
| 99 | + const Vector2 stageSize = stage.GetSize(); | |
| 100 | + const Vector3 itemViewLayoutSize( ITEM_VIEW_LAYOUT_SIZE_SCALE.x * stageSize.x, ITEM_VIEW_LAYOUT_SIZE_SCALE.y * stageSize.y, ITEM_VIEW_LAYOUT_SIZE_SCALE.z * stageSize.x ); | |
| 101 | + mItemView.ActivateLayout( 0, itemViewLayoutSize, 0.0f ); | |
| 102 | + | |
| 103 | + // Create a border around item-view (as item-view is clipping its children, we should NOT add this as a child of item-view). | |
| 104 | + Control border = Control::New(); | |
| 105 | + border.SetParentOrigin( ParentOrigin::CENTER ); | |
| 106 | + border.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 107 | + border.SetProperty( Control::Property::BACKGROUND, | |
| 108 | + Property::Map().Add( Visual::Property::TYPE, Visual::BORDER ) | |
| 109 | + .Add( BorderVisual::Property::COLOR, Color::WHITE ) | |
| 110 | + .Add( BorderVisual::Property::SIZE, 2.0f ) ); | |
| 111 | + border.SetSize( Vector3( itemViewLayoutSize.x + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.y + ITEM_VIEW_BORDER_SIZE * 2.0f, itemViewLayoutSize.z + ITEM_VIEW_BORDER_SIZE * 2.0f ) ); | |
| 112 | + stage.Add( border ); | |
| 113 | + | |
| 114 | + // Create a button to toggle the clipping mode | |
| 115 | + PushButton button = Toolkit::PushButton::New(); | |
| 116 | + button.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); | |
| 117 | + button.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); | |
| 118 | + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); | |
| 119 | + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); | |
| 120 | + button.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); | |
| 121 | + button.SetProperty( Button::Property::LABEL, | |
| 122 | + Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ) | |
| 123 | + .Add( Toolkit::TextVisual::Property::TEXT, BUTTON_LABEL ) ); | |
| 124 | + button.ClickedSignal().Connect( this, &ClippingExample::OnButtonClicked ); | |
| 125 | + stage.Add( button ); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * @brief Called when any key event is received | |
| 130 | + * | |
| 131 | + * Will use this to quit the application if Back or the Escape key is received | |
| 132 | + * @param[in] event The key event information | |
| 133 | + */ | |
| 134 | + void OnKeyEvent( const KeyEvent& event ) | |
| 135 | + { | |
| 136 | + if( event.state == KeyEvent::Down ) | |
| 137 | + { | |
| 138 | + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) | |
| 139 | + { | |
| 140 | + mApplication.Quit(); | |
| 141 | + } | |
| 142 | + } | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * @brief Called when the button is clicked. | |
| 147 | + * | |
| 148 | + * Will use this to toggle between the clipping modes. | |
| 149 | + * @param[in] button The button that has been clicked. | |
| 150 | + */ | |
| 151 | + bool OnButtonClicked( Toolkit::Button button ) | |
| 152 | + { | |
| 153 | + if( mItemView ) | |
| 154 | + { | |
| 155 | + ClippingMode::Type currentMode = static_cast< ClippingMode::Type >( mItemView.GetProperty( Actor::Property::CLIPPING_MODE ).Get< int >() ); | |
| 156 | + mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ( currentMode == ClippingMode::CLIP_CHILDREN ) ? ClippingMode::DISABLED : ClippingMode::CLIP_CHILDREN ); | |
| 157 | + } | |
| 158 | + return true; | |
| 159 | + } | |
| 160 | + | |
| 161 | + // Data | |
| 162 | + | |
| 163 | + Application& mApplication; ///< Reference to the application class. | |
| 164 | + ItemView mItemView; ///< The item view which whose children we would like to clip. | |
| 165 | + ClippingItemFactory mClippingItemFactory; ///< The ItemFactory used to create our items. | |
| 166 | +}; | |
| 167 | + | |
| 168 | +int DALI_EXPORT_API main( int argc, char **argv ) | |
| 169 | +{ | |
| 170 | + Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); | |
| 171 | + ClippingExample test(app); | |
| 172 | + app.MainLoop(); | |
| 173 | + return 0; | |
| 174 | +} | ... | ... |
examples/clipping/clipping-item-factory.cpp
0 → 100644
| 1 | +/* | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 18 | +// CLASS HEADER | |
| 19 | +#include "clipping-item-factory.h" | |
| 20 | + | |
| 21 | +// EXTERNAL INCLUDES | |
| 22 | +#include <dali/public-api/object/property-map.h> | |
| 23 | +#include <dali-toolkit/public-api/controls/image-view/image-view.h> | |
| 24 | +#include <dali-toolkit/public-api/visuals/border-visual-properties.h> | |
| 25 | +#include <dali-toolkit/public-api/visuals/visual-properties.h> | |
| 26 | + | |
| 27 | +using namespace Dali; | |
| 28 | +using namespace Dali::Toolkit; | |
| 29 | + | |
| 30 | +namespace | |
| 31 | +{ | |
| 32 | +const char * IMAGE_PATHS[] = { | |
| 33 | + DEMO_IMAGE_DIR "gallery-medium-1.jpg", | |
| 34 | + DEMO_IMAGE_DIR "gallery-medium-2.jpg", | |
| 35 | + DEMO_IMAGE_DIR "gallery-medium-3.jpg", | |
| 36 | + DEMO_IMAGE_DIR "gallery-medium-4.jpg", | |
| 37 | + DEMO_IMAGE_DIR "gallery-medium-5.jpg", | |
| 38 | + DEMO_IMAGE_DIR "gallery-medium-6.jpg", | |
| 39 | + DEMO_IMAGE_DIR "gallery-medium-7.jpg", | |
| 40 | + DEMO_IMAGE_DIR "gallery-medium-8.jpg", | |
| 41 | + DEMO_IMAGE_DIR "gallery-medium-9.jpg", | |
| 42 | + DEMO_IMAGE_DIR "gallery-medium-10.jpg", | |
| 43 | + DEMO_IMAGE_DIR "gallery-medium-11.jpg", | |
| 44 | + DEMO_IMAGE_DIR "gallery-medium-12.jpg", | |
| 45 | + DEMO_IMAGE_DIR "gallery-medium-13.jpg", | |
| 46 | + DEMO_IMAGE_DIR "gallery-medium-14.jpg", | |
| 47 | + DEMO_IMAGE_DIR "gallery-medium-15.jpg", | |
| 48 | + DEMO_IMAGE_DIR "gallery-medium-16.jpg", | |
| 49 | + DEMO_IMAGE_DIR "gallery-medium-17.jpg", | |
| 50 | + DEMO_IMAGE_DIR "gallery-medium-18.jpg", | |
| 51 | + DEMO_IMAGE_DIR "gallery-medium-19.jpg", | |
| 52 | + DEMO_IMAGE_DIR "gallery-medium-20.jpg", | |
| 53 | + DEMO_IMAGE_DIR "gallery-medium-21.jpg", | |
| 54 | + DEMO_IMAGE_DIR "gallery-medium-22.jpg", | |
| 55 | + DEMO_IMAGE_DIR "gallery-medium-23.jpg", | |
| 56 | + DEMO_IMAGE_DIR "gallery-medium-24.jpg", | |
| 57 | + DEMO_IMAGE_DIR "gallery-medium-25.jpg", | |
| 58 | + DEMO_IMAGE_DIR "gallery-medium-26.jpg", | |
| 59 | + DEMO_IMAGE_DIR "gallery-medium-27.jpg", | |
| 60 | + DEMO_IMAGE_DIR "gallery-medium-28.jpg", | |
| 61 | + DEMO_IMAGE_DIR "gallery-medium-29.jpg", | |
| 62 | + DEMO_IMAGE_DIR "gallery-medium-30.jpg", | |
| 63 | + DEMO_IMAGE_DIR "gallery-medium-31.jpg", | |
| 64 | + DEMO_IMAGE_DIR "gallery-medium-32.jpg", | |
| 65 | + DEMO_IMAGE_DIR "gallery-medium-33.jpg", | |
| 66 | + DEMO_IMAGE_DIR "gallery-medium-34.jpg", | |
| 67 | + DEMO_IMAGE_DIR "gallery-medium-35.jpg", | |
| 68 | + DEMO_IMAGE_DIR "gallery-medium-36.jpg", | |
| 69 | + DEMO_IMAGE_DIR "gallery-medium-37.jpg", | |
| 70 | + DEMO_IMAGE_DIR "gallery-medium-38.jpg", | |
| 71 | + DEMO_IMAGE_DIR "gallery-medium-39.jpg", | |
| 72 | + DEMO_IMAGE_DIR "gallery-medium-40.jpg", | |
| 73 | + DEMO_IMAGE_DIR "gallery-medium-41.jpg", | |
| 74 | + DEMO_IMAGE_DIR "gallery-medium-42.jpg", | |
| 75 | + DEMO_IMAGE_DIR "gallery-medium-43.jpg", | |
| 76 | + DEMO_IMAGE_DIR "gallery-medium-44.jpg", | |
| 77 | + DEMO_IMAGE_DIR "gallery-medium-45.jpg", | |
| 78 | + DEMO_IMAGE_DIR "gallery-medium-46.jpg", | |
| 79 | + DEMO_IMAGE_DIR "gallery-medium-47.jpg", | |
| 80 | + DEMO_IMAGE_DIR "gallery-medium-48.jpg", | |
| 81 | + DEMO_IMAGE_DIR "gallery-medium-49.jpg", | |
| 82 | + DEMO_IMAGE_DIR "gallery-medium-50.jpg", | |
| 83 | + DEMO_IMAGE_DIR "gallery-medium-51.jpg", | |
| 84 | + DEMO_IMAGE_DIR "gallery-medium-52.jpg", | |
| 85 | + DEMO_IMAGE_DIR "gallery-medium-53.jpg", | |
| 86 | +}; | |
| 87 | +const unsigned int NUM_IMAGES = sizeof( IMAGE_PATHS ) / sizeof( char * ); | |
| 88 | +const unsigned int NUM_IMAGES_MULTIPLIER = 10; | |
| 89 | + | |
| 90 | +const float ITEM_BORDER_SIZE = 2.0f; | |
| 91 | +} // unnamed namespace | |
| 92 | + | |
| 93 | +ClippingItemFactory::ClippingItemFactory() | |
| 94 | +{ | |
| 95 | +} | |
| 96 | + | |
| 97 | +unsigned int ClippingItemFactory::GetNumberOfItems() | |
| 98 | +{ | |
| 99 | + return NUM_IMAGES * NUM_IMAGES_MULTIPLIER; | |
| 100 | +} | |
| 101 | + | |
| 102 | +Actor ClippingItemFactory::NewItem( unsigned int itemId ) | |
| 103 | +{ | |
| 104 | + // Create an image view for this item | |
| 105 | + ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] ); | |
| 106 | + | |
| 107 | + // Add a border image child actor | |
| 108 | + ImageView borderActor = ImageView::New(); | |
| 109 | + borderActor.SetParentOrigin( ParentOrigin::CENTER ); | |
| 110 | + borderActor.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 111 | + borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 112 | + borderActor.SetSizeModeFactor( Vector3( 2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f ) ); | |
| 113 | + borderActor.SetColorMode( USE_PARENT_COLOR ); | |
| 114 | + borderActor.SetProperty( ImageView::Property::IMAGE, | |
| 115 | + Property::Map().Add( Visual::Property::TYPE, Visual::BORDER ) | |
| 116 | + .Add( BorderVisual::Property::COLOR, Color::WHITE ) | |
| 117 | + .Add( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE ) | |
| 118 | + .Add( BorderVisual::Property::ANTI_ALIASING, true ) ); | |
| 119 | + actor.Add(borderActor); | |
| 120 | + | |
| 121 | + return actor; | |
| 122 | +} | ... | ... |
examples/clipping/clipping-item-factory.h
0 → 100644
| 1 | +#ifndef CLIPPING_ITEM_FACTORY_H | |
| 2 | +#define CLIPPING_ITEM_FACTORY_H | |
| 3 | + | |
| 4 | +/* | |
| 5 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 6 | + * | |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | + * you may not use this file except in compliance with the License. | |
| 9 | + * You may obtain a copy of the License at | |
| 10 | + * | |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | + * | |
| 13 | + * Unless required by applicable law or agreed to in writing, software | |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 16 | + * See the License for the specific language governing permissions and | |
| 17 | + * limitations under the License. | |
| 18 | + * | |
| 19 | + */ | |
| 20 | + | |
| 21 | +#include <dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h> | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * @brief Factory used to create the items required in the item-view used by this example. | |
| 25 | + */ | |
| 26 | +class ClippingItemFactory : public Dali::Toolkit::ItemFactory | |
| 27 | +{ | |
| 28 | +public: | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * @brief Constructor | |
| 32 | + */ | |
| 33 | + ClippingItemFactory(); | |
| 34 | + | |
| 35 | +private: // From ItemFactory | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Query the number of items available from the factory. | |
| 39 | + * The maximum available item has an ID of GetNumberOfItems() - 1. | |
| 40 | + */ | |
| 41 | + virtual unsigned int GetNumberOfItems(); | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * Create an Actor to represent a visible item. | |
| 45 | + * @param itemId | |
| 46 | + * @return the created actor. | |
| 47 | + */ | |
| 48 | + virtual Dali::Actor NewItem( unsigned int itemId ); | |
| 49 | + | |
| 50 | +private: | |
| 51 | + | |
| 52 | + ClippingItemFactory( const ClippingItemFactory& ); ///< Undefined | |
| 53 | + ClippingItemFactory& operator=( const ClippingItemFactory& ); ///< Undefined | |
| 54 | +}; | |
| 55 | + | |
| 56 | +#endif // CLIPPING_ITEM_FACTORY_H | ... | ... |
examples/cube-transition-effect/cube-transition-effect-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 | |
| 25 | 25 | #include <dali/dali.h> |
| 26 | 26 | #include <dali-toolkit/dali-toolkit.h> |
| 27 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 27 | 28 | #include <dali-toolkit/devel-api/transition-effects/cube-transition-effect.h> |
| 28 | 29 | #include <dali-toolkit/devel-api/transition-effects/cube-transition-cross-effect.h> |
| 29 | 30 | #include <dali-toolkit/devel-api/transition-effects/cube-transition-fold-effect.h> |
| ... | ... | @@ -219,8 +220,8 @@ void CubeTransitionApp::OnInit( Application& application ) |
| 219 | 220 | |
| 220 | 221 | // Add an effect-changing button on the right of the tool bar. |
| 221 | 222 | mEffectChangeButton = Toolkit::PushButton::New(); |
| 222 | - mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE ); | |
| 223 | - mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED ); | |
| 223 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE ); | |
| 224 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE_SELECTED ); | |
| 224 | 225 | mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked ); |
| 225 | 226 | mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 226 | 227 | |
| ... | ... | @@ -230,8 +231,8 @@ void CubeTransitionApp::OnInit( Application& application ) |
| 230 | 231 | |
| 231 | 232 | //Add an slideshow icon on the right of the title |
| 232 | 233 | mSlideshowButton = Toolkit::PushButton::New(); |
| 233 | - mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON ); | |
| 234 | - mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED ); | |
| 234 | + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON ); | |
| 235 | + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED ); | |
| 235 | 236 | mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked ); |
| 236 | 237 | mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 237 | 238 | |
| ... | ... | @@ -324,23 +325,23 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button ) |
| 324 | 325 | { |
| 325 | 326 | mCurrentEffect = mCubeCrossEffect; |
| 326 | 327 | mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) ); |
| 327 | - mEffectChangeButton.SetUnselectedImage( EFFECT_CROSS_IMAGE ); | |
| 328 | - mEffectChangeButton.SetSelectedImage( EFFECT_CROSS_IMAGE_SELECTED ); | |
| 328 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_CROSS_IMAGE ); | |
| 329 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_CROSS_IMAGE_SELECTED ); | |
| 329 | 330 | |
| 330 | 331 | } |
| 331 | 332 | else if(mCurrentEffect == mCubeCrossEffect) |
| 332 | 333 | { |
| 333 | 334 | mCurrentEffect = mCubeFoldEffect; |
| 334 | 335 | mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) ); |
| 335 | - mEffectChangeButton.SetUnselectedImage( EFFECT_FOLD_IMAGE ); | |
| 336 | - mEffectChangeButton.SetSelectedImage( EFFECT_FOLD_IMAGE_SELECTED ); | |
| 336 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_FOLD_IMAGE ); | |
| 337 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_FOLD_IMAGE_SELECTED ); | |
| 337 | 338 | } |
| 338 | 339 | else |
| 339 | 340 | { |
| 340 | 341 | mCurrentEffect = mCubeWaveEffect; |
| 341 | 342 | mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) ); |
| 342 | - mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE ); | |
| 343 | - mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED ); | |
| 343 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE ); | |
| 344 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE_SELECTED ); | |
| 344 | 345 | } |
| 345 | 346 | mContent.Add( mCurrentEffect ); |
| 346 | 347 | |
| ... | ... | @@ -356,8 +357,8 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) |
| 356 | 357 | if( mSlideshow ) |
| 357 | 358 | { |
| 358 | 359 | mPanGestureDetector.Detach( mContent ); |
| 359 | - mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_STOP_ICON ); | |
| 360 | - mSlideshowButton.SetSelectedImage( SLIDE_SHOW_STOP_ICON_SELECTED ); | |
| 360 | + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON ); | |
| 361 | + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON_SELECTED ); | |
| 361 | 362 | mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f ); |
| 362 | 363 | mPanDisplacement = Vector2( -10.f, 0.f ); |
| 363 | 364 | mViewTimer.Start(); |
| ... | ... | @@ -365,8 +366,8 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) |
| 365 | 366 | else |
| 366 | 367 | { |
| 367 | 368 | mPanGestureDetector.Attach( mContent ); |
| 368 | - mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON ); | |
| 369 | - mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED ); | |
| 369 | + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON ); | |
| 370 | + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED ); | |
| 370 | 371 | mViewTimer.Stop(); |
| 371 | 372 | } |
| 372 | 373 | return true; | ... | ... |
examples/dissolve-effect/dissolve-effect-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | |
| 24 | 24 | #include <dali/dali.h> |
| 25 | 25 | #include <dali-toolkit/dali-toolkit.h> |
| 26 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 26 | 27 | #include <dali-toolkit/devel-api/shader-effects/dissolve-effect.h> |
| 27 | 28 | |
| 28 | 29 | using namespace Dali; |
| ... | ... | @@ -221,8 +222,8 @@ void DissolveEffectApp::OnInit( Application& application ) |
| 221 | 222 | |
| 222 | 223 | // Add an effect-changing button on the right of the tool bar. |
| 223 | 224 | mEffectChangeButton = Toolkit::PushButton::New(); |
| 224 | - mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE ); | |
| 225 | - mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED ); | |
| 225 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE ); | |
| 226 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE_SELECTED ); | |
| 226 | 227 | mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked ); |
| 227 | 228 | mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 228 | 229 | |
| ... | ... | @@ -232,8 +233,8 @@ void DissolveEffectApp::OnInit( Application& application ) |
| 232 | 233 | |
| 233 | 234 | // Add an slide-show button on the right of the title |
| 234 | 235 | mPlayStopButton = Toolkit::PushButton::New(); |
| 235 | - mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON ); | |
| 236 | - mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED ); | |
| 236 | + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON ); | |
| 237 | + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED ); | |
| 237 | 238 | mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); |
| 238 | 239 | mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 239 | 240 | |
| ... | ... | @@ -341,14 +342,14 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button ) |
| 341 | 342 | if(mUseHighPrecision) |
| 342 | 343 | { |
| 343 | 344 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) ); |
| 344 | - mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE ); | |
| 345 | - mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED ); | |
| 345 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE ); | |
| 346 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE_SELECTED ); | |
| 346 | 347 | } |
| 347 | 348 | else |
| 348 | 349 | { |
| 349 | 350 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) ); |
| 350 | - mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE ); | |
| 351 | - mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE_SELECTED ); | |
| 351 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_MEDIUMP_IMAGE ); | |
| 352 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_MEDIUMP_IMAGE_SELECTED ); | |
| 352 | 353 | } |
| 353 | 354 | |
| 354 | 355 | return true; |
| ... | ... | @@ -359,16 +360,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) |
| 359 | 360 | mSlideshow = !mSlideshow; |
| 360 | 361 | if( mSlideshow ) |
| 361 | 362 | { |
| 362 | - mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, STOP_ICON ); | |
| 363 | - mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, STOP_ICON_SELECTED ); | |
| 363 | + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_ICON ); | |
| 364 | + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_ICON_SELECTED ); | |
| 364 | 365 | mPanGestureDetector.Detach( mParent ); |
| 365 | 366 | mViewTimer.Start(); |
| 366 | 367 | mTimerReady = false; |
| 367 | 368 | } |
| 368 | 369 | else |
| 369 | 370 | { |
| 370 | - mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON ); | |
| 371 | - mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED ); | |
| 371 | + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON ); | |
| 372 | + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED ); | |
| 372 | 373 | mTimerReady = true; |
| 373 | 374 | mPanGestureDetector.Attach( mParent ); |
| 374 | 375 | } | ... | ... |
examples/effects-view/effects-view-example.cpp
| 1 | 1 | // |
| 2 | -// Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | +// Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | // |
| 4 | 4 | // Licensed under the Flora License, Version 1.0 (the License); |
| 5 | 5 | // you may not use this file except in compliance with the License. |
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | |
| 22 | 22 | #include <dali/dali.h> |
| 23 | 23 | #include <dali-toolkit/dali-toolkit.h> |
| 24 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 24 | 25 | #include <dali-toolkit/devel-api/controls/effects-view/effects-view.h> |
| 25 | 26 | #include <sstream> |
| 26 | 27 | |
| ... | ... | @@ -131,8 +132,8 @@ void EffectsViewApp::OnAppInitialize( Application& application ) |
| 131 | 132 | |
| 132 | 133 | // Creates view change button. |
| 133 | 134 | Toolkit::PushButton viewButton = Toolkit::PushButton::New(); |
| 134 | - viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE ); | |
| 135 | - viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE ); | |
| 135 | + viewButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, VIEW_SWAP_IMAGE ); | |
| 136 | + viewButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, VIEW_SWAP_SELECTED_IMAGE ); | |
| 136 | 137 | // Connects the view change button clicked signal to the OnView method. |
| 137 | 138 | viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize ); |
| 138 | 139 | mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); | ... | ... |
examples/flex-container/flex-container-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | #include <dali/dali.h> |
| 22 | 22 | #include <dali-toolkit/dali-toolkit.h> |
| 23 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 23 | 24 | |
| 24 | 25 | using namespace Dali; |
| 25 | 26 | using namespace Dali::Toolkit; |
| ... | ... | @@ -137,8 +138,8 @@ public: |
| 137 | 138 | // Create a flex direction toggle button. (left of toolbar) |
| 138 | 139 | mFlexDirectionButton = Toolkit::PushButton::New(); |
| 139 | 140 | mFlexDirectionButton.SetName("mFlexDirectionButton"); |
| 140 | - mFlexDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-change.png" ); | |
| 141 | - mFlexDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-change-selected.png" ); | |
| 141 | + mFlexDirectionButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-change.png" ); | |
| 142 | + mFlexDirectionButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-change-selected.png" ); | |
| 142 | 143 | mFlexDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexDirectionButtonClicked); |
| 143 | 144 | mFlexDirectionButton.SetLeaveRequired( true ); |
| 144 | 145 | mToolBar.AddControl( mFlexDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -146,8 +147,8 @@ public: |
| 146 | 147 | // Create a flex wrap toggle button. (left of toolbar) |
| 147 | 148 | mFlexWrapButton = Toolkit::PushButton::New(); |
| 148 | 149 | mFlexWrapButton.SetName("mFlexWrapButton"); |
| 149 | - mFlexWrapButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-edit.png" ); | |
| 150 | - mFlexWrapButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-edit-selected.png" ); | |
| 150 | + mFlexWrapButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-edit.png" ); | |
| 151 | + mFlexWrapButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-edit-selected.png" ); | |
| 151 | 152 | mFlexWrapButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexWrapButtonClicked); |
| 152 | 153 | mFlexWrapButton.SetLeaveRequired( true ); |
| 153 | 154 | mToolBar.AddControl( mFlexWrapButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -155,8 +156,8 @@ public: |
| 155 | 156 | // Create a content direction toggle button. (left of toolbar) |
| 156 | 157 | mContentDirectionButton = Toolkit::PushButton::New(); |
| 157 | 158 | mContentDirectionButton.SetName("mContentDirectionButton"); |
| 158 | - mContentDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-replace.png" ); | |
| 159 | - mContentDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-replace-selected.png" ); | |
| 159 | + mContentDirectionButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-replace.png" ); | |
| 160 | + mContentDirectionButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-replace-selected.png" ); | |
| 160 | 161 | mContentDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnContentDirectionButtonClicked); |
| 161 | 162 | mContentDirectionButton.SetLeaveRequired( true ); |
| 162 | 163 | mToolBar.AddControl( mContentDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -164,8 +165,8 @@ public: |
| 164 | 165 | // Create a justify content toggle button. (right of toolbar) |
| 165 | 166 | mJustifyContentButton = Toolkit::PushButton::New(); |
| 166 | 167 | mJustifyContentButton.SetName("mJustifyContentButton"); |
| 167 | - mJustifyContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-reset.png" ); | |
| 168 | - mJustifyContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-reset-selected.png" ); | |
| 168 | + mJustifyContentButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-reset.png" ); | |
| 169 | + mJustifyContentButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-reset-selected.png" ); | |
| 169 | 170 | mJustifyContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnJustifyContentButtonClicked); |
| 170 | 171 | mJustifyContentButton.SetLeaveRequired( true ); |
| 171 | 172 | mToolBar.AddControl( mJustifyContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -173,8 +174,8 @@ public: |
| 173 | 174 | // Create a align items toggle button. (right of toolbar) |
| 174 | 175 | mAlignItemsButton = Toolkit::PushButton::New(); |
| 175 | 176 | mAlignItemsButton.SetName("mAlignItemsButton"); |
| 176 | - mAlignItemsButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-highp.png" ); | |
| 177 | - mAlignItemsButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-highp-selected.png" ); | |
| 177 | + mAlignItemsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-highp.png" ); | |
| 178 | + mAlignItemsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-highp-selected.png" ); | |
| 178 | 179 | mAlignItemsButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignItemsButtonClicked); |
| 179 | 180 | mAlignItemsButton.SetLeaveRequired( true ); |
| 180 | 181 | mToolBar.AddControl( mAlignItemsButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -182,8 +183,8 @@ public: |
| 182 | 183 | // Create a align content toggle button. (right of toolbar) |
| 183 | 184 | mAlignContentButton = Toolkit::PushButton::New(); |
| 184 | 185 | mAlignContentButton.SetName("mAlignContentButton"); |
| 185 | - mAlignContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-effect-cross.png" ); | |
| 186 | - mAlignContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-effect-cross-selected.png" ); | |
| 186 | + mAlignContentButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-effect-cross.png" ); | |
| 187 | + mAlignContentButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-effect-cross-selected.png" ); | |
| 187 | 188 | mAlignContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignContentButtonClicked); |
| 188 | 189 | mAlignContentButton.SetLeaveRequired( true ); |
| 189 | 190 | mToolBar.AddControl( mAlignContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -224,13 +225,13 @@ public: |
| 224 | 225 | |
| 225 | 226 | // Set different background colour to help to identify different items |
| 226 | 227 | flexItem.SetBackgroundColor(Vector4(static_cast<float>(i) / NUM_FLEX_ITEMS, static_cast<float>(NUM_FLEX_ITEMS - i) / NUM_FLEX_ITEMS, 1.0f, 1.0f)); |
| 227 | - flexItem.SetUnselectedImage(""); | |
| 228 | - flexItem.SetSelectedImage(""); | |
| 228 | + flexItem.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, "" ); | |
| 229 | + flexItem.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, "" ); | |
| 229 | 230 | |
| 230 | 231 | // Add a label to the button so that we can identify each item more easily |
| 231 | 232 | std::ostringstream index; |
| 232 | 233 | index << i + 1; |
| 233 | - flexItem.SetLabelText(index.str()); | |
| 234 | + flexItem.SetProperty( Toolkit::Button::Property::LABEL, index.str() ); | |
| 234 | 235 | flexItem.SetName("FlexItem " + index.str()); |
| 235 | 236 | |
| 236 | 237 | // Set a fixed size to the items so that we can wrap the line and test these | ... | ... |
examples/fpp-game/fpp-game-tutorial-controller.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -20,7 +20,10 @@ |
| 20 | 20 | #include <dali/public-api/events/touch-data.h> |
| 21 | 21 | #include <dali/public-api/animation/animation.h> |
| 22 | 22 | #include <dali/public-api/actors/camera-actor.h> |
| 23 | +#include <dali/public-api/object/property-map.h> | |
| 23 | 24 | #include <dali/public-api/render-tasks/render-task-list.h> |
| 25 | +#include <dali-toolkit/public-api/visuals/visual-properties.h> | |
| 26 | +#include <dali-toolkit/public-api/visuals/color-visual-properties.h> | |
| 24 | 27 | |
| 25 | 28 | using namespace Dali; |
| 26 | 29 | using namespace Dali::Toolkit; |
| ... | ... | @@ -111,7 +114,9 @@ void FppGameTutorialController::DisplayTutorial() |
| 111 | 114 | mLeftLabel.SetAnchorPoint( AnchorPoint::CENTER ); |
| 112 | 115 | mLeftLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 113 | 116 | mLeftLabel.SetSize( Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) ); |
| 114 | - mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 )); | |
| 117 | + mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND, | |
| 118 | + Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) | |
| 119 | + .Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 ) ) ); | |
| 115 | 120 | mLeftLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White. |
| 116 | 121 | mLeftLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); |
| 117 | 122 | mLeftLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); |
| ... | ... | @@ -122,7 +127,9 @@ void FppGameTutorialController::DisplayTutorial() |
| 122 | 127 | mRightLabel.SetAnchorPoint( AnchorPoint::CENTER ); |
| 123 | 128 | mRightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 124 | 129 | mRightLabel.SetSize( Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) ); |
| 125 | - mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 )); | |
| 130 | + mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND, | |
| 131 | + Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) | |
| 132 | + .Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 ) ) ); | |
| 126 | 133 | mRightLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White. |
| 127 | 134 | mRightLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); |
| 128 | 135 | mRightLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); | ... | ... |
examples/gradients/gradients-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 19 | 20 | #include "shared/view.h" |
| 20 | 21 | |
| 21 | 22 | using namespace Dali; |
| ... | ... | @@ -67,8 +68,8 @@ public: |
| 67 | 68 | APPLICATION_TITLE ); |
| 68 | 69 | |
| 69 | 70 | PushButton changeButton = Toolkit::PushButton::New(); |
| 70 | - changeButton.SetUnselectedImage( CHANGE_ICON ); | |
| 71 | - changeButton.SetSelectedImage( CHANGE_ICON_SELECTED ); | |
| 71 | + changeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_ICON ); | |
| 72 | + changeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_ICON_SELECTED ); | |
| 72 | 73 | changeButton.ClickedSignal().Connect( this, &GradientController::OnChangeIconClicked ); |
| 73 | 74 | toolBar.AddControl( changeButton, |
| 74 | 75 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, | ... | ... |
examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp
| ... | ... | @@ -373,7 +373,7 @@ public: |
| 373 | 373 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 374 | 374 | button.SetStyleName( STYLE_BUTTON_TEXT ); |
| 375 | 375 | button.SetName( id ); |
| 376 | - button.SetLabelText( label ); | |
| 376 | + button.SetProperty( Toolkit::Button::Property::LABEL, label ); | |
| 377 | 377 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 378 | 378 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 379 | 379 | button.ClickedSignal().Connect( this, &ImageScalingAndFilteringController::OnButtonClicked ); |
| ... | ... | @@ -400,7 +400,7 @@ public: |
| 400 | 400 | { |
| 401 | 401 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 402 | 402 | button.SetName( id ); |
| 403 | - button.SetLabelText( id ); | |
| 403 | + button.SetProperty( Toolkit::Button::Property::LABEL, id ); | |
| 404 | 404 | |
| 405 | 405 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 406 | 406 | button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); |
| ... | ... | @@ -489,7 +489,7 @@ public: |
| 489 | 489 | if( button.GetName() == modeName ) |
| 490 | 490 | { |
| 491 | 491 | mFittingMode = mode; |
| 492 | - mFittingModeButton.SetLabelText( modeName ); | |
| 492 | + mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, modeName ); | |
| 493 | 493 | ResizeImage(); |
| 494 | 494 | mPopup.SetDisplayState( Toolkit::Popup::HIDDEN ); |
| 495 | 495 | mPopup.Reset(); |
| ... | ... | @@ -504,7 +504,7 @@ public: |
| 504 | 504 | if( button.GetName() == modeName ) |
| 505 | 505 | { |
| 506 | 506 | mSamplingMode = mode; |
| 507 | - mSamplingModeButton.SetLabelText( modeName ); | |
| 507 | + mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, modeName ); | |
| 508 | 508 | ResizeImage(); |
| 509 | 509 | mPopup.SetDisplayState( Toolkit::Popup::HIDDEN ); |
| 510 | 510 | mPopup.Reset(); |
| ... | ... | @@ -661,13 +661,13 @@ public: |
| 661 | 661 | else if ( event.keyPressedName == "f" ) |
| 662 | 662 | { |
| 663 | 663 | mSamplingMode = NextFilterMode( mSamplingMode ); |
| 664 | - mSamplingModeButton.SetLabelText( StringFromFilterMode( mSamplingMode ) ); | |
| 664 | + mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromFilterMode( mSamplingMode ) ); | |
| 665 | 665 | } |
| 666 | 666 | // Cycle filter and scaling modes: |
| 667 | 667 | else if ( event.keyPressedName == "s" ) |
| 668 | 668 | { |
| 669 | 669 | mFittingMode = NextScalingMode( mFittingMode ); |
| 670 | - mFittingModeButton.SetLabelText( StringFromScalingMode( mFittingMode ) ); | |
| 670 | + mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromScalingMode( mFittingMode ) ); | |
| 671 | 671 | } |
| 672 | 672 | else |
| 673 | 673 | { | ... | ... |
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -45,6 +45,7 @@ |
| 45 | 45 | #include <algorithm> |
| 46 | 46 | #include <map> |
| 47 | 47 | #include <dali-toolkit/dali-toolkit.h> |
| 48 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 48 | 49 | #include <iostream> |
| 49 | 50 | |
| 50 | 51 | // INTERNAL INCLUDES |
| ... | ... | @@ -307,8 +308,8 @@ public: |
| 307 | 308 | |
| 308 | 309 | // Create an image scaling toggle button. (right of toolbar) |
| 309 | 310 | Toolkit::PushButton toggleScalingButton = Toolkit::PushButton::New(); |
| 310 | - toggleScalingButton.SetUnselectedImage( TOGGLE_SCALING_IMAGE ); | |
| 311 | - toggleScalingButton.SetSelectedImage( TOGGLE_SCALING_IMAGE_SELECTED ); | |
| 311 | + toggleScalingButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TOGGLE_SCALING_IMAGE ); | |
| 312 | + toggleScalingButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, TOGGLE_SCALING_IMAGE_SELECTED ); | |
| 312 | 313 | toggleScalingButton.ClickedSignal().Connect( this, &ImageScalingIrregularGridController::OnToggleScalingTouched ); |
| 313 | 314 | mToolBar.AddControl( toggleScalingButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 314 | 315 | ... | ... |
examples/image-view-pixel-area/image-view-pixel-area-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -16,6 +16,8 @@ |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 20 | + | |
| 19 | 21 | #include "shared/view.h" |
| 20 | 22 | |
| 21 | 23 | using namespace Dali; |
| ... | ... | @@ -69,8 +71,8 @@ private: |
| 69 | 71 | |
| 70 | 72 | // Add a button to switch the scene. (right of toolbar) |
| 71 | 73 | Toolkit::PushButton switchButton = Toolkit::PushButton::New(); |
| 72 | - switchButton.SetUnselectedImage( BUTTON_ICON ); | |
| 73 | - switchButton.SetSelectedImage( BUTTON_ICON_SELECTED ); | |
| 74 | + switchButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_ICON ); | |
| 75 | + switchButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_ICON_SELECTED ); | |
| 74 | 76 | switchButton.ClickedSignal().Connect( this, &ImageViewPixelAreaApp::OnButtonClicked ); |
| 75 | 77 | toolBar.AddControl( switchButton, |
| 76 | 78 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, | ... | ... |
examples/image-view-svg/image-view-svg-example.cpp
| ... | ... | @@ -82,7 +82,7 @@ public: |
| 82 | 82 | |
| 83 | 83 | // Push button, for changing the image set for displaying |
| 84 | 84 | Toolkit::PushButton changeButton = Toolkit::PushButton::New(); |
| 85 | - changeButton.SetLabelText( "Next" ); | |
| 85 | + changeButton.SetProperty( Toolkit::Button::Property::LABEL, "Next" ); | |
| 86 | 86 | changeButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); |
| 87 | 87 | changeButton.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| 88 | 88 | stage.Add( changeButton ); |
| ... | ... | @@ -91,7 +91,7 @@ public: |
| 91 | 91 | |
| 92 | 92 | // Push button, for resetting the actor size and position |
| 93 | 93 | Toolkit::PushButton resetButton = Toolkit::PushButton::New(); |
| 94 | - resetButton.SetLabelText( "Reset" ); | |
| 94 | + resetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" ); | |
| 95 | 95 | resetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 96 | 96 | resetButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 97 | 97 | stage.Add( resetButton ); | ... | ... |
examples/image-view/image-view-example.cpp
| ... | ... | @@ -107,7 +107,7 @@ class ImageViewController: public ConnectionTracker |
| 107 | 107 | buttonsTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 108 | 108 | |
| 109 | 109 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 110 | - button.SetLabelText( "Toggle on/off stage" ); | |
| 110 | + button.SetProperty( Toolkit::Button::Property::LABEL, "Toggle on/off stage" ); | |
| 111 | 111 | button.SetParentOrigin( ParentOrigin::CENTER ); |
| 112 | 112 | button.SetAnchorPoint( AnchorPoint::CENTER ); |
| 113 | 113 | button.ClickedSignal().Connect( this, &ImageViewController::ToggleImageOnStage ); |
| ... | ... | @@ -115,7 +115,7 @@ class ImageViewController: public ConnectionTracker |
| 115 | 115 | buttonsTable.AddChild( button, Toolkit::TableView::CellPosition( 0, 0 ) ); |
| 116 | 116 | |
| 117 | 117 | Toolkit::PushButton button2 = Toolkit::PushButton::New(); |
| 118 | - button2.SetLabelText( "Change Image" ); | |
| 118 | + button2.SetProperty( Toolkit::Button::Property::LABEL, "Change Image" ); | |
| 119 | 119 | button2.SetParentOrigin( ParentOrigin::CENTER ); |
| 120 | 120 | button2.SetAnchorPoint( AnchorPoint::CENTER ); |
| 121 | 121 | button2.ClickedSignal().Connect( this, &ImageViewController::ChangeImageClicked ); | ... | ... |
examples/item-view/item-view-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2014 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | #include <dali/dali.h> |
| 22 | 22 | #include <dali-toolkit/dali-toolkit.h> |
| 23 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 23 | 24 | |
| 24 | 25 | using namespace Dali; |
| 25 | 26 | using namespace Dali::Toolkit; |
| ... | ... | @@ -213,16 +214,16 @@ public: |
| 213 | 214 | |
| 214 | 215 | // Create an edit mode button. (left of toolbar) |
| 215 | 216 | Toolkit::PushButton editButton = Toolkit::PushButton::New(); |
| 216 | - editButton.SetUnselectedImage( EDIT_IMAGE ); | |
| 217 | - editButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); | |
| 217 | + editButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE ); | |
| 218 | + editButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED ); | |
| 218 | 219 | editButton.ClickedSignal().Connect( this, &ItemViewExample::OnModeButtonClicked); |
| 219 | 220 | editButton.SetLeaveRequired( true ); |
| 220 | 221 | mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 221 | 222 | |
| 222 | 223 | // Create a layout toggle button. (right of toolbar) |
| 223 | 224 | mLayoutButton = Toolkit::PushButton::New(); |
| 224 | - mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE ); | |
| 225 | - mLayoutButton.SetSelectedImage(SPIRAL_LAYOUT_IMAGE_SELECTED ); | |
| 225 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE ); | |
| 226 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED ); | |
| 226 | 227 | mLayoutButton.ClickedSignal().Connect( this, &ItemViewExample::OnLayoutButtonClicked); |
| 227 | 228 | mLayoutButton.SetLeaveRequired( true ); |
| 228 | 229 | mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -233,9 +234,9 @@ public: |
| 233 | 234 | mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 234 | 235 | mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); |
| 235 | 236 | mDeleteButton.SetDrawMode( DrawMode::OVERLAY_2D ); |
| 236 | - mDeleteButton.SetUnselectedImage( DELETE_IMAGE ); | |
| 237 | - mDeleteButton.SetSelectedImage( DELETE_IMAGE_SELECTED ); | |
| 238 | - mDeleteButton.SetBackgroundImage( TOOLBAR_IMAGE ); | |
| 237 | + mDeleteButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DELETE_IMAGE ); | |
| 238 | + mDeleteButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DELETE_IMAGE_SELECTED ); | |
| 239 | + mDeleteButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE ); | |
| 239 | 240 | mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) ); |
| 240 | 241 | mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); |
| 241 | 242 | mDeleteButton.SetLeaveRequired( true ); |
| ... | ... | @@ -248,9 +249,9 @@ public: |
| 248 | 249 | mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 249 | 250 | mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); |
| 250 | 251 | mInsertButton.SetDrawMode( DrawMode::OVERLAY_2D ); |
| 251 | - mInsertButton.SetUnselectedImage( INSERT_IMAGE ); | |
| 252 | - mInsertButton.SetSelectedImage( INSERT_IMAGE_SELECTED ); | |
| 253 | - mInsertButton.SetBackgroundImage( TOOLBAR_IMAGE ); | |
| 252 | + mInsertButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, INSERT_IMAGE ); | |
| 253 | + mInsertButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, INSERT_IMAGE_SELECTED ); | |
| 254 | + mInsertButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE ); | |
| 254 | 255 | mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); |
| 255 | 256 | mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); |
| 256 | 257 | mInsertButton.SetLeaveRequired( true ); |
| ... | ... | @@ -263,9 +264,9 @@ public: |
| 263 | 264 | mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 264 | 265 | mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); |
| 265 | 266 | mReplaceButton.SetDrawMode( DrawMode::OVERLAY_2D ); |
| 266 | - mReplaceButton.SetUnselectedImage( REPLACE_IMAGE ); | |
| 267 | - mReplaceButton.SetSelectedImage( REPLACE_IMAGE_SELECTED ); | |
| 268 | - mReplaceButton.SetBackgroundImage( TOOLBAR_IMAGE ); | |
| 267 | + mReplaceButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE ); | |
| 268 | + mReplaceButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE_SELECTED ); | |
| 269 | + mReplaceButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE ); | |
| 269 | 270 | mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); |
| 270 | 271 | mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); |
| 271 | 272 | mReplaceButton.SetLeaveRequired( true ); |
| ... | ... | @@ -821,22 +822,22 @@ public: |
| 821 | 822 | { |
| 822 | 823 | case SPIRAL_LAYOUT: |
| 823 | 824 | { |
| 824 | - mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE ); | |
| 825 | - mLayoutButton.SetSelectedImage( SPIRAL_LAYOUT_IMAGE_SELECTED ); | |
| 825 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE ); | |
| 826 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED ); | |
| 826 | 827 | break; |
| 827 | 828 | } |
| 828 | 829 | |
| 829 | 830 | case GRID_LAYOUT: |
| 830 | 831 | { |
| 831 | - mLayoutButton.SetUnselectedImage( GRID_LAYOUT_IMAGE ); | |
| 832 | - mLayoutButton.SetSelectedImage( GRID_LAYOUT_IMAGE_SELECTED ); | |
| 832 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE ); | |
| 833 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE_SELECTED ); | |
| 833 | 834 | break; |
| 834 | 835 | } |
| 835 | 836 | |
| 836 | 837 | case DEPTH_LAYOUT: |
| 837 | 838 | { |
| 838 | - mLayoutButton.SetUnselectedImage( DEPTH_LAYOUT_IMAGE ); | |
| 839 | - mLayoutButton.SetSelectedImage( DEPTH_LAYOUT_IMAGE_SELECTED ); | |
| 839 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE ); | |
| 840 | + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE_SELECTED ); | |
| 840 | 841 | break; |
| 841 | 842 | } |
| 842 | 843 | ... | ... |
examples/line-mesh/line-mesh-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -253,7 +253,7 @@ public: |
| 253 | 253 | |
| 254 | 254 | radio.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 255 | 255 | radio.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 256 | - radio.SetSelected( i == 0 ); | |
| 256 | + radio.SetProperty( Toolkit::Button::Property::SELECTED, i == 0 ); | |
| 257 | 257 | radio.PressedSignal().Connect( this, &ExampleController::OnButtonPressed ); |
| 258 | 258 | mButtons[i] = radio; |
| 259 | 259 | modeSelectTableView.AddChild( radio, Toolkit::TableView::CellPosition( i, 0 ) ); |
| ... | ... | @@ -268,12 +268,12 @@ public: |
| 268 | 268 | elementCountTableView.SetFitWidth( 1 ); |
| 269 | 269 | elementCountTableView.SetFitWidth( 2 ); |
| 270 | 270 | mMinusButton = Toolkit::PushButton::New(); |
| 271 | - mMinusButton.SetLabelText( "<<" ); | |
| 271 | + mMinusButton.SetProperty( Toolkit::Button::Property::LABEL, "<<" ); | |
| 272 | 272 | mMinusButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 273 | 273 | mMinusButton.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); |
| 274 | 274 | |
| 275 | 275 | Toolkit::PushButton mPlusButton = Toolkit::PushButton::New(); |
| 276 | - mPlusButton.SetLabelText( ">>" ); | |
| 276 | + mPlusButton.SetProperty( Toolkit::Button::Property::LABEL, ">>" ); | |
| 277 | 277 | mPlusButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 278 | 278 | mPlusButton.SetAnchorPoint( AnchorPoint::CENTER_RIGHT ); |
| 279 | 279 | ... | ... |
examples/logging/logging-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -241,7 +241,7 @@ class LoggingController: public ConnectionTracker |
| 241 | 241 | radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 242 | 242 | radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 243 | 243 | radioButton.SetPosition( DP(radioX), DP(radioY) ); |
| 244 | - radioButton.SetSelected( true ); | |
| 244 | + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 245 | 245 | |
| 246 | 246 | radioButton.StateChangedSignal().Connect( this, &LoggingController::LoggingRadioSelect ); |
| 247 | 247 | |
| ... | ... | @@ -294,7 +294,7 @@ class LoggingController: public ConnectionTracker |
| 294 | 294 | { |
| 295 | 295 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 296 | 296 | button.SetName( CREATE_BUTTON_ID ); |
| 297 | - button.SetLabelText( CREATE_BUTTON_TEXT ); | |
| 297 | + button.SetProperty( Toolkit::Button::Property::LABEL, CREATE_BUTTON_TEXT); | |
| 298 | 298 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 299 | 299 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 300 | 300 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -305,7 +305,7 @@ class LoggingController: public ConnectionTracker |
| 305 | 305 | { |
| 306 | 306 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 307 | 307 | button.SetName( DELETE_BUTTON_ID ); |
| 308 | - button.SetLabelText( DELETE_BUTTON_TEXT ); | |
| 308 | + button.SetProperty( Toolkit::Button::Property::LABEL, DELETE_BUTTON_TEXT); | |
| 309 | 309 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 310 | 310 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 311 | 311 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -327,7 +327,7 @@ class LoggingController: public ConnectionTracker |
| 327 | 327 | { |
| 328 | 328 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 329 | 329 | button.SetName( START_BUTTON_ID ); |
| 330 | - button.SetLabelText( START_BUTTON_TEXT ); | |
| 330 | + button.SetProperty( Toolkit::Button::Property::LABEL, START_BUTTON_TEXT); | |
| 331 | 331 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 332 | 332 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 333 | 333 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -338,7 +338,7 @@ class LoggingController: public ConnectionTracker |
| 338 | 338 | { |
| 339 | 339 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 340 | 340 | button.SetName( STOP_BUTTON_ID ); |
| 341 | - button.SetLabelText( STOP_BUTTON_TEXT ); | |
| 341 | + button.SetProperty( Toolkit::Button::Property::LABEL, STOP_BUTTON_TEXT); | |
| 342 | 342 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 343 | 343 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 344 | 344 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -359,7 +359,7 @@ class LoggingController: public ConnectionTracker |
| 359 | 359 | { |
| 360 | 360 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 361 | 361 | button.SetName( ENABLE_BUTTON_ID ); |
| 362 | - button.SetLabelText( ENABLE_BUTTON_TEXT ); | |
| 362 | + button.SetProperty( Toolkit::Button::Property::LABEL, ENABLE_BUTTON_TEXT); | |
| 363 | 363 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 364 | 364 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 365 | 365 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -370,7 +370,7 @@ class LoggingController: public ConnectionTracker |
| 370 | 370 | { |
| 371 | 371 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 372 | 372 | button.SetName( DISABLE_BUTTON_ID ); |
| 373 | - button.SetLabelText( DISABLE_BUTTON_TEXT ); | |
| 373 | + button.SetProperty( Toolkit::Button::Property::LABEL, DISABLE_BUTTON_TEXT); | |
| 374 | 374 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 375 | 375 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 376 | 376 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -421,7 +421,7 @@ class LoggingController: public ConnectionTracker |
| 421 | 421 | Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_2_RADIO_TEXT ); |
| 422 | 422 | radioButton.SetName( FREQUENCY_2_RADIO_ID ); |
| 423 | 423 | |
| 424 | - radioButton.SetSelected( true ); | |
| 424 | + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 425 | 425 | |
| 426 | 426 | radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); |
| 427 | 427 | |
| ... | ... | @@ -453,7 +453,7 @@ class LoggingController: public ConnectionTracker |
| 453 | 453 | { |
| 454 | 454 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 455 | 455 | button.SetName( VSYNC_BUTTON_ID ); |
| 456 | - button.SetLabelText( VSYNC_BUTTON_TEXT ); | |
| 456 | + button.SetProperty( Toolkit::Button::Property::LABEL, VSYNC_BUTTON_TEXT); | |
| 457 | 457 | button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 458 | 458 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 459 | 459 | button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); |
| ... | ... | @@ -473,21 +473,27 @@ class LoggingController: public ConnectionTracker |
| 473 | 473 | << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped") |
| 474 | 474 | << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled"); |
| 475 | 475 | |
| 476 | - mLogRadioButtons[i].SetLabelText( ss.str() ); | |
| 476 | + mLogRadioButtons[i].SetProperty( Toolkit::Button::Property::LABEL, ss.str() ); | |
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | bool LoggingRadioSelect( Toolkit::Button button ) |
| 481 | 481 | { |
| 482 | - if( button.GetName() == LOGGER_1_RADIO_ID && button.IsSelected() == true ) | |
| 482 | + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 483 | + if( !isSelected ) | |
| 484 | + { | |
| 485 | + return true; | |
| 486 | + } | |
| 487 | + | |
| 488 | + if( button.GetName() == LOGGER_1_RADIO_ID ) | |
| 483 | 489 | { |
| 484 | 490 | mCurrentLogger = 0; |
| 485 | 491 | } |
| 486 | - else if( button.GetName() == LOGGER_2_RADIO_ID && button.IsSelected() == true ) | |
| 492 | + else if( button.GetName() == LOGGER_2_RADIO_ID ) | |
| 487 | 493 | { |
| 488 | 494 | mCurrentLogger = 1; |
| 489 | 495 | } |
| 490 | - else if( button.GetName() == LOGGER_3_RADIO_ID && button.IsSelected() == true ) | |
| 496 | + else if( button.GetName() == LOGGER_3_RADIO_ID ) | |
| 491 | 497 | { |
| 492 | 498 | mCurrentLogger = 2; |
| 493 | 499 | } |
| ... | ... | @@ -503,21 +509,27 @@ class LoggingController: public ConnectionTracker |
| 503 | 509 | const unsigned int frequency = mLoggerStates[mCurrentLogger].frequency; |
| 504 | 510 | if( frequency == HIGH_FREQUENCY ) |
| 505 | 511 | { |
| 506 | - mFrequencyRadioButtons[0].SetSelected( true ); | |
| 512 | + mFrequencyRadioButtons[0].SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 507 | 513 | } |
| 508 | 514 | else if( frequency == MEDIUM_FREQUENCY ) |
| 509 | 515 | { |
| 510 | - mFrequencyRadioButtons[1].SetSelected( true ); | |
| 516 | + mFrequencyRadioButtons[1].SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 511 | 517 | } |
| 512 | 518 | else if( frequency == LOW_FREQUENCY ) |
| 513 | 519 | { |
| 514 | - mFrequencyRadioButtons[2].SetSelected( true ); | |
| 520 | + mFrequencyRadioButtons[2].SetProperty( Toolkit::Button::Property::SELECTED, true ); | |
| 515 | 521 | } |
| 516 | 522 | } |
| 517 | 523 | |
| 518 | 524 | bool FrequencyRadioSelect( Toolkit::Button button ) |
| 519 | 525 | { |
| 520 | - if( button.GetName() == FREQUENCY_1_RADIO_ID && button.IsSelected() == true ) | |
| 526 | + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 527 | + if( !isSelected ) | |
| 528 | + { | |
| 529 | + return true; | |
| 530 | + } | |
| 531 | + | |
| 532 | + if( button.GetName() == FREQUENCY_1_RADIO_ID ) | |
| 521 | 533 | { |
| 522 | 534 | if( mPerformanceLoggers[mCurrentLogger] ) |
| 523 | 535 | { |
| ... | ... | @@ -528,7 +540,7 @@ class LoggingController: public ConnectionTracker |
| 528 | 540 | mLoggerStates[mCurrentLogger].frequency = HIGH_FREQUENCY; |
| 529 | 541 | } |
| 530 | 542 | } |
| 531 | - else if( button.GetName() == FREQUENCY_2_RADIO_ID && button.IsSelected() == true ) | |
| 543 | + else if( button.GetName() == FREQUENCY_2_RADIO_ID ) | |
| 532 | 544 | { |
| 533 | 545 | if( mPerformanceLoggers[mCurrentLogger] ) |
| 534 | 546 | { |
| ... | ... | @@ -539,7 +551,7 @@ class LoggingController: public ConnectionTracker |
| 539 | 551 | mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY; |
| 540 | 552 | } |
| 541 | 553 | } |
| 542 | - else if( button.GetName() == FREQUENCY_3_RADIO_ID && button.IsSelected() == true ) | |
| 554 | + else if( button.GetName() == FREQUENCY_3_RADIO_ID ) | |
| 543 | 555 | { |
| 544 | 556 | if( mPerformanceLoggers[mCurrentLogger] ) |
| 545 | 557 | { | ... | ... |
examples/mesh-visual/mesh-visual-example.cpp
| ... | ... | @@ -183,7 +183,7 @@ public: |
| 183 | 183 | modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked ); |
| 184 | 184 | modelButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); |
| 185 | 185 | modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); |
| 186 | - modelButton.SetLabelText( "Model" ); | |
| 186 | + modelButton.SetProperty( Toolkit::Button::Property::LABEL, "Model" ); | |
| 187 | 187 | positionActorModel.Add( modelButton ); |
| 188 | 188 | |
| 189 | 189 | //Create button for shading mode changing. |
| ... | ... | @@ -192,7 +192,7 @@ public: |
| 192 | 192 | shadingModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShadingModeClicked ); |
| 193 | 193 | shadingModeButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); |
| 194 | 194 | shadingModeButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 195 | - shadingModeButton.SetLabelText( "Shading Mode" ); | |
| 195 | + shadingModeButton.SetProperty( Toolkit::Button::Property::LABEL, "Shading Mode" ); | |
| 196 | 196 | positionActorModel.Add( shadingModeButton ); |
| 197 | 197 | |
| 198 | 198 | //Text label title for changing model or shading mode. |
| ... | ... | @@ -209,7 +209,7 @@ public: |
| 209 | 209 | pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked ); |
| 210 | 210 | pauseButton.SetParentOrigin( Vector3( 0.5, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); |
| 211 | 211 | pauseButton.SetAnchorPoint( AnchorPoint::CENTER ); |
| 212 | - pauseButton.SetLabelText( PAUSE ); | |
| 212 | + pauseButton.SetProperty( Toolkit::Button::Property::LABEL, PAUSE ); | |
| 213 | 213 | layer.Add( pauseButton ); |
| 214 | 214 | |
| 215 | 215 | //Actor for positioning light position buttons. |
| ... | ... | @@ -224,7 +224,7 @@ public: |
| 224 | 224 | lightModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked ); |
| 225 | 225 | lightModeButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); |
| 226 | 226 | lightModeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); |
| 227 | - lightModeButton.SetLabelText( FIXED ); | |
| 227 | + lightModeButton.SetProperty( Toolkit::Button::Property::LABEL, FIXED ); | |
| 228 | 228 | positionActorLight.Add( lightModeButton ); |
| 229 | 229 | |
| 230 | 230 | //Create button for switching between front and back light position. |
| ... | ... | @@ -233,7 +233,7 @@ public: |
| 233 | 233 | lightSideButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightSideClicked ); |
| 234 | 234 | lightSideButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); |
| 235 | 235 | lightSideButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); |
| 236 | - lightSideButton.SetLabelText( FRONT ); | |
| 236 | + lightSideButton.SetProperty( Toolkit::Button::Property::LABEL, FRONT ); | |
| 237 | 237 | positionActorLight.Add( lightSideButton ); |
| 238 | 238 | |
| 239 | 239 | //Text label title for light position mode. |
| ... | ... | @@ -504,7 +504,7 @@ public: |
| 504 | 504 | mModels[i].rotationAnimation.Pause(); |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - button.SetLabelText( PLAY ); | |
| 507 | + button.SetProperty( Toolkit::Button::Property::LABEL, PLAY ); | |
| 508 | 508 | } |
| 509 | 509 | else //Unpause all animations again. |
| 510 | 510 | { |
| ... | ... | @@ -513,7 +513,7 @@ public: |
| 513 | 513 | mModels[i].rotationAnimation.Play(); |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - button.SetLabelText( PAUSE ); | |
| 516 | + button.SetProperty( Toolkit::Button::Property::LABEL, PAUSE ); | |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | return true; |
| ... | ... | @@ -528,11 +528,11 @@ public: |
| 528 | 528 | |
| 529 | 529 | if( mLightFixed ) |
| 530 | 530 | { |
| 531 | - button.SetLabelText( FIXED ); | |
| 531 | + button.SetProperty( Toolkit::Button::Property::LABEL, FIXED ); | |
| 532 | 532 | } |
| 533 | 533 | else |
| 534 | 534 | { |
| 535 | - button.SetLabelText( MANUAL ); | |
| 535 | + button.SetProperty( Toolkit::Button::Property::LABEL, MANUAL ); | |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | SetLightMode(); |
| ... | ... | @@ -548,11 +548,11 @@ public: |
| 548 | 548 | |
| 549 | 549 | if( mLightFront ) |
| 550 | 550 | { |
| 551 | - button.SetLabelText( FRONT ); | |
| 551 | + button.SetProperty( Toolkit::Button::Property::LABEL, FRONT ); | |
| 552 | 552 | } |
| 553 | 553 | else |
| 554 | 554 | { |
| 555 | - button.SetLabelText( BACK ); | |
| 555 | + button.SetProperty( Toolkit::Button::Property::LABEL, BACK ); | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | //Change light image. | ... | ... |
examples/model3d-view/model3d-view-example.cpp
| ... | ... | @@ -117,7 +117,7 @@ public: |
| 117 | 117 | editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeModelClicked); |
| 118 | 118 | editButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 119 | 119 | editButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 120 | - editButton.SetLabelText( "Change Model" ); | |
| 120 | + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Model" ); | |
| 121 | 121 | mButtonLayer.Add( editButton ); |
| 122 | 122 | |
| 123 | 123 | // Create button for shader changing |
| ... | ... | @@ -126,7 +126,7 @@ public: |
| 126 | 126 | editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeLightingClicked); |
| 127 | 127 | editButton.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| 128 | 128 | editButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); |
| 129 | - editButton.SetLabelText( "Change Shader" ); | |
| 129 | + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Shader" ); | |
| 130 | 130 | mButtonLayer.Add( editButton ); |
| 131 | 131 | |
| 132 | 132 | // Create button for pause/resume animation |
| ... | ... | @@ -135,7 +135,7 @@ public: |
| 135 | 135 | editButton.ClickedSignal().Connect( this, &Model3dViewController::OnPauseAnimationsClicked); |
| 136 | 136 | editButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); |
| 137 | 137 | editButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); |
| 138 | - editButton.SetLabelText( "Pause Animations" ); | |
| 138 | + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Pause Animations" ); | |
| 139 | 139 | mButtonLayer.Add( editButton ); |
| 140 | 140 | |
| 141 | 141 | //Create animations | ... | ... |
examples/motion-blur/motion-blur-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -21,8 +21,8 @@ |
| 21 | 21 | #include "shared/view.h" |
| 22 | 22 | #include <dali/dali.h> |
| 23 | 23 | #include <dali-toolkit/dali-toolkit.h> |
| 24 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 24 | 25 | #include <dali-toolkit/devel-api/shader-effects/motion-blur-effect.h> |
| 25 | -#include <dali-toolkit/devel-api/controls/popup/popup.h> | |
| 26 | 26 | |
| 27 | 27 | using namespace Dali; |
| 28 | 28 | using namespace Dali::Toolkit; |
| ... | ... | @@ -176,16 +176,16 @@ public: |
| 176 | 176 | |
| 177 | 177 | //Add an effects icon on the right of the title |
| 178 | 178 | mActorEffectsButton = Toolkit::PushButton::New(); |
| 179 | - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); | |
| 180 | - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); | |
| 179 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); | |
| 180 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); | |
| 181 | 181 | mActorEffectsButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnEffectButtonClicked ); |
| 182 | 182 | mToolBar.AddControl( mActorEffectsButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 183 | 183 | |
| 184 | 184 | // Creates a mode button. |
| 185 | 185 | // Create a effect toggle button. (right of toolbar) |
| 186 | 186 | Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); |
| 187 | - layoutButton.SetUnselectedImage( LAYOUT_IMAGE ); | |
| 188 | - layoutButton.SetSelectedImage( LAYOUT_IMAGE_SELECTED ); | |
| 187 | + layoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE ); | |
| 188 | + layoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE_SELECTED ); | |
| 189 | 189 | layoutButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnLayoutButtonClicked); |
| 190 | 190 | layoutButton.SetLeaveRequired( true ); |
| 191 | 191 | mToolBar.AddControl( layoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -435,14 +435,14 @@ public: |
| 435 | 435 | if(!mActorEffectsEnabled) |
| 436 | 436 | { |
| 437 | 437 | mActorEffectsEnabled = true; |
| 438 | - mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON ); | |
| 439 | - mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED ); | |
| 438 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON ); | |
| 439 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON_SELECTED ); | |
| 440 | 440 | } |
| 441 | 441 | else |
| 442 | 442 | { |
| 443 | 443 | mActorEffectsEnabled = false; |
| 444 | - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); | |
| 445 | - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); | |
| 444 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); | |
| 445 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); | |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | |
| ... | ... | @@ -539,8 +539,6 @@ private: |
| 539 | 539 | |
| 540 | 540 | DeviceOrientation mOrientation; ///< Current Device orientation |
| 541 | 541 | Animation mRotateAnimation; ///< Animation for rotating between landscape and portrait. |
| 542 | - | |
| 543 | - Popup mInstructionsPopup; ///< Info Popup | |
| 544 | 542 | }; |
| 545 | 543 | |
| 546 | 544 | void RunTest(Application& app) | ... | ... |
examples/motion-stretch/motion-stretch-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | #include "shared/view.h" |
| 22 | 22 | #include <dali/dali.h> |
| 23 | 23 | #include <dali-toolkit/dali-toolkit.h> |
| 24 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 24 | 25 | #include <dali-toolkit/devel-api/shader-effects/motion-stretch-effect.h> |
| 25 | 26 | |
| 26 | 27 | using namespace Dali; |
| ... | ... | @@ -142,16 +143,16 @@ public: |
| 142 | 143 | |
| 143 | 144 | //Add an slideshow icon on the right of the title |
| 144 | 145 | mActorEffectsButton = Toolkit::PushButton::New(); |
| 145 | - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); | |
| 146 | - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); | |
| 146 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); | |
| 147 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); | |
| 147 | 148 | mActorEffectsButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnEffectButtonClicked ); |
| 148 | 149 | mToolBar.AddControl( mActorEffectsButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 149 | 150 | |
| 150 | 151 | // Creates a mode button. |
| 151 | 152 | // Create a effect toggle button. (right of toolbar) |
| 152 | 153 | Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); |
| 153 | - layoutButton.SetUnselectedImage( LAYOUT_IMAGE ); | |
| 154 | - layoutButton.SetSelectedImage( LAYOUT_IMAGE_SELECTED ); | |
| 154 | + layoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE ); | |
| 155 | + layoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE_SELECTED ); | |
| 155 | 156 | layoutButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnLayoutButtonClicked); |
| 156 | 157 | layoutButton.SetLeaveRequired( true ); |
| 157 | 158 | mToolBar.AddControl( layoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| ... | ... | @@ -333,14 +334,14 @@ public: |
| 333 | 334 | if(!mActorEffectsEnabled) |
| 334 | 335 | { |
| 335 | 336 | mActorEffectsEnabled = true; |
| 336 | - mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON ); | |
| 337 | - mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED ); | |
| 337 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON ); | |
| 338 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON_SELECTED ); | |
| 338 | 339 | } |
| 339 | 340 | else |
| 340 | 341 | { |
| 341 | 342 | mActorEffectsEnabled = false; |
| 342 | - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); | |
| 343 | - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); | |
| 343 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); | |
| 344 | + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); | |
| 344 | 345 | } |
| 345 | 346 | } |
| 346 | 347 | ... | ... |
examples/native-image-source/native-image-source-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -153,16 +153,16 @@ public: |
| 153 | 153 | stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent); |
| 154 | 154 | |
| 155 | 155 | mButtonRefreshAlways = PushButton::New(); |
| 156 | - mButtonRefreshAlways.SetTogglableButton( true ); | |
| 157 | - mButtonRefreshAlways.SetSelected( true ); | |
| 158 | - mButtonRefreshAlways.SetLabelText( "Refresh ALWAYS" ); | |
| 156 | + mButtonRefreshAlways.SetProperty( Button::Property::TOGGLABLE, true ); | |
| 157 | + mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, true ); | |
| 158 | + mButtonRefreshAlways.SetProperty( Toolkit::Button::Property::LABEL, "Refresh ALWAYS" ); | |
| 159 | 159 | mButtonRefreshAlways.SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 160 | 160 | mButtonRefreshAlways.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 161 | 161 | mButtonRefreshAlways.StateChangedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); |
| 162 | 162 | stage.Add( mButtonRefreshAlways ); |
| 163 | 163 | |
| 164 | 164 | mButtonRefreshOnce = PushButton::New(); |
| 165 | - mButtonRefreshOnce.SetLabelText( "Refresh ONCE" ); | |
| 165 | + mButtonRefreshOnce.SetProperty( Toolkit::Button::Property::LABEL, "Refresh ONCE" ); | |
| 166 | 166 | mButtonRefreshOnce.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| 167 | 167 | mButtonRefreshOnce.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); |
| 168 | 168 | mButtonRefreshOnce.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); |
| ... | ... | @@ -246,10 +246,12 @@ public: |
| 246 | 246 | |
| 247 | 247 | bool OnButtonSelected( Toolkit::Button button ) |
| 248 | 248 | { |
| 249 | + bool isSelected = mButtonRefreshAlways.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 250 | + | |
| 249 | 251 | Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); |
| 250 | 252 | if( pushButton == mButtonRefreshAlways ) |
| 251 | 253 | { |
| 252 | - if( mButtonRefreshAlways.IsSelected() ) | |
| 254 | + if( isSelected ) | |
| 253 | 255 | { |
| 254 | 256 | mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); |
| 255 | 257 | } |
| ... | ... | @@ -260,9 +262,9 @@ public: |
| 260 | 262 | } |
| 261 | 263 | else if( pushButton == mButtonRefreshOnce ) |
| 262 | 264 | { |
| 263 | - if( mButtonRefreshAlways.IsSelected() ) | |
| 265 | + if( isSelected ) | |
| 264 | 266 | { |
| 265 | - mButtonRefreshAlways.SetSelected( false ); | |
| 267 | + mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, false ); | |
| 266 | 268 | } |
| 267 | 269 | mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); |
| 268 | 270 | } | ... | ... |
examples/new-window/new-window-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | #include <dali/public-api/rendering/renderer.h> |
| 20 | 20 | #include <dali-toolkit/dali-toolkit.h> |
| 21 | 21 | #include <dali-toolkit/devel-api/controls/bubble-effect/bubble-emitter.h> |
| 22 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 22 | 23 | #include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h> |
| 23 | 24 | |
| 24 | 25 | #include <cstdio> |
| ... | ... | @@ -204,8 +205,8 @@ void NewWindowController::Create( Application& app ) |
| 204 | 205 | } |
| 205 | 206 | |
| 206 | 207 | mLoseContextButton = Toolkit::PushButton::New(); |
| 207 | - mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE ); | |
| 208 | - mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED ); | |
| 208 | + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE ); | |
| 209 | + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED ); | |
| 209 | 210 | mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked ); |
| 210 | 211 | mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 211 | 212 | ... | ... |
examples/page-turn-view/page-turn-view-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | |
| 18 | 18 | #include <dali/dali.h> |
| 19 | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 20 | 21 | #include <dali-toolkit/devel-api/controls/page-turn-view/page-factory.h> |
| 21 | 22 | #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-landscape-view.h> |
| 22 | 23 | #include <dali-toolkit/devel-api/controls/page-turn-view/page-turn-portrait-view.h> |
| ... | ... | @@ -256,8 +257,8 @@ void PageTurnController::OnInit( Application& app ) |
| 256 | 257 | Toolkit::PushButton button = Toolkit::PushButton::New(); |
| 257 | 258 | button.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); |
| 258 | 259 | button.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| 259 | - button.SetUnselectedImage( CHANGE_IMAGE_ICON ); | |
| 260 | - button.SetSelectedImage( CHANGE_IMAGE_ICON_SELECTED ); | |
| 260 | + button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON ); | |
| 261 | + button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON_SELECTED ); | |
| 261 | 262 | button.SetLeaveRequired( true ); |
| 262 | 263 | button.SetScale(1.5f); |
| 263 | 264 | button.PressedSignal().Connect( this, &PageTurnController::OnButtonClicked ); | ... | ... |
examples/popup/popup-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | #include "shared/view.h" |
| 19 | 19 | #include <dali/dali.h> |
| 20 | 20 | #include <dali-toolkit/dali-toolkit.h> |
| 21 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 21 | 22 | #include <dali-toolkit/devel-api/controls/popup/popup.h> |
| 22 | 23 | #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h> |
| 23 | 24 | |
| ... | ... | @@ -140,17 +141,17 @@ public: |
| 140 | 141 | |
| 141 | 142 | // Create animation button. |
| 142 | 143 | mAnimationButton = Toolkit::PushButton::New(); |
| 143 | - mAnimationButton.SetUnselectedImage( ANIMATION_FADE_ICON_IMAGE ); | |
| 144 | - mAnimationButton.SetSelectedImage( ANIMATION_ZOOM_ICON_IMAGE ); | |
| 145 | - mAnimationButton.SetTogglableButton( true ); | |
| 144 | + mAnimationButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, ANIMATION_FADE_ICON_IMAGE ); | |
| 145 | + mAnimationButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, ANIMATION_ZOOM_ICON_IMAGE ); | |
| 146 | + mAnimationButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); | |
| 146 | 147 | mAnimationButton.ClickedSignal().Connect( this, &PopupExample::OnAnimationClicked ); |
| 147 | 148 | mToolBar.AddControl( mAnimationButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 148 | 149 | |
| 149 | 150 | // Create context button. |
| 150 | 151 | mContextButton = Toolkit::PushButton::New(); |
| 151 | - mContextButton.SetUnselectedImage( CONTEXT_DISABLED_ICON_IMAGE ); | |
| 152 | - mContextButton.SetSelectedImage( CONTEXT_ENABLED_ICON_IMAGE ); | |
| 153 | - mContextButton.SetTogglableButton( true ); | |
| 152 | + mContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CONTEXT_DISABLED_ICON_IMAGE ); | |
| 153 | + mContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CONTEXT_ENABLED_ICON_IMAGE ); | |
| 154 | + mContextButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); | |
| 154 | 155 | mContextButton.ClickedSignal().Connect( this, &PopupExample::OnContextClicked ); |
| 155 | 156 | mToolBar.AddControl( mContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 156 | 157 | |
| ... | ... | @@ -176,13 +177,13 @@ public: |
| 176 | 177 | |
| 177 | 178 | bool OnContextClicked( Toolkit::Button button ) |
| 178 | 179 | { |
| 179 | - mContextual = button.IsSelected(); | |
| 180 | + mContextual = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>(); | |
| 180 | 181 | return true; |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | 184 | bool OnAnimationClicked( Toolkit::Button button ) |
| 184 | 185 | { |
| 185 | - mAnimationFade = !button.IsSelected(); | |
| 186 | + mAnimationFade = ! ( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ); | |
| 186 | 187 | return true; |
| 187 | 188 | } |
| 188 | 189 | |
| ... | ... | @@ -427,7 +428,7 @@ public: |
| 427 | 428 | { |
| 428 | 429 | Toolkit::PushButton okayButton = Toolkit::PushButton::New(); |
| 429 | 430 | okayButton.SetName( POPUP_CONTROL_OK_NAME ); |
| 430 | - okayButton.SetLabelText( "OK!" ); | |
| 431 | + okayButton.SetProperty( Toolkit::Button::Property::LABEL, "OK!" ); | |
| 431 | 432 | |
| 432 | 433 | okayButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked ); |
| 433 | 434 | |
| ... | ... | @@ -438,7 +439,7 @@ public: |
| 438 | 439 | { |
| 439 | 440 | Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); |
| 440 | 441 | cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME ); |
| 441 | - cancelButton.SetLabelText( "Cancel" ); | |
| 442 | + cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" ); | |
| 442 | 443 | |
| 443 | 444 | cancelButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked ); |
| 444 | 445 | |
| ... | ... | @@ -707,7 +708,7 @@ public: // From ItemFactory |
| 707 | 708 | { |
| 708 | 709 | Toolkit::PushButton popupButton = Toolkit::PushButton::New(); |
| 709 | 710 | popupButton.SetName( POPUP_BUTTON_ITEMS[ itemId ].name ); |
| 710 | - popupButton.SetLabelText( POPUP_BUTTON_ITEMS[ itemId ].text ); | |
| 711 | + popupButton.SetProperty( Toolkit::Button::Property::LABEL, POPUP_BUTTON_ITEMS[ itemId ].text ); | |
| 711 | 712 | popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 712 | 713 | |
| 713 | 714 | popupButton.ClickedSignal().Connect( this, &PopupExample::OnButtonClicked ); | ... | ... |
examples/primitive-shapes/primitive-shapes-example.cpp
| 1 | +/* | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | + * | |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | + * you may not use this file except in compliance with the License. | |
| 6 | + * You may obtain a copy of the License at | |
| 7 | + * | |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | + * | |
| 10 | + * Unless required by applicable law or agreed to in writing, software | |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | + * See the License for the specific language governing permissions and | |
| 14 | + * limitations under the License. | |
| 15 | + * | |
| 16 | + */ | |
| 17 | + | |
| 1 | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 2 | 19 | #include <dali/public-api/object/property-map.h> |
| 20 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 3 | 21 | #include <dali-toolkit/public-api/controls/slider/slider.h> |
| 4 | 22 | |
| 5 | 23 | using namespace Dali; |
| ... | ... | @@ -170,8 +188,8 @@ public: |
| 170 | 188 | button.SetAnchorPoint( AnchorPoint::CENTER ); |
| 171 | 189 | button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 172 | 190 | button.SetPadding( Padding( elementPadding, elementPadding, elementPadding, elementPadding ) ); |
| 173 | - button.SetProperty( Button::Property::UNSELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) ); | |
| 174 | - button.SetProperty( Button::Property::SELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) ); | |
| 191 | + button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] ); | |
| 192 | + button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] ); | |
| 175 | 193 | button.RegisterProperty( "modelNumber", Property::Value( modelNumber ) ); |
| 176 | 194 | button.ClickedSignal().Connect( this, &PrimitiveShapesController::OnChangeShapeClicked ); |
| 177 | 195 | ... | ... |
examples/progress-bar/progress-bar-example.cpp
| ... | ... | @@ -143,7 +143,7 @@ private: |
| 143 | 143 | contentTable.Add( buttonBackground ); |
| 144 | 144 | |
| 145 | 145 | mResetProgressButton = Toolkit::PushButton::New(); |
| 146 | - mResetProgressButton.SetLabelText( "Reset" ); | |
| 146 | + mResetProgressButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" ); | |
| 147 | 147 | mResetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 148 | 148 | mResetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); |
| 149 | 149 | mResetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnResetProgressButtonSelected ); | ... | ... |
examples/refraction-effect/refraction-effect-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | #include <dali/dali.h> |
| 20 | 20 | #include <dali/public-api/rendering/renderer.h> |
| 21 | 21 | #include <dali-toolkit/dali-toolkit.h> |
| 22 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 22 | 23 | |
| 23 | 24 | #include <fstream> |
| 24 | 25 | #include <sstream> |
| ... | ... | @@ -260,8 +261,8 @@ private: |
| 260 | 261 | |
| 261 | 262 | // Add a button to change background. (right of toolbar) |
| 262 | 263 | mChangeTextureButton = Toolkit::PushButton::New(); |
| 263 | - mChangeTextureButton.SetUnselectedImage( CHANGE_TEXTURE_ICON ); | |
| 264 | - mChangeTextureButton.SetSelectedImage( CHANGE_TEXTURE_ICON_SELECTED ); | |
| 264 | + mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON ); | |
| 265 | + mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON_SELECTED ); | |
| 265 | 266 | mChangeTextureButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeTexture ); |
| 266 | 267 | toolBar.AddControl( mChangeTextureButton, |
| 267 | 268 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, |
| ... | ... | @@ -269,8 +270,8 @@ private: |
| 269 | 270 | DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 270 | 271 | // Add a button to change mesh pattern. ( left of bar ) |
| 271 | 272 | mChangeMeshButton = Toolkit::PushButton::New(); |
| 272 | - mChangeMeshButton.SetUnselectedImage( CHANGE_MESH_ICON ); | |
| 273 | - mChangeMeshButton.SetSelectedImage( CHANGE_MESH_ICON_SELECTED ); | |
| 273 | + mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON ); | |
| 274 | + mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON_SELECTED ); | |
| 274 | 275 | mChangeMeshButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeMesh ); |
| 275 | 276 | toolBar.AddControl( mChangeMeshButton, |
| 276 | 277 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, | ... | ... |
examples/scroll-view/scroll-view-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | #include "shared/view.h" |
| 23 | 23 | #include <dali/dali.h> |
| 24 | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 25 | 26 | |
| 26 | 27 | using namespace Dali; |
| 27 | 28 | using namespace Dali::Toolkit; |
| ... | ... | @@ -33,6 +34,12 @@ const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); |
| 33 | 34 | const char * const APPLICATION_TITLE( "ScrollView" ); |
| 34 | 35 | const char * const EFFECT_CAROUSEL_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-carousel.png" ); |
| 35 | 36 | const char * const EFFECT_CAROUSEL_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-carousel-selected.png" ); |
| 37 | +const char * const EFFECT_CUBE_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-inner-cube.png" ); | |
| 38 | +const char * const EFFECT_CUBE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-inner-cube-selected.png" ); | |
| 39 | +const char * const EFFECT_SPIRAL_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-spiral.png" ); | |
| 40 | +const char * const EFFECT_SPIRAL_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-spiral-selected.png" ); | |
| 41 | +const char * const EFFECT_WAVE_IMAGE( DEMO_IMAGE_DIR "icon-effect-wave.png" ); | |
| 42 | +const char * const EFFECT_WAVE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-wave-selected.png" ); | |
| 36 | 43 | |
| 37 | 44 | const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f); |
| 38 | 45 | |
| ... | ... | @@ -175,12 +182,12 @@ public: |
| 175 | 182 | |
| 176 | 183 | mEffectIcon[ PageCarouselEffect ] = EFFECT_CAROUSEL_IMAGE; |
| 177 | 184 | mEffectIconSelected[ PageCarouselEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; |
| 178 | - mEffectIcon[ PageCubeEffect ] = EFFECT_CAROUSEL_IMAGE; | |
| 179 | - mEffectIconSelected[ PageCubeEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; | |
| 180 | - mEffectIcon[ PageSpiralEffect ] = EFFECT_CAROUSEL_IMAGE; | |
| 181 | - mEffectIconSelected[ PageSpiralEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; | |
| 182 | - mEffectIcon[ PageWaveEffect ] = EFFECT_CAROUSEL_IMAGE; | |
| 183 | - mEffectIconSelected[ PageWaveEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; | |
| 185 | + mEffectIcon[ PageCubeEffect ] = EFFECT_CUBE_IMAGE; | |
| 186 | + mEffectIconSelected[ PageCubeEffect ] = EFFECT_CUBE_IMAGE_SELECTED; | |
| 187 | + mEffectIcon[ PageSpiralEffect ] = EFFECT_SPIRAL_IMAGE; | |
| 188 | + mEffectIconSelected[ PageSpiralEffect ] = EFFECT_SPIRAL_IMAGE_SELECTED; | |
| 189 | + mEffectIcon[ PageWaveEffect ] = EFFECT_WAVE_IMAGE; | |
| 190 | + mEffectIconSelected[ PageWaveEffect ] = EFFECT_WAVE_IMAGE_SELECTED; | |
| 184 | 191 | |
| 185 | 192 | // Create a effect change button. (right of toolbar) |
| 186 | 193 | mEffectChangeButton = Toolkit::PushButton::New(); |
| ... | ... | @@ -244,8 +251,8 @@ private: |
| 244 | 251 | ss << APPLICATION_TITLE << ": " << EFFECT_MODE_NAME[mEffectMode]; |
| 245 | 252 | SetTitle(ss.str()); |
| 246 | 253 | |
| 247 | - mEffectChangeButton.SetUnselectedImage( mEffectIcon[ mEffectMode ] ); | |
| 248 | - mEffectChangeButton.SetSelectedImage( mEffectIconSelected[ mEffectMode ] ); | |
| 254 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, mEffectIcon[ mEffectMode ] ); | |
| 255 | + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, mEffectIconSelected[ mEffectMode ] ); | |
| 249 | 256 | |
| 250 | 257 | // remove old Effect if exists. |
| 251 | 258 | if(mScrollViewEffect) | ... | ... |
examples/shadows-and-lights/shadows-and-lights-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | #include <dali/dali.h> |
| 22 | 22 | #include <dali-toolkit/dali-toolkit.h> |
| 23 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 23 | 24 | #include <dali-toolkit/devel-api/controls/shadow-view/shadow-view.h> |
| 24 | 25 | |
| 25 | 26 | #include <iostream> |
| ... | ... | @@ -166,8 +167,8 @@ public: |
| 166 | 167 | |
| 167 | 168 | // Add an effect-changing button on the right of the tool bar. |
| 168 | 169 | Toolkit::PushButton effectChangeButton = Toolkit::PushButton::New(); |
| 169 | - effectChangeButton.SetUnselectedImage( CHANGE_EFFECT_IMAGE ); | |
| 170 | - effectChangeButton.SetSelectedImage( CHANGE_EFFECT_IMAGE_SELECTED ); | |
| 170 | + effectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_EFFECT_IMAGE ); | |
| 171 | + effectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_EFFECT_IMAGE_SELECTED ); | |
| 171 | 172 | effectChangeButton.ClickedSignal().Connect( this, &TestApp::OnEffectButtonClicked ); |
| 172 | 173 | toolBar.AddControl( effectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); |
| 173 | 174 | |
| ... | ... | @@ -180,8 +181,8 @@ public: |
| 180 | 181 | |
| 181 | 182 | //Add a reset button |
| 182 | 183 | Toolkit::PushButton resetButton = Toolkit::PushButton::New(); |
| 183 | - resetButton.SetUnselectedImage( RESET_ICON ); | |
| 184 | - resetButton.SetSelectedImage( RESET_ICON_SELECTED ); | |
| 184 | + resetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_ICON ); | |
| 185 | + resetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_ICON_SELECTED ); | |
| 185 | 186 | resetButton.ClickedSignal().Connect( this, &TestApp::OnResetPressed ); |
| 186 | 187 | toolBar.AddControl( resetButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 187 | 188 | ... | ... |
examples/size-negotiation/size-negotiation-example.cpp
| ... | ... | @@ -800,7 +800,7 @@ public: // From ItemFactory |
| 800 | 800 | { |
| 801 | 801 | Toolkit::PushButton popupButton = Toolkit::PushButton::New(); |
| 802 | 802 | popupButton.SetName( TABLEVIEW_BUTTON_ITEMS[ itemId ].name ); |
| 803 | - popupButton.SetLabelText( TABLEVIEW_BUTTON_ITEMS[ itemId ].text ); | |
| 803 | + popupButton.SetProperty( Toolkit::Button::Property::LABEL, TABLEVIEW_BUTTON_ITEMS[ itemId ].text ); | |
| 804 | 804 | popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 805 | 805 | |
| 806 | 806 | popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); | ... | ... |
examples/styling/styling-application.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -188,7 +188,7 @@ void StylingApplication::Create( Application& application ) |
| 188 | 188 | mRadioButtons[i].SetName( radioButtonStyleName.str() ); |
| 189 | 189 | mRadioButtons[i].SetParentOrigin( ParentOrigin::TOP_LEFT ); |
| 190 | 190 | mRadioButtons[i].SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 191 | - mRadioButtons[i].SetSelected( false ); | |
| 191 | + mRadioButtons[i].SetProperty( Button::Property::SELECTED, false ); | |
| 192 | 192 | mRadioButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnButtonStateChange ); |
| 193 | 193 | |
| 194 | 194 | radioButtonsLayout.AddChild( mRadioButtons[i], TableView::CellPosition( i, 0 ) ); |
| ... | ... | @@ -197,7 +197,7 @@ void StylingApplication::Create( Application& application ) |
| 197 | 197 | radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - mRadioButtons[0].SetSelected( true ); | |
| 200 | + mRadioButtons[0].SetProperty( Button::Property::SELECTED, true ); | |
| 201 | 201 | |
| 202 | 202 | mImagePlacement = Actor::New(); |
| 203 | 203 | mImagePlacement.SetParentOrigin( ParentOrigin::CENTER ); |
| ... | ... | @@ -265,7 +265,7 @@ void StylingApplication::Create( Application& application ) |
| 265 | 265 | mCheckButtons[i].SetName( checkBoxStyleName.str() ); |
| 266 | 266 | mCheckButtons[i].SetParentOrigin( ParentOrigin::CENTER ); |
| 267 | 267 | mCheckButtons[i].SetAnchorPoint( AnchorPoint::CENTER ); |
| 268 | - mCheckButtons[i].SetSelected( true ); | |
| 268 | + mCheckButtons[i].SetProperty( Button::Property::SELECTED, true ); | |
| 269 | 269 | |
| 270 | 270 | mCheckButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnCheckButtonChange ); |
| 271 | 271 | mCheckButtons[i].RegisterProperty( "channel", i, Property::READ_WRITE ); |
| ... | ... | @@ -309,7 +309,7 @@ void StylingApplication::Create( Application& application ) |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | mResetButton = PushButton::New(); |
| 312 | - mResetButton.SetLabelText( "Reset" ); | |
| 312 | + mResetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" ); | |
| 313 | 313 | mResetButton.SetName("ResetButton"); |
| 314 | 314 | mResetButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); |
| 315 | 315 | mResetButton.ClickedSignal().Connect( this, &StylingApplication::OnResetClicked ); |
| ... | ... | @@ -349,9 +349,9 @@ void StylingApplication::Create( Application& application ) |
| 349 | 349 | mThemeButtons[i].ClickedSignal().Connect( this, &StylingApplication::OnThemeButtonClicked ); |
| 350 | 350 | themeButtonLayout.AddChild( mThemeButtons[i], TableView::CellPosition( 0, 1+i ) ); |
| 351 | 351 | } |
| 352 | - mThemeButtons[0].SetLabelText( "Lite" ); // Lightweight changes on top of Dali | |
| 353 | - mThemeButtons[1].SetLabelText( "App1" ); // Different application style | |
| 354 | - mThemeButtons[2].SetLabelText( "App2" ); | |
| 352 | + mThemeButtons[0].SetProperty( Toolkit::Button::Property::LABEL, "Lite" ); // Lightweight changes on top of Dali | |
| 353 | + mThemeButtons[1].SetProperty( Toolkit::Button::Property::LABEL, "App1" ); // Different application style | |
| 354 | + mThemeButtons[2].SetProperty( Toolkit::Button::Property::LABEL, "App2" ); | |
| 355 | 355 | |
| 356 | 356 | contentLayout.Add( themeButtonLayout ); |
| 357 | 357 | } |
| ... | ... | @@ -438,7 +438,7 @@ Popup StylingApplication::CreateResetPopup() |
| 438 | 438 | PushButton okayButton = PushButton::New(); |
| 439 | 439 | okayButton.SetName( POPUP_CONTROL_OK_NAME ); |
| 440 | 440 | okayButton.SetStyleName( POPUP_CONTROL_OK_NAME ); |
| 441 | - okayButton.SetLabelText( "Ok!" ); | |
| 441 | + okayButton.SetProperty( Toolkit::Button::Property::LABEL, "Ok!" ); | |
| 442 | 442 | okayButton.ClickedSignal().Connect( this, &StylingApplication::OnReset ); |
| 443 | 443 | okayButton.SetParentOrigin( ParentOrigin::CENTER ); |
| 444 | 444 | okayButton.SetAnchorPoint( AnchorPoint::CENTER ); |
| ... | ... | @@ -448,7 +448,7 @@ Popup StylingApplication::CreateResetPopup() |
| 448 | 448 | PushButton cancelButton = PushButton::New(); |
| 449 | 449 | cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME ); |
| 450 | 450 | cancelButton.SetStyleName( POPUP_CONTROL_CANCEL_NAME ); |
| 451 | - cancelButton.SetLabelText( "Cancel" ); | |
| 451 | + cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" ); | |
| 452 | 452 | cancelButton.ClickedSignal().Connect( this, &StylingApplication::OnResetCancelled ); |
| 453 | 453 | cancelButton.SetParentOrigin( ParentOrigin::CENTER ); |
| 454 | 454 | cancelButton.SetAnchorPoint( AnchorPoint::CENTER ); |
| ... | ... | @@ -484,20 +484,20 @@ bool StylingApplication::OnButtonStateChange( Button button ) |
| 484 | 484 | |
| 485 | 485 | // Todo: save / restore slider states per image |
| 486 | 486 | |
| 487 | - if( button.IsSelected() ) | |
| 487 | + if( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 488 | 488 | { |
| 489 | 489 | |
| 490 | 490 | ImageChannelControl prevIcc = mImageChannelControl; |
| 491 | 491 | |
| 492 | - if( mRadioButtons[0].IsSelected() ) | |
| 492 | + if( mRadioButtons[0].GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 493 | 493 | { |
| 494 | 494 | mImageChannelControl = mIcc1; |
| 495 | 495 | } |
| 496 | - else if( mRadioButtons[1].IsSelected() ) | |
| 496 | + else if( mRadioButtons[1].GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 497 | 497 | { |
| 498 | 498 | mImageChannelControl = mIcc2; |
| 499 | 499 | } |
| 500 | - else if( mRadioButtons[2].IsSelected() ) | |
| 500 | + else if( mRadioButtons[2].GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>() ) | |
| 501 | 501 | { |
| 502 | 502 | mImageChannelControl = mIcc3; |
| 503 | 503 | } | ... | ... |
examples/super-blur-bloom/super-blur-bloom-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -16,8 +16,9 @@ |
| 16 | 16 | */ |
| 17 | 17 | #include <dali/dali.h> |
| 18 | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | -#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h> | |
| 20 | 19 | #include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h> |
| 20 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 21 | +#include <dali-toolkit/devel-api/controls/super-blur-view/super-blur-view.h> | |
| 21 | 22 | #include "shared/view.h" |
| 22 | 23 | #include "shared/utility.h" |
| 23 | 24 | |
| ... | ... | @@ -81,8 +82,9 @@ private: |
| 81 | 82 | |
| 82 | 83 | // Add a button to change background. (right of toolbar) |
| 83 | 84 | Toolkit::PushButton changeBackgroundButton = Toolkit::PushButton::New(); |
| 84 | - changeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON ); | |
| 85 | - changeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED ); | |
| 85 | + changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON ); | |
| 86 | + changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED ); | |
| 87 | + | |
| 86 | 88 | changeBackgroundButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBackgroundIconClicked ); |
| 87 | 89 | mToolBar.AddControl( changeBackgroundButton, |
| 88 | 90 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, |
| ... | ... | @@ -91,8 +93,9 @@ private: |
| 91 | 93 | |
| 92 | 94 | // Add a button to change the blur view. (left of toolbar) |
| 93 | 95 | Toolkit::PushButton changeBlurButton = Toolkit::PushButton::New(); |
| 94 | - changeBlurButton.SetUnselectedImage( CHANGE_BLUR_ICON ); | |
| 95 | - changeBlurButton.SetSelectedImage( CHANGE_BLUR_ICON_SELECTED ); | |
| 96 | + changeBlurButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON ); | |
| 97 | + changeBlurButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON_SELECTED ); | |
| 98 | + | |
| 96 | 99 | changeBlurButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBlurIconClicked ); |
| 97 | 100 | mToolBar.AddControl( changeBlurButton, |
| 98 | 101 | DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, | ... | ... |
examples/text-editor/text-editor-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | |
| 23 | 23 | // EXTERNAL INCLUDES |
| 24 | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | -#include <iostream> | |
| 25 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 26 | 26 | #include <sstream> |
| 27 | 27 | |
| 28 | 28 | // INTERNAL INCLUDES |
| ... | ... | @@ -140,8 +140,7 @@ public: |
| 140 | 140 | mColorButtonOption.SetParentOrigin( ParentOrigin::CENTER ); |
| 141 | 141 | mColorButtonOption.SetAnchorPoint( AnchorPoint::CENTER ); |
| 142 | 142 | |
| 143 | - mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, Color::BLACK ); | |
| 144 | - mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, Color::BLACK ); | |
| 143 | + SetButtonColor( mColorButtonOption, Color::BLACK ); | |
| 145 | 144 | |
| 146 | 145 | mColorButtonOption.ClickedSignal().Connect( this, &TextEditorExample::OnChangeColorButtonClicked ); |
| 147 | 146 | mColorContainer.Add( mColorButtonOption ); |
| ... | ... | @@ -208,8 +207,7 @@ public: |
| 208 | 207 | s << "color" << index; |
| 209 | 208 | button.SetName( s.str() ); |
| 210 | 209 | |
| 211 | - button.SetProperty( Button::Property::UNSELECTED_COLOR, COLORS[index] ); | |
| 212 | - button.SetProperty( Button::Property::SELECTED_COLOR, COLORS[index] ); | |
| 210 | + SetButtonColor( button, COLORS[index] ); | |
| 213 | 211 | |
| 214 | 212 | button.ClickedSignal().Connect( this, &TextEditorExample::OnColorButtonClicked ); |
| 215 | 213 | |
| ... | ... | @@ -253,8 +251,7 @@ public: |
| 253 | 251 | mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color ); |
| 254 | 252 | } |
| 255 | 253 | |
| 256 | - mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); | |
| 257 | - mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); | |
| 254 | + SetButtonColor( mColorButtonOption, color ); | |
| 258 | 255 | |
| 259 | 256 | mButtonContainer.SetVisible( false ); |
| 260 | 257 | mButtonContainer.SetSensitive( false ); |
| ... | ... | @@ -267,14 +264,22 @@ public: |
| 267 | 264 | if( TextEditor::InputStyle::NONE != static_cast<TextEditor::InputStyle::Mask>( mask & TextEditor::InputStyle::COLOR ) ) |
| 268 | 265 | { |
| 269 | 266 | const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get<Vector4>(); |
| 270 | - | |
| 271 | - mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); | |
| 272 | - mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); | |
| 267 | + SetButtonColor( mColorButtonOption, color ); | |
| 273 | 268 | } |
| 274 | 269 | |
| 275 | 270 | editor.Reset(); |
| 276 | 271 | } |
| 277 | 272 | |
| 273 | + void SetButtonColor( Button& button, const Vector4& color ) | |
| 274 | + { | |
| 275 | + Property::Map colorVisualMap; | |
| 276 | + colorVisualMap.Add( Visual::Property::TYPE, Visual::COLOR ) | |
| 277 | + .Add( ColorVisual::Property::MIX_COLOR, color ); | |
| 278 | + | |
| 279 | + button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, colorVisualMap ); | |
| 280 | + button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, colorVisualMap ); | |
| 281 | + } | |
| 282 | + | |
| 278 | 283 | private: |
| 279 | 284 | |
| 280 | 285 | Application& mApplication; | ... | ... |
examples/text-field/text-field-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2015 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -22,6 +22,7 @@ |
| 22 | 22 | |
| 23 | 23 | // EXTERNAL INCLUDES |
| 24 | 24 | #include <dali-toolkit/dali-toolkit.h> |
| 25 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 25 | 26 | #include <dali-toolkit/devel-api/controls/popup/popup.h> |
| 26 | 27 | #include <iostream> |
| 27 | 28 | #include <dali/public-api/events/touch-point.h> |
| ... | ... | @@ -86,8 +87,8 @@ public: |
| 86 | 87 | PushButton CreateFolderButton() |
| 87 | 88 | { |
| 88 | 89 | PushButton button = PushButton::New(); |
| 89 | - button.SetUnselectedImage( FOLDER_ICON_IMAGE ); | |
| 90 | - button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE ); | |
| 90 | + button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); | |
| 91 | + button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); | |
| 91 | 92 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 92 | 93 | button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); |
| 93 | 94 | ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); |
| ... | ... | @@ -151,7 +152,7 @@ public: |
| 151 | 152 | { |
| 152 | 153 | Property::Value text = mField.GetProperty( TextField::Property::TEXT ); |
| 153 | 154 | mButtonLabel = text.Get< std::string >(); |
| 154 | - mButton.SetLabelText( mButtonLabel ); | |
| 155 | + mButton.SetProperty( Toolkit::Button::Property::LABEL, mButtonLabel ); | |
| 155 | 156 | } |
| 156 | 157 | |
| 157 | 158 | // Hide & discard the pop-up |
| ... | ... | @@ -176,7 +177,7 @@ public: |
| 176 | 177 | { |
| 177 | 178 | Property::Value text = mField.GetProperty( TextField::Property::TEXT ); |
| 178 | 179 | mButtonLabel = text.Get< std::string >(); |
| 179 | - mButton.SetLabelText( mButtonLabel ); | |
| 180 | + mButton.SetProperty( Toolkit::Button::Property::LABEL, mButtonLabel ); | |
| 180 | 181 | mField.ClearKeyInputFocus(); |
| 181 | 182 | } |
| 182 | 183 | break; | ... | ... |
examples/transitions/transition-application.cpp
| ... | ... | @@ -125,9 +125,9 @@ void TransitionApplication::Create( Application& application ) |
| 125 | 125 | mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked ); |
| 126 | 126 | actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) ); |
| 127 | 127 | } |
| 128 | - mActionButtons[0].SetLabelText( "Bounce" ); | |
| 129 | - mActionButtons[1].SetLabelText( "X" ); | |
| 130 | - mActionButtons[2].SetLabelText( "Y" ); | |
| 128 | + mActionButtons[0].SetProperty( Toolkit::Button::Property::LABEL, "Bounce" ); | |
| 129 | + mActionButtons[1].SetProperty( Toolkit::Button::Property::LABEL, "X" ); | |
| 130 | + mActionButtons[2].SetProperty( Toolkit::Button::Property::LABEL, "Y" ); | |
| 131 | 131 | |
| 132 | 132 | contentLayout.Add( actionButtonLayout ); |
| 133 | 133 | contentLayout.SetFitHeight(2); | ... | ... |
examples/video-view/video-view-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | |
| 18 | 18 | #include <dali/dali.h> |
| 19 | 19 | #include <dali-toolkit/dali-toolkit.h> |
| 20 | +#include <dali-toolkit/devel-api/controls/buttons/button-devel.h> | |
| 20 | 21 | |
| 21 | 22 | using namespace Dali; |
| 22 | 23 | using namespace Toolkit; |
| ... | ... | @@ -150,20 +151,20 @@ class VideoViewController: public ConnectionTracker |
| 150 | 151 | mResetButton.SetVisible( false ); |
| 151 | 152 | mResetButton.SetDisabled( true ); |
| 152 | 153 | |
| 153 | - mPlayButton.SetUnselectedImage( PLAY_IMAGE ); | |
| 154 | - mPlayButton.SetSelectedImage( PLAY_IMAGE ); | |
| 155 | - mPauseButton.SetUnselectedImage( PAUSE_IMAGE ); | |
| 156 | - mPauseButton.SetSelectedImage( PAUSE_IMAGE ); | |
| 154 | + mPlayButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_IMAGE ); | |
| 155 | + mPlayButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_IMAGE ); | |
| 156 | + mPauseButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE ); | |
| 157 | + mPauseButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE ); | |
| 157 | 158 | |
| 158 | - mStopButton.SetUnselectedImage( STOP_IMAGE ); | |
| 159 | - mStopButton.SetSelectedImage( STOP_IMAGE ); | |
| 160 | - mResetButton.SetUnselectedImage( RESET_IMAGE ); | |
| 161 | - mResetButton.SetSelectedImage( RESET_IMAGE ); | |
| 159 | + mStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_IMAGE ); | |
| 160 | + mStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_IMAGE ); | |
| 161 | + mResetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_IMAGE ); | |
| 162 | + mResetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_IMAGE ); | |
| 162 | 163 | |
| 163 | - mBackwardButton.SetUnselectedImage( BACKWARD_IMAGE ); | |
| 164 | - mBackwardButton.SetSelectedImage( BACKWARD_IMAGE ); | |
| 165 | - mForwardButton.SetUnselectedImage( FORWARD_IMAGE ); | |
| 166 | - mForwardButton.SetSelectedImage( FORWARD_IMAGE ); | |
| 164 | + mBackwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE ); | |
| 165 | + mBackwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE ); | |
| 166 | + mForwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FORWARD_IMAGE ); | |
| 167 | + mForwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FORWARD_IMAGE ); | |
| 167 | 168 | |
| 168 | 169 | mPanGestureDetector = PanGestureDetector::New(); |
| 169 | 170 | mPanGestureDetector.Attach( mVideoView ); | ... | ... |
packaging/com.samsung.dali-demo.spec
resources/images/shape-bubble.png
0 → 100644
5.81 KB
resources/images/shape-circle.png
0 → 100644
3.54 KB
resources/po/as.po
resources/po/de.po
resources/po/en_GB.po
resources/po/en_US.po
resources/po/es.po
resources/po/fi.po
resources/po/ko.po
| 1 | 1 | msgid "DALI_DEMO_STR_TITLE_ANIMATED_IMAGES" |
| 2 | 2 | msgstr "애니메이션 이미지" |
| 3 | 3 | |
| 4 | - | |
| 5 | 4 | msgid "DALI_DEMO_STR_TITLE_ANIMATED_SHAPES" |
| 6 | 5 | msgstr "애니메이션 모양" |
| 7 | 6 | |
| ... | ... | @@ -14,6 +13,9 @@ msgstr "방울" |
| 14 | 13 | msgid "DALI_DEMO_STR_TITLE_BUTTONS" |
| 15 | 14 | msgstr "버튼" |
| 16 | 15 | |
| 16 | +msgid "DALI_DEMO_STR_TITLE_CLIPPING" | |
| 17 | +msgstr "깎는" | |
| 18 | + | |
| 17 | 19 | msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" |
| 18 | 20 | msgstr "색상 그라디언트" |
| 19 | 21 | ... | ... |
resources/po/ml.po
resources/po/ur.po
resources/po/zn_CH.po
shared/dali-demo-strings.h
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2016 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2017 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -37,6 +37,7 @@ extern "C" |
| 37 | 37 | #define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") |
| 38 | 38 | #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") |
| 39 | 39 | #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") |
| 40 | +#define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING") | |
| 40 | 41 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") |
| 41 | 42 | #define DALI_DEMO_STR_TITLE_CONTACT_CARDS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS") |
| 42 | 43 | #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION") |
| ... | ... | @@ -93,6 +94,7 @@ extern "C" |
| 93 | 94 | #define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" |
| 94 | 95 | #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" |
| 95 | 96 | #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" |
| 97 | +#define DALI_DEMO_STR_TITLE_CLIPPING "Clipping" | |
| 96 | 98 | #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" |
| 97 | 99 | #define DALI_DEMO_STR_TITLE_CONTACT_CARDS "Contact Cards" |
| 98 | 100 | #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect" | ... | ... |