Changed the theme of the some examples to match the new button style
[platform/core/uifw/dali-demo.git] / examples / buttons / buttons-example.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <dali-toolkit/dali-toolkit.h>
19 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
20 #include <dali/dali.h>
21 #include "shared/view.h"
22
23 using namespace Dali;
24
25 // Define this so that it is interchangeable
26 // "DP" stands for Device independent Pixels
27 #define DP(x) x
28
29 namespace
30 {
31 const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-default.png";
32 const char* const TOOLBAR_IMAGE    = DEMO_IMAGE_DIR "top-bar.png";
33
34 const char* const TOOLBAR_TITLE = "Buttons";
35
36 const char* const SMALL_IMAGE_1 = DEMO_IMAGE_DIR "gallery-small-14.jpg";
37 const char* const BIG_IMAGE_1   = DEMO_IMAGE_DIR "gallery-large-4.jpg";
38
39 const char* const SMALL_IMAGE_2 = DEMO_IMAGE_DIR "gallery-small-20.jpg";
40 const char* const BIG_IMAGE_2   = DEMO_IMAGE_DIR "gallery-large-11.jpg";
41
42 const char* const SMALL_IMAGE_3 = DEMO_IMAGE_DIR "gallery-small-25.jpg";
43 const char* const BIG_IMAGE_3   = DEMO_IMAGE_DIR "gallery-large-13.jpg";
44
45 const char* const ENABLED_IMAGE = DEMO_IMAGE_DIR "item-select-check.png";
46
47 const Vector4 BACKGROUND_COLOUR(0.25f, 0.25f, 0.25f, 0.15f);
48
49 // Layout sizes
50 const int RADIO_LABEL_THUMBNAIL_SIZE       = 50;
51 const int RADIO_LABEL_THUMBNAIL_SIZE_SMALL = 40;
52 const int RADIO_IMAGE_SPACING              = 8;
53 const int BUTTON_HEIGHT                    = 48;
54
55 const int MARGIN_SIZE   = 10;
56 const int TOP_MARGIN    = 85;
57
58 } // namespace
59
60 /** This example shows how to create and use different buttons.
61  *
62  * 1. First group of radio buttons with image actor labels selects an image to load
63  * 2. A push button loads the selected thumbnail image into the larger image pane
64  * 3. Second group of radio buttons with a table view label containing a text view and image view, and a normal text view.
65  *    Selecting one of these will enable/disable the image loading push button
66  * 4. A group of check boxes
67  */
68 class ButtonsController : public ConnectionTracker
69 {
70 public:
71   ButtonsController(Application& application)
72   : mApplication(application)
73   {
74     // Connect to the Application's Init signal
75     mApplication.InitSignal().Connect(this, &ButtonsController::Create);
76   }
77
78   ~ButtonsController()
79   {
80     // Nothing to do here
81   }
82
83   void Create(Application& application)
84   {
85     // The Init signal is received once (only) during the Application lifetime
86
87     // Respond to key events
88     application.GetWindow().KeyEventSignal().Connect(this, &ButtonsController::OnKeyEvent);
89
90     // Creates a default view with a default tool bar.
91     // The view is added to the window.
92     mContentLayer = DemoHelper::CreateView(application,
93                                            mView,
94                                            mToolBar,
95                                            BACKGROUND_IMAGE,
96                                            TOOLBAR_IMAGE,
97                                            TOOLBAR_TITLE);
98
99     Toolkit::TableView contentTable = Toolkit::TableView::New(4, 1);
100     contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
101     contentTable.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
102     contentTable.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
103     contentTable.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
104     contentTable.SetCellPadding(Size(MARGIN_SIZE, MARGIN_SIZE * 0.5f));
105
106     for(unsigned int i = 0; i < contentTable.GetRows(); ++i)
107     {
108       contentTable.SetFitHeight(i);
109     }
110
111     contentTable.SetProperty(Actor::Property::POSITION, Vector2(0.0f, TOP_MARGIN));
112
113     mContentLayer.Add(contentTable);
114
115     // Image selector radio group
116     Toolkit::TableView radioGroup2Background = Toolkit::TableView::New(2, 2);
117     radioGroup2Background.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
118     radioGroup2Background.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
119     radioGroup2Background.SetBackgroundColor(BACKGROUND_COLOUR);
120     radioGroup2Background.SetCellPadding(Size(MARGIN_SIZE, MARGIN_SIZE));
121     radioGroup2Background.SetFitHeight(0);
122     radioGroup2Background.SetFitHeight(1);
123     radioGroup2Background.SetFitWidth(0);
124
125     contentTable.Add(radioGroup2Background);
126
127     Toolkit::TableView radioButtonsGroup2 = Toolkit::TableView::New(3, 1);
128     radioButtonsGroup2.SetCellPadding(Size(0.0f, MARGIN_SIZE * 0.5f));
129     radioButtonsGroup2.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
130     for(unsigned int i = 0; i < radioButtonsGroup2.GetRows(); ++i)
131     {
132       radioButtonsGroup2.SetFitHeight(i);
133     }
134     radioButtonsGroup2.SetFitWidth(0);
135
136     radioGroup2Background.AddChild(radioButtonsGroup2, Toolkit::TableView::CellPosition(0, 0));
137
138     // TableView to lay out 3x Radio buttons on the left, and 3x Image thumbnails on the right.
139     Toolkit::TableView imageSelectTableView = Toolkit::TableView::New(3, 2);
140     imageSelectTableView.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
141     imageSelectTableView.SetFitHeight(0);
142     imageSelectTableView.SetFitHeight(1);
143     imageSelectTableView.SetFitHeight(2);
144     imageSelectTableView.SetFitWidth(0);
145     imageSelectTableView.SetFitWidth(1);
146     imageSelectTableView.SetCellPadding(Vector2(6.0f, 0.0f));
147
148     radioButtonsGroup2.Add(imageSelectTableView);
149
150     int radioY = 0;
151
152     // Radio 1
153     {
154       Toolkit::ImageView image = Toolkit::ImageView::New(SMALL_IMAGE_1);
155       image.SetProperty(Actor::Property::SIZE, Vector2(DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE)));
156
157       mRadioButtonImage1 = Dali::Toolkit::RadioButton::New("1");
158       mRadioButtonImage1.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
159       mRadioButtonImage1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
160       mRadioButtonImage1.SetProperty(Actor::Property::POSITION, Vector2(0, DP(radioY)));
161       mRadioButtonImage1.SetProperty(Toolkit::Button::Property::SELECTED, true);
162
163       imageSelectTableView.AddChild(mRadioButtonImage1, Toolkit::TableView::CellPosition(0, 0));
164       imageSelectTableView.AddChild(image, Toolkit::TableView::CellPosition(0, 1));
165     }
166
167     // Radio 2
168     {
169       radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
170
171       Toolkit::ImageView image = Toolkit::ImageView::New(SMALL_IMAGE_2);
172       image.SetProperty(Actor::Property::SIZE, Vector2(DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE)));
173
174       mRadioButtonImage2 = Dali::Toolkit::RadioButton::New("2");
175       mRadioButtonImage2.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
176       mRadioButtonImage2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
177       mRadioButtonImage2.SetProperty(Actor::Property::POSITION, Vector2(0, DP(radioY)));
178
179       imageSelectTableView.AddChild(mRadioButtonImage2, Toolkit::TableView::CellPosition(1, 0));
180       imageSelectTableView.AddChild(image, Toolkit::TableView::CellPosition(1, 1));
181     }
182
183     // Radio 3
184     {
185       radioY += RADIO_LABEL_THUMBNAIL_SIZE + RADIO_IMAGE_SPACING;
186
187       Toolkit::ImageView image = Toolkit::ImageView::New(SMALL_IMAGE_3);
188       image.SetProperty(Actor::Property::SIZE, Vector2(DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE)));
189
190       mRadioButtonImage3 = Dali::Toolkit::RadioButton::New("3");
191       mRadioButtonImage3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
192       mRadioButtonImage3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
193       mRadioButtonImage3.SetProperty(Actor::Property::POSITION, Vector2(0, DP(radioY)));
194
195       imageSelectTableView.AddChild(mRadioButtonImage3, Toolkit::TableView::CellPosition(2, 0));
196       imageSelectTableView.AddChild(image, Toolkit::TableView::CellPosition(2, 1));
197     }
198
199     // Create select button
200     mUpdateButton = Toolkit::PushButton::New();
201     mUpdateButton.SetProperty(Toolkit::Button::Property::LABEL, "Select");
202     mUpdateButton.SetProperty(Dali::Actor::Property::NAME, "selectButton");
203     mUpdateButton.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
204
205     mUpdateButton.ClickedSignal().Connect(this, &ButtonsController::OnButtonClicked);
206
207     radioGroup2Background.AddChild(mUpdateButton, Toolkit::TableView::CellPosition(1, 0));
208
209     // ImageView to display selected image
210     mImage = Toolkit::ImageView::New(BIG_IMAGE_1);
211     mImage.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
212     mImage.SetProperty(Actor::Property::SIZE_SCALE_POLICY, SizeScalePolicy::FIT_WITH_ASPECT_RATIO);
213     radioGroup2Background.AddChild(mImage, Toolkit::TableView::CellPosition(0, 1, 2, 1));
214
215     // The enable/disable radio group
216     Toolkit::TableView radioGroup1Background = Toolkit::TableView::New(1, 1);
217     radioGroup1Background.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
218     radioGroup1Background.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
219     radioGroup1Background.SetBackgroundColor(BACKGROUND_COLOUR);
220     radioGroup1Background.SetCellPadding(Size(MARGIN_SIZE, MARGIN_SIZE));
221     radioGroup1Background.SetFitHeight(0);
222
223     contentTable.Add(radioGroup1Background);
224
225     // Radio group
226     Toolkit::TableView radioButtonsGroup1 = Toolkit::TableView::New(2, 1);
227     radioButtonsGroup1.SetCellPadding(Size(0.0f, MARGIN_SIZE * 0.5f));
228     radioButtonsGroup1.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
229     for(unsigned int i = 0; i < radioButtonsGroup1.GetRows(); ++i)
230     {
231       radioButtonsGroup1.SetFitHeight(i);
232     }
233     radioButtonsGroup1.SetFitWidth(0);
234
235     radioGroup1Background.Add(radioButtonsGroup1);
236
237     // TableView to lay out 2x Radio buttons on the left, and 1x Tick image on the right.
238     Toolkit::TableView tableView = Toolkit::TableView::New(2, 2);
239     tableView.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS);
240     tableView.SetFitHeight(0);
241     tableView.SetFitHeight(1);
242     tableView.SetFitWidth(0);
243     tableView.SetFitWidth(1);
244
245     Toolkit::TextLabel textLabel = Toolkit::TextLabel::New("Select enabled");
246     textLabel.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::WIDTH);
247     textLabel.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT);
248     textLabel.SetProperty(Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER");
249
250     Toolkit::ImageView image = Toolkit::ImageView::New(ENABLED_IMAGE);
251     image.SetProperty(Actor::Property::SIZE, Vector2(DP(RADIO_LABEL_THUMBNAIL_SIZE), DP(RADIO_LABEL_THUMBNAIL_SIZE)));
252     image.SetProperty(Actor::Property::PADDING, Padding(DP(20.0f), 0.0f, 0.0f, 0.0f));
253     tableView.AddChild(image, Toolkit::TableView::CellPosition(0, 1));
254
255     radioButtonsGroup1.Add(tableView);
256
257     // First radio button
258     {
259       Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New("Select enabled");
260       radioButton.SetProperty(Dali::Actor::Property::NAME, "radioSelectEnable");
261       radioButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
262       radioButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
263       radioButton.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
264       radioButton.SetProperty(Toolkit::Button::Property::SELECTED, true);
265
266       radioButton.StateChangedSignal().Connect(this, &ButtonsController::EnableSelectButton);
267
268       tableView.AddChild(radioButton, Toolkit::TableView::CellPosition(0, 0));
269     }
270
271     // Second radio button
272     {
273       Toolkit::RadioButton radioButton = Dali::Toolkit::RadioButton::New("Select disabled");
274       radioButton.SetProperty(Dali::Actor::Property::NAME, "radioSelectDisable");
275       radioButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
276       radioButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
277       radioButton.SetProperty(Actor::Property::POSITION, Vector2(0, DP(50)));
278
279       radioButton.StateChangedSignal().Connect(this, &ButtonsController::EnableSelectButton);
280
281       tableView.AddChild(radioButton, Toolkit::TableView::CellPosition(1, 0));
282     }
283
284     // CheckBoxes
285     Toolkit::TableView checkBoxBackground = Toolkit::TableView::New(3, 1);
286     checkBoxBackground.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
287     checkBoxBackground.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
288     checkBoxBackground.SetBackgroundColor(BACKGROUND_COLOUR);
289     checkBoxBackground.SetCellPadding(Size(MARGIN_SIZE / 2.0f, MARGIN_SIZE / 2.0f));
290
291     for(unsigned int i = 0; i < checkBoxBackground.GetRows(); ++i)
292     {
293       checkBoxBackground.SetFitHeight(i);
294     }
295
296     contentTable.Add(checkBoxBackground);
297
298     {
299       mCheckboxButton1 = Toolkit::CheckBoxButton::New();
300       mCheckboxButton1.SetProperty(Dali::Actor::Property::NAME, "checkbox1");
301       mCheckboxButton1.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox1 is unselected");
302       mCheckboxButton1.StateChangedSignal().Connect(this, &ButtonsController::OnCheckBoxesSelected);
303       mCheckboxButton1.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
304
305       checkBoxBackground.Add(mCheckboxButton1);
306     }
307
308     {
309       mCheckboxButton2 = Toolkit::CheckBoxButton::New();
310       mCheckboxButton2.SetProperty(Dali::Actor::Property::NAME, "checkbox2");
311       mCheckboxButton2.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox2 is selected");
312       mCheckboxButton2.SetProperty(Toolkit::Button::Property::SELECTED, true);
313       mCheckboxButton2.StateChangedSignal().Connect(this, &ButtonsController::OnCheckBoxesSelected);
314       mCheckboxButton2.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
315
316       checkBoxBackground.Add(mCheckboxButton2);
317     }
318
319     {
320       mCheckboxButton3 = Toolkit::CheckBoxButton::New();
321       mCheckboxButton3.SetProperty(Dali::Actor::Property::NAME, "checkbox3");
322       mCheckboxButton3.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox3 is unselected");
323       mCheckboxButton3.StateChangedSignal().Connect(this, &ButtonsController::OnCheckBoxesSelected);
324       mCheckboxButton3.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
325
326       checkBoxBackground.Add(mCheckboxButton3);
327     }
328
329     // Create togglabe button
330     Toolkit::TableView toggleBackground = Toolkit::TableView::New(3, 1);
331     toggleBackground.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
332     toggleBackground.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
333     toggleBackground.SetBackgroundColor(BACKGROUND_COLOUR);
334     toggleBackground.SetCellPadding(Size(MARGIN_SIZE, MARGIN_SIZE));
335
336     for(unsigned int i = 0; i < toggleBackground.GetRows(); ++i)
337     {
338       toggleBackground.SetFitHeight(i);
339     }
340
341     contentTable.Add(toggleBackground);
342
343     mToggleButton = Toolkit::PushButton::New();
344     mToggleButton.SetProperty(Toolkit::Button::Property::TOGGLABLE, true);
345     mToggleButton.SetProperty(Toolkit::Button::Property::LABEL, "Unselected");
346     mToggleButton.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
347     mToggleButton.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
348     mToggleButton.StateChangedSignal().Connect(this, &ButtonsController::OnButtonSelected);
349
350     toggleBackground.Add(mToggleButton);
351   }
352
353   void OnKeyEvent(const KeyEvent& event)
354   {
355     if(event.GetState() == KeyEvent::DOWN)
356     {
357       if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK))
358       {
359         // Exit application when click back or escape.
360         mApplication.Quit();
361       }
362     }
363   }
364
365   bool OnButtonSelected(Toolkit::Button button)
366   {
367     Toolkit::PushButton pushButton = Toolkit::PushButton::DownCast(button);
368     if(pushButton)
369     {
370       bool isSelected = button.GetProperty(Toolkit::Button::Property::SELECTED).Get<bool>();
371       if(isSelected)
372       {
373         pushButton.SetProperty(Toolkit::Button::Property::LABEL, "Selected");
374       }
375       else
376       {
377         pushButton.SetProperty(Toolkit::Button::Property::LABEL, "Unselected");
378       }
379     }
380
381     return true;
382   }
383
384   bool EnableSelectButton(Toolkit::Button button)
385   {
386     bool isSelected = button.GetProperty(Toolkit::Button::Property::SELECTED).Get<bool>();
387     if(!isSelected)
388     {
389       return true;
390     }
391
392     if(button.GetProperty<std::string>(Dali::Actor::Property::NAME) == "radioSelectEnable")
393     {
394       mUpdateButton.SetProperty(Toolkit::Button::Property::DISABLED, false);
395
396       mRadioButtonImage1.SetProperty(Toolkit::Button::Property::DISABLED, false);
397       mRadioButtonImage2.SetProperty(Toolkit::Button::Property::DISABLED, false);
398       mRadioButtonImage3.SetProperty(Toolkit::Button::Property::DISABLED, false);
399
400       mCheckboxButton1.SetProperty(Toolkit::Button::Property::DISABLED, false);
401       mCheckboxButton2.SetProperty(Toolkit::Button::Property::DISABLED, false);
402       mCheckboxButton3.SetProperty(Toolkit::Button::Property::DISABLED, false);
403
404       mToggleButton.SetProperty(Toolkit::Button::Property::DISABLED, false);
405     }
406     else if(button.GetProperty<std::string>(Dali::Actor::Property::NAME) == "radioSelectDisable")
407     {
408       mUpdateButton.SetProperty(Toolkit::Button::Property::DISABLED, true);
409
410       mRadioButtonImage1.SetProperty(Toolkit::Button::Property::DISABLED, true);
411       mRadioButtonImage2.SetProperty(Toolkit::Button::Property::DISABLED, true);
412       mRadioButtonImage3.SetProperty(Toolkit::Button::Property::DISABLED, true);
413
414       mCheckboxButton1.SetProperty(Toolkit::Button::Property::DISABLED, true);
415       mCheckboxButton2.SetProperty(Toolkit::Button::Property::DISABLED, true);
416       mCheckboxButton3.SetProperty(Toolkit::Button::Property::DISABLED, true);
417
418       mToggleButton.SetProperty(Toolkit::Button::Property::DISABLED, true);
419     }
420
421     return true;
422   }
423
424   bool OnButtonClicked(Toolkit::Button button)
425   {
426     if(mRadioButtonImage1.GetProperty(Toolkit::Button::Property::SELECTED).Get<bool>())
427     {
428       mImage.SetImage(BIG_IMAGE_1);
429     }
430     else if(mRadioButtonImage2.GetProperty(Toolkit::Button::Property::SELECTED).Get<bool>())
431     {
432       mImage.SetImage(BIG_IMAGE_2);
433     }
434     else if(mRadioButtonImage3.GetProperty(Toolkit::Button::Property::SELECTED).Get<bool>())
435     {
436       mImage.SetImage(BIG_IMAGE_3);
437     }
438     return true;
439   }
440
441   bool OnCheckBoxesSelected(Toolkit::Button button)
442   {
443     bool isSelected = button.GetProperty(Toolkit::Button::Property::SELECTED).Get<bool>();
444     if(button.GetProperty<std::string>(Dali::Actor::Property::NAME) == "checkbox1")
445     {
446       if(isSelected)
447       {
448         button.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox1 is selected");
449       }
450       else
451       {
452         button.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox1 is unselected");
453       }
454     }
455
456     if(button.GetProperty<std::string>(Dali::Actor::Property::NAME) == "checkbox2")
457     {
458       if(isSelected)
459       {
460         button.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox2 is selected");
461       }
462       else
463       {
464         button.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox2 is unselected");
465       }
466     }
467
468     if(button.GetProperty<std::string>(Dali::Actor::Property::NAME) == "checkbox3")
469     {
470       if(isSelected)
471       {
472         button.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox3 is selected");
473       }
474       else
475       {
476         button.SetProperty(Toolkit::Button::Property::LABEL, "CheckBox3 is unselected");
477       }
478     }
479
480     return true;
481   }
482
483 private:
484   Application&     mApplication;
485   Toolkit::Control mView;         ///< The View instance.
486   Toolkit::ToolBar mToolBar;      ///< The View's Toolbar.
487   Layer            mContentLayer; ///< Content layer
488
489   Toolkit::RadioButton mRadioButtonImage1;
490   Toolkit::RadioButton mRadioButtonImage2;
491   Toolkit::RadioButton mRadioButtonImage3;
492
493   Toolkit::PushButton mUpdateButton;
494   Toolkit::PushButton mToggleButton;
495
496   Toolkit::CheckBoxButton mCheckboxButton1;
497   Toolkit::CheckBoxButton mCheckboxButton2;
498   Toolkit::CheckBoxButton mCheckboxButton3;
499
500   Animation mAnimation;
501
502   Toolkit::ImageView mImage;
503 };
504
505 int DALI_EXPORT_API main(int argc, char** argv)
506 {
507   Application       application = Application::New(&argc, &argv, DEMO_THEME_PATH);
508   ButtonsController test(application);
509   application.MainLoop();
510   return 0;
511 }