diff --git a/build/tizen/CMakeLists.txt b/build/tizen/CMakeLists.txt index 9f51652..66b1dc3 100644 --- a/build/tizen/CMakeLists.txt +++ b/build/tizen/CMakeLists.txt @@ -169,7 +169,7 @@ ENDIF(INTERNATIONALIZATION) ########################################################################### SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${REQUIRED_CFLAGS} ${DALI_DEMO_CFLAGS} -Werror -Wall -fPIE") -SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") INCLUDE_DIRECTORIES(${ROOT_SRC_DIR}) #INCLUDE_DIRECTORIES(${DEMO_SRC_DIR}) diff --git a/build/tizen/builder/CMakeLists.txt b/build/tizen/builder/CMakeLists.txt index d7d72e9..5cbdfa6 100644 --- a/build/tizen/builder/CMakeLists.txt +++ b/build/tizen/builder/CMakeLists.txt @@ -1,6 +1,7 @@ SET(BUILDER_SRC_DIR ${ROOT_SRC_DIR}/builder) SET(DALI_BUILDER_SRCS ${BUILDER_SRC_DIR}/dali-builder.cpp) +SET(DALI_BUILDER_SRCS ${DALI_BUILDER_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") ADD_EXECUTABLE(dali-builder ${DALI_BUILDER_SRCS}) TARGET_LINK_LIBRARIES(dali-builder ${REQUIRED_PKGS_LDFLAGS}) INSTALL(TARGETS dali-builder DESTINATION ${BINDIR}) diff --git a/build/tizen/demo/CMakeLists.txt b/build/tizen/demo/CMakeLists.txt index 6aaf032..205f3a1 100644 --- a/build/tizen/demo/CMakeLists.txt +++ b/build/tizen/demo/CMakeLists.txt @@ -2,11 +2,7 @@ SET(DEMO_SRC_DIR ${ROOT_SRC_DIR}/demo) AUX_SOURCE_DIRECTORY(${DEMO_SRC_DIR} DEMO_SRCS) - -IF(NOT DEFINED DALI_APP_RES_DIR) - message([STATUS] "Setting application resource path from resource-location file") - SET( DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") -ENDIF() +SET(DEMO_SRCS ${DEMO_SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") ADD_EXECUTABLE(${PROJECT_NAME} ${DEMO_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${REQUIRED_PKGS_LDFLAGS} -pie) diff --git a/build/tizen/examples/CMakeLists.txt b/build/tizen/examples/CMakeLists.txt index d83f427..ee0d04f 100644 --- a/build/tizen/examples/CMakeLists.txt +++ b/build/tizen/examples/CMakeLists.txt @@ -15,10 +15,7 @@ SUBDIRLIST(SUBDIRS ${EXAMPLES_SRC_DIR}) FOREACH(EXAMPLE ${SUBDIRS}) FILE(GLOB SRCS "${EXAMPLES_SRC_DIR}/${EXAMPLE}/*.cpp") - IF(NOT DEFINED DALI_APP_RES_DIR) - SET( SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") - - ENDIF() + SET(SRCS ${SRCS} "${ROOT_SRC_DIR}/shared/resources-location.cpp") ADD_EXECUTABLE(${EXAMPLE}.example ${SRCS}) TARGET_LINK_LIBRARIES(${EXAMPLE}.example ${REQUIRED_PKGS_LDFLAGS} -pie) INSTALL(TARGETS ${EXAMPLE}.example DESTINATION ${BINDIR}) diff --git a/build/tizen/resources-location.in b/build/tizen/resources-location.in index 89b0b87..6474abb 100644 --- a/build/tizen/resources-location.in +++ b/build/tizen/resources-location.in @@ -1,6 +1,6 @@ /** - * This file defines the location dali-demo resources - It is used exclusively for Ubuntu builds where an application resource directory is explicity defined. + * This file defines the location dali-demo resources. + * It is used for builds where an application resource directory is NOT explicity defined. */ #include diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 046061d..4b3c4d0 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -184,4 +184,7 @@ + + + diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 904e3be..60c8501 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * 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) demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND)); demo.AddExample(Example("fpp-game.example", DALI_DEMO_STR_TITLE_FPP_GAME)); demo.AddExample(Example("tooltip.example", DALI_DEMO_STR_TITLE_TOOLTIP)); + demo.AddExample(Example("clipping.example", DALI_DEMO_STR_TITLE_CLIPPING)); demo.SortAlphabetically( true ); diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 09a0343..799304e 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,6 +82,13 @@ const Vector4 BUBBLE_COLOR[] = }; const int NUMBER_OF_BUBBLE_COLOR( sizeof(BUBBLE_COLOR) / sizeof(BUBBLE_COLOR[0]) ); +const char * const SHAPE_IMAGE_TABLE[] = +{ + DEMO_IMAGE_DIR "shape-circle.png", + DEMO_IMAGE_DIR "shape-bubble.png" +}; +const int NUMBER_OF_SHAPE_IMAGES( sizeof( SHAPE_IMAGE_TABLE ) / sizeof( SHAPE_IMAGE_TABLE[0] ) ); + const int NUM_BACKGROUND_IMAGES = 18; const float BACKGROUND_SWIPE_SCALE = 0.025f; const float BACKGROUND_SPREAD_SCALE = 1.5f; @@ -732,16 +739,9 @@ void DaliTableView::OnKeyEvent( const KeyEvent& event ) void DaliTableView::SetupBackground( Actor bubbleContainer ) { - // Create distance field shapes. - BufferImage distanceFields[2]; - Size imageSize( 512, 512 ); - - CreateShapeImage( CIRCLE, imageSize, distanceFields[0] ); - CreateShapeImage( BUBBLE, imageSize, distanceFields[1] ); - // Add bubbles to the bubbleContainer. // Note: The bubbleContainer is parented externally to this function. - AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES, distanceFields ); + AddBackgroundActors( bubbleContainer, NUM_BACKGROUND_IMAGES ); } void DaliTableView::InitialiseBackgroundActors( Actor actor ) @@ -780,13 +780,13 @@ void DaliTableView::InitialiseBackgroundActors( Actor actor ) } } -void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* distanceField ) +void DaliTableView::AddBackgroundActors( Actor layer, int count ) { for( int i = 0; i < count; ++i ) { float randSize = Random::Range( 10.0f, 400.0f ); - int distanceFieldType = static_cast( Random::Range( 0.0f, 1.0f ) + 0.5f ); - ImageView dfActor = ImageView::New( distanceField[ distanceFieldType ] ); + int shapeType = static_cast( Random::Range( 0.0f, NUMBER_OF_SHAPE_IMAGES - 1 ) + 0.5f ); + ImageView dfActor = ImageView::New( SHAPE_IMAGE_TABLE[ shapeType ] ); dfActor.SetSize( Vector2( randSize, randSize ) ); dfActor.SetParentOrigin( ParentOrigin::CENTER ); @@ -801,57 +801,6 @@ void DaliTableView::AddBackgroundActors( Actor layer, int count, BufferImage* di layer.OnRelayoutSignal().Connect( this, &DaliTableView::InitialiseBackgroundActors ); } -void DaliTableView::CreateShapeImage( ShapeType shapeType, const Size& size, BufferImage& distanceFieldOut ) -{ - // this bitmap will hold the alpha map for the distance field shader - distanceFieldOut = BufferImage::New( size.width, size.height, Pixel::A8 ); - - // Generate bit pattern - std::vector< unsigned char > imageDataA8; - imageDataA8.reserve( size.width * size.height ); // A8 - - switch( shapeType ) - { - case CIRCLE: - GenerateCircle( size, imageDataA8 ); - break; - case BUBBLE: - GenerateCircle( size, imageDataA8, true ); - break; - default: - break; - } - - PixelBuffer* buffer = distanceFieldOut.GetBuffer(); - if( buffer ) - { - GenerateDistanceFieldMap( &imageDataA8[ 0 ], size, buffer, size, 8.0f, size ); - distanceFieldOut.Update(); - } -} - -void DaliTableView::GenerateCircle( const Size& size, std::vector< unsigned char >& distanceFieldOut, bool hollow ) -{ - const float radius = size.width * 0.5f * size.width * 0.5f; - Vector2 center( size.width / 2, size.height / 2 ); - - for( int h = 0; h < size.height; ++h ) - { - for( int w = 0; w < size.width; ++w ) - { - Vector2 pos( w, h ); - Vector2 dist = pos - center; - - float distance = ( dist.x * dist.x ) + ( dist.y * dist.y ); - - // If hollow, check the distance against a min & max value, otherwise just use the max value. - unsigned char fillByte = ( hollow ? ( ( distance <= radius ) && ( distance > ( radius * 0.7f ) ) ) : ( distance <= radius ) ) ? 0xFF : 0x00; - - distanceFieldOut.push_back( fillByte ); - } - } -} - ImageView DaliTableView::CreateLogo( std::string imagePath ) { ImageView logo = ImageView::New( imagePath ); diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index c91f2fc..c7cf0ab 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -2,7 +2,7 @@ #define DALI_DEMO_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -262,37 +262,8 @@ private: // Application callbacks & implementation * * @param[in] layer The layer to add the actors to * @param[in] count The number of actors to generate - * @param[in] distanceField A array (pointer) to 2 distance field types to use */ - void AddBackgroundActors( Dali::Actor layer, int count, Dali::BufferImage* distanceField ); - - /** - * Create a bitmap with the specified shape and also output a distance field - * - * @param[in] shapeType The shape to generate - * @param[in] size The size of the bitmap to create - * @param[out] distanceFieldOut The return depth field alpha map - */ - void CreateShapeImage( ShapeType shapeType, const Dali::Size& size, Dali::BufferImage& distanceFieldOut ); - - /** - * Generate a square bit pattern and depth field - * - * @param[in] size The size of the bitmap to create - * @param[out] imageOut The return bitmap - * @param[out] distanceFieldOut The return depth field alpha map - */ - void GenerateSquare( const Dali::Size& size, std::vector& distanceFieldOut ); - - /** - * Generate a circle bit pattern and depth field - * - * @param[in] size The size of the bitmap to create - * @param[out] imageOut The return bitmap - * @param[out] distanceFieldOut The return depth field alpha map - * @param[in] hollow Optional - Set to true for a thick circle outline without fill - */ - void GenerateCircle( const Dali::Size& size, std::vector& distanceFieldOut, bool hollow = false ); + void AddBackgroundActors( Dali::Actor layer, int count ); /** * Creates the logo. diff --git a/examples/animated-images/animated-images-example.cpp b/examples/animated-images/animated-images-example.cpp index b9ec308..5587ab9 100644 --- a/examples/animated-images/animated-images-example.cpp +++ b/examples/animated-images/animated-images-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ */ #include +#include #include "shared/utility.h" @@ -87,8 +88,8 @@ public: // Create a push button, and add it as child of the image view Toolkit::PushButton animateButton = Toolkit::PushButton::New(); - animateButton.SetUnselectedImage( PLAY_ICON ); - animateButton.SetSelectedImage( PLAY_ICON_SELECTED ); + animateButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON ); + animateButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED ); animateButton.SetParentOrigin( ParentOrigin::CENTER ); animateButton.SetAnchorPoint( AnchorPoint::CENTER ); animateButton.ClickedSignal().Connect( this, &AnimatedImageController::OnPlayButtonClicked ); diff --git a/examples/atlas/atlas-example.cpp b/examples/atlas/atlas-example.cpp index 503d577..05483dc 100644 --- a/examples/atlas/atlas-example.cpp +++ b/examples/atlas/atlas-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ #include #include +#include #include "shared/view.h" #include @@ -72,8 +73,8 @@ public: "Atlas" ); mLoseContextButton = Toolkit::PushButton::New(); - mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE ); - mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED ); + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE ); + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED ); mLoseContextButton.ClickedSignal().Connect( this, &AtlasController::OnLoseContextButtonClicked ); mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); diff --git a/examples/bubble-effect/bubble-effect-example.cpp b/examples/bubble-effect/bubble-effect-example.cpp index 878e933..66c02b8 100644 --- a/examples/bubble-effect/bubble-effect-example.cpp +++ b/examples/bubble-effect/bubble-effect-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #include #include #include +#include #include "shared/view.h" #include "shared/utility.h" @@ -108,8 +109,8 @@ private: // Add a button to change background. (right of toolbar) mChangeBackgroundButton = Toolkit::PushButton::New(); - mChangeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON ); - mChangeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED ); + mChangeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON ); + mChangeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED ); mChangeBackgroundButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); toolBar.AddControl( mChangeBackgroundButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -117,8 +118,8 @@ private: DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Add a button to change bubble shape. ( left of bar ) mChangeBubbleShapeButton = Toolkit::PushButton::New(); - mChangeBubbleShapeButton.SetUnselectedImage( CHANGE_BUBBLE_SHAPE_ICON ); - mChangeBubbleShapeButton.SetSelectedImage( CHANGE_BUBBLE_SHAPE_ICON_SELECTED ); + mChangeBubbleShapeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON ); + mChangeBubbleShapeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BUBBLE_SHAPE_ICON_SELECTED ); mChangeBubbleShapeButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); toolBar.AddControl( mChangeBubbleShapeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, diff --git a/examples/builder/examples.cpp b/examples/builder/examples.cpp index 2895d82..ba47e28 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -472,8 +473,8 @@ public: // Create an edit mode button. (left of toolbar) Toolkit::PushButton backButton = Toolkit::PushButton::New(); - backButton.SetUnselectedImage( EDIT_IMAGE ); - backButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); + backButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE ); + backButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED ); backButton.ClickedSignal().Connect( this, &ExampleApp::OnBackButtonPressed); backButton.SetLeaveRequired( true ); mToolBar.AddControl( backButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index eddb106..a21e2f2 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -164,7 +164,7 @@ class ButtonsController: public ConnectionTracker mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT ); mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mRadioButtonImage1.SetPosition( 0, DP(radioY) ); - mRadioButtonImage1.SetSelected( true ); + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::SELECTED, true ); imageSelectTableView.AddChild( mRadioButtonImage1, Toolkit::TableView::CellPosition( 0, 0 ) ); imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); @@ -204,7 +204,7 @@ class ButtonsController: public ConnectionTracker // Create select button mUpdateButton = Toolkit::PushButton::New(); - mUpdateButton.SetLabelText( "Select" ); + mUpdateButton.SetProperty( Toolkit::Button::Property::LABEL, "Select" ); mUpdateButton.SetName( "selectButton" ); mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); @@ -267,7 +267,7 @@ class ButtonsController: public ConnectionTracker radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); radioButton.SetPosition( 0, 0 ); - radioButton.SetSelected( true ); + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton ); @@ -304,7 +304,7 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton1 = Toolkit::CheckBoxButton::New(); mCheckboxButton1.SetName( "checkbox1" ); - mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" ); + mCheckboxButton1.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected" ); mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); @@ -314,8 +314,8 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton2 = Toolkit::CheckBoxButton::New(); mCheckboxButton2.SetName( "checkbox2" ); - mCheckboxButton2.SetLabelText( "CheckBox2 is selected" ); - mCheckboxButton2.SetSelected( true ); + mCheckboxButton2.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected" ); + mCheckboxButton2.SetProperty( Toolkit::Button::Property::SELECTED, true ); mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); @@ -325,7 +325,7 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton3 = Toolkit::CheckBoxButton::New(); mCheckboxButton3.SetName( "checkbox3" ); - mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" ); + mCheckboxButton3.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected" ); mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); @@ -347,8 +347,8 @@ class ButtonsController: public ConnectionTracker contentTable.Add( toggleBackground ); mToggleButton = Toolkit::PushButton::New(); - mToggleButton.SetTogglableButton( true ); - mToggleButton.SetLabelText( "Unselected" ); + mToggleButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); + mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" ); mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mToggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected ); @@ -373,13 +373,14 @@ class ButtonsController: public ConnectionTracker Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); if( pushButton ) { - if( button.IsSelected() ) + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + if( isSelected ) { - pushButton.SetLabelText( "Selected" ); + pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Selected" ); } else { - pushButton.SetLabelText( "Unselected" ); + pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" ); } } @@ -388,33 +389,39 @@ class ButtonsController: public ConnectionTracker bool EnableSelectButton( Toolkit::Button button ) { - if( button.GetName() == "radioSelectEnable" && button.IsSelected() == true ) + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + if( !isSelected ) { - mUpdateButton.SetDisabled( false ); + return true; + } + + if( button.GetName() == "radioSelectEnable" ) + { + mUpdateButton.SetProperty( Toolkit::Button::Property::DISABLED, false ); - mRadioButtonImage1.SetDisabled( false ); - mRadioButtonImage2.SetDisabled( false ); - mRadioButtonImage3.SetDisabled( false ); + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::DISABLED, false ); + mRadioButtonImage2.SetProperty( Toolkit::Button::Property::DISABLED, false ); + mRadioButtonImage3.SetProperty( Toolkit::Button::Property::DISABLED, false ); - mCheckboxButton1.SetDisabled( false ); - mCheckboxButton2.SetDisabled( false ); - mCheckboxButton3.SetDisabled( false ); + mCheckboxButton1.SetProperty( Toolkit::Button::Property::DISABLED, false ); + mCheckboxButton2.SetProperty( Toolkit::Button::Property::DISABLED, false ); + mCheckboxButton3.SetProperty( Toolkit::Button::Property::DISABLED, false ); - mToggleButton.SetDisabled( false ); + mToggleButton.SetProperty( Toolkit::Button::Property::DISABLED, false ); } - else if( button.GetName() == "radioSelectDisable" && button.IsSelected() == true ) + else if( button.GetName() == "radioSelectDisable" ) { - mUpdateButton.SetDisabled( true ); + mUpdateButton.SetProperty( Toolkit::Button::Property::DISABLED, true ); - mRadioButtonImage1.SetDisabled( true ); - mRadioButtonImage2.SetDisabled( true ); - mRadioButtonImage3.SetDisabled( true ); + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::DISABLED, true ); + mRadioButtonImage2.SetProperty( Toolkit::Button::Property::DISABLED, true ); + mRadioButtonImage3.SetProperty( Toolkit::Button::Property::DISABLED, true ); - mCheckboxButton1.SetDisabled( true ); - mCheckboxButton2.SetDisabled( true ); - mCheckboxButton3.SetDisabled( true ); + mCheckboxButton1.SetProperty( Toolkit::Button::Property::DISABLED, true ); + mCheckboxButton2.SetProperty( Toolkit::Button::Property::DISABLED, true ); + mCheckboxButton3.SetProperty( Toolkit::Button::Property::DISABLED, true ); - mToggleButton.SetDisabled( true ); + mToggleButton.SetProperty( Toolkit::Button::Property::DISABLED, true ); } return true; @@ -422,15 +429,15 @@ class ButtonsController: public ConnectionTracker bool OnButtonClicked(Toolkit::Button button) { - if( mRadioButtonImage1.IsSelected() ) + if( mRadioButtonImage1.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { mImage.SetImage( BIG_IMAGE_1 ); } - else if( mRadioButtonImage2.IsSelected() ) + else if( mRadioButtonImage2.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { mImage.SetImage( BIG_IMAGE_2 ); } - else if( mRadioButtonImage3.IsSelected() ) + else if( mRadioButtonImage3.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { mImage.SetImage( BIG_IMAGE_3 ); } @@ -439,39 +446,40 @@ class ButtonsController: public ConnectionTracker bool OnCheckBoxesSelected( Toolkit::Button button ) { + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); if( button.GetName() == "checkbox1" ) { - if( button.IsSelected() ) + if( isSelected ) { - button.SetLabelText("CheckBox1 is selected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is selected"); } else { - button.SetLabelText("CheckBox1 is unselected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected"); } } if( button.GetName() == "checkbox2" ) { - if( button.IsSelected() ) + if( isSelected ) { - button.SetLabelText("CheckBox2 is selected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected"); } else { - button.SetLabelText("CheckBox2 is unselected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is unselected"); } } if( button.GetName() == "checkbox3" ) { - if( button.IsSelected() ) + if( isSelected ) { - button.SetLabelText("CheckBox3 is selected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is selected"); } else { - button.SetLabelText("CheckBox3 is unselected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected"); } } diff --git a/examples/clipping/clipping-example.cpp b/examples/clipping/clipping-example.cpp new file mode 100644 index 0000000..4db5147 --- /dev/null +++ b/examples/clipping/clipping-example.cpp @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// EXTERNAL INCLUDES +#include +#include +#include +#include +#include + +// INTERNAL INCLUDES +#include "clipping-item-factory.h" + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const char * const APPLICATION_TITLE( "Clipping Controls" ); +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). +const Vector3 ITEM_VIEW_LAYOUT_SIZE_SCALE( 0.75f, 0.5f, 0.75f ); +const float ITEM_VIEW_BORDER_SIZE = 2.0f; +const char * const BUTTON_LABEL( "Toggle Clipping Mode" ); +} // unnamed namespace + +/** + * @brief Demonstrates the control clipping of a UI Control. + * + * When an Actor is set to clip its children, the renderers have to be added manually in order to specify what its children + * need to clip to. UI Controls automate the creation of the renderers/visuals when they are set to clip their children. + * + * This example displays an item-view whose clipping mode is toggled without the need for adding any renderers to it. + */ +class ClippingExample : public ConnectionTracker +{ +public: + + /** + * @brief Constructor. + * @param[in] application A reference to the Application class. + */ + ClippingExample( Application& application ) + : mApplication( application ) + { + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &ClippingExample::Create ); + } + +private: + + /** + * @brief Called to initialise the application content. + * @param[in] application A reference to the Application class. + */ + void Create( Application& application ) + { + // Hide the indicator bar + application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); + + // Connect to the stage's key signal to allow Back and Escape to exit. + Stage stage = Dali::Stage::GetCurrent(); + stage.KeyEventSignal().Connect( this, &ClippingExample::OnKeyEvent ); + + // Create a TextLabel for the application title. + Toolkit::TextLabel label = Toolkit::TextLabel::New( APPLICATION_TITLE ); + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + label.SetParentOrigin( APPLICATION_TITLE_PARENT_ORIGIN ); + label.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); + label.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::WHITE ); + stage.Add( label ); + + // Create an item-view which clips its children. + mItemView = ItemView::New( mClippingItemFactory ); + mItemView.SetParentOrigin( ParentOrigin::CENTER ); + mItemView.SetAnchorPoint( AnchorPoint::CENTER ); + mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN ); // Enable clipping. No need to create any renderers. + stage.Add( mItemView ); + + // Create a Spiral Layout and add it to the Item View. + mItemView.AddLayout( * DefaultItemLayout::New( DefaultItemLayout::SPIRAL ) ); + stage.GetRootLayer().SetBehavior( Layer::LAYER_3D ); // The item-view spiral layout requires Layer 3D behaviour. + + // Calculate the size we would like our item-view layout to be, and then activate the layout. + const Vector2 stageSize = stage.GetSize(); + 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 ); + mItemView.ActivateLayout( 0, itemViewLayoutSize, 0.0f ); + + // Create a border around item-view (as item-view is clipping its children, we should NOT add this as a child of item-view). + Control border = Control::New(); + border.SetParentOrigin( ParentOrigin::CENTER ); + border.SetAnchorPoint( AnchorPoint::CENTER ); + border.SetProperty( Control::Property::BACKGROUND, + Property::Map().Add( Visual::Property::TYPE, Visual::BORDER ) + .Add( BorderVisual::Property::COLOR, Color::WHITE ) + .Add( BorderVisual::Property::SIZE, 2.0f ) ); + 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 ) ); + stage.Add( border ); + + // Create a button to toggle the clipping mode + PushButton button = Toolkit::PushButton::New(); + button.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + button.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); + button.SetProperty( Actor::Property::DRAW_MODE, DrawMode::OVERLAY_2D ); + button.SetProperty( Button::Property::LABEL, + Property::Map().Add( Toolkit::Visual::Property::TYPE, Toolkit::DevelVisual::TEXT ) + .Add( Toolkit::TextVisual::Property::TEXT, BUTTON_LABEL ) ); + button.ClickedSignal().Connect( this, &ClippingExample::OnButtonClicked ); + stage.Add( button ); + } + + /** + * @brief Called when any key event is received + * + * Will use this to quit the application if Back or the Escape key is received + * @param[in] event The key event information + */ + void OnKeyEvent( const KeyEvent& event ) + { + if( event.state == KeyEvent::Down ) + { + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } + } + + /** + * @brief Called when the button is clicked. + * + * Will use this to toggle between the clipping modes. + * @param[in] button The button that has been clicked. + */ + bool OnButtonClicked( Toolkit::Button button ) + { + if( mItemView ) + { + ClippingMode::Type currentMode = static_cast< ClippingMode::Type >( mItemView.GetProperty( Actor::Property::CLIPPING_MODE ).Get< int >() ); + mItemView.SetProperty( Actor::Property::CLIPPING_MODE, ( currentMode == ClippingMode::CLIP_CHILDREN ) ? ClippingMode::DISABLED : ClippingMode::CLIP_CHILDREN ); + } + return true; + } + + // Data + + Application& mApplication; ///< Reference to the application class. + ItemView mItemView; ///< The item view which whose children we would like to clip. + ClippingItemFactory mClippingItemFactory; ///< The ItemFactory used to create our items. +}; + +int DALI_EXPORT_API main( int argc, char **argv ) +{ + Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); + ClippingExample test(app); + app.MainLoop(); + return 0; +} diff --git a/examples/clipping/clipping-item-factory.cpp b/examples/clipping/clipping-item-factory.cpp new file mode 100644 index 0000000..50ec810 --- /dev/null +++ b/examples/clipping/clipping-item-factory.cpp @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include "clipping-item-factory.h" + +// EXTERNAL INCLUDES +#include +#include +#include +#include + +using namespace Dali; +using namespace Dali::Toolkit; + +namespace +{ +const char * IMAGE_PATHS[] = { + DEMO_IMAGE_DIR "gallery-medium-1.jpg", + DEMO_IMAGE_DIR "gallery-medium-2.jpg", + DEMO_IMAGE_DIR "gallery-medium-3.jpg", + DEMO_IMAGE_DIR "gallery-medium-4.jpg", + DEMO_IMAGE_DIR "gallery-medium-5.jpg", + DEMO_IMAGE_DIR "gallery-medium-6.jpg", + DEMO_IMAGE_DIR "gallery-medium-7.jpg", + DEMO_IMAGE_DIR "gallery-medium-8.jpg", + DEMO_IMAGE_DIR "gallery-medium-9.jpg", + DEMO_IMAGE_DIR "gallery-medium-10.jpg", + DEMO_IMAGE_DIR "gallery-medium-11.jpg", + DEMO_IMAGE_DIR "gallery-medium-12.jpg", + DEMO_IMAGE_DIR "gallery-medium-13.jpg", + DEMO_IMAGE_DIR "gallery-medium-14.jpg", + DEMO_IMAGE_DIR "gallery-medium-15.jpg", + DEMO_IMAGE_DIR "gallery-medium-16.jpg", + DEMO_IMAGE_DIR "gallery-medium-17.jpg", + DEMO_IMAGE_DIR "gallery-medium-18.jpg", + DEMO_IMAGE_DIR "gallery-medium-19.jpg", + DEMO_IMAGE_DIR "gallery-medium-20.jpg", + DEMO_IMAGE_DIR "gallery-medium-21.jpg", + DEMO_IMAGE_DIR "gallery-medium-22.jpg", + DEMO_IMAGE_DIR "gallery-medium-23.jpg", + DEMO_IMAGE_DIR "gallery-medium-24.jpg", + DEMO_IMAGE_DIR "gallery-medium-25.jpg", + DEMO_IMAGE_DIR "gallery-medium-26.jpg", + DEMO_IMAGE_DIR "gallery-medium-27.jpg", + DEMO_IMAGE_DIR "gallery-medium-28.jpg", + DEMO_IMAGE_DIR "gallery-medium-29.jpg", + DEMO_IMAGE_DIR "gallery-medium-30.jpg", + DEMO_IMAGE_DIR "gallery-medium-31.jpg", + DEMO_IMAGE_DIR "gallery-medium-32.jpg", + DEMO_IMAGE_DIR "gallery-medium-33.jpg", + DEMO_IMAGE_DIR "gallery-medium-34.jpg", + DEMO_IMAGE_DIR "gallery-medium-35.jpg", + DEMO_IMAGE_DIR "gallery-medium-36.jpg", + DEMO_IMAGE_DIR "gallery-medium-37.jpg", + DEMO_IMAGE_DIR "gallery-medium-38.jpg", + DEMO_IMAGE_DIR "gallery-medium-39.jpg", + DEMO_IMAGE_DIR "gallery-medium-40.jpg", + DEMO_IMAGE_DIR "gallery-medium-41.jpg", + DEMO_IMAGE_DIR "gallery-medium-42.jpg", + DEMO_IMAGE_DIR "gallery-medium-43.jpg", + DEMO_IMAGE_DIR "gallery-medium-44.jpg", + DEMO_IMAGE_DIR "gallery-medium-45.jpg", + DEMO_IMAGE_DIR "gallery-medium-46.jpg", + DEMO_IMAGE_DIR "gallery-medium-47.jpg", + DEMO_IMAGE_DIR "gallery-medium-48.jpg", + DEMO_IMAGE_DIR "gallery-medium-49.jpg", + DEMO_IMAGE_DIR "gallery-medium-50.jpg", + DEMO_IMAGE_DIR "gallery-medium-51.jpg", + DEMO_IMAGE_DIR "gallery-medium-52.jpg", + DEMO_IMAGE_DIR "gallery-medium-53.jpg", +}; +const unsigned int NUM_IMAGES = sizeof( IMAGE_PATHS ) / sizeof( char * ); +const unsigned int NUM_IMAGES_MULTIPLIER = 10; + +const float ITEM_BORDER_SIZE = 2.0f; +} // unnamed namespace + +ClippingItemFactory::ClippingItemFactory() +{ +} + +unsigned int ClippingItemFactory::GetNumberOfItems() +{ + return NUM_IMAGES * NUM_IMAGES_MULTIPLIER; +} + +Actor ClippingItemFactory::NewItem( unsigned int itemId ) +{ + // Create an image view for this item + ImageView actor = ImageView::New( IMAGE_PATHS[ itemId % NUM_IMAGES ] ); + + // Add a border image child actor + ImageView borderActor = ImageView::New(); + borderActor.SetParentOrigin( ParentOrigin::CENTER ); + borderActor.SetAnchorPoint( AnchorPoint::CENTER ); + borderActor.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS ); + borderActor.SetSizeModeFactor( Vector3( 2.0f * ITEM_BORDER_SIZE, 2.0f * ITEM_BORDER_SIZE, 0.0f ) ); + borderActor.SetColorMode( USE_PARENT_COLOR ); + borderActor.SetProperty( ImageView::Property::IMAGE, + Property::Map().Add( Visual::Property::TYPE, Visual::BORDER ) + .Add( BorderVisual::Property::COLOR, Color::WHITE ) + .Add( BorderVisual::Property::SIZE, ITEM_BORDER_SIZE ) + .Add( BorderVisual::Property::ANTI_ALIASING, true ) ); + actor.Add(borderActor); + + return actor; +} diff --git a/examples/clipping/clipping-item-factory.h b/examples/clipping/clipping-item-factory.h new file mode 100644 index 0000000..344afea --- /dev/null +++ b/examples/clipping/clipping-item-factory.h @@ -0,0 +1,56 @@ +#ifndef CLIPPING_ITEM_FACTORY_H +#define CLIPPING_ITEM_FACTORY_H + +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include + +/** + * @brief Factory used to create the items required in the item-view used by this example. + */ +class ClippingItemFactory : public Dali::Toolkit::ItemFactory +{ +public: + + /** + * @brief Constructor + */ + ClippingItemFactory(); + +private: // From ItemFactory + + /** + * Query the number of items available from the factory. + * The maximum available item has an ID of GetNumberOfItems() - 1. + */ + virtual unsigned int GetNumberOfItems(); + + /** + * Create an Actor to represent a visible item. + * @param itemId + * @return the created actor. + */ + virtual Dali::Actor NewItem( unsigned int itemId ); + +private: + + ClippingItemFactory( const ClippingItemFactory& ); ///< Undefined + ClippingItemFactory& operator=( const ClippingItemFactory& ); ///< Undefined +}; + +#endif // CLIPPING_ITEM_FACTORY_H diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index b50c3b0..9cc96a2 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -219,8 +220,8 @@ void CubeTransitionApp::OnInit( Application& application ) // Add an effect-changing button on the right of the tool bar. mEffectChangeButton = Toolkit::PushButton::New(); - mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE_SELECTED ); mEffectChangeButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnEffectButtonClicked ); mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -230,8 +231,8 @@ void CubeTransitionApp::OnInit( Application& application ) //Add an slideshow icon on the right of the title mSlideshowButton = Toolkit::PushButton::New(); - mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON ); - mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED ); + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON ); + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED ); mSlideshowButton.ClickedSignal().Connect( this, &CubeTransitionApp::OnSildeshowButtonClicked ); mToolBar.AddControl( mSlideshowButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); @@ -324,23 +325,23 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button ) { mCurrentEffect = mCubeCrossEffect; mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) ); - mEffectChangeButton.SetUnselectedImage( EFFECT_CROSS_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_CROSS_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_CROSS_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_CROSS_IMAGE_SELECTED ); } else if(mCurrentEffect == mCubeCrossEffect) { mCurrentEffect = mCubeFoldEffect; mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) ); - mEffectChangeButton.SetUnselectedImage( EFFECT_FOLD_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_FOLD_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_FOLD_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_FOLD_IMAGE_SELECTED ); } else { mCurrentEffect = mCubeWaveEffect; mTitle.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) ); - mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_WAVE_IMAGE_SELECTED ); } mContent.Add( mCurrentEffect ); @@ -356,8 +357,8 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) if( mSlideshow ) { mPanGestureDetector.Detach( mContent ); - mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_STOP_ICON ); - mSlideshowButton.SetSelectedImage( SLIDE_SHOW_STOP_ICON_SELECTED ); + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON ); + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_STOP_ICON_SELECTED ); mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f ); mPanDisplacement = Vector2( -10.f, 0.f ); mViewTimer.Start(); @@ -365,8 +366,8 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) else { mPanGestureDetector.Attach( mContent ); - mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON ); - mSlideshowButton.SetSelectedImage( SLIDE_SHOW_START_ICON_SELECTED ); + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON ); + mSlideshowButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SLIDE_SHOW_START_ICON_SELECTED ); mViewTimer.Stop(); } return true; diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index 20f477f..ed47bd5 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ #include #include +#include #include using namespace Dali; @@ -221,8 +222,8 @@ void DissolveEffectApp::OnInit( Application& application ) // Add an effect-changing button on the right of the tool bar. mEffectChangeButton = Toolkit::PushButton::New(); - mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE ); - mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE_SELECTED ); mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked ); mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -232,8 +233,8 @@ void DissolveEffectApp::OnInit( Application& application ) // Add an slide-show button on the right of the title mPlayStopButton = Toolkit::PushButton::New(); - mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON ); - mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED ); + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON ); + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED ); mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); @@ -341,14 +342,14 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button ) if(mUseHighPrecision) { mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) ); - mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE ); - mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_HIGHP_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_HIGHP_IMAGE_SELECTED ); } else { mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) ); - mEffectChangeButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE ); - mEffectChangeButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, EFFECT_MEDIUMP_IMAGE_SELECTED ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECT_MEDIUMP_IMAGE ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECT_MEDIUMP_IMAGE_SELECTED ); } return true; @@ -359,16 +360,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) mSlideshow = !mSlideshow; if( mSlideshow ) { - mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, STOP_ICON ); - mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, STOP_ICON_SELECTED ); + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_ICON ); + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_ICON_SELECTED ); mPanGestureDetector.Detach( mParent ); mViewTimer.Start(); mTimerReady = false; } else { - mPlayStopButton.SetProperty( Toolkit::Button::Property::UNSELECTED_STATE_IMAGE, PLAY_ICON ); - mPlayStopButton.SetProperty( Toolkit::Button::Property::SELECTED_STATE_IMAGE, PLAY_ICON_SELECTED ); + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_ICON ); + mPlayStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_ICON_SELECTED ); mTimerReady = true; mPanGestureDetector.Attach( mParent ); } diff --git a/examples/effects-view/effects-view-example.cpp b/examples/effects-view/effects-view-example.cpp index ab78ec0..e4c0373 100644 --- a/examples/effects-view/effects-view-example.cpp +++ b/examples/effects-view/effects-view-example.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2016 Samsung Electronics Co., Ltd. +// Copyright (c) 2017 Samsung Electronics Co., Ltd. // // Licensed under the Flora License, Version 1.0 (the License); // you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -131,8 +132,8 @@ void EffectsViewApp::OnAppInitialize( Application& application ) // Creates view change button. Toolkit::PushButton viewButton = Toolkit::PushButton::New(); - viewButton.SetUnselectedImage( VIEW_SWAP_IMAGE ); - viewButton.SetSelectedImage( VIEW_SWAP_SELECTED_IMAGE ); + viewButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, VIEW_SWAP_IMAGE ); + viewButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, VIEW_SWAP_SELECTED_IMAGE ); // Connects the view change button clicked signal to the OnView method. viewButton.ClickedSignal().Connect( this, &EffectsViewApp::ChangeEffectSize ); mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); diff --git a/examples/flex-container/flex-container-example.cpp b/examples/flex-container/flex-container-example.cpp index 835176e..4178991 100644 --- a/examples/flex-container/flex-container-example.cpp +++ b/examples/flex-container/flex-container-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -137,8 +138,8 @@ public: // Create a flex direction toggle button. (left of toolbar) mFlexDirectionButton = Toolkit::PushButton::New(); mFlexDirectionButton.SetName("mFlexDirectionButton"); - mFlexDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-change.png" ); - mFlexDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-change-selected.png" ); + mFlexDirectionButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-change.png" ); + mFlexDirectionButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-change-selected.png" ); mFlexDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexDirectionButtonClicked); mFlexDirectionButton.SetLeaveRequired( true ); mToolBar.AddControl( mFlexDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -146,8 +147,8 @@ public: // Create a flex wrap toggle button. (left of toolbar) mFlexWrapButton = Toolkit::PushButton::New(); mFlexWrapButton.SetName("mFlexWrapButton"); - mFlexWrapButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-edit.png" ); - mFlexWrapButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-edit-selected.png" ); + mFlexWrapButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-edit.png" ); + mFlexWrapButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-edit-selected.png" ); mFlexWrapButton.ClickedSignal().Connect( this, &FlexContainerExample::OnFlexWrapButtonClicked); mFlexWrapButton.SetLeaveRequired( true ); mToolBar.AddControl( mFlexWrapButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -155,8 +156,8 @@ public: // Create a content direction toggle button. (left of toolbar) mContentDirectionButton = Toolkit::PushButton::New(); mContentDirectionButton.SetName("mContentDirectionButton"); - mContentDirectionButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-replace.png" ); - mContentDirectionButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-replace-selected.png" ); + mContentDirectionButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-replace.png" ); + mContentDirectionButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-replace-selected.png" ); mContentDirectionButton.ClickedSignal().Connect( this, &FlexContainerExample::OnContentDirectionButtonClicked); mContentDirectionButton.SetLeaveRequired( true ); mToolBar.AddControl( mContentDirectionButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -164,8 +165,8 @@ public: // Create a justify content toggle button. (right of toolbar) mJustifyContentButton = Toolkit::PushButton::New(); mJustifyContentButton.SetName("mJustifyContentButton"); - mJustifyContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-reset.png" ); - mJustifyContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-reset-selected.png" ); + mJustifyContentButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-reset.png" ); + mJustifyContentButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-reset-selected.png" ); mJustifyContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnJustifyContentButtonClicked); mJustifyContentButton.SetLeaveRequired( true ); mToolBar.AddControl( mJustifyContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -173,8 +174,8 @@ public: // Create a align items toggle button. (right of toolbar) mAlignItemsButton = Toolkit::PushButton::New(); mAlignItemsButton.SetName("mAlignItemsButton"); - mAlignItemsButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-highp.png" ); - mAlignItemsButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-highp-selected.png" ); + mAlignItemsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-highp.png" ); + mAlignItemsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-highp-selected.png" ); mAlignItemsButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignItemsButtonClicked); mAlignItemsButton.SetLeaveRequired( true ); mToolBar.AddControl( mAlignItemsButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -182,8 +183,8 @@ public: // Create a align content toggle button. (right of toolbar) mAlignContentButton = Toolkit::PushButton::New(); mAlignContentButton.SetName("mAlignContentButton"); - mAlignContentButton.SetUnselectedImage( DEMO_IMAGE_DIR "icon-effect-cross.png" ); - mAlignContentButton.SetSelectedImage( DEMO_IMAGE_DIR "icon-effect-cross-selected.png" ); + mAlignContentButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-effect-cross.png" ); + mAlignContentButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEMO_IMAGE_DIR "icon-effect-cross-selected.png" ); mAlignContentButton.ClickedSignal().Connect( this, &FlexContainerExample::OnAlignContentButtonClicked); mAlignContentButton.SetLeaveRequired( true ); mToolBar.AddControl( mAlignContentButton, VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -224,13 +225,13 @@ public: // Set different background colour to help to identify different items flexItem.SetBackgroundColor(Vector4(static_cast(i) / NUM_FLEX_ITEMS, static_cast(NUM_FLEX_ITEMS - i) / NUM_FLEX_ITEMS, 1.0f, 1.0f)); - flexItem.SetUnselectedImage(""); - flexItem.SetSelectedImage(""); + flexItem.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, "" ); + flexItem.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, "" ); // Add a label to the button so that we can identify each item more easily std::ostringstream index; index << i + 1; - flexItem.SetLabelText(index.str()); + flexItem.SetProperty( Toolkit::Button::Property::LABEL, index.str() ); flexItem.SetName("FlexItem " + index.str()); // Set a fixed size to the items so that we can wrap the line and test these diff --git a/examples/fpp-game/fpp-game-tutorial-controller.cpp b/examples/fpp-game/fpp-game-tutorial-controller.cpp index ec97bb8..61af0c1 100644 --- a/examples/fpp-game/fpp-game-tutorial-controller.cpp +++ b/examples/fpp-game/fpp-game-tutorial-controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,10 @@ #include #include #include +#include #include +#include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -111,7 +114,9 @@ void FppGameTutorialController::DisplayTutorial() mLeftLabel.SetAnchorPoint( AnchorPoint::CENTER ); mLeftLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mLeftLabel.SetSize( Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) ); - mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 )); + mLeftLabel.SetProperty( Toolkit::Control::Property::BACKGROUND, + Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.0, 0.0, 0.7, 0.2 ) ) ); mLeftLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White. mLeftLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); mLeftLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); @@ -122,7 +127,9 @@ void FppGameTutorialController::DisplayTutorial() mRightLabel.SetAnchorPoint( AnchorPoint::CENTER ); mRightLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mRightLabel.SetSize( Vector3( stageSize.x*0.5, stageSize.y, 1.0f ) ); - mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 )); + mRightLabel.SetProperty( Toolkit::Control::Property::BACKGROUND, + Property::Map().Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, Vector4( 0.5, 0.0, 0.0, 0.2 ) ) ); mRightLabel.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); // White. mRightLabel.SetProperty( Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" ); mRightLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); diff --git a/examples/gradients/gradients-example.cpp b/examples/gradients/gradients-example.cpp index 5d1ab63..9a92d2e 100644 --- a/examples/gradients/gradients-example.cpp +++ b/examples/gradients/gradients-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ */ #include +#include #include "shared/view.h" using namespace Dali; @@ -67,8 +68,8 @@ public: APPLICATION_TITLE ); PushButton changeButton = Toolkit::PushButton::New(); - changeButton.SetUnselectedImage( CHANGE_ICON ); - changeButton.SetSelectedImage( CHANGE_ICON_SELECTED ); + changeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_ICON ); + changeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_ICON_SELECTED ); changeButton.ClickedSignal().Connect( this, &GradientController::OnChangeIconClicked ); toolBar.AddControl( changeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index f5d17c6..1c4563c 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -373,7 +373,7 @@ public: Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetStyleName( STYLE_BUTTON_TEXT ); button.SetName( id ); - button.SetLabelText( label ); + button.SetProperty( Toolkit::Button::Property::LABEL, label ); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &ImageScalingAndFilteringController::OnButtonClicked ); @@ -400,7 +400,7 @@ public: { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( id ); - button.SetLabelText( id ); + button.SetProperty( Toolkit::Button::Property::LABEL, id ); button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); @@ -489,7 +489,7 @@ public: if( button.GetName() == modeName ) { mFittingMode = mode; - mFittingModeButton.SetLabelText( modeName ); + mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, modeName ); ResizeImage(); mPopup.SetDisplayState( Toolkit::Popup::HIDDEN ); mPopup.Reset(); @@ -504,7 +504,7 @@ public: if( button.GetName() == modeName ) { mSamplingMode = mode; - mSamplingModeButton.SetLabelText( modeName ); + mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, modeName ); ResizeImage(); mPopup.SetDisplayState( Toolkit::Popup::HIDDEN ); mPopup.Reset(); @@ -661,13 +661,13 @@ public: else if ( event.keyPressedName == "f" ) { mSamplingMode = NextFilterMode( mSamplingMode ); - mSamplingModeButton.SetLabelText( StringFromFilterMode( mSamplingMode ) ); + mSamplingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromFilterMode( mSamplingMode ) ); } // Cycle filter and scaling modes: else if ( event.keyPressedName == "s" ) { mFittingMode = NextScalingMode( mFittingMode ); - mFittingModeButton.SetLabelText( StringFromScalingMode( mFittingMode ) ); + mFittingModeButton.SetProperty( Toolkit::Button::Property::LABEL, StringFromScalingMode( mFittingMode ) ); } else { diff --git a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp index 302686c..fdae2c4 100644 --- a/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp +++ b/examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ #include #include #include +#include #include // INTERNAL INCLUDES @@ -307,8 +308,8 @@ public: // Create an image scaling toggle button. (right of toolbar) Toolkit::PushButton toggleScalingButton = Toolkit::PushButton::New(); - toggleScalingButton.SetUnselectedImage( TOGGLE_SCALING_IMAGE ); - toggleScalingButton.SetSelectedImage( TOGGLE_SCALING_IMAGE_SELECTED ); + toggleScalingButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, TOGGLE_SCALING_IMAGE ); + toggleScalingButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, TOGGLE_SCALING_IMAGE_SELECTED ); toggleScalingButton.ClickedSignal().Connect( this, &ImageScalingIrregularGridController::OnToggleScalingTouched ); mToolBar.AddControl( toggleScalingButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); diff --git a/examples/image-view-pixel-area/image-view-pixel-area-example.cpp b/examples/image-view-pixel-area/image-view-pixel-area-example.cpp index b00ccf5..362ced1 100644 --- a/examples/image-view-pixel-area/image-view-pixel-area-example.cpp +++ b/examples/image-view-pixel-area/image-view-pixel-area-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ */ #include +#include + #include "shared/view.h" using namespace Dali; @@ -69,8 +71,8 @@ private: // Add a button to switch the scene. (right of toolbar) Toolkit::PushButton switchButton = Toolkit::PushButton::New(); - switchButton.SetUnselectedImage( BUTTON_ICON ); - switchButton.SetSelectedImage( BUTTON_ICON_SELECTED ); + switchButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_ICON ); + switchButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_ICON_SELECTED ); switchButton.ClickedSignal().Connect( this, &ImageViewPixelAreaApp::OnButtonClicked ); toolBar.AddControl( switchButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, diff --git a/examples/image-view-svg/image-view-svg-example.cpp b/examples/image-view-svg/image-view-svg-example.cpp index 5617a73..613ecb7 100644 --- a/examples/image-view-svg/image-view-svg-example.cpp +++ b/examples/image-view-svg/image-view-svg-example.cpp @@ -82,7 +82,7 @@ public: // Push button, for changing the image set for displaying Toolkit::PushButton changeButton = Toolkit::PushButton::New(); - changeButton.SetLabelText( "Next" ); + changeButton.SetProperty( Toolkit::Button::Property::LABEL, "Next" ); changeButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); changeButton.SetParentOrigin( ParentOrigin::TOP_RIGHT ); stage.Add( changeButton ); @@ -91,7 +91,7 @@ public: // Push button, for resetting the actor size and position Toolkit::PushButton resetButton = Toolkit::PushButton::New(); - resetButton.SetLabelText( "Reset" ); + resetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" ); resetButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); resetButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); stage.Add( resetButton ); diff --git a/examples/image-view/image-view-example.cpp b/examples/image-view/image-view-example.cpp index 15d37e8..bc41577 100644 --- a/examples/image-view/image-view-example.cpp +++ b/examples/image-view/image-view-example.cpp @@ -107,7 +107,7 @@ class ImageViewController: public ConnectionTracker buttonsTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); Toolkit::PushButton button = Toolkit::PushButton::New(); - button.SetLabelText( "Toggle on/off stage" ); + button.SetProperty( Toolkit::Button::Property::LABEL, "Toggle on/off stage" ); button.SetParentOrigin( ParentOrigin::CENTER ); button.SetAnchorPoint( AnchorPoint::CENTER ); button.ClickedSignal().Connect( this, &ImageViewController::ToggleImageOnStage ); @@ -115,7 +115,7 @@ class ImageViewController: public ConnectionTracker buttonsTable.AddChild( button, Toolkit::TableView::CellPosition( 0, 0 ) ); Toolkit::PushButton button2 = Toolkit::PushButton::New(); - button2.SetLabelText( "Change Image" ); + button2.SetProperty( Toolkit::Button::Property::LABEL, "Change Image" ); button2.SetParentOrigin( ParentOrigin::CENTER ); button2.SetAnchorPoint( AnchorPoint::CENTER ); button2.ClickedSignal().Connect( this, &ImageViewController::ChangeImageClicked ); diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index f93aaec..9b13be3 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -213,16 +214,16 @@ public: // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); - editButton.SetUnselectedImage( EDIT_IMAGE ); - editButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); + editButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EDIT_IMAGE ); + editButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EDIT_IMAGE_SELECTED ); editButton.ClickedSignal().Connect( this, &ItemViewExample::OnModeButtonClicked); editButton.SetLeaveRequired( true ); mToolBar.AddControl( editButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Create a layout toggle button. (right of toolbar) mLayoutButton = Toolkit::PushButton::New(); - mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE ); - mLayoutButton.SetSelectedImage(SPIRAL_LAYOUT_IMAGE_SELECTED ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED ); mLayoutButton.ClickedSignal().Connect( this, &ItemViewExample::OnLayoutButtonClicked); mLayoutButton.SetLeaveRequired( true ); mToolBar.AddControl( mLayoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -233,9 +234,9 @@ public: mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mDeleteButton.SetDrawMode( DrawMode::OVERLAY_2D ); - mDeleteButton.SetUnselectedImage( DELETE_IMAGE ); - mDeleteButton.SetSelectedImage( DELETE_IMAGE_SELECTED ); - mDeleteButton.SetBackgroundImage( TOOLBAR_IMAGE ); + mDeleteButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DELETE_IMAGE ); + mDeleteButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DELETE_IMAGE_SELECTED ); + mDeleteButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE ); mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) ); mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); mDeleteButton.SetLeaveRequired( true ); @@ -248,9 +249,9 @@ public: mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mInsertButton.SetDrawMode( DrawMode::OVERLAY_2D ); - mInsertButton.SetUnselectedImage( INSERT_IMAGE ); - mInsertButton.SetSelectedImage( INSERT_IMAGE_SELECTED ); - mInsertButton.SetBackgroundImage( TOOLBAR_IMAGE ); + mInsertButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, INSERT_IMAGE ); + mInsertButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, INSERT_IMAGE_SELECTED ); + mInsertButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE ); mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); mInsertButton.SetLeaveRequired( true ); @@ -263,9 +264,9 @@ public: mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mReplaceButton.SetDrawMode( DrawMode::OVERLAY_2D ); - mReplaceButton.SetUnselectedImage( REPLACE_IMAGE ); - mReplaceButton.SetSelectedImage( REPLACE_IMAGE_SELECTED ); - mReplaceButton.SetBackgroundImage( TOOLBAR_IMAGE ); + mReplaceButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE ); + mReplaceButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, REPLACE_IMAGE_SELECTED ); + mReplaceButton.SetProperty( Toolkit::Control::Property::BACKGROUND, TOOLBAR_IMAGE ); mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); mReplaceButton.SetLeaveRequired( true ); @@ -821,22 +822,22 @@ public: { case SPIRAL_LAYOUT: { - mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE ); - mLayoutButton.SetSelectedImage( SPIRAL_LAYOUT_IMAGE_SELECTED ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, SPIRAL_LAYOUT_IMAGE_SELECTED ); break; } case GRID_LAYOUT: { - mLayoutButton.SetUnselectedImage( GRID_LAYOUT_IMAGE ); - mLayoutButton.SetSelectedImage( GRID_LAYOUT_IMAGE_SELECTED ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, GRID_LAYOUT_IMAGE_SELECTED ); break; } case DEPTH_LAYOUT: { - mLayoutButton.SetUnselectedImage( DEPTH_LAYOUT_IMAGE ); - mLayoutButton.SetSelectedImage( DEPTH_LAYOUT_IMAGE_SELECTED ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE ); + mLayoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, DEPTH_LAYOUT_IMAGE_SELECTED ); break; } diff --git a/examples/line-mesh/line-mesh-example.cpp b/examples/line-mesh/line-mesh-example.cpp index 5127284..922da41 100644 --- a/examples/line-mesh/line-mesh-example.cpp +++ b/examples/line-mesh/line-mesh-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -253,7 +253,7 @@ public: radio.SetParentOrigin( ParentOrigin::TOP_LEFT ); radio.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radio.SetSelected( i == 0 ); + radio.SetProperty( Toolkit::Button::Property::SELECTED, i == 0 ); radio.PressedSignal().Connect( this, &ExampleController::OnButtonPressed ); mButtons[i] = radio; modeSelectTableView.AddChild( radio, Toolkit::TableView::CellPosition( i, 0 ) ); @@ -268,12 +268,12 @@ public: elementCountTableView.SetFitWidth( 1 ); elementCountTableView.SetFitWidth( 2 ); mMinusButton = Toolkit::PushButton::New(); - mMinusButton.SetLabelText( "<<" ); + mMinusButton.SetProperty( Toolkit::Button::Property::LABEL, "<<" ); mMinusButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); mMinusButton.SetAnchorPoint( AnchorPoint::CENTER_LEFT ); Toolkit::PushButton mPlusButton = Toolkit::PushButton::New(); - mPlusButton.SetLabelText( ">>" ); + mPlusButton.SetProperty( Toolkit::Button::Property::LABEL, ">>" ); mPlusButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); mPlusButton.SetAnchorPoint( AnchorPoint::CENTER_RIGHT ); diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index db6d4a6..21e1ef5 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -241,7 +241,7 @@ class LoggingController: public ConnectionTracker radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); radioButton.SetPosition( DP(radioX), DP(radioY) ); - radioButton.SetSelected( true ); + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); radioButton.StateChangedSignal().Connect( this, &LoggingController::LoggingRadioSelect ); @@ -294,7 +294,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( CREATE_BUTTON_ID ); - button.SetLabelText( CREATE_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, CREATE_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -305,7 +305,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( DELETE_BUTTON_ID ); - button.SetLabelText( DELETE_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, DELETE_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -327,7 +327,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( START_BUTTON_ID ); - button.SetLabelText( START_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, START_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -338,7 +338,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( STOP_BUTTON_ID ); - button.SetLabelText( STOP_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, STOP_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -359,7 +359,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( ENABLE_BUTTON_ID ); - button.SetLabelText( ENABLE_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, ENABLE_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -370,7 +370,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( DISABLE_BUTTON_ID ); - button.SetLabelText( DISABLE_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, DISABLE_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -421,7 +421,7 @@ class LoggingController: public ConnectionTracker Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_2_RADIO_TEXT ); radioButton.SetName( FREQUENCY_2_RADIO_ID ); - radioButton.SetSelected( true ); + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect ); @@ -453,7 +453,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( VSYNC_BUTTON_ID ); - button.SetLabelText( VSYNC_BUTTON_TEXT ); + button.SetProperty( Toolkit::Button::Property::LABEL, VSYNC_BUTTON_TEXT); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked ); @@ -473,21 +473,27 @@ class LoggingController: public ConnectionTracker << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped") << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled"); - mLogRadioButtons[i].SetLabelText( ss.str() ); + mLogRadioButtons[i].SetProperty( Toolkit::Button::Property::LABEL, ss.str() ); } } bool LoggingRadioSelect( Toolkit::Button button ) { - if( button.GetName() == LOGGER_1_RADIO_ID && button.IsSelected() == true ) + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + if( !isSelected ) + { + return true; + } + + if( button.GetName() == LOGGER_1_RADIO_ID ) { mCurrentLogger = 0; } - else if( button.GetName() == LOGGER_2_RADIO_ID && button.IsSelected() == true ) + else if( button.GetName() == LOGGER_2_RADIO_ID ) { mCurrentLogger = 1; } - else if( button.GetName() == LOGGER_3_RADIO_ID && button.IsSelected() == true ) + else if( button.GetName() == LOGGER_3_RADIO_ID ) { mCurrentLogger = 2; } @@ -503,21 +509,27 @@ class LoggingController: public ConnectionTracker const unsigned int frequency = mLoggerStates[mCurrentLogger].frequency; if( frequency == HIGH_FREQUENCY ) { - mFrequencyRadioButtons[0].SetSelected( true ); + mFrequencyRadioButtons[0].SetProperty( Toolkit::Button::Property::SELECTED, true ); } else if( frequency == MEDIUM_FREQUENCY ) { - mFrequencyRadioButtons[1].SetSelected( true ); + mFrequencyRadioButtons[1].SetProperty( Toolkit::Button::Property::SELECTED, true ); } else if( frequency == LOW_FREQUENCY ) { - mFrequencyRadioButtons[2].SetSelected( true ); + mFrequencyRadioButtons[2].SetProperty( Toolkit::Button::Property::SELECTED, true ); } } bool FrequencyRadioSelect( Toolkit::Button button ) { - if( button.GetName() == FREQUENCY_1_RADIO_ID && button.IsSelected() == true ) + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + if( !isSelected ) + { + return true; + } + + if( button.GetName() == FREQUENCY_1_RADIO_ID ) { if( mPerformanceLoggers[mCurrentLogger] ) { @@ -528,7 +540,7 @@ class LoggingController: public ConnectionTracker mLoggerStates[mCurrentLogger].frequency = HIGH_FREQUENCY; } } - else if( button.GetName() == FREQUENCY_2_RADIO_ID && button.IsSelected() == true ) + else if( button.GetName() == FREQUENCY_2_RADIO_ID ) { if( mPerformanceLoggers[mCurrentLogger] ) { @@ -539,7 +551,7 @@ class LoggingController: public ConnectionTracker mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY; } } - else if( button.GetName() == FREQUENCY_3_RADIO_ID && button.IsSelected() == true ) + else if( button.GetName() == FREQUENCY_3_RADIO_ID ) { if( mPerformanceLoggers[mCurrentLogger] ) { diff --git a/examples/mesh-visual/mesh-visual-example.cpp b/examples/mesh-visual/mesh-visual-example.cpp index e8674c9..24901bd 100644 --- a/examples/mesh-visual/mesh-visual-example.cpp +++ b/examples/mesh-visual/mesh-visual-example.cpp @@ -183,7 +183,7 @@ public: modelButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeModelClicked ); modelButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); modelButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - modelButton.SetLabelText( "Model" ); + modelButton.SetProperty( Toolkit::Button::Property::LABEL, "Model" ); positionActorModel.Add( modelButton ); //Create button for shading mode changing. @@ -192,7 +192,7 @@ public: shadingModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeShadingModeClicked ); shadingModeButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); shadingModeButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - shadingModeButton.SetLabelText( "Shading Mode" ); + shadingModeButton.SetProperty( Toolkit::Button::Property::LABEL, "Shading Mode" ); positionActorModel.Add( shadingModeButton ); //Text label title for changing model or shading mode. @@ -209,7 +209,7 @@ public: pauseButton.ClickedSignal().Connect( this, &MeshVisualController::OnPauseClicked ); pauseButton.SetParentOrigin( Vector3( 0.5, 1.0 - BUTTONS_OFFSET_BOTTOM, 0.5 ) ); pauseButton.SetAnchorPoint( AnchorPoint::CENTER ); - pauseButton.SetLabelText( PAUSE ); + pauseButton.SetProperty( Toolkit::Button::Property::LABEL, PAUSE ); layer.Add( pauseButton ); //Actor for positioning light position buttons. @@ -224,7 +224,7 @@ public: lightModeButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightModeClicked ); lightModeButton.SetParentOrigin( ParentOrigin::TOP_CENTER ); lightModeButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - lightModeButton.SetLabelText( FIXED ); + lightModeButton.SetProperty( Toolkit::Button::Property::LABEL, FIXED ); positionActorLight.Add( lightModeButton ); //Create button for switching between front and back light position. @@ -233,7 +233,7 @@ public: lightSideButton.ClickedSignal().Connect( this, &MeshVisualController::OnChangeLightSideClicked ); lightSideButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); lightSideButton.SetAnchorPoint( AnchorPoint::TOP_CENTER ); - lightSideButton.SetLabelText( FRONT ); + lightSideButton.SetProperty( Toolkit::Button::Property::LABEL, FRONT ); positionActorLight.Add( lightSideButton ); //Text label title for light position mode. @@ -504,7 +504,7 @@ public: mModels[i].rotationAnimation.Pause(); } - button.SetLabelText( PLAY ); + button.SetProperty( Toolkit::Button::Property::LABEL, PLAY ); } else //Unpause all animations again. { @@ -513,7 +513,7 @@ public: mModels[i].rotationAnimation.Play(); } - button.SetLabelText( PAUSE ); + button.SetProperty( Toolkit::Button::Property::LABEL, PAUSE ); } return true; @@ -528,11 +528,11 @@ public: if( mLightFixed ) { - button.SetLabelText( FIXED ); + button.SetProperty( Toolkit::Button::Property::LABEL, FIXED ); } else { - button.SetLabelText( MANUAL ); + button.SetProperty( Toolkit::Button::Property::LABEL, MANUAL ); } SetLightMode(); @@ -548,11 +548,11 @@ public: if( mLightFront ) { - button.SetLabelText( FRONT ); + button.SetProperty( Toolkit::Button::Property::LABEL, FRONT ); } else { - button.SetLabelText( BACK ); + button.SetProperty( Toolkit::Button::Property::LABEL, BACK ); } //Change light image. diff --git a/examples/model3d-view/model3d-view-example.cpp b/examples/model3d-view/model3d-view-example.cpp index 21e7553..08cb8fa 100644 --- a/examples/model3d-view/model3d-view-example.cpp +++ b/examples/model3d-view/model3d-view-example.cpp @@ -117,7 +117,7 @@ public: editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeModelClicked); editButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); editButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - editButton.SetLabelText( "Change Model" ); + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Model" ); mButtonLayer.Add( editButton ); // Create button for shader changing @@ -126,7 +126,7 @@ public: editButton.ClickedSignal().Connect( this, &Model3dViewController::OnChangeLightingClicked); editButton.SetParentOrigin( ParentOrigin::TOP_RIGHT ); editButton.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); - editButton.SetLabelText( "Change Shader" ); + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Change Shader" ); mButtonLayer.Add( editButton ); // Create button for pause/resume animation @@ -135,7 +135,7 @@ public: editButton.ClickedSignal().Connect( this, &Model3dViewController::OnPauseAnimationsClicked); editButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); editButton.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); - editButton.SetLabelText( "Pause Animations" ); + editButton.SetProperty( Toolkit::Button::Property::LABEL, "Pause Animations" ); mButtonLayer.Add( editButton ); //Create animations diff --git a/examples/motion-blur/motion-blur-example.cpp b/examples/motion-blur/motion-blur-example.cpp index 55605ba..e002e73 100644 --- a/examples/motion-blur/motion-blur-example.cpp +++ b/examples/motion-blur/motion-blur-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ #include "shared/view.h" #include #include +#include #include -#include using namespace Dali; using namespace Dali::Toolkit; @@ -176,16 +176,16 @@ public: //Add an effects icon on the right of the title mActorEffectsButton = Toolkit::PushButton::New(); - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); mActorEffectsButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnEffectButtonClicked ); mToolBar.AddControl( mActorEffectsButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); // Creates a mode button. // Create a effect toggle button. (right of toolbar) Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); - layoutButton.SetUnselectedImage( LAYOUT_IMAGE ); - layoutButton.SetSelectedImage( LAYOUT_IMAGE_SELECTED ); + layoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE ); + layoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE_SELECTED ); layoutButton.ClickedSignal().Connect( this, &MotionBlurExampleApp::OnLayoutButtonClicked); layoutButton.SetLeaveRequired( true ); mToolBar.AddControl( layoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -435,14 +435,14 @@ public: if(!mActorEffectsEnabled) { mActorEffectsEnabled = true; - mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON ); - mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON_SELECTED ); } else { mActorEffectsEnabled = false; - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); } } @@ -539,8 +539,6 @@ private: DeviceOrientation mOrientation; ///< Current Device orientation Animation mRotateAnimation; ///< Animation for rotating between landscape and portrait. - - Popup mInstructionsPopup; ///< Info Popup }; void RunTest(Application& app) diff --git a/examples/motion-stretch/motion-stretch-example.cpp b/examples/motion-stretch/motion-stretch-example.cpp index 4389907..b0105de 100644 --- a/examples/motion-stretch/motion-stretch-example.cpp +++ b/examples/motion-stretch/motion-stretch-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ #include "shared/view.h" #include #include +#include #include using namespace Dali; @@ -142,16 +143,16 @@ public: //Add an slideshow icon on the right of the title mActorEffectsButton = Toolkit::PushButton::New(); - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); mActorEffectsButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnEffectButtonClicked ); mToolBar.AddControl( mActorEffectsButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); // Creates a mode button. // Create a effect toggle button. (right of toolbar) Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); - layoutButton.SetUnselectedImage( LAYOUT_IMAGE ); - layoutButton.SetSelectedImage( LAYOUT_IMAGE_SELECTED ); + layoutButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE ); + layoutButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LAYOUT_IMAGE_SELECTED ); layoutButton.ClickedSignal().Connect( this, &MotionStretchExampleApp::OnLayoutButtonClicked); layoutButton.SetLeaveRequired( true ); mToolBar.AddControl( layoutButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -333,14 +334,14 @@ public: if(!mActorEffectsEnabled) { mActorEffectsEnabled = true; - mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON ); - mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_ON_ICON_SELECTED ); } else { mActorEffectsEnabled = false; - mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); - mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON ); + mActorEffectsButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, EFFECTS_OFF_ICON_SELECTED ); } } diff --git a/examples/native-image-source/native-image-source-example.cpp b/examples/native-image-source/native-image-source-example.cpp index cf9304b..f9f7a54 100644 --- a/examples/native-image-source/native-image-source-example.cpp +++ b/examples/native-image-source/native-image-source-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,16 +153,16 @@ public: stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent); mButtonRefreshAlways = PushButton::New(); - mButtonRefreshAlways.SetTogglableButton( true ); - mButtonRefreshAlways.SetSelected( true ); - mButtonRefreshAlways.SetLabelText( "Refresh ALWAYS" ); + mButtonRefreshAlways.SetProperty( Button::Property::TOGGLABLE, true ); + mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, true ); + mButtonRefreshAlways.SetProperty( Toolkit::Button::Property::LABEL, "Refresh ALWAYS" ); mButtonRefreshAlways.SetParentOrigin( ParentOrigin::TOP_LEFT ); mButtonRefreshAlways.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mButtonRefreshAlways.StateChangedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); stage.Add( mButtonRefreshAlways ); mButtonRefreshOnce = PushButton::New(); - mButtonRefreshOnce.SetLabelText( "Refresh ONCE" ); + mButtonRefreshOnce.SetProperty( Toolkit::Button::Property::LABEL, "Refresh ONCE" ); mButtonRefreshOnce.SetParentOrigin( ParentOrigin::TOP_RIGHT ); mButtonRefreshOnce.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); mButtonRefreshOnce.ClickedSignal().Connect( this, &NativeImageSourceController::OnButtonSelected ); @@ -246,10 +246,12 @@ public: bool OnButtonSelected( Toolkit::Button button ) { + bool isSelected = mButtonRefreshAlways.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); if( pushButton == mButtonRefreshAlways ) { - if( mButtonRefreshAlways.IsSelected() ) + if( isSelected ) { mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ALWAYS ); } @@ -260,9 +262,9 @@ public: } else if( pushButton == mButtonRefreshOnce ) { - if( mButtonRefreshAlways.IsSelected() ) + if( isSelected ) { - mButtonRefreshAlways.SetSelected( false ); + mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, false ); } mOffscreenRenderTask.SetRefreshRate( RenderTask::REFRESH_ONCE ); } diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp index 7e6c625..545f8ad 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -204,8 +205,8 @@ void NewWindowController::Create( Application& app ) } mLoseContextButton = Toolkit::PushButton::New(); - mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE ); - mLoseContextButton.SetSelectedImage( LOSE_CONTEXT_IMAGE_SELECTED ); + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE ); + mLoseContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, LOSE_CONTEXT_IMAGE_SELECTED ); mLoseContextButton.ClickedSignal().Connect( this, &NewWindowController::OnLoseContextButtonClicked ); mToolBar.AddControl( mLoseContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); diff --git a/examples/page-turn-view/page-turn-view-example.cpp b/examples/page-turn-view/page-turn-view-example.cpp index 7c40ef4..3eb9c32 100644 --- a/examples/page-turn-view/page-turn-view-example.cpp +++ b/examples/page-turn-view/page-turn-view-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -256,8 +257,8 @@ void PageTurnController::OnInit( Application& app ) Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); button.SetParentOrigin( ParentOrigin::TOP_RIGHT ); - button.SetUnselectedImage( CHANGE_IMAGE_ICON ); - button.SetSelectedImage( CHANGE_IMAGE_ICON_SELECTED ); + button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON ); + button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_IMAGE_ICON_SELECTED ); button.SetLeaveRequired( true ); button.SetScale(1.5f); button.PressedSignal().Connect( this, &PageTurnController::OnButtonClicked ); diff --git a/examples/popup/popup-example.cpp b/examples/popup/popup-example.cpp index 1caa94e..a2427ea 100644 --- a/examples/popup/popup-example.cpp +++ b/examples/popup/popup-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ #include "shared/view.h" #include #include +#include #include #include @@ -140,17 +141,17 @@ public: // Create animation button. mAnimationButton = Toolkit::PushButton::New(); - mAnimationButton.SetUnselectedImage( ANIMATION_FADE_ICON_IMAGE ); - mAnimationButton.SetSelectedImage( ANIMATION_ZOOM_ICON_IMAGE ); - mAnimationButton.SetTogglableButton( true ); + mAnimationButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, ANIMATION_FADE_ICON_IMAGE ); + mAnimationButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, ANIMATION_ZOOM_ICON_IMAGE ); + mAnimationButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); mAnimationButton.ClickedSignal().Connect( this, &PopupExample::OnAnimationClicked ); mToolBar.AddControl( mAnimationButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Create context button. mContextButton = Toolkit::PushButton::New(); - mContextButton.SetUnselectedImage( CONTEXT_DISABLED_ICON_IMAGE ); - mContextButton.SetSelectedImage( CONTEXT_ENABLED_ICON_IMAGE ); - mContextButton.SetTogglableButton( true ); + mContextButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CONTEXT_DISABLED_ICON_IMAGE ); + mContextButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CONTEXT_ENABLED_ICON_IMAGE ); + mContextButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); mContextButton.ClickedSignal().Connect( this, &PopupExample::OnContextClicked ); mToolBar.AddControl( mContextButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -176,13 +177,13 @@ public: bool OnContextClicked( Toolkit::Button button ) { - mContextual = button.IsSelected(); + mContextual = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); return true; } bool OnAnimationClicked( Toolkit::Button button ) { - mAnimationFade = !button.IsSelected(); + mAnimationFade = ! ( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ); return true; } @@ -427,7 +428,7 @@ public: { Toolkit::PushButton okayButton = Toolkit::PushButton::New(); okayButton.SetName( POPUP_CONTROL_OK_NAME ); - okayButton.SetLabelText( "OK!" ); + okayButton.SetProperty( Toolkit::Button::Property::LABEL, "OK!" ); okayButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked ); @@ -438,7 +439,7 @@ public: { Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME ); - cancelButton.SetLabelText( "Cancel" ); + cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" ); cancelButton.ClickedSignal().Connect( this, &PopupExample::OnPopupButtonClicked ); @@ -707,7 +708,7 @@ public: // From ItemFactory { Toolkit::PushButton popupButton = Toolkit::PushButton::New(); popupButton.SetName( POPUP_BUTTON_ITEMS[ itemId ].name ); - popupButton.SetLabelText( POPUP_BUTTON_ITEMS[ itemId ].text ); + popupButton.SetProperty( Toolkit::Button::Property::LABEL, POPUP_BUTTON_ITEMS[ itemId ].text ); popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); popupButton.ClickedSignal().Connect( this, &PopupExample::OnButtonClicked ); diff --git a/examples/primitive-shapes/primitive-shapes-example.cpp b/examples/primitive-shapes/primitive-shapes-example.cpp index 06e794a..cc762be 100644 --- a/examples/primitive-shapes/primitive-shapes-example.cpp +++ b/examples/primitive-shapes/primitive-shapes-example.cpp @@ -1,5 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + #include #include +#include #include using namespace Dali; @@ -170,8 +188,8 @@ public: button.SetAnchorPoint( AnchorPoint::CENTER ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); button.SetPadding( Padding( elementPadding, elementPadding, elementPadding, elementPadding ) ); - button.SetProperty( Button::Property::UNSELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) ); - button.SetProperty( Button::Property::SELECTED_STATE_IMAGE, Property::Value( BUTTON_IMAGE_URL[modelNumber] ) ); + button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] ); + button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BUTTON_IMAGE_URL[modelNumber] ); button.RegisterProperty( "modelNumber", Property::Value( modelNumber ) ); button.ClickedSignal().Connect( this, &PrimitiveShapesController::OnChangeShapeClicked ); diff --git a/examples/progress-bar/progress-bar-example.cpp b/examples/progress-bar/progress-bar-example.cpp index d63b5ec..aca1a53 100644 --- a/examples/progress-bar/progress-bar-example.cpp +++ b/examples/progress-bar/progress-bar-example.cpp @@ -143,7 +143,7 @@ private: contentTable.Add( buttonBackground ); mResetProgressButton = Toolkit::PushButton::New(); - mResetProgressButton.SetLabelText( "Reset" ); + mResetProgressButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" ); mResetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mResetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mResetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnResetProgressButtonSelected ); diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index 4d67a27..4150ac8 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -260,8 +261,8 @@ private: // Add a button to change background. (right of toolbar) mChangeTextureButton = Toolkit::PushButton::New(); - mChangeTextureButton.SetUnselectedImage( CHANGE_TEXTURE_ICON ); - mChangeTextureButton.SetSelectedImage( CHANGE_TEXTURE_ICON_SELECTED ); + mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON ); + mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON_SELECTED ); mChangeTextureButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeTexture ); toolBar.AddControl( mChangeTextureButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -269,8 +270,8 @@ private: DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Add a button to change mesh pattern. ( left of bar ) mChangeMeshButton = Toolkit::PushButton::New(); - mChangeMeshButton.SetUnselectedImage( CHANGE_MESH_ICON ); - mChangeMeshButton.SetSelectedImage( CHANGE_MESH_ICON_SELECTED ); + mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON ); + mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON_SELECTED ); mChangeMeshButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeMesh ); toolBar.AddControl( mChangeMeshButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, diff --git a/examples/scroll-view/scroll-view-example.cpp b/examples/scroll-view/scroll-view-example.cpp index d45f1c9..b7bc735 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ #include "shared/view.h" #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -33,6 +34,12 @@ const char * const TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); const char * const APPLICATION_TITLE( "ScrollView" ); const char * const EFFECT_CAROUSEL_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-carousel.png" ); const char * const EFFECT_CAROUSEL_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-carousel-selected.png" ); +const char * const EFFECT_CUBE_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-inner-cube.png" ); +const char * const EFFECT_CUBE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-inner-cube-selected.png" ); +const char * const EFFECT_SPIRAL_IMAGE( DEMO_IMAGE_DIR "icon-scroll-view-spiral.png" ); +const char * const EFFECT_SPIRAL_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-scroll-view-spiral-selected.png" ); +const char * const EFFECT_WAVE_IMAGE( DEMO_IMAGE_DIR "icon-effect-wave.png" ); +const char * const EFFECT_WAVE_IMAGE_SELECTED( DEMO_IMAGE_DIR "icon-effect-wave-selected.png" ); const Vector3 ICON_SIZE(100.0f, 100.0f, 0.0f); @@ -175,12 +182,12 @@ public: mEffectIcon[ PageCarouselEffect ] = EFFECT_CAROUSEL_IMAGE; mEffectIconSelected[ PageCarouselEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; - mEffectIcon[ PageCubeEffect ] = EFFECT_CAROUSEL_IMAGE; - mEffectIconSelected[ PageCubeEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; - mEffectIcon[ PageSpiralEffect ] = EFFECT_CAROUSEL_IMAGE; - mEffectIconSelected[ PageSpiralEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; - mEffectIcon[ PageWaveEffect ] = EFFECT_CAROUSEL_IMAGE; - mEffectIconSelected[ PageWaveEffect ] = EFFECT_CAROUSEL_IMAGE_SELECTED; + mEffectIcon[ PageCubeEffect ] = EFFECT_CUBE_IMAGE; + mEffectIconSelected[ PageCubeEffect ] = EFFECT_CUBE_IMAGE_SELECTED; + mEffectIcon[ PageSpiralEffect ] = EFFECT_SPIRAL_IMAGE; + mEffectIconSelected[ PageSpiralEffect ] = EFFECT_SPIRAL_IMAGE_SELECTED; + mEffectIcon[ PageWaveEffect ] = EFFECT_WAVE_IMAGE; + mEffectIconSelected[ PageWaveEffect ] = EFFECT_WAVE_IMAGE_SELECTED; // Create a effect change button. (right of toolbar) mEffectChangeButton = Toolkit::PushButton::New(); @@ -244,8 +251,8 @@ private: ss << APPLICATION_TITLE << ": " << EFFECT_MODE_NAME[mEffectMode]; SetTitle(ss.str()); - mEffectChangeButton.SetUnselectedImage( mEffectIcon[ mEffectMode ] ); - mEffectChangeButton.SetSelectedImage( mEffectIconSelected[ mEffectMode ] ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, mEffectIcon[ mEffectMode ] ); + mEffectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, mEffectIconSelected[ mEffectMode ] ); // remove old Effect if exists. if(mScrollViewEffect) diff --git a/examples/shadows-and-lights/shadows-and-lights-example.cpp b/examples/shadows-and-lights/shadows-and-lights-example.cpp index 7a8714b..6dac9fa 100644 --- a/examples/shadows-and-lights/shadows-and-lights-example.cpp +++ b/examples/shadows-and-lights/shadows-and-lights-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -166,8 +167,8 @@ public: // Add an effect-changing button on the right of the tool bar. Toolkit::PushButton effectChangeButton = Toolkit::PushButton::New(); - effectChangeButton.SetUnselectedImage( CHANGE_EFFECT_IMAGE ); - effectChangeButton.SetSelectedImage( CHANGE_EFFECT_IMAGE_SELECTED ); + effectChangeButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_EFFECT_IMAGE ); + effectChangeButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_EFFECT_IMAGE_SELECTED ); effectChangeButton.ClickedSignal().Connect( this, &TestApp::OnEffectButtonClicked ); toolBar.AddControl( effectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -180,8 +181,8 @@ public: //Add a reset button Toolkit::PushButton resetButton = Toolkit::PushButton::New(); - resetButton.SetUnselectedImage( RESET_ICON ); - resetButton.SetSelectedImage( RESET_ICON_SELECTED ); + resetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_ICON ); + resetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_ICON_SELECTED ); resetButton.ClickedSignal().Connect( this, &TestApp::OnResetPressed ); toolBar.AddControl( resetButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index 5e03efa..7d2962a 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -800,7 +800,7 @@ public: // From ItemFactory { Toolkit::PushButton popupButton = Toolkit::PushButton::New(); popupButton.SetName( TABLEVIEW_BUTTON_ITEMS[ itemId ].name ); - popupButton.SetLabelText( TABLEVIEW_BUTTON_ITEMS[ itemId ].text ); + popupButton.SetProperty( Toolkit::Button::Property::LABEL, TABLEVIEW_BUTTON_ITEMS[ itemId ].text ); popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); diff --git a/examples/styling/styling-application.cpp b/examples/styling/styling-application.cpp index ffd0aaa..19a1411 100644 --- a/examples/styling/styling-application.cpp +++ b/examples/styling/styling-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -188,7 +188,7 @@ void StylingApplication::Create( Application& application ) mRadioButtons[i].SetName( radioButtonStyleName.str() ); mRadioButtons[i].SetParentOrigin( ParentOrigin::TOP_LEFT ); mRadioButtons[i].SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mRadioButtons[i].SetSelected( false ); + mRadioButtons[i].SetProperty( Button::Property::SELECTED, false ); mRadioButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnButtonStateChange ); radioButtonsLayout.AddChild( mRadioButtons[i], TableView::CellPosition( i, 0 ) ); @@ -197,7 +197,7 @@ void StylingApplication::Create( Application& application ) radioButtonsLayout.SetCellAlignment( TableView::CellPosition( i, 1 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER ); } - mRadioButtons[0].SetSelected( true ); + mRadioButtons[0].SetProperty( Button::Property::SELECTED, true ); mImagePlacement = Actor::New(); mImagePlacement.SetParentOrigin( ParentOrigin::CENTER ); @@ -265,7 +265,7 @@ void StylingApplication::Create( Application& application ) mCheckButtons[i].SetName( checkBoxStyleName.str() ); mCheckButtons[i].SetParentOrigin( ParentOrigin::CENTER ); mCheckButtons[i].SetAnchorPoint( AnchorPoint::CENTER ); - mCheckButtons[i].SetSelected( true ); + mCheckButtons[i].SetProperty( Button::Property::SELECTED, true ); mCheckButtons[i].StateChangedSignal().Connect( this, &StylingApplication::OnCheckButtonChange ); mCheckButtons[i].RegisterProperty( "channel", i, Property::READ_WRITE ); @@ -309,7 +309,7 @@ void StylingApplication::Create( Application& application ) } mResetButton = PushButton::New(); - mResetButton.SetLabelText( "Reset" ); + mResetButton.SetProperty( Toolkit::Button::Property::LABEL, "Reset" ); mResetButton.SetName("ResetButton"); mResetButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mResetButton.ClickedSignal().Connect( this, &StylingApplication::OnResetClicked ); @@ -349,9 +349,9 @@ void StylingApplication::Create( Application& application ) mThemeButtons[i].ClickedSignal().Connect( this, &StylingApplication::OnThemeButtonClicked ); themeButtonLayout.AddChild( mThemeButtons[i], TableView::CellPosition( 0, 1+i ) ); } - mThemeButtons[0].SetLabelText( "Lite" ); // Lightweight changes on top of Dali - mThemeButtons[1].SetLabelText( "App1" ); // Different application style - mThemeButtons[2].SetLabelText( "App2" ); + mThemeButtons[0].SetProperty( Toolkit::Button::Property::LABEL, "Lite" ); // Lightweight changes on top of Dali + mThemeButtons[1].SetProperty( Toolkit::Button::Property::LABEL, "App1" ); // Different application style + mThemeButtons[2].SetProperty( Toolkit::Button::Property::LABEL, "App2" ); contentLayout.Add( themeButtonLayout ); } @@ -438,7 +438,7 @@ Popup StylingApplication::CreateResetPopup() PushButton okayButton = PushButton::New(); okayButton.SetName( POPUP_CONTROL_OK_NAME ); okayButton.SetStyleName( POPUP_CONTROL_OK_NAME ); - okayButton.SetLabelText( "Ok!" ); + okayButton.SetProperty( Toolkit::Button::Property::LABEL, "Ok!" ); okayButton.ClickedSignal().Connect( this, &StylingApplication::OnReset ); okayButton.SetParentOrigin( ParentOrigin::CENTER ); okayButton.SetAnchorPoint( AnchorPoint::CENTER ); @@ -448,7 +448,7 @@ Popup StylingApplication::CreateResetPopup() PushButton cancelButton = PushButton::New(); cancelButton.SetName( POPUP_CONTROL_CANCEL_NAME ); cancelButton.SetStyleName( POPUP_CONTROL_CANCEL_NAME ); - cancelButton.SetLabelText( "Cancel" ); + cancelButton.SetProperty( Toolkit::Button::Property::LABEL, "Cancel" ); cancelButton.ClickedSignal().Connect( this, &StylingApplication::OnResetCancelled ); cancelButton.SetParentOrigin( ParentOrigin::CENTER ); cancelButton.SetAnchorPoint( AnchorPoint::CENTER ); @@ -484,20 +484,20 @@ bool StylingApplication::OnButtonStateChange( Button button ) // Todo: save / restore slider states per image - if( button.IsSelected() ) + if( button.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { ImageChannelControl prevIcc = mImageChannelControl; - if( mRadioButtons[0].IsSelected() ) + if( mRadioButtons[0].GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { mImageChannelControl = mIcc1; } - else if( mRadioButtons[1].IsSelected() ) + else if( mRadioButtons[1].GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { mImageChannelControl = mIcc2; } - else if( mRadioButtons[2].IsSelected() ) + else if( mRadioButtons[2].GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { mImageChannelControl = mIcc3; } diff --git a/examples/super-blur-bloom/super-blur-bloom-example.cpp b/examples/super-blur-bloom/super-blur-bloom-example.cpp index 088692a..d466e9f 100644 --- a/examples/super-blur-bloom/super-blur-bloom-example.cpp +++ b/examples/super-blur-bloom/super-blur-bloom-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,9 @@ */ #include #include -#include #include +#include +#include #include "shared/view.h" #include "shared/utility.h" @@ -81,8 +82,9 @@ private: // Add a button to change background. (right of toolbar) Toolkit::PushButton changeBackgroundButton = Toolkit::PushButton::New(); - changeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON ); - changeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED ); + changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON ); + changeBackgroundButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BACKGROUND_ICON_SELECTED ); + changeBackgroundButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBackgroundIconClicked ); mToolBar.AddControl( changeBackgroundButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -91,8 +93,9 @@ private: // Add a button to change the blur view. (left of toolbar) Toolkit::PushButton changeBlurButton = Toolkit::PushButton::New(); - changeBlurButton.SetUnselectedImage( CHANGE_BLUR_ICON ); - changeBlurButton.SetSelectedImage( CHANGE_BLUR_ICON_SELECTED ); + changeBlurButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON ); + changeBlurButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_BLUR_ICON_SELECTED ); + changeBlurButton.ClickedSignal().Connect( this, &BlurExample::OnChangeBlurIconClicked ); mToolBar.AddControl( changeBlurButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, diff --git a/examples/text-editor/text-editor-example.cpp b/examples/text-editor/text-editor-example.cpp index 209c280..23d9dbb 100644 --- a/examples/text-editor/text-editor-example.cpp +++ b/examples/text-editor/text-editor-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ // EXTERNAL INCLUDES #include -#include +#include #include // INTERNAL INCLUDES @@ -140,8 +140,7 @@ public: mColorButtonOption.SetParentOrigin( ParentOrigin::CENTER ); mColorButtonOption.SetAnchorPoint( AnchorPoint::CENTER ); - mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, Color::BLACK ); - mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, Color::BLACK ); + SetButtonColor( mColorButtonOption, Color::BLACK ); mColorButtonOption.ClickedSignal().Connect( this, &TextEditorExample::OnChangeColorButtonClicked ); mColorContainer.Add( mColorButtonOption ); @@ -208,8 +207,7 @@ public: s << "color" << index; button.SetName( s.str() ); - button.SetProperty( Button::Property::UNSELECTED_COLOR, COLORS[index] ); - button.SetProperty( Button::Property::SELECTED_COLOR, COLORS[index] ); + SetButtonColor( button, COLORS[index] ); button.ClickedSignal().Connect( this, &TextEditorExample::OnColorButtonClicked ); @@ -253,8 +251,7 @@ public: mEditor.SetProperty( TextEditor::Property::INPUT_COLOR, color ); } - mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); - mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + SetButtonColor( mColorButtonOption, color ); mButtonContainer.SetVisible( false ); mButtonContainer.SetSensitive( false ); @@ -267,14 +264,22 @@ public: if( TextEditor::InputStyle::NONE != static_cast( mask & TextEditor::InputStyle::COLOR ) ) { const Vector4 color = editor.GetProperty( TextEditor::Property::INPUT_COLOR ).Get(); - - mColorButtonOption.SetProperty( Button::Property::UNSELECTED_COLOR, color ); - mColorButtonOption.SetProperty( Button::Property::SELECTED_COLOR, color ); + SetButtonColor( mColorButtonOption, color ); } editor.Reset(); } + void SetButtonColor( Button& button, const Vector4& color ) + { + Property::Map colorVisualMap; + colorVisualMap.Add( Visual::Property::TYPE, Visual::COLOR ) + .Add( ColorVisual::Property::MIX_COLOR, color ); + + button.SetProperty( DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, colorVisualMap ); + button.SetProperty( DevelButton::Property::SELECTED_BACKGROUND_VISUAL, colorVisualMap ); + } + private: Application& mApplication; diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index 1b21b48..5e025b1 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ // EXTERNAL INCLUDES #include +#include #include #include #include @@ -86,8 +87,8 @@ public: PushButton CreateFolderButton() { PushButton button = PushButton::New(); - button.SetUnselectedImage( FOLDER_ICON_IMAGE ); - button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE ); + button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); + button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); @@ -151,7 +152,7 @@ public: { Property::Value text = mField.GetProperty( TextField::Property::TEXT ); mButtonLabel = text.Get< std::string >(); - mButton.SetLabelText( mButtonLabel ); + mButton.SetProperty( Toolkit::Button::Property::LABEL, mButtonLabel ); } // Hide & discard the pop-up @@ -176,7 +177,7 @@ public: { Property::Value text = mField.GetProperty( TextField::Property::TEXT ); mButtonLabel = text.Get< std::string >(); - mButton.SetLabelText( mButtonLabel ); + mButton.SetProperty( Toolkit::Button::Property::LABEL, mButtonLabel ); mField.ClearKeyInputFocus(); } break; diff --git a/examples/transitions/transition-application.cpp b/examples/transitions/transition-application.cpp index ab0daf0..cf4312b 100644 --- a/examples/transitions/transition-application.cpp +++ b/examples/transitions/transition-application.cpp @@ -125,9 +125,9 @@ void TransitionApplication::Create( Application& application ) mActionButtons[i].ClickedSignal().Connect( this, &TransitionApplication::OnActionButtonClicked ); actionButtonLayout.AddChild( mActionButtons[i], TableView::CellPosition( 0, 1+i ) ); } - mActionButtons[0].SetLabelText( "Bounce" ); - mActionButtons[1].SetLabelText( "X" ); - mActionButtons[2].SetLabelText( "Y" ); + mActionButtons[0].SetProperty( Toolkit::Button::Property::LABEL, "Bounce" ); + mActionButtons[1].SetProperty( Toolkit::Button::Property::LABEL, "X" ); + mActionButtons[2].SetProperty( Toolkit::Button::Property::LABEL, "Y" ); contentLayout.Add( actionButtonLayout ); contentLayout.SetFitHeight(2); diff --git a/examples/video-view/video-view-example.cpp b/examples/video-view/video-view-example.cpp index cb29b8d..371c7a5 100644 --- a/examples/video-view/video-view-example.cpp +++ b/examples/video-view/video-view-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ #include #include +#include using namespace Dali; using namespace Toolkit; @@ -150,20 +151,20 @@ class VideoViewController: public ConnectionTracker mResetButton.SetVisible( false ); mResetButton.SetDisabled( true ); - mPlayButton.SetUnselectedImage( PLAY_IMAGE ); - mPlayButton.SetSelectedImage( PLAY_IMAGE ); - mPauseButton.SetUnselectedImage( PAUSE_IMAGE ); - mPauseButton.SetSelectedImage( PAUSE_IMAGE ); + mPlayButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PLAY_IMAGE ); + mPlayButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PLAY_IMAGE ); + mPauseButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE ); + mPauseButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, PAUSE_IMAGE ); - mStopButton.SetUnselectedImage( STOP_IMAGE ); - mStopButton.SetSelectedImage( STOP_IMAGE ); - mResetButton.SetUnselectedImage( RESET_IMAGE ); - mResetButton.SetSelectedImage( RESET_IMAGE ); + mStopButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, STOP_IMAGE ); + mStopButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, STOP_IMAGE ); + mResetButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, RESET_IMAGE ); + mResetButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, RESET_IMAGE ); - mBackwardButton.SetUnselectedImage( BACKWARD_IMAGE ); - mBackwardButton.SetSelectedImage( BACKWARD_IMAGE ); - mForwardButton.SetUnselectedImage( FORWARD_IMAGE ); - mForwardButton.SetSelectedImage( FORWARD_IMAGE ); + mBackwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE ); + mBackwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, BACKWARD_IMAGE ); + mForwardButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FORWARD_IMAGE ); + mForwardButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FORWARD_IMAGE ); mPanGestureDetector = PanGestureDetector::New(); mPanGestureDetector.Attach( mVideoView ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index ff82a33..5d81885 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.2.21 +Version: 1.2.22 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/images/shape-bubble.png b/resources/images/shape-bubble.png new file mode 100644 index 0000000..f100b8e --- /dev/null +++ b/resources/images/shape-bubble.png diff --git a/resources/images/shape-circle.png b/resources/images/shape-circle.png new file mode 100644 index 0000000..7b72827 --- /dev/null +++ b/resources/images/shape-circle.png diff --git a/resources/po/as.po b/resources/po/as.po index 5d9f329..a384ac3 100755 --- a/resources/po/as.po +++ b/resources/po/as.po @@ -13,6 +13,9 @@ msgstr "বেলুন" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "ক্লিক্" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "Clipping" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "ঝুৰ্" diff --git a/resources/po/de.po b/resources/po/de.po index b76a0f5..ed6593d 100755 --- a/resources/po/de.po +++ b/resources/po/de.po @@ -13,6 +13,9 @@ msgstr "Schaumbildung" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "Tasten" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "Clipping" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "Farbverlauf" diff --git a/resources/po/en_GB.po b/resources/po/en_GB.po index 2bc0e21..933be8b 100755 --- a/resources/po/en_GB.po +++ b/resources/po/en_GB.po @@ -13,6 +13,9 @@ msgstr "Bubbles" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "Buttons" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "Clipping" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "Colour Gradient" diff --git a/resources/po/en_US.po b/resources/po/en_US.po index 501c311..c5a288d 100755 --- a/resources/po/en_US.po +++ b/resources/po/en_US.po @@ -13,6 +13,9 @@ msgstr "Bubbles" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "Buttons" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "Clipping" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "Color Gradient" diff --git a/resources/po/es.po b/resources/po/es.po index 49a7683..2ea1dee 100755 --- a/resources/po/es.po +++ b/resources/po/es.po @@ -13,6 +13,9 @@ msgstr "Burbujas" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "Botones" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "Recorte" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "Gradiente de color" diff --git a/resources/po/fi.po b/resources/po/fi.po index 7cd5658..476f975 100755 --- a/resources/po/fi.po +++ b/resources/po/fi.po @@ -13,6 +13,9 @@ msgstr "Kuplat" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "Painikkeet" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "Leikkaaminen" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "Liukuväri" diff --git a/resources/po/ko.po b/resources/po/ko.po index e8d35a8..659b301 100755 --- a/resources/po/ko.po +++ b/resources/po/ko.po @@ -1,7 +1,6 @@ msgid "DALI_DEMO_STR_TITLE_ANIMATED_IMAGES" msgstr "애니메이션 이미지" - msgid "DALI_DEMO_STR_TITLE_ANIMATED_SHAPES" msgstr "애니메이션 모양" @@ -14,6 +13,9 @@ msgstr "방울" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "버튼" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "깎는" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "색상 그라디언트" diff --git a/resources/po/ml.po b/resources/po/ml.po index 525722e..7d37255 100755 --- a/resources/po/ml.po +++ b/resources/po/ml.po @@ -13,6 +13,9 @@ msgstr "കുമിള" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "ബട്ടണുകൾ" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "ക്ലിപ്പിംഗ്" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "വർണ്ണ ഗ്രേഡിയന്റ്" diff --git a/resources/po/ur.po b/resources/po/ur.po index 4dbbf49..cb07dd1 100755 --- a/resources/po/ur.po +++ b/resources/po/ur.po @@ -13,6 +13,9 @@ msgstr "بلبلے" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "بٹنوں" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "کاٹنا" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "رنگ میلان" diff --git a/resources/po/zn_CH.po b/resources/po/zn_CH.po index 035b724..68087e2 100755 --- a/resources/po/zn_CH.po +++ b/resources/po/zn_CH.po @@ -13,6 +13,9 @@ msgstr "气泡" msgid "DALI_DEMO_STR_TITLE_BUTTONS" msgstr "按钮" +msgid "DALI_DEMO_STR_TITLE_CLIPPING" +msgstr "剪裁" + msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT" msgstr "颜色梯度" diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index c8b3283..47f8f4f 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_BLOCKS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BLOCKS") #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES") #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS") +#define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING") #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT") #define DALI_DEMO_STR_TITLE_CONTACT_CARDS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS") #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION") @@ -93,6 +94,7 @@ extern "C" #define DALI_DEMO_STR_TITLE_BLOCKS "Blocks" #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles" #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons" +#define DALI_DEMO_STR_TITLE_CLIPPING "Clipping" #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient" #define DALI_DEMO_STR_TITLE_CONTACT_CARDS "Contact Cards" #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect"