1 #ifndef __DALI_TOOLKIT_INTERNAL_CHECK_BOX_BUTTON_H__
2 #define __DALI_TOOLKIT_INTERNAL_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/public-api/common/dali-vector.h>
23 #include <dali/public-api/animation/animation.h>
26 #include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
27 #include <dali-toolkit/public-api/shader-effects/image-region-effect.h>
29 #include "button-impl.h"
41 * CheckBoxButton implementation class.
43 * \sa Dali::Toolkit::CheckBoxButton
45 class CheckBoxButton : public Button
50 * Create a new CheckBoxButton.
51 * @return A smart-pointer to the newly allocated CheckBoxButton.
53 static Dali::Toolkit::CheckBoxButton New();
55 public: // From Button
58 * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image )
60 virtual void SetSelectedImage( Actor image );
63 * @copydoc Toolkit::Internal::Button::SetBackgroundImage( Actor image )
65 virtual void SetBackgroundImage( Actor image );
68 * @copydoc Toolkit::Internal::Button::SetDisabledSelectedImage( Actor image )
70 virtual void SetDisabledSelectedImage( Actor image );
73 * @copydoc Toolkit::Internal::Button::SetDisabledBackgroundImage( Actor image )
75 virtual void SetDisabledBackgroundImage( Actor image );
77 private: // From Button
81 * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
83 virtual void OnButtonInitialize();
86 * @copydoc Toolkit::Internal::Button::OnLabelSet()
88 virtual void OnLabelSet();
91 * @copydoc Toolkit::Internal::Button::OnSelected()
93 virtual void OnSelected( bool selected );
96 * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled )
98 virtual void OnDisabled( bool disabled );
103 * Construct a new CheckBoxButton.
108 * A reference counted object may only be deleted by calling Unreference()
110 virtual ~CheckBoxButton();
115 * Adds the actor to the button.
117 void AddChild( Actor& actor );
120 * Removes the actor from the button.
122 void RemoveChild( Actor& actor );
125 * Adds the actor to the check in animation.
126 * It creates a check in animation if needed and starts the check in animation.
127 * @param[in] actor The actor.
129 void StartCheckInAnimation( Actor& actor );
132 * Stops the check in animation.
134 void StopCheckInAnimation();
139 * Called when the check in animation finishes.
140 * It changes the check button paint state.
142 void CheckInAnimationFinished( Dali::Animation& source );
147 CheckBoxButton( const CheckBoxButton& );
150 CheckBoxButton& operator=( const CheckBoxButton& );
153 Animation mCheckInAnimation; ///< Animation used in the state transitions.
154 ImageRegionEffect mTickUVEffect; ///< ImageRegionEffect to expand the tick across
156 PaintState mPaintState; ///< The paint state.
159 } // namespace Internal
161 // Helpers for public-api forwarding methods
163 inline Toolkit::Internal::CheckBoxButton& GetImplementation( Toolkit::CheckBoxButton& button )
165 DALI_ASSERT_ALWAYS( button );
167 Dali::RefObject& handle = button.GetImplementation();
169 return static_cast<Toolkit::Internal::CheckBoxButton&>( handle );
172 inline const Toolkit::Internal::CheckBoxButton& GetImplementation( const Toolkit::CheckBoxButton& button )
174 DALI_ASSERT_ALWAYS( button );
176 const Dali::RefObject& handle = button.GetImplementation();
178 return static_cast<const Toolkit::Internal::CheckBoxButton&>( handle );
181 } // namespace Toolkit
185 #endif // __DALI_TOOLKIT_INTERNAL_CHECK_BOX_BUTTON_H__