From 8d194661ee2c5a366291824b13f7d058028456e0 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Thu, 16 Jul 2015 18:43:02 +0100 Subject: [PATCH] Removed Actor API from button. Added Icon properties --- examples/atlas/atlas-example.cpp | 4 ++-- examples/bubble-effect/bubble-effect-example.cpp | 8 ++++---- examples/builder/examples.cpp | 4 ++-- examples/buttons/buttons-example.cpp | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- examples/cluster/cluster-example.cpp | 22 +++++++++++----------- examples/cube-transition-effect/cube-transition-effect-example.cpp | 48 ++++++++++++++---------------------------------- examples/dissolve-effect/dissolve-effect-example.cpp | 40 ++++++++++++---------------------------- examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp | 20 ++++++-------------- examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp | 6 ++---- examples/item-view/item-view-example.cpp | 38 +++++++++++++++++++------------------- examples/logging/logging-example.cpp | 18 ++++++++---------- examples/motion-blur/motion-blur-example.cpp | 26 ++++++++------------------ examples/motion-stretch/motion-stretch-example.cpp | 26 ++++++++------------------ examples/new-window/new-window-example.cpp | 4 ++-- examples/radial-menu/radial-menu-example.cpp | 28 ++++++++++------------------ examples/refraction-effect/refraction-effect-example.cpp | 8 ++++---- examples/scroll-view/scroll-view-example.cpp | 22 +++++++++++----------- examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp | 12 ++++-------- examples/size-negotiation/size-negotiation-example.cpp | 30 +++++++++++++++--------------- examples/text-field/text-field-example.cpp | 15 +++++++-------- resources/images/folder_appicon_empty_open_bg.png | Bin 0 -> 6362 bytes resources/scripts/button.json | 53 +++++++---------------------------------------------- resources/scripts/super-blur-view.json | 18 ++---------------- resources/style/demo-theme.json | 2 +- 24 files changed, 226 insertions(+), 339 deletions(-) create mode 100644 resources/images/folder_appicon_empty_open_bg.png diff --git a/examples/atlas/atlas-example.cpp b/examples/atlas/atlas-example.cpp index 425fd44..e6b987c 100644 --- a/examples/atlas/atlas-example.cpp +++ b/examples/atlas/atlas-example.cpp @@ -72,8 +72,8 @@ public: "Atlas" ); mLoseContextButton = Toolkit::PushButton::New(); - mLoseContextButton.SetButtonImage( ResourceImage::New( LOSE_CONTEXT_IMAGE ) ); - mLoseContextButton.SetSelectedImage( ResourceImage::New( LOSE_CONTEXT_IMAGE_SELECTED ) ); + mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE ); + mLoseContextButton.SetSelectedImage( 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 268e393..c0b6c00 100644 --- a/examples/bubble-effect/bubble-effect-example.cpp +++ b/examples/bubble-effect/bubble-effect-example.cpp @@ -111,8 +111,8 @@ private: // Add a button to change background. (right of toolbar) mChangeBackgroundButton = Toolkit::PushButton::New(); - mChangeBackgroundButton.SetButtonImage( ResourceImage::New( CHANGE_BACKGROUND_ICON ) ); - mChangeBackgroundButton.SetSelectedImage( ResourceImage::New( CHANGE_BACKGROUND_ICON_SELECTED ) ); + mChangeBackgroundButton.SetUnselectedImage( CHANGE_BACKGROUND_ICON ); + mChangeBackgroundButton.SetSelectedImage( CHANGE_BACKGROUND_ICON_SELECTED ); mChangeBackgroundButton.ClickedSignal().Connect( this, &BubbleEffectExample::OnChangeIconClicked ); toolBar.AddControl( mChangeBackgroundButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -120,8 +120,8 @@ private: DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Add a button to change bubble shape. ( left of bar ) mChangeBubbleShapeButton = Toolkit::PushButton::New(); - mChangeBubbleShapeButton.SetButtonImage( ResourceImage::New( CHANGE_BUBBLE_SHAPE_ICON ) ); - mChangeBubbleShapeButton.SetSelectedImage( ResourceImage::New( CHANGE_BUBBLE_SHAPE_ICON_SELECTED ) ); + mChangeBubbleShapeButton.SetUnselectedImage( CHANGE_BUBBLE_SHAPE_ICON ); + mChangeBubbleShapeButton.SetSelectedImage( 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 4e83575..f302d9f 100644 --- a/examples/builder/examples.cpp +++ b/examples/builder/examples.cpp @@ -513,8 +513,8 @@ public: // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); - editButton.SetButtonImage( ResourceImage::New( EDIT_IMAGE ) ); - editButton.SetSelectedImage( ResourceImage::New( EDIT_IMAGE_SELECTED ) ); + editButton.SetUnselectedImage( EDIT_IMAGE ); + editButton.SetSelectedImage( EDIT_IMAGE_SELECTED ); editButton.ClickedSignal().Connect( this, &ExampleApp::OnToolSelectLayout); editButton.SetLeaveRequired( true ); mToolBar.AddControl( editButton, 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 c6cec93..d312418 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -49,6 +49,7 @@ const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); // Layout sizes const int RADIO_LABEL_THUMBNAIL_SIZE = 60; +const int RADIO_LABEL_THUMBNAIL_SIZE_SMALL = 40; const int RADIO_IMAGE_SPACING = 8; const int BUTTON_HEIGHT = 48; @@ -141,54 +142,71 @@ class ButtonsController: public ConnectionTracker radioGroup2Background.AddChild( radioButtonsGroup2, Toolkit::TableView::CellPosition( 0, 0 ) ); + // TableView to lay out 3x Radio buttons on the left, and 3x Image thumbnails on the right. + Toolkit::TableView imageSelectTableView = Toolkit::TableView::New( 3, 2 ); + imageSelectTableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + imageSelectTableView.SetFitHeight( 0 ); + imageSelectTableView.SetFitHeight( 1 ); + imageSelectTableView.SetFitHeight( 2 ); + imageSelectTableView.SetFitWidth( 0 ); + imageSelectTableView.SetFitWidth( 1 ); + imageSelectTableView.SetCellPadding( Vector2( 6.0f, 0.0f ) ); + + radioButtonsGroup2.Add( imageSelectTableView ); + int radioY = 0; // Radio 1 { - ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) ); - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); - mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( imageActor ); + ImageActor image = ImageActor::New( ResourceImage::New( SMALL_IMAGE_1 ) ); + image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + + mRadioButtonImage1 = Dali::Toolkit::RadioButton::New( "1" ); mRadioButtonImage1.SetParentOrigin( ParentOrigin::TOP_LEFT ); mRadioButtonImage1.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mRadioButtonImage1.SetPosition( 0, DP(radioY) ); mRadioButtonImage1.SetSelected( true ); - radioButtonsGroup2.Add( mRadioButtonImage1 ); + imageSelectTableView.AddChild( mRadioButtonImage1, Toolkit::TableView::CellPosition( 0, 0 ) ); + imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); } // Radio 2 { radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; - ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) ); - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + ImageActor image = ImageActor::New( ResourceImage::New( SMALL_IMAGE_2 ) ); + image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); - mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( imageActor ); + mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( "2" ); mRadioButtonImage2.SetParentOrigin( ParentOrigin::TOP_LEFT ); mRadioButtonImage2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mRadioButtonImage2.SetPosition( 0, DP(radioY) ); - radioButtonsGroup2.Add( mRadioButtonImage2 ); + imageSelectTableView.AddChild( mRadioButtonImage2, Toolkit::TableView::CellPosition( 1, 0 ) ); + imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 1, 1 ) ); } // Radio 3 { radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; - ImageActor imageActor = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) ); - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + ImageActor image = ImageActor::New( ResourceImage::New( SMALL_IMAGE_3 ) ); + image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); - mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( imageActor ); + mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( "3" ); mRadioButtonImage3.SetParentOrigin( ParentOrigin::TOP_LEFT ); mRadioButtonImage3.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mRadioButtonImage3.SetPosition( 0, DP(radioY) ); - radioButtonsGroup2.Add( mRadioButtonImage3 ); + imageSelectTableView.AddChild( mRadioButtonImage3, Toolkit::TableView::CellPosition( 2, 0 ) ); + imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 2, 1 ) ); } // Create select button mUpdateButton = Toolkit::PushButton::New(); - mUpdateButton.SetLabel( "Select" ); + mUpdateButton.SetLabelText( "Select" ); + mUpdateButton.SetName( "select-button" ); mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mUpdateButton.ClickedSignal().Connect( this, &ButtonsController::OnButtonClicked ); @@ -227,26 +245,29 @@ class ButtonsController: public ConnectionTracker radioGroup1Background.Add( radioButtonsGroup1 ); + // TableView to lay out 2x Radio buttons on the left, and 1x Tick image on the right. + Toolkit::TableView tableView = Toolkit::TableView::New( 2, 2 ); + tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); + tableView.SetFitHeight( 0 ); + tableView.SetFitHeight( 1 ); + tableView.SetFitWidth( 0 ); + tableView.SetFitWidth( 1 ); + + Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( "Select enabled" ); + textLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); + + ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); + imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); + tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); + + radioButtonsGroup1.Add( tableView ); + // First radio button { - Toolkit::TableView tableView = Toolkit::TableView::New( 1, 2 ); - tableView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - tableView.SetFitHeight( 0 ); - tableView.SetFitWidth( 0 ); - tableView.SetFitWidth( 1 ); - - Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( "Select enabled" ); - textLabel.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH ); - textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); - textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); - tableView.AddChild( textLabel, Toolkit::TableView::CellPosition( 0, 0 ) ); - - ImageActor imageActor = ImageActor::New( ResourceImage::New( ENABLED_IMAGE ) ); - imageActor.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); - imageActor.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); - tableView.AddChild( imageActor, Toolkit::TableView::CellPosition( 0, 1 ) ); - - Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( tableView ); + Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( "Select enabled" ); radioButton.SetName( "radio-select-enable" ); radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); @@ -255,7 +276,7 @@ class ButtonsController: public ConnectionTracker radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton ); - radioButtonsGroup1.Add( radioButton ); + tableView.AddChild( radioButton, Toolkit::TableView::CellPosition( 0, 0 ) ); } // Second radio button @@ -268,7 +289,7 @@ class ButtonsController: public ConnectionTracker radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton ); - radioButtonsGroup1.Add( radioButton ); + tableView.AddChild( radioButton, Toolkit::TableView::CellPosition( 1, 0 ) ); } // CheckBoxes @@ -276,7 +297,7 @@ class ButtonsController: public ConnectionTracker checkBoxBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); checkBoxBackground.SetBackgroundColor( BACKGROUND_COLOUR ); - checkBoxBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) ); + checkBoxBackground.SetCellPadding( Size( MARGIN_SIZE / 2.0f, MARGIN_SIZE / 2.0f ) ); for( unsigned int i = 0; i < checkBoxBackground.GetRows(); ++i ) { @@ -288,7 +309,7 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton1 = Toolkit::CheckBoxButton::New(); mCheckboxButton1.SetName( "checkbox1" ); - mCheckboxButton1.SetLabel( "CheckBox1 is unselected" ); + mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" ); mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); checkBoxBackground.Add( mCheckboxButton1 ); @@ -297,7 +318,7 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton2 = Toolkit::CheckBoxButton::New(); mCheckboxButton2.SetName( "checkbox2" ); - mCheckboxButton2.SetLabel( "CheckBox2 is selected" ); + mCheckboxButton2.SetLabelText( "CheckBox2 is selected" ); mCheckboxButton2.SetSelected( true ); mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); @@ -307,7 +328,7 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton3 = Toolkit::CheckBoxButton::New(); mCheckboxButton3.SetName( "checkbox3" ); - mCheckboxButton3.SetLabel( "CheckBox3 is unselected" ); + mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" ); mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); checkBoxBackground.Add( mCheckboxButton3 ); @@ -329,7 +350,7 @@ class ButtonsController: public ConnectionTracker mToggleButton = Toolkit::PushButton::New(); mToggleButton.SetTogglableButton( true ); - mToggleButton.SetLabel( "Unselected" ); + mToggleButton.SetLabelText( "Unselected" ); mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mToggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected ); @@ -356,11 +377,11 @@ class ButtonsController: public ConnectionTracker { if( button.IsSelected() ) { - pushButton.SetLabel( "Selected" ); + pushButton.SetLabelText( "Selected" ); } else { - pushButton.SetLabel( "Unselected" ); + pushButton.SetLabelText( "Unselected" ); } } @@ -424,11 +445,11 @@ class ButtonsController: public ConnectionTracker { if( button.IsSelected() ) { - button.SetLabel("CheckBox1 is selected"); + button.SetLabelText("CheckBox1 is selected"); } else { - button.SetLabel("CheckBox1 is unselected"); + button.SetLabelText("CheckBox1 is unselected"); } } @@ -436,11 +457,11 @@ class ButtonsController: public ConnectionTracker { if( button.IsSelected() ) { - button.SetLabel("CheckBox2 is selected"); + button.SetLabelText("CheckBox2 is selected"); } else { - button.SetLabel("CheckBox2 is unselected"); + button.SetLabelText("CheckBox2 is unselected"); } } @@ -448,11 +469,11 @@ class ButtonsController: public ConnectionTracker { if( button.IsSelected() ) { - button.SetLabel("CheckBox3 is selected"); + button.SetLabelText("CheckBox3 is selected"); } else { - button.SetLabel("CheckBox3 is unselected"); + button.SetLabelText("CheckBox3 is unselected"); } } diff --git a/examples/cluster/cluster-example.cpp b/examples/cluster/cluster-example.cpp index 0bc4532..d13389c 100644 --- a/examples/cluster/cluster-example.cpp +++ b/examples/cluster/cluster-example.cpp @@ -325,8 +325,8 @@ struct ShrinkConstraint struct ButtonImages { - Image mButtonImage; - Image mSelectedImage; + std::string mButtonImage; + std::string mSelectedImage; }; @@ -390,14 +390,14 @@ public: mContentLayer.SetProperty(Layer::Property::BEHAVIOR, "Dali::Layer::LAYER_3D"); // Create a effect toggle button. (right of toolbar) - mLayoutButtonImages[ NO_EFFECT ].mButtonImage = ResourceImage::New( LAYOUT_NONE_IMAGE ); - mLayoutButtonImages[ NO_EFFECT ].mSelectedImage = ResourceImage::New( LAYOUT_NONE_IMAGE_SELECTED ); - mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mButtonImage = ResourceImage::New( LAYOUT_MOTION_BLUR_IMAGE ); - mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mSelectedImage = ResourceImage::New( LAYOUT_MOTION_BLUR_IMAGE_SELECTED ); - mLayoutButtonImages[ CAROUSEL_EFFECT ].mButtonImage = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE ); - mLayoutButtonImages[ CAROUSEL_EFFECT ].mSelectedImage = ResourceImage::New( LAYOUT_CAROUSEL_IMAGE_SELECTED ); - mLayoutButtonImages[ SPHERE_EFFECT ].mButtonImage = ResourceImage::New( LAYOUT_SPHERE_IMAGE ); - mLayoutButtonImages[ SPHERE_EFFECT ].mSelectedImage = ResourceImage::New( LAYOUT_SPHERE_IMAGE_SELECTED ); + mLayoutButtonImages[ NO_EFFECT ].mButtonImage = LAYOUT_NONE_IMAGE; + mLayoutButtonImages[ NO_EFFECT ].mSelectedImage = LAYOUT_NONE_IMAGE_SELECTED; + mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mButtonImage = LAYOUT_MOTION_BLUR_IMAGE; + mLayoutButtonImages[ MOTION_BLUR_EFFECT ].mSelectedImage = LAYOUT_MOTION_BLUR_IMAGE_SELECTED; + mLayoutButtonImages[ CAROUSEL_EFFECT ].mButtonImage = LAYOUT_CAROUSEL_IMAGE; + mLayoutButtonImages[ CAROUSEL_EFFECT ].mSelectedImage = LAYOUT_CAROUSEL_IMAGE_SELECTED; + mLayoutButtonImages[ SPHERE_EFFECT ].mButtonImage = LAYOUT_SPHERE_IMAGE; + mLayoutButtonImages[ SPHERE_EFFECT ].mSelectedImage = LAYOUT_SPHERE_IMAGE_SELECTED; mLayoutButton = Toolkit::PushButton::New(); mLayoutButton.ClickedSignal().Connect( this, &ClusterController::OnEffectTouched ); @@ -631,7 +631,7 @@ public: // Remove all shader-effects from mScrollView and it's children (the clusters) mScrollView.SetPosition(Vector3::ZERO); - mLayoutButton.SetButtonImage( mLayoutButtonImages[ type ].mButtonImage ); + mLayoutButton.SetUnselectedImage( mLayoutButtonImages[ type ].mButtonImage ); mLayoutButton.SetSelectedImage( mLayoutButtonImages[ type ].mSelectedImage ); for( std::vector::iterator i = mClusterInfo.begin(); i != mClusterInfo.end(); ++i ) diff --git a/examples/cube-transition-effect/cube-transition-effect-example.cpp b/examples/cube-transition-effect/cube-transition-effect-example.cpp index a948f30..0033935 100644 --- a/examples/cube-transition-effect/cube-transition-effect-example.cpp +++ b/examples/cube-transition-effect/cube-transition-effect-example.cpp @@ -201,20 +201,10 @@ private: bool mSlideshow; Timer mViewTimer; Toolkit::PushButton mSlideshowButton; - Image mIconSlideshowStart; - Image mIconSlideshowStartSelected; - Image mIconSlideshowStop; - Image mIconSlideshowStopSelected; Vector2 mPanPosition; Vector2 mPanDisplacement; - Image mImageWave; - Image mImageWaveSelected; - Image mImageCross; - Image mImageCrossSelected; - Image mImageFold; - Image mImageFoldSelected; Toolkit::PushButton mEffectChangeButton; }; @@ -241,15 +231,9 @@ void CubeTransitionApp::OnInit( Application& application ) mContent.SetBehavior( Layer::LAYER_3D ); // Add an effect-changing button on the right of the tool bar. - mImageWave = ResourceImage::New( EFFECT_WAVE_IMAGE ); - mImageWaveSelected = ResourceImage::New( EFFECT_WAVE_IMAGE_SELECTED ); - mImageCross = ResourceImage::New( EFFECT_CROSS_IMAGE ); - mImageCrossSelected = ResourceImage::New( EFFECT_CROSS_IMAGE_SELECTED ); - mImageFold = ResourceImage::New( EFFECT_FOLD_IMAGE ); - mImageFoldSelected = ResourceImage::New( EFFECT_FOLD_IMAGE_SELECTED ); mEffectChangeButton = Toolkit::PushButton::New(); - mEffectChangeButton.SetButtonImage( mImageWave ); - mEffectChangeButton.SetSelectedImage( mImageWaveSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE ); + mEffectChangeButton.SetSelectedImage( 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 ); @@ -258,13 +242,9 @@ void CubeTransitionApp::OnInit( Application& application ) mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); //Add an slideshow icon on the right of the title - mIconSlideshowStart = ResourceImage::New( SLIDE_SHOW_START_ICON ); - mIconSlideshowStartSelected = ResourceImage::New( SLIDE_SHOW_START_ICON_SELECTED ); - mIconSlideshowStop = ResourceImage::New( SLIDE_SHOW_STOP_ICON ); - mIconSlideshowStopSelected = ResourceImage::New( SLIDE_SHOW_STOP_ICON_SELECTED ); mSlideshowButton = Toolkit::PushButton::New(); - mSlideshowButton.SetButtonImage( mIconSlideshowStart ); - mSlideshowButton.SetSelectedImage( mIconSlideshowStartSelected ); + mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON ); + mSlideshowButton.SetSelectedImage( 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 ); @@ -375,23 +355,23 @@ bool CubeTransitionApp::OnEffectButtonClicked( Toolkit::Button button ) { mCurrentEffect = mCubeCrossEffect; mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_CROSS) ); - mEffectChangeButton.SetButtonImage( mImageCross ); - mEffectChangeButton.SetSelectedImage( mImageCrossSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_CROSS_IMAGE ); + mEffectChangeButton.SetSelectedImage( EFFECT_CROSS_IMAGE_SELECTED ); } else if(mCurrentEffect == mCubeCrossEffect) { mCurrentEffect = mCubeFoldEffect; mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_FOLD) ); - mEffectChangeButton.SetButtonImage( mImageFold ); - mEffectChangeButton.SetSelectedImage( mImageFoldSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_FOLD_IMAGE ); + mEffectChangeButton.SetSelectedImage( EFFECT_FOLD_IMAGE_SELECTED ); } else { mCurrentEffect = mCubeWaveEffect; mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_WAVE) ); - mEffectChangeButton.SetButtonImage( mImageWave ); - mEffectChangeButton.SetSelectedImage( mImageWaveSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_WAVE_IMAGE ); + mEffectChangeButton.SetSelectedImage( EFFECT_WAVE_IMAGE_SELECTED ); } // Set the current image to cube transition effect @@ -406,8 +386,8 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) if( mSlideshow ) { mPanGestureDetector.Detach( mParent ); - mSlideshowButton.SetButtonImage( mIconSlideshowStop ); - mSlideshowButton.SetSelectedImage( mIconSlideshowStopSelected ); + mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_STOP_ICON ); + mSlideshowButton.SetSelectedImage( SLIDE_SHOW_STOP_ICON_SELECTED ); mPanPosition = Vector2( mViewSize.width, mViewSize.height*0.5f ); mPanDisplacement = Vector2( -10.f, 0.f ); mViewTimer.Start(); @@ -415,8 +395,8 @@ bool CubeTransitionApp::OnSildeshowButtonClicked( Toolkit::Button button ) else { mPanGestureDetector.Attach( mParent ); - mSlideshowButton.SetButtonImage( mIconSlideshowStart ); - mSlideshowButton.SetSelectedImage( mIconSlideshowStartSelected ); + mSlideshowButton.SetUnselectedImage( SLIDE_SHOW_START_ICON ); + mSlideshowButton.SetSelectedImage( 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 3a346fb..a961320 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -180,16 +180,8 @@ private: bool mTimerReady; unsigned int mCentralLineIndex; - Image mIconPlay; - Image mIconPlaySelected; - Image mIconStop; - Image mIconStopSelected; Toolkit::PushButton mPlayStopButton; - Image mIconHighP; - Image mIconHighPSelected; - Image mIconMediumP; - Image mIconMediumPSelected; Toolkit::PushButton mEffectChangeButton; }; @@ -218,13 +210,9 @@ void DissolveEffectApp::OnInit( Application& application ) mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" ); // Add an effect-changing button on the right of the tool bar. - mIconHighP = ResourceImage::New( EFFECT_HIGHP_IMAGE ); - mIconHighPSelected = ResourceImage::New( EFFECT_HIGHP_IMAGE_SELECTED ); - mIconMediumP = ResourceImage::New( EFFECT_MEDIUMP_IMAGE ); - mIconMediumPSelected = ResourceImage::New( EFFECT_MEDIUMP_IMAGE_SELECTED ); mEffectChangeButton = Toolkit::PushButton::New(); - mEffectChangeButton.SetButtonImage( mIconHighP ); - mEffectChangeButton.SetSelectedImage( mIconHighPSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_HIGHP_IMAGE ); + mEffectChangeButton.SetSelectedImage( 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 ); @@ -233,13 +221,9 @@ void DissolveEffectApp::OnInit( Application& application ) mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); // Add an slide-show button on the right of the title - mIconPlay = ResourceImage::New( PLAY_ICON ); - mIconPlaySelected = ResourceImage::New( PLAY_ICON_SELECTED ); - mIconStop = ResourceImage::New( STOP_ICON ); - mIconStopSelected = ResourceImage::New( STOP_ICON_SELECTED ); mPlayStopButton = Toolkit::PushButton::New(); - mPlayStopButton.SetButtonImage( mIconPlay ); - mPlayStopButton.SetSelectedImage( mIconPlaySelected ); + mPlayStopButton.SetUnselectedImage( PLAY_ICON ); + mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); @@ -350,14 +334,14 @@ bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button ) if(mUseHighPrecision) { mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) ); - mEffectChangeButton.SetButtonImage( mIconHighP ); - mEffectChangeButton.SetSelectedImage( mIconHighPSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_HIGHP_IMAGE ); + mEffectChangeButton.SetSelectedImage( EFFECT_HIGHP_IMAGE_SELECTED ); } else { mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) ); - mEffectChangeButton.SetButtonImage( mIconMediumP ); - mEffectChangeButton.SetSelectedImage( mIconMediumPSelected ); + mEffectChangeButton.SetUnselectedImage( EFFECT_MEDIUMP_IMAGE ); + mEffectChangeButton.SetSelectedImage( EFFECT_MEDIUMP_IMAGE_SELECTED ); } return true; @@ -368,16 +352,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) mSlideshow = !mSlideshow; if( mSlideshow ) { - mPlayStopButton.SetButtonImage( mIconStop ); - mPlayStopButton.SetSelectedImage( mIconStopSelected ); + mPlayStopButton.SetUnselectedImage( STOP_ICON ); + mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); mPanGestureDetector.Detach( mParent ); mViewTimer.Start(); mTimerReady = false; } else { - mPlayStopButton.SetButtonImage( mIconPlay ); - mPlayStopButton.SetSelectedImage( mIconPlaySelected ); + mPlayStopButton.SetUnselectedImage( PLAY_ICON ); + mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); mTimerReady = true; mPanGestureDetector.Attach( mParent ); } 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 65068fc..32c1dbd 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 @@ -337,7 +337,6 @@ public: fittingModeGroup.Add( label ); Toolkit::PushButton button = CreateButton( FITTING_BUTTON_ID, StringFromScalingMode( mFittingMode ) ); - button.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); fittingModeGroup.Add( button ); mFittingModeButton = button; @@ -359,7 +358,6 @@ public: samplingModeGroup.Add( label ); Toolkit::PushButton button = CreateButton( SAMPLING_BUTTON_ID, StringFromFilterMode( mSamplingMode ) ); - button.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); samplingModeGroup.Add( button ); mSamplingModeButton = button; @@ -372,7 +370,7 @@ public: Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); button.SetName( id ); - button.SetLabel( label ); + button.SetLabelText( label ); button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); button.ClickedSignal().Connect( this, &ImageScalingAndFilteringController::OnButtonClicked ); @@ -401,9 +399,7 @@ public: { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( id ); - button.SetLabel( id ); - Toolkit::TextLabel textLabel = Toolkit::TextLabel::DownCast( button.GetLabel() ); - textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f ); + button.SetLabelText( id ); button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); button.SetParentOrigin( ParentOrigin::BOTTOM_LEFT ); @@ -492,8 +488,7 @@ public: if( button.GetName() == modeName ) { mFittingMode = mode; - mFittingModeButton.SetLabel( modeName ); - mFittingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); + mFittingModeButton.SetLabelText( modeName ); ResizeImage(); mPopup.Hide(); mPopup.Reset(); @@ -508,8 +503,7 @@ public: if( button.GetName() == modeName ) { mSamplingMode = mode; - mSamplingModeButton.SetLabel( modeName ); - mSamplingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); + mSamplingModeButton.SetLabelText( modeName ); ResizeImage(); mPopup.Hide(); mPopup.Reset(); @@ -657,15 +651,13 @@ public: else if ( event.keyPressedName == "f" ) { mSamplingMode = NextFilterMode( mSamplingMode ); - mSamplingModeButton.SetLabel( StringFromFilterMode( mSamplingMode ) ); - mSamplingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); + mSamplingModeButton.SetLabelText( StringFromFilterMode( mSamplingMode ) ); } // Cycle filter and scaling modes: else if ( event.keyPressedName == "s" ) { mFittingMode = NextScalingMode( mFittingMode ); - mFittingModeButton.SetLabel( StringFromScalingMode( mFittingMode ) ); - mFittingModeButton.GetLabel().SetProperty( Toolkit::Control::Property::STYLE_NAME, STYLE_BUTTON_TEXT ); + mFittingModeButton.SetLabelText( 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 0caf323..0c0bf86 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 @@ -306,11 +306,9 @@ public: "" ); // Create an image scaling toggle button. (right of toolbar) - Image toggleScalingImage = ResourceImage::New( TOGGLE_SCALING_IMAGE ); - Image toggleScalingImageSelected = ResourceImage::New( TOGGLE_SCALING_IMAGE_SELECTED ); Toolkit::PushButton toggleScalingButton = Toolkit::PushButton::New(); - toggleScalingButton.SetButtonImage( toggleScalingImage ); - toggleScalingButton.SetSelectedImage( toggleScalingImageSelected ); + toggleScalingButton.SetUnselectedImage( TOGGLE_SCALING_IMAGE ); + toggleScalingButton.SetSelectedImage( 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/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index 51a6588..7820ebf 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -231,16 +231,16 @@ public: // Create an edit mode button. (left of toolbar) Toolkit::PushButton editButton = Toolkit::PushButton::New(); - editButton.SetButtonImage( ResourceImage::New( EDIT_IMAGE ) ); - editButton.SetSelectedImage( ResourceImage::New( EDIT_IMAGE_SELECTED ) ); + editButton.SetUnselectedImage( EDIT_IMAGE ); + editButton.SetSelectedImage( 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.SetButtonImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE ) ); - mLayoutButton.SetSelectedImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE_SELECTED ) ); + mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE ); + mLayoutButton.SetSelectedImage(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 ); @@ -251,9 +251,9 @@ public: mDeleteButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mDeleteButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mDeleteButton.SetDrawMode( DrawMode::OVERLAY_2D ); - mDeleteButton.SetButtonImage( ResourceImage::New( DELETE_IMAGE ) ); - mDeleteButton.SetSelectedImage( ResourceImage::New( DELETE_IMAGE_SELECTED ) ); - mDeleteButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); + mDeleteButton.SetUnselectedImage( DELETE_IMAGE ); + mDeleteButton.SetSelectedImage( DELETE_IMAGE_SELECTED ); + mDeleteButton.SetBackgroundImage( TOOLBAR_IMAGE ); mDeleteButton.SetSize( Vector2( stageSize.width * 0.15f, stageSize.width * 0.15f ) ); mDeleteButton.ClickedSignal().Connect( this, &ItemViewExample::OnDeleteButtonClicked); mDeleteButton.SetLeaveRequired( true ); @@ -266,9 +266,9 @@ public: mInsertButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mInsertButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mInsertButton.SetDrawMode( DrawMode::OVERLAY_2D ); - mInsertButton.SetButtonImage( ResourceImage::New( INSERT_IMAGE ) ); - mInsertButton.SetSelectedImage( ResourceImage::New( INSERT_IMAGE_SELECTED ) ); - mInsertButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); + mInsertButton.SetUnselectedImage( INSERT_IMAGE ); + mInsertButton.SetSelectedImage( INSERT_IMAGE_SELECTED ); + mInsertButton.SetBackgroundImage( TOOLBAR_IMAGE ); mInsertButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mInsertButton.ClickedSignal().Connect( this, &ItemViewExample::OnInsertButtonClicked); mInsertButton.SetLeaveRequired( true ); @@ -281,9 +281,9 @@ public: mReplaceButton.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); mReplaceButton.SetPosition( BUTTON_BORDER, BUTTON_BORDER ); mReplaceButton.SetDrawMode( DrawMode::OVERLAY_2D ); - mReplaceButton.SetButtonImage( ResourceImage::New( REPLACE_IMAGE ) ); - mReplaceButton.SetSelectedImage( ResourceImage::New( REPLACE_IMAGE_SELECTED ) ); - mReplaceButton.SetBackgroundImage( ResourceImage::New( TOOLBAR_IMAGE ) ); + mReplaceButton.SetUnselectedImage( REPLACE_IMAGE ); + mReplaceButton.SetSelectedImage( REPLACE_IMAGE_SELECTED ); + mReplaceButton.SetBackgroundImage( TOOLBAR_IMAGE ); mReplaceButton.SetSize( stageSize.width * 0.15f, stageSize.width * 0.15f ); mReplaceButton.ClickedSignal().Connect( this, &ItemViewExample::OnReplaceButtonClicked); mReplaceButton.SetLeaveRequired( true ); @@ -812,22 +812,22 @@ public: { case SPIRAL_LAYOUT: { - mLayoutButton.SetButtonImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE ) ); - mLayoutButton.SetSelectedImage( ResourceImage::New( SPIRAL_LAYOUT_IMAGE_SELECTED ) ); + mLayoutButton.SetUnselectedImage( SPIRAL_LAYOUT_IMAGE ); + mLayoutButton.SetSelectedImage( SPIRAL_LAYOUT_IMAGE_SELECTED ); break; } case GRID_LAYOUT: { - mLayoutButton.SetButtonImage( ResourceImage::New( GRID_LAYOUT_IMAGE ) ); - mLayoutButton.SetSelectedImage( ResourceImage::New( GRID_LAYOUT_IMAGE_SELECTED ) ); + mLayoutButton.SetUnselectedImage( GRID_LAYOUT_IMAGE ); + mLayoutButton.SetSelectedImage( GRID_LAYOUT_IMAGE_SELECTED ); break; } case DEPTH_LAYOUT: { - mLayoutButton.SetButtonImage( ResourceImage::New( DEPTH_LAYOUT_IMAGE ) ); - mLayoutButton.SetSelectedImage( ResourceImage::New( DEPTH_LAYOUT_IMAGE_SELECTED ) ); + mLayoutButton.SetUnselectedImage( DEPTH_LAYOUT_IMAGE ); + mLayoutButton.SetSelectedImage( DEPTH_LAYOUT_IMAGE_SELECTED ); break; } diff --git a/examples/logging/logging-example.cpp b/examples/logging/logging-example.cpp index 96fc30c..ee4643d 100644 --- a/examples/logging/logging-example.cpp +++ b/examples/logging/logging-example.cpp @@ -285,7 +285,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( CREATE_BUTTON_ID ); - button.SetLabel( CREATE_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -296,7 +296,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( DELETE_BUTTON_ID ); - button.SetLabel( DELETE_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -318,7 +318,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( START_BUTTON_ID ); - button.SetLabel( START_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -329,7 +329,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( STOP_BUTTON_ID ); - button.SetLabel( STOP_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -350,7 +350,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( ENABLE_BUTTON_ID ); - button.SetLabel( ENABLE_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -361,7 +361,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( DISABLE_BUTTON_ID ); - button.SetLabel( DISABLE_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -444,7 +444,7 @@ class LoggingController: public ConnectionTracker { Toolkit::PushButton button = Toolkit::PushButton::New(); button.SetName( VSYNC_BUTTON_ID ); - button.SetLabel( VSYNC_BUTTON_TEXT ); + button.SetLabelText( 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 ); @@ -464,9 +464,7 @@ class LoggingController: public ConnectionTracker << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped") << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled"); - Toolkit::TextLabel textLabel = Toolkit::TextLabel::New( ss.str() ); - - mLogRadioButtons[i].SetLabel( textLabel ); + mLogRadioButtons[i].SetLabelText( ss.str() ); } } diff --git a/examples/motion-blur/motion-blur-example.cpp b/examples/motion-blur/motion-blur-example.cpp index b2d14e9..d19e7a6 100644 --- a/examples/motion-blur/motion-blur-example.cpp +++ b/examples/motion-blur/motion-blur-example.cpp @@ -166,23 +166,17 @@ public: APPLICATION_TITLE ); //Add an effects icon on the right of the title - mIconEffectsOff = ResourceImage::New( EFFECTS_OFF_ICON ); - mIconEffectsOffSelected = ResourceImage::New( EFFECTS_OFF_ICON_SELECTED ); - mIconEffectsOn = ResourceImage::New( EFFECTS_ON_ICON ); - mIconEffectsOnSelected = ResourceImage::New( EFFECTS_ON_ICON_SELECTED ); mActorEffectsButton = Toolkit::PushButton::New(); - mActorEffectsButton.SetButtonImage( mIconEffectsOff ); - mActorEffectsButton.SetSelectedImage( mIconEffectsOffSelected ); + mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); + mActorEffectsButton.SetSelectedImage( 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) - Image imageLayout = ResourceImage::New( LAYOUT_IMAGE ); - Image imageLayoutSelected = ResourceImage::New( LAYOUT_IMAGE_SELECTED ); Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); - layoutButton.SetButtonImage( imageLayout ); - layoutButton.SetSelectedImage( imageLayoutSelected ); + layoutButton.SetUnselectedImage( LAYOUT_IMAGE ); + layoutButton.SetSelectedImage( 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 ); @@ -455,14 +449,14 @@ public: if(!mActorEffectsEnabled) { mActorEffectsEnabled = true; - mActorEffectsButton.SetButtonImage( mIconEffectsOn ); - mActorEffectsButton.SetSelectedImage( mIconEffectsOnSelected ); + mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON ); + mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED ); } else { mActorEffectsEnabled = false; - mActorEffectsButton.SetButtonImage( mIconEffectsOff ); - mActorEffectsButton.SetSelectedImage( mIconEffectsOffSelected ); + mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); + mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); } } @@ -522,10 +516,6 @@ private: Application& mApplication; ///< Application instance Toolkit::Control mView; Toolkit::ToolBar mToolBar; - Image mIconEffectsOff; - Image mIconEffectsOffSelected; - Image mIconEffectsOn; - Image mIconEffectsOnSelected; Layer mContentLayer; ///< Content layer (contains actor for this blur demo) diff --git a/examples/motion-stretch/motion-stretch-example.cpp b/examples/motion-stretch/motion-stretch-example.cpp index 9653df0..7d03875 100644 --- a/examples/motion-stretch/motion-stretch-example.cpp +++ b/examples/motion-stretch/motion-stretch-example.cpp @@ -140,23 +140,17 @@ public: APPLICATION_TITLE ); //Add an slideshow icon on the right of the title - mIconEffectsOff = ResourceImage::New( EFFECTS_OFF_ICON ); - mIconEffectsOffSelected = ResourceImage::New( EFFECTS_OFF_ICON_SELECTED ); - mIconEffectsOn = ResourceImage::New( EFFECTS_ON_ICON ); - mIconEffectsOnSelected = ResourceImage::New( EFFECTS_ON_ICON_SELECTED ); mActorEffectsButton = Toolkit::PushButton::New(); - mActorEffectsButton.SetButtonImage( mIconEffectsOff ); - mActorEffectsButton.SetSelectedImage( mIconEffectsOffSelected ); + mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); + mActorEffectsButton.SetSelectedImage( 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) - Image imageLayout = ResourceImage::New( LAYOUT_IMAGE ); - Image imageLayoutSelected = ResourceImage::New( LAYOUT_IMAGE_SELECTED ); Toolkit::PushButton layoutButton = Toolkit::PushButton::New(); - layoutButton.SetButtonImage( imageLayout ); - layoutButton.SetSelectedImage( imageLayoutSelected ); + layoutButton.SetUnselectedImage( LAYOUT_IMAGE ); + layoutButton.SetSelectedImage( 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 ); @@ -349,14 +343,14 @@ public: if(!mActorEffectsEnabled) { mActorEffectsEnabled = true; - mActorEffectsButton.SetButtonImage( mIconEffectsOn ); - mActorEffectsButton.SetSelectedImage( mIconEffectsOnSelected ); + mActorEffectsButton.SetUnselectedImage( EFFECTS_ON_ICON ); + mActorEffectsButton.SetSelectedImage( EFFECTS_ON_ICON_SELECTED ); } else { mActorEffectsEnabled = false; - mActorEffectsButton.SetButtonImage( mIconEffectsOff ); - mActorEffectsButton.SetSelectedImage( mIconEffectsOffSelected ); + mActorEffectsButton.SetUnselectedImage( EFFECTS_OFF_ICON ); + mActorEffectsButton.SetSelectedImage( EFFECTS_OFF_ICON_SELECTED ); } } @@ -416,10 +410,6 @@ private: Application& mApplication; ///< Application instance Toolkit::Control mView; Toolkit::ToolBar mToolBar; - Image mIconEffectsOff; - Image mIconEffectsOffSelected; - Image mIconEffectsOn; - Image mIconEffectsOnSelected; Layer mContentLayer; ///< Content layer (contains actor for this stretch demo) PushButton mActorEffectsButton; ///< The actor effects toggling Button. diff --git a/examples/new-window/new-window-example.cpp b/examples/new-window/new-window-example.cpp index 19c11ff..966f526 100644 --- a/examples/new-window/new-window-example.cpp +++ b/examples/new-window/new-window-example.cpp @@ -199,8 +199,8 @@ void NewWindowController::Create( Application& app ) } mLoseContextButton = Toolkit::PushButton::New(); - mLoseContextButton.SetButtonImage( ResourceImage::New( LOSE_CONTEXT_IMAGE ) ); - mLoseContextButton.SetSelectedImage( ResourceImage::New( LOSE_CONTEXT_IMAGE_SELECTED ) ); + mLoseContextButton.SetUnselectedImage( LOSE_CONTEXT_IMAGE ); + mLoseContextButton.SetSelectedImage( 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/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp index 00c8cc6..9f5b9fa 100644 --- a/examples/radial-menu/radial-menu-example.cpp +++ b/examples/radial-menu/radial-menu-example.cpp @@ -108,10 +108,6 @@ private: // Member variables Animation mAnimation; AnimState mAnimationState; - Image mIconPlay; - Image mIconPlaySelected; - Image mIconStop; - Image mIconStopSelected; Toolkit::PushButton mPlayStopButton; ImageView mDialView; RadialSweepView mRadialSweepView1; @@ -148,13 +144,9 @@ void RadialMenuExample::OnInit(Application& app) TOOLBAR_IMAGE, APPLICATION_TITLE ); - mIconPlay = ResourceImage::New( PLAY_ICON ); - mIconPlaySelected = ResourceImage::New( PLAY_ICON_SELECTED ); - mIconStop = ResourceImage::New( STOP_ICON ); - mIconStopSelected = ResourceImage::New( STOP_ICON_SELECTED ); mPlayStopButton = Toolkit::PushButton::New(); - mPlayStopButton.SetButtonImage( mIconStop ); - mPlayStopButton.SetSelectedImage( mIconStopSelected ); + mPlayStopButton.SetUnselectedImage( STOP_ICON ); + mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); mPlayStopButton.ClickedSignal().Connect( this, &RadialMenuExample::OnButtonClicked ); @@ -223,8 +215,8 @@ bool RadialMenuExample::OnButtonClicked( Toolkit::Button button ) { mAnimation.Pause(); mAnimationState = PAUSED; - mPlayStopButton.SetButtonImage( mIconPlay ); - mPlayStopButton.SetSelectedImage( mIconPlaySelected ); + mPlayStopButton.SetUnselectedImage( PLAY_ICON ); + mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); } break; @@ -232,15 +224,15 @@ bool RadialMenuExample::OnButtonClicked( Toolkit::Button button ) { mAnimation.Play(); mAnimationState = PLAYING; - mPlayStopButton.SetButtonImage( mIconStop ); - mPlayStopButton.SetSelectedImage( mIconStopSelected ); + mPlayStopButton.SetUnselectedImage( STOP_ICON ); + mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); } break; case STOPPED: { - mPlayStopButton.SetButtonImage( mIconStop ); - mPlayStopButton.SetSelectedImage( mIconStopSelected ); + mPlayStopButton.SetUnselectedImage( STOP_ICON ); + mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); mRadialSweepView1.Deactivate(); mRadialSweepView2.Deactivate(); mRadialSweepView3.Deactivate(); @@ -253,8 +245,8 @@ bool RadialMenuExample::OnButtonClicked( Toolkit::Button button ) void RadialMenuExample::OnAnimationFinished( Animation& source ) { mAnimationState = STOPPED; - mPlayStopButton.SetButtonImage( mIconPlay ); - mPlayStopButton.SetSelectedImage( mIconPlaySelected ); + mPlayStopButton.SetUnselectedImage( PLAY_ICON ); + mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); } RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, diff --git a/examples/refraction-effect/refraction-effect-example.cpp b/examples/refraction-effect/refraction-effect-example.cpp index 39feed3..80bdc0f 100644 --- a/examples/refraction-effect/refraction-effect-example.cpp +++ b/examples/refraction-effect/refraction-effect-example.cpp @@ -257,8 +257,8 @@ private: // Add a button to change background. (right of toolbar) mChangeTextureButton = Toolkit::PushButton::New(); - mChangeTextureButton.SetButtonImage( ResourceImage::New( CHANGE_TEXTURE_ICON ) ); - mChangeTextureButton.SetSelectedImage( ResourceImage::New( CHANGE_TEXTURE_ICON_SELECTED ) ); + mChangeTextureButton.SetUnselectedImage( CHANGE_TEXTURE_ICON ); + mChangeTextureButton.SetSelectedImage( CHANGE_TEXTURE_ICON_SELECTED ); mChangeTextureButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeTexture ); toolBar.AddControl( mChangeTextureButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, @@ -266,8 +266,8 @@ private: DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); // Add a button to change mesh pattern. ( left of bar ) mChangeMeshButton = Toolkit::PushButton::New(); - mChangeMeshButton.SetButtonImage( ResourceImage::New( CHANGE_MESH_ICON ) ); - mChangeMeshButton.SetSelectedImage( ResourceImage::New( CHANGE_MESH_ICON_SELECTED ) ); + mChangeMeshButton.SetUnselectedImage( CHANGE_MESH_ICON ); + mChangeMeshButton.SetSelectedImage( 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 f6d9f27..c37a45d 100644 --- a/examples/scroll-view/scroll-view-example.cpp +++ b/examples/scroll-view/scroll-view-example.cpp @@ -173,14 +173,14 @@ public: TOOLBAR_IMAGE, "" ); - mEffectIcon[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); - mEffectIconSelected[ PageCarouselEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE_SELECTED ); - mEffectIcon[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); - mEffectIconSelected[ PageCubeEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE_SELECTED ); - mEffectIcon[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); - mEffectIconSelected[ PageSpiralEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE_SELECTED ); - mEffectIcon[ PageWaveEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE ); - mEffectIconSelected[ PageWaveEffect ] = ResourceImage::New( EFFECT_CAROUSEL_IMAGE_SELECTED ); + 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; // Create a effect change button. (right of toolbar) mEffectChangeButton = Toolkit::PushButton::New(); @@ -244,7 +244,7 @@ private: ss << APPLICATION_TITLE << ": " << EFFECT_MODE_NAME[mEffectMode]; SetTitle(ss.str()); - mEffectChangeButton.SetButtonImage( mEffectIcon[ mEffectMode ] ); + mEffectChangeButton.SetUnselectedImage( mEffectIcon[ mEffectMode ] ); mEffectChangeButton.SetSelectedImage( mEffectIconSelected[ mEffectMode ] ); // remove old Effect if exists. @@ -582,8 +582,8 @@ private: EffectMode mEffectMode; ///< Current Effect mode - Image mEffectIcon[Total]; ///< Icons for the effect button - Image mEffectIconSelected[Total]; ///< Icons for the effect button when its selected + std::string mEffectIcon[Total]; ///< Icons for the effect button + std::string mEffectIconSelected[Total]; ///< Icons for the effect button when its selected Toolkit::PushButton mEffectChangeButton; ///< Effect Change Button }; diff --git a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp index 8e717a3..ca4dd07 100644 --- a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp +++ b/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp @@ -146,11 +146,9 @@ public: "" ); // Add an effect-changing button on the right of the tool bar. - Image imageChangeEffect = ResourceImage::New( CHANGE_EFFECT_IMAGE ); - Image imageChangeEffectSelected = ResourceImage::New( CHANGE_EFFECT_IMAGE_SELECTED ); Toolkit::PushButton effectChangeButton = Toolkit::PushButton::New(); - effectChangeButton.SetButtonImage( imageChangeEffect ); - effectChangeButton.SetSelectedImage( imageChangeEffectSelected ); + effectChangeButton.SetUnselectedImage( CHANGE_EFFECT_IMAGE ); + effectChangeButton.SetSelectedImage( 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 ); @@ -162,11 +160,9 @@ public: mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); //Add a reset button - Image resetImage = ResourceImage::New( RESET_ICON ); - Image resetImageSelected = ResourceImage::New( RESET_ICON_SELECTED ); Toolkit::PushButton resetButton = Toolkit::PushButton::New(); - resetButton.SetButtonImage( resetImage ); - resetButton.SetSelectedImage( resetImageSelected ); + resetButton.SetUnselectedImage( RESET_ICON ); + resetButton.SetSelectedImage( 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 a2c43ae..6f6c926 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -176,8 +176,8 @@ public: // Create menu button Toolkit::PushButton viewButton = Toolkit::PushButton::New(); - viewButton.SetButtonImage( ResourceImage::New( MENU_ICON_IMAGE ) ); - viewButton.SetSelectedImage( ResourceImage::New( MENU_ICON_IMAGE_SELECTED ) ); + viewButton.SetUnselectedImage( MENU_ICON_IMAGE ); + viewButton.SetSelectedImage( MENU_ICON_IMAGE_SELECTED ); viewButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenu ); mToolBar.AddControl( viewButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalLeft, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -259,9 +259,9 @@ public: { Toolkit::PushButton menuButton = Toolkit::PushButton::New(); menuButton.SetName( MENU_ITEMS[ i ].name ); - menuButton.SetLabel( MENU_ITEMS[ i ].text ); - menuButton.SetButtonImage( Actor() ); - menuButton.SetSelectedImage( Actor() ); + menuButton.SetLabelText( MENU_ITEMS[ i ].text ); + menuButton.SetUnselectedImage( "" ); + menuButton.SetSelectedImage( "" ); menuButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnMenuSelect ); tableView.Add( menuButton ); @@ -354,7 +354,7 @@ public: Toolkit::PushButton okayButton = Toolkit::PushButton::New(); okayButton.SetName( OKAY_BUTTON_ID ); - okayButton.SetLabel( "OK!" ); + okayButton.SetLabelText( "OK!" ); okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -368,7 +368,7 @@ public: Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); cancelButton.SetName( CANCEL_BUTTON_ID ); - cancelButton.SetLabel( "Cancel" ); + cancelButton.SetLabelText( "Cancel" ); cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -376,7 +376,7 @@ public: Toolkit::PushButton okayButton = Toolkit::PushButton::New(); okayButton.SetName( OKAY_BUTTON_ID ); - okayButton.SetLabel( "OK!" ); + okayButton.SetLabelText( "OK!" ); okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -391,7 +391,7 @@ public: Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); cancelButton.SetName( CANCEL_BUTTON_ID ); - cancelButton.SetLabel( "Cancel" ); + cancelButton.SetLabelText( "Cancel" ); cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -399,7 +399,7 @@ public: Toolkit::PushButton okayButton = Toolkit::PushButton::New(); okayButton.SetName( OKAY_BUTTON_ID ); - okayButton.SetLabel( "OK!" ); + okayButton.SetLabelText( "OK!" ); okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -513,7 +513,7 @@ public: Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); cancelButton.SetName( CANCEL_BUTTON_ID ); - cancelButton.SetLabel( "Cancel" ); + cancelButton.SetLabelText( "Cancel" ); cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -521,7 +521,7 @@ public: Toolkit::PushButton okayButton = Toolkit::PushButton::New(); okayButton.SetName( OKAY_BUTTON_ID ); - okayButton.SetLabel( "OK!" ); + okayButton.SetLabelText( "OK!" ); okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -591,7 +591,7 @@ public: // Buttons Toolkit::PushButton cancelButton = Toolkit::PushButton::New(); cancelButton.SetName( CANCEL_BUTTON_ID ); - cancelButton.SetLabel( "Cancel" ); + cancelButton.SetLabelText( "Cancel" ); cancelButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -599,7 +599,7 @@ public: Toolkit::PushButton okayButton = Toolkit::PushButton::New(); okayButton.SetName( OKAY_BUTTON_ID ); - okayButton.SetLabel( "OK!" ); + okayButton.SetLabelText( "OK!" ); okayButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); @@ -1226,7 +1226,7 @@ public: // From ItemFactory { Toolkit::PushButton popupButton = Toolkit::PushButton::New(); popupButton.SetName( buttonDataArray[ itemId ].name ); - popupButton.SetLabel( buttonDataArray[ itemId ].text ); + popupButton.SetLabelText( buttonDataArray[ itemId ].text ); popupButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); popupButton.ClickedSignal().Connect( this, &SizeNegotiationController::OnButtonClicked ); diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index bd00911..eae9fa1 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -38,6 +38,7 @@ namespace { const char* const FOLDER_ICON_IMAGE = DALI_IMAGE_DIR "folder_appicon_empty_bg.png"; + const char* const FOLDER_OPEN_ICON_IMAGE = DALI_IMAGE_DIR "folder_appicon_empty_open_bg.png"; const float BORDER_WIDTH = 4.0f; @@ -82,14 +83,12 @@ public: PushButton CreateFolderButton() { PushButton button = PushButton::New(); - ResourceImage image = ResourceImage::New( FOLDER_ICON_IMAGE ); - ImageActor folderButton = ImageActor::New( image ); - folderButton.SetColor( Color::WHITE ); - button.SetButtonImage( folderButton ); - button.SetSelectedImage( Actor() ); + button.SetUnselectedImage( FOLDER_ICON_IMAGE ); + button.SetSelectedImage( FOLDER_OPEN_ICON_IMAGE ); button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - button.SetSize( image.GetWidth(), image.GetHeight() ); + ResourceImage imageClosed = ResourceImage::New( FOLDER_ICON_IMAGE ); + button.SetSize( imageClosed.GetWidth(), imageClosed.GetHeight() ); return button; } @@ -149,7 +148,7 @@ public: { Property::Value text = mField.GetProperty( TextField::Property::TEXT ); mButtonLabel = text.Get< std::string >(); - mButton.SetLabel( mButtonLabel ); + mButton.SetLabelText( mButtonLabel ); } // Hide & discard the pop-up @@ -175,7 +174,7 @@ public: { Property::Value text = mField.GetProperty( TextField::Property::TEXT ); mButtonLabel = text.Get< std::string >(); - mButton.SetLabel( mButtonLabel ); + mButton.SetLabelText( mButtonLabel ); mField.ClearKeyInputFocus(); } break; diff --git a/resources/images/folder_appicon_empty_open_bg.png b/resources/images/folder_appicon_empty_open_bg.png new file mode 100644 index 0000000..01764ee Binary files /dev/null and b/resources/images/folder_appicon_empty_open_bg.png differ diff --git a/resources/scripts/button.json b/resources/scripts/button.json index cfb44df..9b3d46e 100644 --- a/resources/scripts/button.json +++ b/resources/scripts/button.json @@ -26,18 +26,8 @@ "anchor-point": "TOP_CENTER", "position": [0, 0, 0], "size": [400, 200, 0], - "normal-state-actor": { - "type": "ImageActor", - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-brick-1.png" - } - }, - "selected-state-actor": { - "type": "ImageActor", - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-brick-2.png" - } - }, + "unselected-state-actor": "{DALI_IMAGE_DIR}blocks-brick-1.png", + "selected-state-actor": "{DALI_IMAGE_DIR}blocks-brick-2.png", "label-actor": { "type": "TextLabel", "text": "Normal" @@ -56,24 +46,9 @@ "text": "Disabled" }, "disabled": true, - "normal-state-actor": { - "type": "ImageActor", - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-brick-1.png" - } - }, - "selected-state-actor": { - "type": "ImageActor", - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-brick-2.png" - } - }, - "disabled-state-actor": { - "type": "ImageActor", - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-brick-3.png" - } - } + "unselected-state-actor": "{DALI_IMAGE_DIR}blocks-brick-1.png", + "selected-state-actor": "{DALI_IMAGE_DIR}blocks-brick-2.png", + "disabled-state-actor": "{DALI_IMAGE_DIR}blocks-brick-3.png" }, // Third Button @@ -89,22 +64,8 @@ "text": "Toggle" }, "togglable": true, - "normal-state-actor": { - "type": "ImageActor", - "style": "STYLE_NINE_PATCH", - "border": [26, 24, 26, 23], - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-brick-1.png" - } - }, - "selected-state-actor": { - "type": "ImageActor", - "style": "STYLE_NINE_PATCH", - "border": [26, 24, 26, 23], - "image": { - "filename": "{DALI_IMAGE_DIR}blocks-paddle.png" - } - }, + "unselected-state-actor": "{DALI_IMAGE_DIR}blocks-brick-1.png", + "selected-state-actor": "{DALI_IMAGE_DIR}blocks-paddle.png", "signals": [{ "name": "selected", "action": "set", diff --git a/resources/scripts/super-blur-view.json b/resources/scripts/super-blur-view.json index a273fc6..a94252c 100644 --- a/resources/scripts/super-blur-view.json +++ b/resources/scripts/super-blur-view.json @@ -70,22 +70,8 @@ "type": "TextLabel", "text": "Blur" }, - "normal-state-actor": { - "type": "ImageActor", - "style": "STYLE_NINE_PATCH", - "border": [26, 24, 26, 23], - "image": { - "filename": "{DALI_IMAGE_DIR}button-background.png" - } - }, - "selected-state-actor": { - "type": "ImageActor", - "style": "STYLE_NINE_PATCH", - "border": [26, 24, 26, 23], - "image": { - "filename": "{DALI_IMAGE_DIR}button-background.png" - } - }, + "unselected-state-actor": "{DALI_IMAGE_DIR}button-background.png", + "selected-state-actor": "{DALI_IMAGE_DIR}button-background.png", "signals": [{ "name": "pressed", "action": "play", diff --git a/resources/style/demo-theme.json b/resources/style/demo-theme.json index 5b35adc..660df77 100644 --- a/resources/style/demo-theme.json +++ b/resources/style/demo-theme.json @@ -53,7 +53,7 @@ distributing this software or its derivatives. "option-divider-size":[2,0], "popup-divider-color":[0.23,0.72,0.8,0.11], "popup-icon-color":[1.0,1.0,1.0,1.0], - "popup-pressed-color":[0.24,0.72,0.8,0.11], + "popup-pressed-color":[0.24,0.72,0.8,0.9], "background-image": { "filename": "{DALI_IMAGE_DIR}selection-popup-bg.9.png" } -- libgit2 0.21.4