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
80 * @copydoc Toolkit::Internal::Button::OnLabelSet()
82 virtual void OnLabelSet();
85 * @copydoc Toolkit::Internal::Button::OnSelected()
87 virtual void OnSelected( bool selected );
90 * @copydoc Toolkit::Internal::Button::OnDisabled( bool disabled )
92 virtual void OnDisabled( bool disabled );
94 private: // From Control
97 * @copydoc Dali::Toolkit::Control::OnRelayout()
99 virtual void OnRelayout( const Vector2& size, ActorSizeContainer& container );
104 * Construct a new CheckBoxButton.
109 * A reference counted object may only be deleted by calling Unreference()
111 virtual ~CheckBoxButton();
116 * Adds the actor to the button.
118 void AddChild( Actor& actor );
121 * Removes the actor from the button.
123 void RemoveChild( Actor& actor );
126 * Adds the actor to the check in animation.
127 * It creates a check in animation if needed and starts the check in animation.
128 * @param[in] actor The actor.
130 void StartCheckInAnimation( Actor& actor );
133 * Stops the check in animation.
135 void StopCheckInAnimation();
140 * Called when the check in animation finishes.
141 * It changes the check button paint state.
143 void CheckInAnimationFinished( Dali::Animation& source );
148 CheckBoxButton( const CheckBoxButton& );
151 CheckBoxButton& operator=( const CheckBoxButton& );
154 Animation mCheckInAnimation; ///< Animation used in the state transitions.
155 ImageRegionEffect mTickUVEffect; ///< ImageRegionEffect to expand the tick across
157 PaintState mPaintState; ///< The paint state.
160 } // namespace Internal
162 // Helpers for public-api forwarding methods
164 inline Toolkit::Internal::CheckBoxButton& GetImplementation( Toolkit::CheckBoxButton& button )
166 DALI_ASSERT_ALWAYS( button );
168 Dali::RefObject& handle = button.GetImplementation();
170 return static_cast<Toolkit::Internal::CheckBoxButton&>( handle );
173 inline const Toolkit::Internal::CheckBoxButton& GetImplementation( const Toolkit::CheckBoxButton& button )
175 DALI_ASSERT_ALWAYS( button );
177 const Dali::RefObject& handle = button.GetImplementation();
179 return static_cast<const Toolkit::Internal::CheckBoxButton&>( handle );
182 } // namespace Toolkit
186 #endif // __DALI_TOOLKIT_INTERNAL_CHECK_BOX_BUTTON_H__