e58f1c5c7a61f72fa2b05fba47550f5334b4f1c6
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / buttons / radio-button.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19
20 #include <dali-toolkit/public-api/controls/buttons/radio-button.h>
21
22 // INTERNAL INCLUDES
23
24 #include <dali-toolkit/internal/controls/buttons/radio-button-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 RadioButton::RadioButton()
33   : Button()
34 {
35 }
36
37 RadioButton::RadioButton(Internal::RadioButton& implementation)
38   : Button(implementation)
39 {
40 }
41
42 RadioButton::RadioButton(const RadioButton& radioButton)
43   : Button(radioButton)
44 {
45 }
46
47 RadioButton& RadioButton::operator=(const RadioButton& radioButton )
48 {
49   if( &radioButton != this )
50   {
51     Button::operator=( radioButton );
52   }
53   return *this;
54 }
55
56 RadioButton::RadioButton(Dali::Internal::CustomActor* internal)
57   : Button(internal)
58 {
59   VerifyCustomActorPointer<Internal::RadioButton>( internal );
60 }
61
62 RadioButton::~RadioButton()
63 {
64 }
65
66 RadioButton RadioButton::New()
67 {
68   return Internal::RadioButton::New();
69 }
70
71 RadioButton RadioButton::New(const std::string& label)
72 {
73   RadioButton radioButton = Internal::RadioButton::New();
74   radioButton.SetLabel(label);
75   return radioButton;
76 }
77
78 RadioButton RadioButton::New(Actor label)
79 {
80   RadioButton radioButton = Internal::RadioButton::New();
81   radioButton.SetLabel(label);
82   return radioButton;
83 }
84
85 RadioButton RadioButton::DownCast(BaseHandle handle)
86 {
87   return Control::DownCast<RadioButton, Internal::RadioButton>( handle );
88 }
89
90 void RadioButton::SetLabel(const std::string& label)
91 {
92   Dali::Toolkit::GetImplementation(*this).SetLabel(label);
93 }
94
95 void RadioButton::SetLabel(Actor label)
96 {
97   Dali::Toolkit::GetImplementation(*this).SetLabel(label);
98 }
99
100 Actor RadioButton::GetLabel() const
101 {
102   return Dali::Toolkit::GetImplementation(*this).GetLabel();
103 }
104
105 void RadioButton::SetSelected(bool selected)
106 {
107   Dali::Toolkit::GetImplementation(*this).SetSelected(selected);
108 }
109
110 bool RadioButton::IsSelected()const
111 {
112   return Dali::Toolkit::GetImplementation(*this).IsSelected();
113 }
114
115 void RadioButton::ToggleState()
116 {
117   Dali::Toolkit::GetImplementation(*this).ToggleState();
118 }
119
120 } // namespace Toolkit
121
122 } // namespace Dali