975221305fb7b7a69183f02386420b60e5d26ea1
[platform/core/uifw/dali-toolkit.git] / 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) 2015 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 selected or unselected.
41  *
42  * The button's appearance could be modified by setting images or actors with CheckBoxButton::SetBackgroundImage,
43  * CheckBoxButton::SetSelectedImage, CheckBoxButton::SetDisabledBackgroundImage and CheckBoxButton::SetDisabledSelectedImage.
44  *
45  * When the button is not disabled, if it's not selected it only shows the \e background image. The \e selected image is shown over the
46  * \e background image when the box is selected (\e background image is not replaced by \e selected image).
47  *
48  * When the button is disabled, \e background image and \e selected 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
57   /**
58    * Create an uninitialized CheckBoxButton; this can be initialized with CheckBoxButton::New()
59    * Calling member functions with an uninitialized Dali::Object is not allowed.
60    */
61   CheckBoxButton();
62
63   /**
64    * Copy constructor.
65    */
66   CheckBoxButton( const CheckBoxButton& checkBox );
67
68   /**
69    * Assignment operator.
70    */
71   CheckBoxButton& operator=( const CheckBoxButton& checkBox );
72
73   /**
74    * @brief Destructor
75    *
76    * This is non-virtual since derived Handle types must not contain data or virtual methods.
77    */
78   ~CheckBoxButton();
79
80   /**
81    * Create an initialized CheckBoxButton.
82    * @return A handle to a newly allocated Dali resource.
83    */
84   static CheckBoxButton New();
85
86   /**
87    * Downcast an Object handle to CheckBoxButton. If handle points to a CheckBoxButton the
88    * downcast produces valid handle. If not the returned handle is left uninitialized.
89    * @param[in] handle Handle to an object
90    * @return handle to a CheckBoxButton or an uninitialized handle
91    */
92   static CheckBoxButton DownCast( BaseHandle handle );
93
94   /**
95    * Sets the background image.
96    *
97    * @param[in] image The background image.
98    */
99   void SetBackgroundImage( Image image );
100
101   /**
102    * @copydoc SetBackgroundImage( Image image )
103    */
104   void SetBackgroundImage( Actor image );
105
106   /**
107    * Gets the background image.
108    * @return An actor with the background image.
109    */
110   Actor GetBackgroundImage() const;
111
112   /**
113    * Sets the selected image.
114    *
115    * @param[in] image The selected image.
116    */
117   void SetSelectedImage( Image image );
118
119   /**
120    * @copydoc SetSelectedImage( Image image )
121    */
122   void SetSelectedImage( Actor image );
123
124   /**
125    * Gets the selected image.
126    * @return An actor with the selected image.
127    */
128   Actor GetSelectedImage() const;
129
130   /**
131    * Sets the disabled background image.
132    *
133    * @param[in] image The disabled background image.
134    */
135   void SetDisabledBackgroundImage( Image image );
136
137   /**
138    * @copydoc SetDisabledBackgroundImage( Image image )
139    */
140   void SetDisabledBackgroundImage( Actor image );
141
142   /**
143    * Gets the disabled background image.
144    * @return An actor with the disabled background image.
145    */
146   Actor GetDisabledBackgroundImage() const;
147
148   /**
149    * Sets the disabled selected image.
150    *
151    * @param[in] image The disabled selected image.
152    */
153   void SetDisabledSelectedImage( Image image );
154
155   /**
156    * @copydoc SetDisabledSelectedImage( Image image )
157    */
158   void SetDisabledSelectedImage( Actor image );
159
160   /**
161    * Gets the disabled selected image.
162    * @return An actor with the disabled selected image.
163    */
164   Actor GetDisabledSelectedImage() const;
165
166 public: // Not intended for application developers
167
168   /**
169    * Creates a handle using the Toolkit::Internal implementation.
170    * @param[in]  implementation  The Control implementation.
171    */
172   DALI_INTERNAL CheckBoxButton( Internal::CheckBoxButton& implementation );
173
174   /**
175    * Allows the creation of this Control from an Internal::CustomActor pointer.
176    * @param[in]  internal  A pointer to the internal CustomActor.
177    */
178   DALI_INTERNAL CheckBoxButton( Dali::Internal::CustomActor* internal );
179 };
180
181 } // namespace Toolkit
182
183 } // namespace Dali
184
185 #endif // __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__