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 );
84 * This is non-virtual since derived Handle types must not contain data or virtual methods.
89 * Create an initialized CheckBoxButton.
90 * @return A handle to a newly allocated Dali resource.
92 static CheckBoxButton New();
95 * Downcast an Object handle to CheckBoxButton. If handle points to a CheckBoxButton the
96 * downcast produces valid handle. If not the returned handle is left uninitialized.
97 * @param[in] handle Handle to an object
98 * @return handle to a CheckBoxButton or an uninitialized handle
100 static CheckBoxButton DownCast( BaseHandle handle );
103 * Sets the button as checked or unchecked.
105 * Emits a Button::ClickedSignal() signal if the checkbox is not dimmed and the new state,
106 * given in the \e checked param, is different than the previous one.
108 * @param[in] checked state.
110 void SetChecked( bool checked );
113 * @return \e true if the button is checked.
115 bool IsChecked() const;
118 * Sets the background image.
120 * @param[in] image The background image.
122 void SetBackgroundImage( Image image );
125 * @copydoc SetBackgroundImage( Image image )
127 void SetBackgroundImage( Actor image );
130 * Gets the background image.
131 * @return An actor with the background image.
133 Actor GetBackgroundImage() const;
136 * Sets the checked image.
138 * @param[in] image The checked image.
140 void SetCheckedImage( Image image );
143 * @copydoc SetCheckedImage( Image image )
145 void SetCheckedImage( Actor image );
148 * Gets the checked image.
149 * @return An actor with the checked image.
151 Actor GetCheckedImage() const;
154 * Sets the dimmed background image.
156 * @param[in] image The dimmed background image.
158 void SetDimmedBackgroundImage( Image image );
161 * @copydoc SetDimmedBackgroundImage( Image image )
163 void SetDimmedBackgroundImage( Actor image );
166 * Gets the dimmed background image.
167 * @return An actor with the dimmed background image.
169 Actor GetDimmedBackgroundImage() const;
172 * Sets the dimmed checked image.
174 * @param[in] image The dimmed checked image.
176 void SetDimmedCheckedImage( Image image );
179 * @copydoc SetDimmedCheckedImage( Image image )
181 void SetDimmedCheckedImage( Actor image );
184 * Gets the dimmed checked image.
185 * @return An actor with the dimmed checked image.
187 Actor GetDimmedCheckedImage() const;
189 public: // Not intended for application developers
192 * Creates a handle using the Toolkit::Internal implementation.
193 * @param[in] implementation The Control implementation.
195 CheckBoxButton( Internal::CheckBoxButton& implementation );
198 * Allows the creation of this Control from an Internal::CustomActor pointer.
199 * @param[in] internal A pointer to the internal CustomActor.
201 CheckBoxButton( Dali::Internal::CustomActor* internal );
204 } // namespace Toolkit
208 #endif // __DALI_TOOLKIT_CHECK_BOX_BUTTON_H__