From: Xiangyin Ma Date: Thu, 12 Jan 2017 11:48:22 +0000 (+0000) Subject: Remove the usage of deprecated Button APIS X-Git-Tag: dali_1.2.22~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-demo.git;a=commitdiff_plain;h=214f363041053a01ead590d0527dc6c08f7fe961 Remove the usage of deprecated Button APIS Exclude SetLabelText() which will be replaced after the LABEL property supports both MAP and STRING type. Change-Id: I7aae9bdacbe85ff8b07f0e0ac122db2f50bf24bc --- 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..5904504 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 ) ); @@ -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 ); @@ -315,7 +315,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::SELECTED, true ); + mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); @@ -347,7 +348,7 @@ class ButtonsController: public ConnectionTracker contentTable.Add( toggleBackground ); mToggleButton = Toolkit::PushButton::New(); - mToggleButton.SetTogglableButton( true ); + mToggleButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); mToggleButton.SetLabelText( "Unselected" ); mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); @@ -373,7 +374,8 @@ 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" ); } @@ -388,33 +390,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 ) + { + return true; + } + + if( button.GetName() == "radioSelectEnable" ) { - mUpdateButton.SetDisabled( false ); + 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 +430,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,9 +447,10 @@ 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"); } @@ -453,7 +462,7 @@ class ButtonsController: public ConnectionTracker if( button.GetName() == "checkbox2" ) { - if( button.IsSelected() ) + if( isSelected ) { button.SetLabelText("CheckBox2 is selected"); } @@ -465,7 +474,7 @@ class ButtonsController: public ConnectionTracker if( button.GetName() == "checkbox3" ) { - if( button.IsSelected() ) + if( isSelected ) { button.SetLabelText("CheckBox3 is selected"); } 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..6898dbd 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,8 +225,8 @@ 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; 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-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/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..d642450 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 ) ); diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index db6d4a6..02cc1ba 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 ); @@ -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 ); @@ -479,15 +479,21 @@ class LoggingController: public ConnectionTracker 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/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..828bef1 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,8 +153,8 @@ public: stage.KeyEventSignal().Connect(this, &NativeImageSourceController::OnKeyEvent); mButtonRefreshAlways = PushButton::New(); - mButtonRefreshAlways.SetTogglableButton( true ); - mButtonRefreshAlways.SetSelected( true ); + mButtonRefreshAlways.SetProperty( Button::Property::TOGGLABLE, true ); + mButtonRefreshAlways.SetProperty( Button::Property::SELECTED, true ); mButtonRefreshAlways.SetLabelText( "Refresh ALWAYS" ); mButtonRefreshAlways.SetParentOrigin( ParentOrigin::TOP_LEFT ); mButtonRefreshAlways.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -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..cebffd9 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; } 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/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/styling/styling-application.cpp b/examples/styling/styling-application.cpp index ffd0aaa..4a6c8ea 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 ); @@ -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..70e7e7d 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 ); 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 );