1 #ifndef __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__
2 #define __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali-toolkit/public-api/controls/buttons/button.h>
23 namespace Dali DALI_IMPORT_API
29 // Forward declarations
31 namespace Internal DALI_INTERNAL
37 * CheckBoxButton provides a check box button which user can check or uncheck.
39 * By default a CheckBoxButton emits a Button::ClickedSignal() signal when the button changes its state to checked or unchecked.
41 * The button's appearance could be modified by setting images or actors with CheckBoxButton::SetBackgroundImage,
42 * CheckBoxButton::SetCheckedImage, CheckBoxButton::SetDimmedBackgroundImage and CheckBoxButton::SetDimmedCheckedImage.
44 * When the button is not dimmed, if it's not checked it only shows the \e background image. The \e checked image is shown over the
45 * \e background image when the box is checked (\e background image is not replaced by \e checked image).
47 * When the button is dimmed, \e background image and \e checked image are replaced by \e dimmed images.
49 * CheckBoxButton doesn't have a text. However, a Dali::Toolkit::TableView with a Dali::TextActor or a Dali::Toolkit::TextView
50 * and a CheckBoxButton could be used instead.
52 class CheckBoxButton : public Button
56 static const char* const ACTION_CHECK_BOX_BUTTON_CLICK;
59 static const std::string USE_FADE_ANIMATION_PROPERTY_NAME;
60 static const std::string USE_CHECK_ANIMATION_PROPERTY_NAME;
65 * Create an uninitialized CheckBoxButton; this can be initialized with CheckBoxButton::New()
66 * Calling member functions with an uninitialized Dali::Object is not allowed.
73 CheckBoxButton( const CheckBoxButton& checkBox );
76 * Assignment operator.
78 CheckBoxButton& operator=( const CheckBoxButton& checkBox );
82 * Dali::Object derived classes typically do not contain member data.
84 virtual ~CheckBoxButton();
87 * Create an initialized CheckBoxButton.
88 * @return A handle to a newly allocated Dali resource.
90 static CheckBoxButton New();
93 * Downcast an Object handle to CheckBoxButton. If handle points to a CheckBoxButton the
94 * downcast produces valid handle. If not the returned handle is left uninitialized.
95 * @param[in] handle Handle to an object
96 * @return handle to a CheckBoxButton or an uninitialized handle
98 static CheckBoxButton DownCast( BaseHandle handle );
101 * Sets the button as checked or unchecked.
103 * Emits a Button::ClickedSignal() signal if the checkbox is not dimmed and the new state,
104 * given in the \e checked param, is different than the previous one.
106 * @param[in] checked state.
108 void SetChecked( bool checked );
111 * @return \e true if the button is checked.
113 bool IsChecked() const;
116 * Sets the background image.
118 * @param[in] image The background image.
120 void SetBackgroundImage( Image image );
123 * @copydoc SetBackgroundImage( Image image )
125 void SetBackgroundImage( Actor image );
128 * Gets the background image.
129 * @return An actor with the background image.
131 Actor GetBackgroundImage() const;
134 * Sets the checked image.
136 * @param[in] image The checked image.
138 void SetCheckedImage( Image image );
141 * @copydoc SetCheckedImage( Image image )
143 void SetCheckedImage( Actor image );
146 * Gets the checked image.
147 * @return An actor with the checked image.
149 Actor GetCheckedImage() const;
152 * Sets the dimmed background image.
154 * @param[in] image The dimmed background image.
156 void SetDimmedBackgroundImage( Image image );
159 * @copydoc SetDimmedBackgroundImage( Image image )
161 void SetDimmedBackgroundImage( Actor image );
164 * Gets the dimmed background image.
165 * @return An actor with the dimmed background image.
167 Actor GetDimmedBackgroundImage() const;
170 * Sets the dimmed checked image.
172 * @param[in] image The dimmed checked image.
174 void SetDimmedCheckedImage( Image image );
177 * @copydoc SetDimmedCheckedImage( Image image )
179 void SetDimmedCheckedImage( Actor image );
182 * Gets the dimmed checked image.
183 * @return An actor with the dimmed checked image.
185 Actor GetDimmedCheckedImage() const;
187 public: // Not intended for application developers
190 * Creates a handle using the Toolkit::Internal implementation.
191 * @param[in] implementation The Control implementation.
193 CheckBoxButton( Internal::CheckBoxButton& implementation );
196 * Allows the creation of this Control from an Internal::CustomActor pointer.
197 * @param[in] internal A pointer to the internal CustomActor.
199 CheckBoxButton( Dali::Internal::CustomActor* internal );
202 } // namespace Toolkit
206 #endif // __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__