Fork for IVI: mesa fixing
[profile/ivi/uifw.git] / src / ui / controls / FUiCtrlRadioGroup.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18 * @file         FUiCtrlRadioGroup.cpp
19 * @brief        This file contains implementation of RadioGroup class
20 */
21
22 #include <FUiCtrlRadioGroup.h>
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_RadioGroupImpl.h"
25
26 using namespace Tizen::Base;
27 using namespace Tizen::Graphics;
28
29 namespace Tizen { namespace Ui { namespace Controls
30 {
31
32 RadioGroup::RadioGroup(void)
33 {
34
35 }
36
37 RadioGroup::~RadioGroup(void)
38 {
39
40 }
41
42 result
43 RadioGroup::Construct(void)
44 {
45         result r = E_SUCCESS;
46         _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
47
48         SysAssertf(pRadioGroupImpl == null,
49                         "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
50
51         pRadioGroupImpl = _RadioGroupImpl::CreateRadioGroupImplN(this);
52         r = GetLastResult();
53         SysTryReturn(NID_UI_CTRL, pRadioGroupImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
54
55         _pControlImpl = pRadioGroupImpl;
56
57         return E_SUCCESS;
58 }
59
60 result
61 RadioGroup::Add(const CheckButton& checkButton)
62 {
63         _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
64         SysTryReturn(NID_UI_CTRL, pRadioGroupImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
65
66         result r = pRadioGroupImpl->Add(checkButton);
67         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
68
69         return E_SUCCESS;
70 }
71
72 result
73 RadioGroup::Remove(const CheckButton& checkButton)
74 {
75         _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
76         SysTryReturn(NID_UI_CTRL, pRadioGroupImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.\n");
77
78         result r = pRadioGroupImpl->Remove(checkButton);
79         SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
80
81         return E_SUCCESS;
82 }
83
84 int
85 RadioGroup::GetItemCount(void) const
86 {
87         const _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
88         SysAssertf(pRadioGroupImpl != null,
89                                 "Not yet constructed. Construct() should be called before use.");
90
91         return pRadioGroupImpl->GetItemCount();
92 }
93
94 void
95 RadioGroup::SetSelectedItem(const CheckButton& checkButton)
96 {
97         _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
98         SysAssertf(pRadioGroupImpl != null,
99                                         "Not yet constructed. Construct() should be called before use.");
100
101         pRadioGroupImpl->SetSelectedItem(checkButton);
102
103         return;
104 }
105
106 const CheckButton*
107 RadioGroup::GetSelectedItem(void) const
108 {
109         const _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
110         SysAssertf(pRadioGroupImpl != null,
111                                         "Not yet constructed. Construct() should be called before use.");
112
113         return pRadioGroupImpl->GetSelectedItem();
114 }
115
116 result
117 RadioGroup::Draw(void)
118 {
119         return E_UNSUPPORTED_OPERATION;
120 }
121
122 result
123 RadioGroup::Show(void)
124 {
125         return E_UNSUPPORTED_OPERATION;
126 }
127
128 result
129 RadioGroup::SetFocus(void)
130 {
131         return E_UNSUPPORTED_OPERATION;
132 }
133
134 }}} // Tizen::Ui::Controls