Button refactoring: rename properties
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / buttons / check-box-button.h
1 #ifndef __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__
2 #define __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/buttons/button.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 // Forward declarations
31
32 namespace Internal DALI_INTERNAL
33 {
34 class CheckBoxButton;
35 }
36
37 /**
38  * CheckBoxButton provides a check box button which user can check or uncheck.
39  *
40  * By default a CheckBoxButton emits a Button::ClickedSignal() signal when the button changes its state to checked or unchecked.
41  *
42  * The button's appearance could be modified by setting images or actors with CheckBoxButton::SetBackgroundImage,
43  * CheckBoxButton::SetCheckedImage, CheckBoxButton::SetDisabledBackgroundImage and CheckBoxButton::SetDisabledCheckedImage.
44  *
45  * When the button is not disabled, if it's not checked it only shows the \e background image. The \e checked image is shown over the
46  * \e background image when the box is checked (\e background image is not replaced by \e checked image).
47  *
48  * When the button is disabled, \e background image and \e checked image are replaced by \e disabled images.
49  *
50  * CheckBoxButton doesn't have a text. However, a Dali::Toolkit::TableView with a Dali::TextActor or a Dali::Toolkit::TextView
51  * and a CheckBoxButton could be used instead.
52  */
53 class DALI_IMPORT_API CheckBoxButton : public Button
54 {
55 public:
56   //Action Names
57   static const char* const ACTION_CHECK_BOX_BUTTON_CLICK;
58
59 public:
60
61   /**
62    * Create an uninitialized CheckBoxButton; this can be initialized with CheckBoxButton::New()
63    * Calling member functions with an uninitialized Dali::Object is not allowed.
64    */
65   CheckBoxButton();
66
67   /**
68    * Copy constructor.
69    */
70   CheckBoxButton( const CheckBoxButton& checkBox );
71
72   /**
73    * Assignment operator.
74    */
75   CheckBoxButton& operator=( const CheckBoxButton& checkBox );
76
77   /**
78    * @brief Destructor
79    *
80    * This is non-virtual since derived Handle types must not contain data or virtual methods.
81    */
82   ~CheckBoxButton();
83
84   /**
85    * Create an initialized CheckBoxButton.
86    * @return A handle to a newly allocated Dali resource.
87    */
88   static CheckBoxButton New();
89
90   /**
91    * Downcast an Object handle to CheckBoxButton. If handle points to a CheckBoxButton the
92    * downcast produces valid handle. If not the returned handle is left uninitialized.
93    * @param[in] handle Handle to an object
94    * @return handle to a CheckBoxButton or an uninitialized handle
95    */
96   static CheckBoxButton DownCast( BaseHandle handle );
97
98   /**
99    * Sets the button as checked or unchecked.
100    *
101    * Emits a Button::ClickedSignal() signal if the checkbox is not disabled and the new state,
102    * given in the \e checked param, is different than the previous one.
103    *
104    * @param[in] checked state.
105    */
106   void SetChecked( bool checked );
107
108   /**
109    * @return \e true if the button is checked.
110    */
111   bool IsChecked() const;
112
113   /**
114    * Sets the background image.
115    *
116    * @param[in] image The background image.
117    */
118   void SetBackgroundImage( Image image );
119
120   /**
121    * @copydoc SetBackgroundImage( Image image )
122    */
123   void SetBackgroundImage( Actor image );
124
125   /**
126    * Gets the background image.
127    * @return An actor with the background image.
128    */
129   Actor GetBackgroundImage() const;
130
131   /**
132    * Sets the checked image.
133    *
134    * @param[in] image The checked image.
135    */
136   void SetCheckedImage( Image image );
137
138   /**
139    * @copydoc SetCheckedImage( Image image )
140    */
141   void SetCheckedImage( Actor image );
142
143   /**
144    * Gets the checked image.
145    * @return An actor with the checked image.
146    */
147   Actor GetCheckedImage() const;
148
149   /**
150    * Sets the disabled background image.
151    *
152    * @param[in] image The disabled background image.
153    */
154   void SetDisabledBackgroundImage( Image image );
155
156   /**
157    * @copydoc SetDisabledBackgroundImage( Image image )
158    */
159   void SetDisabledBackgroundImage( Actor image );
160
161   /**
162    * Gets the disabled background image.
163    * @return An actor with the disabled background image.
164    */
165   Actor GetDisabledBackgroundImage() const;
166
167   /**
168    * Sets the disabled checked image.
169    *
170    * @param[in] image The disabled checked image.
171    */
172   void SetDisabledCheckedImage( Image image );
173
174   /**
175    * @copydoc SetDisabledCheckedImage( Image image )
176    */
177   void SetDisabledCheckedImage( Actor image );
178
179   /**
180    * Gets the disabled checked image.
181    * @return An actor with the disabled checked image.
182    */
183   Actor GetDisabledCheckedImage() const;
184
185 public: // Not intended for application developers
186
187   /**
188    * Creates a handle using the Toolkit::Internal implementation.
189    * @param[in]  implementation  The Control implementation.
190    */
191   DALI_INTERNAL CheckBoxButton( Internal::CheckBoxButton& implementation );
192
193   /**
194    * Allows the creation of this Control from an Internal::CustomActor pointer.
195    * @param[in]  internal  A pointer to the internal CustomActor.
196    */
197   DALI_INTERNAL CheckBoxButton( Dali::Internal::CustomActor* internal );
198 };
199
200 } // namespace Toolkit
201
202 } // namespace Dali
203
204 #endif // __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__