X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fbuttons%2Fbuttons-example.cpp;h=61dd21783d4ca407c6d963c8ad78fb2994ec53c7;hb=cc6ea8d9723ab3a5415bb550acfbf27501de7a62;hp=11979dbe3391d556d230adaefb44ffb4e76c2115;hpb=0ba76b77106d97a946c0ec83b16cbf57394bfffc;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/buttons/buttons-example.cpp b/examples/buttons/buttons-example.cpp index 11979db..61dd217 100644 --- a/examples/buttons/buttons-example.cpp +++ b/examples/buttons/buttons-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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 using namespace Dali; @@ -29,21 +30,21 @@ using namespace Dali; namespace { -const char* const BACKGROUND_IMAGE = DALI_IMAGE_DIR "background-gradient.jpg"; -const char* const TOOLBAR_IMAGE = DALI_IMAGE_DIR "top-bar.png"; +const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg"; +const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png"; const char* const TOOLBAR_TITLE = "Buttons"; -const char* const SMALL_IMAGE_1 = DALI_IMAGE_DIR "gallery-small-14.jpg"; -const char* const BIG_IMAGE_1 = DALI_IMAGE_DIR "gallery-large-4.jpg"; +const char* const SMALL_IMAGE_1 = DEMO_IMAGE_DIR "gallery-small-14.jpg"; +const char* const BIG_IMAGE_1 = DEMO_IMAGE_DIR "gallery-large-4.jpg"; -const char* const SMALL_IMAGE_2 = DALI_IMAGE_DIR "gallery-small-20.jpg"; -const char* const BIG_IMAGE_2 = DALI_IMAGE_DIR "gallery-large-11.jpg"; +const char* const SMALL_IMAGE_2 = DEMO_IMAGE_DIR "gallery-small-20.jpg"; +const char* const BIG_IMAGE_2 = DEMO_IMAGE_DIR "gallery-large-11.jpg"; -const char* const SMALL_IMAGE_3 = DALI_IMAGE_DIR "gallery-small-25.jpg"; -const char* const BIG_IMAGE_3 = DALI_IMAGE_DIR "gallery-large-13.jpg"; +const char* const SMALL_IMAGE_3 = DEMO_IMAGE_DIR "gallery-small-25.jpg"; +const char* const BIG_IMAGE_3 = DEMO_IMAGE_DIR "gallery-large-13.jpg"; -const char* const ENABLED_IMAGE = DALI_IMAGE_DIR "item-select-check.png"; +const char* const ENABLED_IMAGE = DEMO_IMAGE_DIR "item-select-check.png"; const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f ); @@ -91,10 +92,10 @@ class ButtonsController: public ConnectionTracker // The Init signal is received once (only) during the Application lifetime // Respond to key events - Stage::GetCurrent().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent); + application.GetWindow().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent); // Creates a default view with a default tool bar. - // The view is added to the stage. + // The view is added to the window. mContentLayer = DemoHelper::CreateView( application, mView, mToolBar, @@ -105,17 +106,16 @@ class ButtonsController: public ConnectionTracker Toolkit::TableView contentTable = Toolkit::TableView::New( 4, 1 ); contentTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); contentTable.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); - contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT ); + contentTable.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + contentTable.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) ); -// contentTable.TouchedSignal().Connect( this, &ButtonsController::OnTouchEvent ); for( unsigned int i = 0; i < contentTable.GetRows(); ++i ) { contentTable.SetFitHeight( i ); } - contentTable.SetPosition( 0.0f, TOP_MARGIN ); + contentTable.SetProperty( Actor::Property::POSITION, Vector2( 0.0f, TOP_MARGIN )); mContentLayer.Add( contentTable ); @@ -158,14 +158,14 @@ class ButtonsController: public ConnectionTracker // Radio 1 { - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_1 ) ); - image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_1 ); + image.SetProperty( Actor::Property::SIZE, Vector2( 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 ); + mRadioButtonImage1.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + mRadioButtonImage1.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + mRadioButtonImage1.SetProperty( Actor::Property::POSITION, Vector2( 0, DP(radioY) )); + mRadioButtonImage1.SetProperty( Toolkit::Button::Property::SELECTED, true ); imageSelectTableView.AddChild( mRadioButtonImage1, Toolkit::TableView::CellPosition( 0, 0 ) ); imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); @@ -175,13 +175,13 @@ class ButtonsController: public ConnectionTracker { radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_2 ) ); - image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_2 ); + image.SetProperty( Actor::Property::SIZE, Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) ); mRadioButtonImage2 = Dali::Toolkit::RadioButton::New( "2" ); - mRadioButtonImage2.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mRadioButtonImage2.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mRadioButtonImage2.SetPosition( 0, DP(radioY) ); + mRadioButtonImage2.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + mRadioButtonImage2.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + mRadioButtonImage2.SetProperty( Actor::Property::POSITION, Vector2( 0, DP(radioY) )); imageSelectTableView.AddChild( mRadioButtonImage2, Toolkit::TableView::CellPosition( 1, 0 ) ); imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 1, 1 ) ); @@ -191,13 +191,13 @@ class ButtonsController: public ConnectionTracker { radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING; - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( SMALL_IMAGE_3 ) ); - image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); + Toolkit::ImageView image = Toolkit::ImageView::New( SMALL_IMAGE_3 ); + image.SetProperty( Actor::Property::SIZE, Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) ); mRadioButtonImage3 = Dali::Toolkit::RadioButton::New( "3" ); - mRadioButtonImage3.SetParentOrigin( ParentOrigin::TOP_LEFT ); - mRadioButtonImage3.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - mRadioButtonImage3.SetPosition( 0, DP(radioY) ); + mRadioButtonImage3.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + mRadioButtonImage3.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + mRadioButtonImage3.SetProperty( Actor::Property::POSITION, Vector2( 0, DP(radioY) )); imageSelectTableView.AddChild( mRadioButtonImage3, Toolkit::TableView::CellPosition( 2, 0 ) ); imageSelectTableView.AddChild( image, Toolkit::TableView::CellPosition( 2, 1 ) ); @@ -205,8 +205,8 @@ class ButtonsController: public ConnectionTracker // Create select button mUpdateButton = Toolkit::PushButton::New(); - mUpdateButton.SetLabelText( "Select" ); - mUpdateButton.SetName( "selectButton" ); + mUpdateButton.SetProperty( Toolkit::Button::Property::LABEL, "Select" ); + mUpdateButton.SetProperty( Dali::Actor::Property::NAME, "selectButton" ); mUpdateButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); mUpdateButton.ClickedSignal().Connect( this, &ButtonsController::OnButtonClicked ); @@ -214,13 +214,9 @@ class ButtonsController: public ConnectionTracker radioGroup2Background.AddChild( mUpdateButton, Toolkit::TableView::CellPosition( 1, 0 ) ); // ImageView to display selected image - mBigImage1 = ResourceImage::New( BIG_IMAGE_1 ); - mBigImage2 = ResourceImage::New( BIG_IMAGE_2 ); - mBigImage3 = ResourceImage::New( BIG_IMAGE_3 ); - - mImage = Toolkit::ImageView::New( mBigImage1 ); + mImage = Toolkit::ImageView::New( BIG_IMAGE_1 ); mImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); - mImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); + mImage.SetProperty( Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); radioGroup2Background.AddChild( mImage, Toolkit::TableView::CellPosition( 0, 1, 2, 1 ) ); // The enable/disable radio group @@ -258,9 +254,9 @@ class ButtonsController: public ConnectionTracker textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); textLabel.SetProperty( Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" ); - Toolkit::ImageView image = Toolkit::ImageView::New( ResourceImage::New( ENABLED_IMAGE ) ); - image.SetSize( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ); - image.SetPadding( Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); + Toolkit::ImageView image = Toolkit::ImageView::New( ENABLED_IMAGE ); + image.SetProperty( Actor::Property::SIZE, Vector2( DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE) ) ); + image.SetProperty( Actor::Property::PADDING, Padding( DP(20.0f), 0.0f, 0.0f, 0.0f ) ); tableView.AddChild( image, Toolkit::TableView::CellPosition( 0, 1 ) ); radioButtonsGroup1.Add( tableView ); @@ -268,11 +264,11 @@ class ButtonsController: public ConnectionTracker // First radio button { Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( "Select enabled" ); - radioButton.SetName( "radioSelectEnable" ); - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButton.SetPosition( 0, 0 ); - radioButton.SetSelected( true ); + radioButton.SetProperty( Dali::Actor::Property::NAME, "radioSelectEnable" ); + radioButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + radioButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + radioButton.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 )); + radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true ); radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton ); @@ -282,10 +278,10 @@ class ButtonsController: public ConnectionTracker // Second radio button { Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New( "Select disabled" ); - radioButton.SetName( "radioSelectDisable" ); - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT ); - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - radioButton.SetPosition( 0, DP(50) ); + radioButton.SetProperty( Dali::Actor::Property::NAME, "radioSelectDisable" ); + radioButton.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); + radioButton.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); + radioButton.SetProperty( Actor::Property::POSITION, Vector2( 0, DP(50) )); radioButton.StateChangedSignal().Connect( this, &ButtonsController::EnableSelectButton ); @@ -308,28 +304,31 @@ class ButtonsController: public ConnectionTracker { mCheckboxButton1 = Toolkit::CheckBoxButton::New(); - mCheckboxButton1.SetName( "checkbox1" ); - mCheckboxButton1.SetLabelText( "CheckBox1 is unselected" ); + mCheckboxButton1.SetProperty( Dali::Actor::Property::NAME, "checkbox1" ); + mCheckboxButton1.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected" ); mCheckboxButton1.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); + mCheckboxButton1.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.Add( mCheckboxButton1 ); } { mCheckboxButton2 = Toolkit::CheckBoxButton::New(); - mCheckboxButton2.SetName( "checkbox2" ); - mCheckboxButton2.SetLabelText( "CheckBox2 is selected" ); - mCheckboxButton2.SetSelected( true ); + mCheckboxButton2.SetProperty( Dali::Actor::Property::NAME, "checkbox2" ); + mCheckboxButton2.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected" ); + mCheckboxButton2.SetProperty( Toolkit::Button::Property::SELECTED, true ); mCheckboxButton2.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); + mCheckboxButton2.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.Add( mCheckboxButton2 ); } { mCheckboxButton3 = Toolkit::CheckBoxButton::New(); - mCheckboxButton3.SetName( "checkbox3" ); - mCheckboxButton3.SetLabelText( "CheckBox3 is unselected" ); + mCheckboxButton3.SetProperty( Dali::Actor::Property::NAME, "checkbox3" ); + mCheckboxButton3.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected" ); mCheckboxButton3.StateChangedSignal().Connect( this, &ButtonsController::OnCheckBoxesSelected ); + mCheckboxButton3.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); checkBoxBackground.Add( mCheckboxButton3 ); } @@ -349,8 +348,8 @@ class ButtonsController: public ConnectionTracker contentTable.Add( toggleBackground ); mToggleButton = Toolkit::PushButton::New(); - mToggleButton.SetTogglableButton( true ); - mToggleButton.SetLabelText( "Unselected" ); + mToggleButton.SetProperty( Toolkit::Button::Property::TOGGLABLE, true ); + mToggleButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" ); mToggleButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mToggleButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT ); mToggleButton.StateChangedSignal().Connect( this, &ButtonsController::OnButtonSelected ); @@ -375,13 +374,14 @@ class ButtonsController: public ConnectionTracker Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast( button ); if( pushButton ) { - if( button.IsSelected() ) + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + if( isSelected ) { - pushButton.SetLabelText( "Selected" ); + pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Selected" ); } else { - pushButton.SetLabelText( "Unselected" ); + pushButton.SetProperty( Toolkit::Button::Property::LABEL, "Unselected" ); } } @@ -390,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.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "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.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "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; @@ -424,91 +430,64 @@ class ButtonsController: public ConnectionTracker bool OnButtonClicked(Toolkit::Button button) { - if( mRadioButtonImage1.IsSelected() ) + if( mRadioButtonImage1.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { - mImage.SetImage( mBigImage1 ); + mImage.SetImage( BIG_IMAGE_1 ); } - else if( mRadioButtonImage2.IsSelected() ) + else if( mRadioButtonImage2.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { - mImage.SetImage( mBigImage2 ); + mImage.SetImage( BIG_IMAGE_2 ); } - else if( mRadioButtonImage3.IsSelected() ) + else if( mRadioButtonImage3.GetProperty( Toolkit::Button::Property::SELECTED ).Get() ) { - mImage.SetImage( mBigImage3 ); + mImage.SetImage( BIG_IMAGE_3 ); } return true; } bool OnCheckBoxesSelected( Toolkit::Button button ) { - if( button.GetName() == "checkbox1" ) + bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get(); + if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "checkbox1" ) { - if( button.IsSelected() ) + if( isSelected ) { - button.SetLabelText("CheckBox1 is selected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is selected"); } else { - button.SetLabelText("CheckBox1 is unselected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox1 is unselected"); } } - if( button.GetName() == "checkbox2" ) + if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "checkbox2" ) { - if( button.IsSelected() ) + if( isSelected ) { - button.SetLabelText("CheckBox2 is selected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is selected"); } else { - button.SetLabelText("CheckBox2 is unselected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox2 is unselected"); } } - if( button.GetName() == "checkbox3" ) + if( button.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "checkbox3" ) { - if( button.IsSelected() ) + if( isSelected ) { - button.SetLabelText("CheckBox3 is selected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is selected"); } else { - button.SetLabelText("CheckBox3 is unselected"); + button.SetProperty( Toolkit::Button::Property::LABEL, "CheckBox3 is unselected"); } } return true; } - bool OnTouchEvent( Actor actor, const TouchEvent& event ) - { - if( 1u == event.GetPointCount() ) - { - const TouchPoint::State state = event.GetPoint(0u).state; - - // Clamp to integer values; this is to reduce flicking due to pixel misalignment - const float localPoint = static_cast( static_cast( event.GetPoint( 0 ).local.y ) ); - - if( TouchPoint::Down == state ) - { - mLastPoint = localPoint; - mAnimation = Animation::New( 0.25f ); - } - else if( TouchPoint::Motion == state ) - { - if( mAnimation ) - { - mAnimation.AnimateBy( Property(actor, Actor::Property::POSITION), Vector3( 0.f, localPoint - mLastPoint, 0.f ), AlphaFunction::LINEAR ); - mAnimation.Play(); - mLastPoint = localPoint; - } - } - } - - return true; - } - - private: +private: Application& mApplication; Toolkit::Control mView; ///< The View instance. @@ -527,28 +506,14 @@ class ButtonsController: public ConnectionTracker Toolkit::CheckBoxButton mCheckboxButton3; Animation mAnimation; - float mLastPoint; - Image mBigImage1; - Image mBigImage2; - Image mBigImage3; Toolkit::ImageView mImage; }; -void RunTest( Application& application ) +int DALI_EXPORT_API main( int argc, char **argv ) { + Application application = Application::New( &argc, &argv, DEMO_THEME_PATH ); ButtonsController test( application ); - application.MainLoop(); -} - -// Entry point for Linux & Tizen applications -// -int main( int argc, char **argv ) -{ - Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); - - RunTest( application ); - return 0; }