Merge "Removing GetDefaultFontDescription from Platform Abstraction Test" into devel...
[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  */
51 class DALI_IMPORT_API PushButton : public Button
52 {
53 public:
54
55   /**
56    * @brief The start and end property ranges for this control.
57    */
58   enum PropertyRange
59   {
60     PROPERTY_START_INDEX = Button::PROPERTY_END_INDEX + 1,
61     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserving 1000 property indices
62   };
63
64   /**
65    * @brief An enumeration of properties belonging to the PushButton class.
66    */
67   struct Property
68   {
69     enum
70     {
71       UNSELECTED_ICON = PROPERTY_START_INDEX, ///< Property, name "unselected-icon", type std::string
72       SELECTED_ICON,                          ///< Property, name "selected-icon",   type std::string
73       ICON_ALIGNMENT,                         ///< Property, name "icon-alignment",  type std::string
74       LABEL_PADDING,                          ///< Property, name "label-padding",   type Vector4
75       ICON_PADDING,                           ///< Property, name "icon-padding",    type Vector4
76     };
77   };
78
79 public:
80
81   /**
82    * @brief Create an uninitialized PushButton; this can be initialized with PushButton::New().
83    *
84    * Calling member functions with an uninitialized Dali::Object is not allowed.
85    */
86   PushButton();
87
88   /**
89    * @brief Copy constructor.
90    */
91   PushButton( const PushButton& pushButton );
92
93   /**
94    * @brief Assignment operator.
95    */
96   PushButton& operator=( const PushButton& pushButton );
97
98   /**
99    * @brief Destructor
100    *
101    * This is non-virtual since derived Handle types must not contain data or virtual methods.
102    */
103   ~PushButton();
104
105   /**
106    * @brief Create an initialized PushButton.
107    *
108    * @return A handle to a newly allocated Dali resource.
109    */
110   static PushButton New();
111
112   /**
113    * @brief Downcast an Object handle to PushButton.
114    *
115    * If handle points to a PushButton the downcast produces valid
116    * handle. If not the returned handle is left uninitialized.
117    *
118    * @param[in] handle Handle to an object
119    * @return handle to a PushButton or an uninitialized handle
120    */
121   static PushButton DownCast( BaseHandle handle );
122
123
124   // Deprecated API
125
126   using Button::SetButtonImage;
127
128   /**
129    * @deprecated DALi 1.0.50
130    *
131    * @brief Sets the unselected image with an Actor.
132    *
133    * @param[in] image The Actor to use.
134    */
135   void SetButtonImage( Actor image );
136
137   using Button::SetBackgroundImage;
138
139   /**
140    * @deprecated DALi 1.0.50
141    *
142    * @brief Sets the background image with an Actor.
143    *
144    * @param[in] image The Actor to use.
145    */
146   void SetBackgroundImage( Actor image );
147
148   using Button::SetSelectedImage;
149
150   /**
151    * @deprecated DALi 1.0.50
152    *
153    * @brief Sets the selected image with an Actor.
154    *
155    * @param[in] image The Actor to use.
156    */
157   void SetSelectedImage( Actor image );
158
159   using Button::SetSelectedBackgroundImage;
160
161   /**
162    * @deprecated DALi 1.0.50
163    *
164    * @brief Sets the selected background image with an Actor.
165    *
166    * @param[in] image The Actor to use.
167    */
168   void SetSelectedBackgroundImage( Actor image );
169
170   using Button::SetDisabledBackgroundImage;
171
172   /**
173    * @deprecated DALi 1.0.50
174    *
175    * @brief Sets the disabled background image with an Actor.
176    *
177    * @param[in] image The Actor to use.
178    */
179   void SetDisabledBackgroundImage( Actor image );
180
181   using Button::SetDisabledImage;
182
183   /**
184    * @deprecated DALi 1.0.50
185    *
186    * @brief Sets the disabled image with an Actor.
187    *
188    * @param[in] image The Actor to use.
189    */
190   void SetDisabledImage( Actor image );
191
192   using Button::SetDisabledSelectedImage;
193
194   /**
195    * @deprecated DALi 1.0.50
196    *
197    * @brief Sets the disabled selected image with an Actor.
198    *
199    * @param[in] image The Actor to use.
200    */
201   void SetDisabledSelectedImage( Actor image );
202
203
204 public: // Not intended for application developers
205
206   /**
207    * @brief Creates a handle using the Toolkit::Internal implementation.
208    *
209    * @param[in]  implementation  The Control implementation.
210    */
211   DALI_INTERNAL PushButton( Internal::PushButton& implementation );
212
213   /**
214    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
215    *
216    * @param[in]  internal  A pointer to the internal CustomActor.
217    */
218   DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
219 };
220
221 /**
222  * @}
223  */
224 } // namespace Toolkit
225
226 } // namespace Dali
227
228 #endif // __DALI_TOOLKIT_PUSH_BUTTON_H__