1 #ifndef DALI_TOOLKIT_CHECK_BOX_BUTTON_H
2 #define DALI_TOOLKIT_CHECK_BOX_BUTTON_H
5 * Copyright (c) 2020 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>
28 // Forward declarations
30 namespace Internal DALI_INTERNAL
35 * @addtogroup dali_toolkit_controls_buttons
40 * @brief CheckBoxButton provides a check box button which user can check or uncheck.
42 * By default, a CheckBoxButton emits a Button::ClickedSignal() signal when the button changes its state to selected or unselected.
44 * The button's appearance could be modified by Button::SetUnselectedImage, Button::SetBackgroundImage,
45 * Button::SetSelectedImage, Button::SetSelectedBackgroundImage, Button::SetDisabledBackgroundImage,
46 * Button::SetDisabledImage, and Button::SetDisabledSelectedImage.
48 * When the button is not disabled, if it's not selected it only shows the \e background image. The \e selected image is shown over the
49 * \e background image when the box is selected (\e background image is not replaced by \e selected image).
51 * When the button is disabled, \e background image and \e selected image are replaced by \e disabled images.
56 * // in Creating a DALi Application
57 * void HelloWorldExample::Create( Application& application )
59 * CheckBoxButton button = CheckBoxButton::New();
60 * button.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
61 * button.SetProperty( Button::Property::LABEL, "Check" );
62 * button.SetProperty( Actor::Property::SIZE, Vector2( 200, 40 );
63 * button.SetBackgroundColor( Color::WHITE );
64 * Stage::GetCurrent().Add( button );
66 * // Connect to a button signal emitted by the button
67 * button.StateChangedSignal().Connect( this, &HelloWorldExample::OnButtonStateChanged );
70 * bool HelloWorldExample::OnButtonStateChanged( Button button )
72 * // Do something when the button state is changed
73 * // You can get the state using button.IsSelected() call
79 class DALI_TOOLKIT_API CheckBoxButton : public Button
83 * @brief Creates an uninitialized CheckBoxButton; this can be initialized with CheckBoxButton::New().
84 * Calling member functions with an uninitialized Dali::Object is not allowed.
90 * @brief Copy constructor.
92 * @param[in] checkBox Handle to an object
94 CheckBoxButton(const CheckBoxButton& checkBox);
97 * @brief Move constructor
100 * @param[in] rhs A reference to the moved handle
102 CheckBoxButton(CheckBoxButton&& rhs);
105 * @brief Assignment operator.
107 * @param[in] checkBox Handle to an object
108 * @return A reference to this
110 CheckBoxButton& operator=(const CheckBoxButton& checkBox);
113 * @brief Move assignment
116 * @param[in] rhs A reference to the moved handle
117 * @return A reference to this
119 CheckBoxButton& operator=(CheckBoxButton&& rhs);
124 * This is non-virtual since derived Handle types must not contain data or virtual methods.
130 * @brief Creates an initialized CheckBoxButton.
132 * @return A handle to a newly allocated Dali resource
134 static CheckBoxButton New();
137 * @brief Downcasts a handle to CheckBoxButton handle.
139 * If handle points to a CheckBoxButton, the downcast produces valid handle.
140 * If not, the returned handle is left uninitialized.
142 * @param[in] handle Handle to an object
143 * @return Handle to a CheckBoxButton or an uninitialized handle
145 static CheckBoxButton DownCast(BaseHandle handle);
147 public: // Not intended for application developers
150 * @brief Creates a handle using the Toolkit::Internal implementation.
152 * @param[in] implementation The Control implementation
154 DALI_INTERNAL CheckBoxButton(Internal::CheckBoxButton& implementation);
157 * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
159 * @param[in] internal A pointer to the internal CustomActor
161 DALI_INTERNAL CheckBoxButton(Dali::Internal::CustomActor* internal);
168 } // namespace Toolkit
172 #endif // DALI_TOOLKIT_CHECK_BOX_BUTTON_H