1 #ifndef __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__
2 #define __DALI_TOOLKIT_INTERNAL_PUSH_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/vector-wrapper.h>
25 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
26 #include "button-impl.h"
38 * PushButton implementation class.
40 * \sa Dali::Toolkit::PushButton
42 class PushButton : public Button
47 * Create a new PushButton.
48 * @return A smart-pointer to the newly allocated PushButton.
50 static Dali::Toolkit::PushButton New();
55 * Construct a new PushButton.
60 * A reference counted object may only be deleted by calling Unreference()
62 virtual ~PushButton();
64 private: // From Button
67 * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
69 virtual void OnButtonInitialize();
72 * @copydoc Toolkit::Internal::Button::OnLabelSet()
74 virtual void OnLabelSet();
77 * @copydoc Toolkit::Internal::Button::OnButtonImageSet()
79 virtual void OnButtonImageSet();
82 * @copydoc Toolkit::Internal::Button::OnSelectedImageSet()
84 virtual void OnSelectedImageSet();
87 * @copydoc Toolkit::Internal::Button::OnBackgroundImage()
89 virtual void OnBackgroundImageSet();
92 * @copydoc Toolkit::Internal::Button::OnSelectedBackgroundImageSet()
94 virtual void OnSelectedBackgroundImageSet();
97 * @copydoc Toolkit::Internal::Button::OnDisabledImageSet()
99 virtual void OnDisabledImageSet();
102 * @copydoc Toolkit::Internal::Button::OnDisabledSelectedImageSet()
104 virtual void OnDisabledSelectedImageSet();
107 * @copydoc Toolkit::Internal::Button::OnDisabledBackgroundImageSet()
109 virtual void OnDisabledBackgroundImageSet();
112 * @copydoc Toolkit::Internal::Button::PrepareForTranstionIn( Actor actor )
114 virtual void PrepareForTranstionIn( Actor actor );
117 * @copydoc Toolkit::Internal::Button::PrepareForTranstionOut( Actor actor )
119 virtual void PrepareForTranstionOut( Actor actor );
122 * @copydoc Toolkit::Internal::Button::OnTransitionIn( Actor actor )
124 virtual void OnTransitionIn( Actor actor );
127 * @copydoc Toolkit::Internal::Button::OnTransitionOut( Actor actor )
129 virtual void OnTransitionOut( Actor actor );
131 private: // From Control
134 * @copydoc CustomActorImpl::OnSizeSet( const Vector3& targetSize )
136 virtual void OnSizeSet( const Vector3& targetSize );
139 * @copydoc Toolkit::Control::GetNaturalSize
141 virtual Vector3 GetNaturalSize();
144 * @copydoc Toolkit::Control::OnSetResizePolicy
146 virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension );
151 * It adds the actor to the root actor and to the fade in animation.
152 * @param[inout] actor The actor.
153 * @param[in] opacity The opacity to fade to
155 void FadeImageTo( Actor actor, float opacity );
158 * @brief Custom configuration for size negotiation
160 void ConfigureSizeNegotiation();
163 * @brief Configure size negotiation for a given dimension
165 * @param[in] dimension The dimension to configure
166 * @param[in] images The list of images to configure
167 * @param[in] label The text label to configure
169 void ConfigureSizeNegotiationDimension( Dimension::Type dimension, const std::vector< Actor >& images, Actor& label );
174 PushButton( const PushButton& );
177 PushButton& operator=( const PushButton& );
181 Vector3 mSize; ///< The button's size.
184 } // namespace Internal
186 // Helpers for public-api forwarding methods
188 inline Toolkit::Internal::PushButton& GetImplementation( Toolkit::PushButton& button )
190 DALI_ASSERT_ALWAYS( button );
192 Dali::RefObject& handle = button.GetImplementation();
194 return static_cast<Toolkit::Internal::PushButton&>( handle );
197 inline const Toolkit::Internal::PushButton& GetImplementation( const Toolkit::PushButton& button )
199 DALI_ASSERT_ALWAYS( button );
201 const Dali::RefObject& handle = button.GetImplementation();
203 return static_cast<const Toolkit::Internal::PushButton&>( handle );
206 } // namespace Toolkit
210 #endif // __DALI_TOOLKIT_INTERNAL_PUSH_BUTTON_H__