1 #ifndef __DALI_TOOLKIT_PUSH_BUTTON_H__
2 #define __DALI_TOOLKIT_PUSH_BUTTON_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
30 // Forward declarations
32 namespace Internal DALI_INTERNAL
34 // Forward declarations
40 * @brief A PushButton changes its appearance when is pressed and returns to its original when is released.
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.
45 * PushButton provides the following properties which modify signals emitted:
47 * <li>\e autorepeating
49 * When \e autorepeating is set to \e true, a Button::PressedSignal(), Button::ReleasedSignal() and Button::ClickedSignal() signals are emitted at regular
50 * intervals while the button is touched.
52 * The intervals could be modified with the PushButton::SetInitialAutoRepeatingDelay and PushButton::SetNextAutoRepeatingDelay methods.
54 * A \e togglable button can't be \e autorepeating. If the \e autorepeating property is set to \e true, then the \e togglable property is set to
55 * false but no signal is emitted.
59 * When \e togglable is set to \e true, a Button::StateChangedSignal() signal is emitted, with the selected state, every time the button is touched instead
60 * of emit Button::PressedSignal(), Button::ClickedSignal() and Button::ReleasedSignal() signals.
62 * An \e autorepeating button can't be \e togglable. If the \e togglable property is set to \e true, then the \e autorepeating property is set to false.
65 * The button's appearance could be modified by setting images or actors with PushButton::SetButtonImage, PushButton::SetBackgroundImage,
66 * PushButton::SetSelectedImage, PushButton::SetDisabledBackgroundImage and PushButton::SetDisabledImage or setting a text with
67 * PushButton::SetLabel.
69 * The \e background is always shown and doesn't change if the button is pressed or released. The \e button image is shown over the \e background image when the
70 * button is not pressed and is replaced by the \e selected image when the button is pressed. The text label is placed always on the top of all images.
72 * When the button is disabled, \e background, \e button and \e selected images are replaced by their \e disabled images.
74 * The methods used to modify the button's appearance could receive Dali::Actor objects as a parameter, so more complex images could be defined.
76 * Is not mandatory set all images. A button could be defined only by setting its \e background image or by setting its \e background and \e selected images.
78 class DALI_IMPORT_API PushButton : public Button
83 * @brief Create an uninitialized PushButton; this can be initialized with PushButton::New().
85 * Calling member functions with an uninitialized Dali::Object is not allowed.
90 * @brief Copy constructor.
92 PushButton( const PushButton& pushButton );
95 * @brief Assignment operator.
97 PushButton& operator=( const PushButton& pushButton );
102 * This is non-virtual since derived Handle types must not contain data or virtual methods.
107 * @brief Create an initialized PushButton.
109 * @return A handle to a newly allocated Dali resource.
111 static PushButton New();
114 * @brief Downcast an Object handle to PushButton.
116 * If handle points to a PushButton the downcast produces valid
117 * handle. If not the returned handle is left uninitialized.
119 * @param[in] handle Handle to an object
120 * @return handle to a PushButton or an uninitialized handle
122 static PushButton DownCast( BaseHandle handle );
124 using Button::SetButtonImage;
127 * @brief SetButtonImage
129 * @param[in] image The Actor to be used as the button image.
131 * The natural size of the button would be the size of this Actor
132 * if it's larger than the background and label
134 void SetButtonImage( Actor image );
137 * @brief Gets the button image.
139 * @return An actor with the button image.
141 Actor GetButtonImage() const;
143 using Button::SetBackgroundImage;
146 * @brief SetBackgroundImage
148 * @param[in] image The Actor to be used as the background image.
150 * The natural size of the button would be the size of this Actor
151 * if it's larger than the button and label
153 void SetBackgroundImage( Actor image );
156 * @brief Gets the background image.
158 * @return An actor with the background image.
160 Actor GetBackgroundImage() const;
162 using Button::SetSelectedImage;
165 * @copydoc SetSelectedImage( Image image )
167 void SetSelectedImage( Actor image );
170 * @brief Gets the selected image.
172 * @return An actor with the selected image.
174 Actor GetSelectedImage() const;
176 using Button::SetSelectedBackgroundImage;
179 * @copydoc SetSelectedBackgroundImage( Image image )
181 void SetSelectedBackgroundImage( Actor image );
184 * @brief Gets the selected background image.
186 * @return An actor with the selected background image.
188 Actor GetSelectedBackgroundImage() const;
190 using Button::SetDisabledBackgroundImage;
193 * @copydoc SetDisabledBackgroundImage( Image image )
195 void SetDisabledBackgroundImage( Actor image );
198 * @brief Gets the disabled background image.
200 * @return An actor with the disabled background image.
202 Actor GetDisabledBackgroundImage() const;
204 using Button::SetDisabledImage;
207 * @copydoc SetDisabledImage( Image image )
209 void SetDisabledImage( Actor image );
212 * @brief Gets the disabled image.
214 * @return An actor with the disabled image.
216 Actor GetDisabledImage() const;
218 public: // Not intended for application developers
221 * @brief Creates a handle using the Toolkit::Internal implementation.
223 * @param[in] implementation The Control implementation.
225 DALI_INTERNAL PushButton( Internal::PushButton& implementation );
228 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
230 * @param[in] internal A pointer to the internal CustomActor.
232 DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
235 } // namespace Toolkit
239 #endif // __DALI_TOOLKIT_PUSH_BUTTON_H__