1 #ifndef __DALI_TOOLKIT_PUSH_BUTTON_H__
2 #define __DALI_TOOLKIT_PUSH_BUTTON_H__
5 * Copyright (c) 2014 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 );
125 * @brief Sets the button image.
127 * @param[in] image The button image.
129 void SetButtonImage( Image image );
132 * @copydoc SetButtonImage( Image image )
134 void SetButtonImage( Actor image );
137 * @brief Gets the button image.
139 * @return An actor with the button image.
141 Actor GetButtonImage() const;
144 * @brief Sets the background image.
146 * @param[in] image The background image.
148 void SetBackgroundImage( Image image );
151 * @copydoc SetBackgroundImage( Image image )
153 void SetBackgroundImage( Actor image );
156 * @brief Gets the background image.
158 * @return An actor with the background image.
160 Actor GetBackgroundImage() const;
163 * @brief Sets the selected image.
165 * @param[in] image The selected image.
167 void SetSelectedImage( Image image );
170 * @copydoc SetSelectedImage( Image image )
172 void SetSelectedImage( Actor image );
175 * @brief Gets the selected image.
177 * @return An actor with the selected image.
179 Actor GetSelectedImage() const;
182 * @brief Sets the disabled background image.
184 * @param[in] image The disabled background image.
186 void SetDisabledBackgroundImage( Image image );
189 * @copydoc SetDisabledBackgroundImage( Image image )
191 void SetDisabledBackgroundImage( Actor image );
194 * @brief Gets the disabled background image.
196 * @return An actor with the disabled background image.
198 Actor GetDisabledBackgroundImage() const;
201 * @brief Sets the disabled button image.
203 * @param[in] image The disabled button image.
205 void SetDisabledImage( Image image );
208 * @copydoc SetDisabledImage( Image image )
210 void SetDisabledImage( Actor image );
213 * @brief Gets the disabled image.
215 * @return An actor with the disabled image.
217 Actor GetDisabledImage() const;
219 public: // Not intended for application developers
222 * @brief Creates a handle using the Toolkit::Internal implementation.
224 * @param[in] implementation The Control implementation.
226 DALI_INTERNAL PushButton( Internal::PushButton& implementation );
229 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
231 * @param[in] internal A pointer to the internal CustomActor.
233 DALI_INTERNAL PushButton( Dali::Internal::CustomActor* internal );
236 } // namespace Toolkit
240 #endif // __DALI_TOOLKIT_PUSH_BUTTON_H__