43a3c6270c210bafe2e9557a7069dbc837202333
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / buttons / radio-button-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__
2 #define __DALI_TOOLKIT_INTERNAL_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/actors/image-actor.h>
23 #include <dali/public-api/common/dali-vector.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/controls/buttons/radio-button.h>
27 #include <dali-toolkit/public-api/controls/table-view/table-view.h>
28 #include "button-impl.h"
29
30 namespace Dali
31 {
32 namespace Toolkit
33 {
34 namespace Internal
35 {
36
37 /**
38  * RadioButton implementation class.
39  *
40  * \sa Dali::Toolkit::RadioButton
41  */
42 class RadioButton: public Button
43 {
44 public:
45
46   /**
47    * Create a new RadioButton.
48    *
49    * @return A smart-pointer to the newly allocated PushButton.
50    */
51   static Dali::Toolkit::RadioButton New();
52
53   /**
54    * Construct a new PushButton.
55    */
56   RadioButton();
57
58   /**
59    * Construct a new PushButton with label.
60    */
61   RadioButton( const std::string& label );
62
63   /**
64    * Construct a new PushButton with label.
65    */
66   RadioButton( Actor label );
67
68   /**
69    * A reference counted object may only be deleted by calling Unreference()
70    */
71   virtual ~RadioButton();
72
73 public: // From Button
74
75   /**
76    * @copydoc Toolkit::Internal::Button::SetButtonImage( Actor image )
77    */
78   virtual void SetButtonImage( Actor image );
79
80   /**
81    * @copydoc Toolkit::Internal::Button::SetSelectedImage( Actor image )
82    */
83   virtual void SetSelectedImage( Actor image );
84
85 private: // From Button
86
87   /**
88    * @copydoc Toolkit::Internal::Button::OnButtonInitialize()
89    */
90   virtual void OnButtonInitialize();
91
92   /**
93    * @copydoc Toolkit::Internal::Button::OnButtonUp()
94    */
95   virtual void OnButtonUp();
96
97   /**
98    * @copydoc Toolkit::Internal::Button::OnSelected()
99    */
100   virtual void OnSelected( bool selected );
101
102   /**
103    * @copydoc Toolkit::Internal::Button::OnLabelSet()
104    */
105   virtual void OnLabelSet();
106
107 private:
108
109   /**
110    * @brief Set the image to display
111    *
112    * @param[in] image The image to set
113    */
114   void SetImage( Actor image );
115
116 private:
117
118   // Undefined
119   RadioButton( const RadioButton& origin );
120
121   // Undefined
122   RadioButton& operator=( const RadioButton& origin );
123
124 private:
125
126   Toolkit::TableView mLayoutContainer;      ///< Container to position button images and labels
127
128 };
129
130 } // namespace Internal
131
132 // Helpers for public-api forwarding methods
133
134 inline Toolkit::Internal::RadioButton& GetImplementation(Toolkit::RadioButton& button)
135 {
136   DALI_ASSERT_ALWAYS(button);
137
138   Dali::RefObject& handle = button.GetImplementation();
139
140   return static_cast<Toolkit::Internal::RadioButton&> (handle);
141 }
142
143 inline const Toolkit::Internal::RadioButton& GetImplementation(const Toolkit::RadioButton& button)
144 {
145   DALI_ASSERT_ALWAYS(button);
146
147   const Dali::RefObject& handle = button.GetImplementation();
148
149   return static_cast<const Toolkit::Internal::RadioButton&> (handle);
150 }
151
152 } // namespace Toolkit
153 } // namespace Dali
154
155 #endif // __DALI_TOOLKIT_INTERNAL_RADIO_BUTTON_H__