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 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.
22 #include <dali-toolkit/public-api/controls/buttons/button.h>
24 namespace Dali DALI_IMPORT_API
30 // Forward declarations
32 namespace Internal DALI_INTERNAL
38 * CheckBoxButton provides a check box button which user can check or uncheck.
40 * By default a CheckBoxButton emits a Button::ClickedSignal() signal when the button changes its state to checked or unchecked.
42 * The button's appearance could be modified by setting images or actors with CheckBoxButton::SetBackgroundImage,
43 * CheckBoxButton::SetCheckedImage, CheckBoxButton::SetDimmedBackgroundImage and CheckBoxButton::SetDimmedCheckedImage.
45 * 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
46 * \e background image when the box is checked (\e background image is not replaced by \e checked image).
48 * When the button is dimmed, \e background image and \e checked image are replaced by \e dimmed images.
50 * CheckBoxButton doesn't have a text. However, a Dali::Toolkit::TableView with a Dali::TextActor or a Dali::Toolkit::TextView
51 * and a CheckBoxButton could be used instead.
53 class CheckBoxButton : public Button
57 static const char* const ACTION_CHECK_BOX_BUTTON_CLICK;
60 static const std::string USE_FADE_ANIMATION_PROPERTY_NAME;
61 static const std::string USE_CHECK_ANIMATION_PROPERTY_NAME;
66 * Create an uninitialized CheckBoxButton; this can be initialized with CheckBoxButton::New()
67 * Calling member functions with an uninitialized Dali::Object is not allowed.
74 CheckBoxButton( const CheckBoxButton& checkBox );
77 * Assignment operator.
79 CheckBoxButton& operator=( const CheckBoxButton& checkBox );
83 * Dali::Object derived classes typically do not contain member data.
85 virtual ~CheckBoxButton();
88 * Create an initialized CheckBoxButton.
89 * @return A handle to a newly allocated Dali resource.
91 static CheckBoxButton New();
94 * Downcast an Object handle to CheckBoxButton. If handle points to a CheckBoxButton the
95 * downcast produces valid handle. If not the returned handle is left uninitialized.
96 * @param[in] handle Handle to an object
97 * @return handle to a CheckBoxButton or an uninitialized handle
99 static CheckBoxButton DownCast( BaseHandle handle );
102 * Sets the button as checked or unchecked.
104 * Emits a Button::ClickedSignal() signal if the checkbox is not dimmed and the new state,
105 * given in the \e checked param, is different than the previous one.
107 * @param[in] checked state.
109 void SetChecked( bool checked );
112 * @return \e true if the button is checked.
114 bool IsChecked() const;
117 * Sets the background image.
119 * @param[in] image The background image.
121 void SetBackgroundImage( Image image );
124 * @copydoc SetBackgroundImage( Image image )
126 void SetBackgroundImage( Actor image );
129 * Gets the background image.
130 * @return An actor with the background image.
132 Actor GetBackgroundImage() const;
135 * Sets the checked image.
137 * @param[in] image The checked image.
139 void SetCheckedImage( Image image );
142 * @copydoc SetCheckedImage( Image image )
144 void SetCheckedImage( Actor image );
147 * Gets the checked image.
148 * @return An actor with the checked image.
150 Actor GetCheckedImage() const;
153 * Sets the dimmed background image.
155 * @param[in] image The dimmed background image.
157 void SetDimmedBackgroundImage( Image image );
160 * @copydoc SetDimmedBackgroundImage( Image image )
162 void SetDimmedBackgroundImage( Actor image );
165 * Gets the dimmed background image.
166 * @return An actor with the dimmed background image.
168 Actor GetDimmedBackgroundImage() const;
171 * Sets the dimmed checked image.
173 * @param[in] image The dimmed checked image.
175 void SetDimmedCheckedImage( Image image );
178 * @copydoc SetDimmedCheckedImage( Image image )
180 void SetDimmedCheckedImage( Actor image );
183 * Gets the dimmed checked image.
184 * @return An actor with the dimmed checked image.
186 Actor GetDimmedCheckedImage() const;
188 public: // Not intended for application developers
191 * Creates a handle using the Toolkit::Internal implementation.
192 * @param[in] implementation The Control implementation.
194 CheckBoxButton( Internal::CheckBoxButton& implementation );
197 * Allows the creation of this Control from an Internal::CustomActor pointer.
198 * @param[in] internal A pointer to the internal CustomActor.
200 CheckBoxButton( Dali::Internal::CustomActor* internal );
203 } // namespace Toolkit
207 #endif // __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__