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