TextLabel to update font when system font changes
[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 /**
40  * @brief A PushButton changes its appearance when is pressed and returns to its original when is released.
41  *
42  * By default a PushButton emits a Button::PressedSignal() signal when the button is pressed, a Button::ClickedSignal() signal when it's clicked
43  * and a Button::ReleasedSignal() signal when it's released or having pressed it, the touch point leaves the boundary of the button.
44  *
45  * See Button for more detail on signals and modifying appearance via properties.
46  */
47 class DALI_IMPORT_API PushButton : public Button
48 {
49 public:
50
51   /**
52    * @brief The start and end property ranges for this control.
53    */
54   enum PropertyRange
55   {
56     PROPERTY_START_INDEX = Button::PROPERTY_END_INDEX + 1,
57     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000              ///< Reserving 1000 property indices
58   };
59
60   /**
61    * @brief An enumeration of properties belonging to the PushButton class.
62    */
63   struct Property
64   {
65     enum
66     {
67       UNSELECTED_ICON = PROPERTY_START_INDEX, ///< Property, name "unselected-icon", type std::string
68       SELECTED_ICON,                          ///< Property, name "selected-icon",   type std::string
69       ICON_ALIGNMENT,                         ///< Property, name "icon-alignment",  type std::string
70       LABEL_PADDING,                          ///< Property, name "label-padding",   type Vector4
71       ICON_PADDING,                           ///< Property, name "icon-padding",    type Vector4
72     };
73   };
74
75 public:
76
77   /**
78    * @brief Create an uninitialized PushButton; this can be initialized with PushButton::New().
79    *
80    * Calling member functions with an uninitialized Dali::Object is not allowed.
81    */
82   PushButton();
83
84   /**
85    * @brief Copy constructor.
86    */
87   PushButton( const PushButton& pushButton );
88
89   /**
90    * @brief Assignment operator.
91    */
92   PushButton& operator=( const PushButton& pushButton );
93
94   /**
95    * @brief Destructor
96    *
97    * This is non-virtual since derived Handle types must not contain data or virtual methods.
98    */
99   ~PushButton();
100
101   /**
102    * @brief Create an initialized PushButton.
103    *
104    * @return A handle to a newly allocated Dali resource.
105    */
106   static PushButton New();
107
108   /**
109    * @brief Downcast an Object handle to PushButton.
110    *
111    * If handle points to a PushButton the downcast produces valid
112    * handle. If not the returned handle is left uninitialized.
113    *
114    * @param[in] handle Handle to an object
115    * @return handle to a PushButton or an uninitialized handle
116    */
117   static PushButton DownCast( BaseHandle handle );
118
119
120   // Deprecated API
121
122   using Button::SetButtonImage;
123
124   /**
125    * @deprecated Sets the unselected image with an Actor.
126    * @param[in] image The Actor to use.
127    */
128   void SetButtonImage( Actor image );
129
130   using Button::SetBackgroundImage;
131
132   /**
133    * @deprecated Sets the background image with an Actor.
134    * @param[in] image The Actor to use.
135    */
136   void SetBackgroundImage( Actor image );
137
138   using Button::SetSelectedImage;
139
140   /**
141    * @deprecated Sets the selected image with an Actor.
142    * @param[in] image The Actor to use.
143    */
144   void SetSelectedImage( Actor image );
145
146   using Button::SetSelectedBackgroundImage;
147
148   /**
149    * @deprecated Sets the selected background image with an Actor.
150    * @param[in] image The Actor to use.
151    */
152   void SetSelectedBackgroundImage( Actor image );
153
154   using Button::SetDisabledBackgroundImage;
155
156   /**
157    * @deprecated Sets the disabled background image with an Actor.
158    * @param[in] image The Actor to use.
159    */
160   void SetDisabledBackgroundImage( Actor image );
161
162   using Button::SetDisabledImage;
163
164   /**
165    * @deprecated Sets the disabled image with an Actor.
166    * @param[in] image The Actor to use.
167    */
168   void SetDisabledImage( Actor image );
169
170   using Button::SetDisabledSelectedImage;
171
172   /**
173    * @deprecated Sets the disabled selected image with an Actor.
174    * @param[in] image The Actor to use.
175    */
176   void SetDisabledSelectedImage( Actor image );
177
178
179 public: // Not intended for application developers
180
181   /**
182    * @brief Creates a handle using the Toolkit::Internal implementation.
183    *
184    * @param[in]  implementation  The Control implementation.
185    */
186   DALI_INTERNAL PushButton( Internal::PushButton& implementation );
187
188   /**
189    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
190    *
191    * @param[in]  internal  A pointer to the internal CustomActor.
192    */
193   DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
194 };
195
196 } // namespace Toolkit
197
198 } // namespace Dali
199
200 #endif // __DALI_TOOLKIT_PUSH_BUTTON_H__