1 #ifndef __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__
2 #define __DALI_TOOLKIT_INTERNAL_RADIO_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/actors/image-actor.h>
23 #include <dali/public-api/common/dali-vector.h>
26 #include <dali-toolkit/public-api/controls/buttons/radio-button.h>
27 #include "button-impl.h"
37 * RadioButton implementation class.
39 * \sa Dali::Toolkit::RadioButton
41 class RadioButton: public Button
46 * Create a new RadioButton.
48 * @return A smart-pointer to the newly allocated PushButton.
50 static Dali::Toolkit::RadioButton New();
53 * Construct a new PushButton.
58 * Construct a new PushButton with label.
60 RadioButton(const std::string& label);
63 * Construct a new PushButton with label.
65 RadioButton(Actor label);
68 * A reference counted object may only be deleted by calling Unreference()
70 virtual ~RadioButton();
73 * @copydoc Dali::Toolkit::RadioButton::SetLabel(const std::string& label)
75 void SetLabel(const std::string& label);
78 * @copydoc Dali::Toolkit::RadioButton::SetLabel(Actor label)
80 void SetLabel(Actor label);
83 * @copydoc Dali::Toolkit::RadioButton::GetLabel()
85 Actor GetLabel() const;
88 * @copydoc Dali::Toolkit::RadioButton::SetActive(bool active)
90 void SetActive(bool active);
93 * @copydoc Dali::Toolkit::RadioButton::IsActive()
98 * @copydoc Dali::Toolkit::RadioButton::ToggleState()
103 * @copydoc Dali::Toolkit::Control::OnRelaidOut(Vector2 size, ActorSizeContainer& container)
105 virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
111 * @copydoc Button::SetProperty
113 static void SetProperty(BaseObject* object, Property::Index propertyIndex, const Property::Value& value);
116 * @copydoc Button::GetProperty
118 static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
120 protected: // From Control
123 * Sets the relative position of image and label.
125 virtual void OnInitialize();
127 protected: // From Button
129 * Change button state when the button is pressed.
131 virtual void OnButtonUp();
136 RadioButton(const RadioButton& origin);
139 RadioButton& operator=(const RadioButton& origin);
141 Image mInactiveImage; ///< Stores the inactive image
142 Image mActiveImage; ///< Stores the active image
143 ImageActor mRadioIcon; ///< Stores the current image
144 Actor mLabel; ///< Stores the button label
145 bool mActive; ///< Stores the active state
148 } // namespace Internal
150 // Helpers for public-api forwarding methods
152 inline Toolkit::Internal::RadioButton& GetImplementation(Toolkit::RadioButton& button)
154 DALI_ASSERT_ALWAYS(button);
156 Dali::RefObject& handle = button.GetImplementation();
158 return static_cast<Toolkit::Internal::RadioButton&> (handle);
161 inline const Toolkit::Internal::RadioButton& GetImplementation(const Toolkit::RadioButton& button)
163 DALI_ASSERT_ALWAYS(button);
165 const Dali::RefObject& handle = button.GetImplementation();
167 return static_cast<const Toolkit::Internal::RadioButton&> (handle);
170 } // namespace Toolkit
173 #endif // __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__