[dali_1.1.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / push-button.h
1 #ifndef __DALI_TOOLKIT_PUSH_BUTTON_H__
2 #define __DALI_TOOLKIT_PUSH_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 "button.h"
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 // Forward declarations
31
32 namespace Internal DALI_INTERNAL
33 {
34 // Forward declarations
35
36 class PushButton;
37 }
38 /**
39  * @addtogroup dali_toolkit_controls_buttons
40  * @{
41  */
42
43 /**
44  * @brief A PushButton changes its appearance when is pressed and returns to its original when is released.
45  *
46  * By default a PushButton emits a Button::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked
47  * and a Button::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button.
48  *
49  * See Button for more detail on signals and modifying appearance via properties.
50  * @SINCE_1_0.0
51  */
52 class DALI_IMPORT_API PushButton : public Button
53 {
54 public:
55
56   /**
57    * @brief The start and end property ranges for this control.
58    * @SINCE_1_0.0
59    */
60   enum PropertyRange
61   {
62     PROPERTY_START_INDEX = Button::PROPERTY_END_INDEX + 1,          ///< @SINCE_1_0.0
63     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserving 1000 property indices @SINCE_1_0.0
64   };
65
66   /**
67    * @brief An enumeration of properties belonging to the PushButton class.
68    * @SINCE_1_0.0
69    */
70   struct Property
71   {
72     enum
73     {
74       UNSELECTED_ICON = PROPERTY_START_INDEX, ///< Property, name "unselectedIcon",  type std::string @SINCE_1_0.0
75       SELECTED_ICON,                          ///< Property, name "selectedIcon",    type std::string @SINCE_1_0.0
76       ICON_ALIGNMENT,                         ///< Property, name "iconAlignment",   type std::string @SINCE_1_0.0
77       LABEL_PADDING,                          ///< Property, name "labelPadding",    type Vector4 @SINCE_1_0.0
78       ICON_PADDING,                           ///< Property, name "iconPadding",     type Vector4 @SINCE_1_0.0
79     };
80   };
81
82 public:
83
84   /**
85    * @brief Create an uninitialized PushButton; this can be initialized with PushButton::New().
86    *
87    * Calling member functions with an uninitialized Dali::Object is not allowed.
88    * @SINCE_1_0.0
89    */
90   PushButton();
91
92   /**
93    * @brief Copy constructor.
94    * @SINCE_1_0.0
95    */
96   PushButton( const PushButton& pushButton );
97
98   /**
99    * @brief Assignment operator.
100    * @SINCE_1_0.0
101    */
102   PushButton& operator=( const PushButton& pushButton );
103
104   /**
105    * @brief Destructor
106    *
107    * This is non-virtual since derived Handle types must not contain data or virtual methods.
108    * @SINCE_1_0.0
109    */
110   ~PushButton();
111
112   /**
113    * @brief Create an initialized PushButton.
114    *
115    * @SINCE_1_0.0
116    * @return A handle to a newly allocated Dali resource.
117    */
118   static PushButton New();
119
120   /**
121    * @brief Downcast an Object handle to PushButton.
122    *
123    * If handle points to a PushButton the downcast produces valid
124    * handle. If not the returned handle is left uninitialized.
125    *
126    * @SINCE_1_0.0
127    * @param[in] handle Handle to an object
128    * @return handle to a PushButton or an uninitialized handle
129    */
130   static PushButton DownCast( BaseHandle handle );
131
132
133   // Deprecated API
134
135   using Button::SetButtonImage;
136
137   /**
138    * @DEPRECATED_1_0.50
139    *
140    * @brief Sets the unselected image with an Actor.
141    *
142    * @SINCE_1_0.0
143    * @param[in] image The Actor to use.
144    */
145   void SetButtonImage( Actor image );
146
147   using Button::SetBackgroundImage;
148
149   /**
150    * @DEPRECATED_1_0.50
151    *
152    * @brief Sets the background image with an Actor.
153    *
154    * @SINCE_1_0.0
155    * @param[in] image The Actor to use.
156    */
157   void SetBackgroundImage( Actor image );
158
159   using Button::SetSelectedImage;
160
161   /**
162    * @DEPRECATED_1_0.50
163    *
164    * @brief Sets the selected image with an Actor.
165    *
166    * @SINCE_1_0.0
167    * @param[in] image The Actor to use.
168    */
169   void SetSelectedImage( Actor image );
170
171   using Button::SetSelectedBackgroundImage;
172
173   /**
174    * @DEPRECATED_1_0.50
175    *
176    * @brief Sets the selected background image with an Actor.
177    *
178    * @SINCE_1_0.0
179    * @param[in] image The Actor to use.
180    */
181   void SetSelectedBackgroundImage( Actor image );
182
183   using Button::SetDisabledBackgroundImage;
184
185   /**
186    * @DEPRECATED_1_0.50
187    *
188    * @brief Sets the disabled background image with an Actor.
189    *
190    * @SINCE_1_0.0
191    * @param[in] image The Actor to use.
192    */
193   void SetDisabledBackgroundImage( Actor image );
194
195   using Button::SetDisabledImage;
196
197   /**
198    * @DEPRECATED_1_0.50
199    *
200    * @brief Sets the disabled image with an Actor.
201    *
202    * @SINCE_1_0.0
203    * @param[in] image The Actor to use.
204    */
205   void SetDisabledImage( Actor image );
206
207   using Button::SetDisabledSelectedImage;
208
209   /**
210    * @DEPRECATED_1_0.50
211    *
212    * @brief Sets the disabled selected image with an Actor.
213    *
214    * @SINCE_1_0.0
215    * @param[in] image The Actor to use.
216    */
217   void SetDisabledSelectedImage( Actor image );
218
219
220 public: // Not intended for application developers
221
222   /**
223    * @brief Creates a handle using the Toolkit::Internal implementation.
224    *
225    * @SINCE_1_0.0
226    * @param[in]  implementation  The Control implementation.
227    */
228   DALI_INTERNAL PushButton( Internal::PushButton& implementation );
229
230   /**
231    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
232    *
233    * @SINCE_1_0.0
234    * @param[in]  internal  A pointer to the internal CustomActor.
235    */
236   DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
237 };
238
239 /**
240  * @}
241  */
242 } // namespace Toolkit
243
244 } // namespace Dali
245
246 #endif // __DALI_TOOLKIT_PUSH_BUTTON_H__