Stop exporting Internal symbols
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / buttons / radio-button.h
1 #ifndef __DALI_TOOLKIT_RADIO_BUTTON_H__
2 #define __DALI_TOOLKIT_RADIO_BUTTON_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include "button.h"
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 // Forward declarations
31
32 namespace Internal DALI_INTERNAL
33 {
34 // Forward declarations
35
36 class RadioButton;
37 }
38
39 /**
40  * @brief A RadioButton provides a radio button which two states \e active or \e inactive.
41  *
42  * Radio buttons are designed to select one of many option at the same time.
43  *
44  * Every button have its own \e label and \e state, which can be modified by RadioButton::SetLabel and RadioButton::SetActive.
45  *
46  * RadioButton can change its current state using RadioButton::ToggleState.
47  *
48  * RadioButtons can be grouped.
49  * Two or more RadioButtons are in one group when they have this same parent.
50  * In each groups only one RadioButton can be \e active at a given time.
51  * So when RadioButton is set to \e active, other RadioButtons in its group are set to \e inactive.
52  * When \e active RadioButton is set to \e inactive no other RadioButtons in his group is set to \e active.
53  *
54  * A Button::ClickedSignal() is emitted when the RadioButton change its state to \e active or \e inactive.
55  */
56 class DALI_IMPORT_API RadioButton: public Button
57 {
58  public:
59
60   // Properties
61   static const Property::Index PROPERTY_ACTIVE;         ///< name "active",           @see SetActive(),     type BOOLEAN
62   static const Property::Index PROPERTY_LABEL_ACTOR;    ///< name "label-actor",      @see SetLabel(),      type MAP
63
64  public:
65   /**
66    * @brief Create an uninitialized RadioButton; this can be initialized with RadioButton::New().
67    *
68    * Calling member functions with an uninitialized Dali::Object is not allowed.
69    */
70   RadioButton();
71
72   /**
73    * @brief Copy constructor.
74    */
75   RadioButton(const RadioButton& radioButton);
76
77   /**
78    * @brief Assignment operator.
79    */
80   RadioButton& operator=(const RadioButton& radioButton);
81
82   /**
83    * @brief Destructor
84    *
85    * This is non-virtual since derived Handle types must not contain data or virtual methods.
86    */
87   ~RadioButton();
88
89   /**
90    * @brief Create an initialized RadioButton.
91    *
92    * @return A handle to a newly allocated Dali resource.
93    */
94   static RadioButton New();
95
96   /**
97    * @brief Create an initialized RadioButton with given label.
98    *
99    * @param[in] label The button label.
100    *
101    * @return A handle to a newly allocated Dali resource.
102    */
103   static RadioButton New(const std::string& label);
104
105   /**
106    * @brief Create an initialized RadioButton with existing Actor.
107    *
108    * @param[in] label An Actor with the label.
109    *
110    * @return A handle to a newly allocated Dali resource.
111    */
112   static RadioButton New(Actor label);
113
114   /**
115    * @brief Downcast an Object handle to RadioButton.
116    *
117    * If handle points to a RadioButton the downcast produces valid
118    * handle. If not the returned handle is left uninitialized.
119    *
120    * @param[in] handle Handle to an object
121    * @return handle to a RadioButton or an uninitialized handle
122    */
123   static RadioButton DownCast(BaseHandle handle);
124
125   /**
126    * @brief Sets the button label.
127    *
128    * @param[in] label The button label.
129    */
130   void SetLabel(const std::string& label);
131
132   /**
133    * @brief Sets the button label using existing Actor.
134    *
135    * @param[in] label An Actor with the label.
136    */
137   void SetLabel(Actor label);
138
139   /**
140    * @brief Gets the label.
141    *
142    * @return An Actor with the label.
143    */
144   Actor GetLabel() const;
145
146   /**
147    * @brief Sets the button as active or inactive.
148    *
149    * @param[in] active property
150    */
151   void SetActive(bool active);
152
153   /**
154    * @return true if button is active, false if button is inactive.
155    */
156   bool IsActive()const;
157
158   /**
159    * @brief Change button state.
160    *
161    * If button is active deactivate it. If button is inactive activate it.
162    */
163   void ToggleState();
164
165  public: // Not intended for application developers
166
167   /**
168    * @brief Creates a handle using the Toolkit::Internal implementation.
169    *
170    * @param[in]  implementation  The Control implementation.
171    */
172   DALI_INTERNAL RadioButton(Internal::RadioButton& implementation);
173
174   /**
175    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
176    *
177    * @param[in]  internal  A pointer to the internal CustomActor.
178    */
179   DALI_INTERNAL RadioButton(Dali::Internal::CustomActor* internal);
180
181 };
182
183 } // namespace Toolkit
184
185 } // namespace Dali
186
187 #endif // __DALI_TOOLKIT_RADIO_BUTTON_H__