2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
18 * @file FUiCtrlRadioGroup.cpp
19 * @brief This file contains implementation of RadioGroup class
22 #include <FUiCtrlRadioGroup.h>
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_RadioGroupImpl.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Graphics;
29 namespace Tizen { namespace Ui { namespace Controls
32 RadioGroup::RadioGroup(void)
37 RadioGroup::~RadioGroup(void)
43 RadioGroup::Construct(void)
46 _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
48 SysAssertf(pRadioGroupImpl == null,
49 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
51 pRadioGroupImpl = _RadioGroupImpl::CreateRadioGroupImplN(this);
53 SysTryReturn(NID_UI_CTRL, pRadioGroupImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
55 _pControlImpl = pRadioGroupImpl;
61 RadioGroup::Add(const CheckButton& checkButton)
63 _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
64 SysTryReturn(NID_UI_CTRL, pRadioGroupImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.");
66 result r = pRadioGroupImpl->Add(checkButton);
67 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
73 RadioGroup::Add(CheckButton* pCheckButton)
75 SysTryReturn(NID_UI_CTRL, pCheckButton, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The specified input parameter is invalid.");
77 return Add(*pCheckButton);
81 RadioGroup::Remove(const CheckButton& checkButton)
83 _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
84 SysTryReturn(NID_UI_CTRL, pRadioGroupImpl, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] This instance isn't constructed.\n");
86 result r = pRadioGroupImpl->Remove(checkButton);
87 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
93 RadioGroup::Remove(CheckButton* pCheckButton)
95 SysTryReturn(NID_UI_CTRL, pCheckButton, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The specified input parameter is invalid.");
97 return Remove(*pCheckButton);
101 RadioGroup::GetItemCount(void) const
103 const _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
104 SysAssertf(pRadioGroupImpl != null,
105 "Not yet constructed. Construct() should be called before use.");
107 return pRadioGroupImpl->GetItemCount();
111 RadioGroup::SetSelectedItem(const CheckButton& checkButton)
113 _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
114 SysAssertf(pRadioGroupImpl != null,
115 "Not yet constructed. Construct() should be called before use.");
117 pRadioGroupImpl->SetSelectedItem(checkButton);
123 RadioGroup::SetSelectedItem(CheckButton* pCheckButton)
125 SysTryReturnVoidResult(NID_UI_CTRL, pCheckButton, E_INVALID_ARG, "[E_INVALID_ARG] The specified input parameter is invalid.");
127 return SetSelectedItem(*pCheckButton);
131 RadioGroup::GetSelectedItem(void) const
133 const _RadioGroupImpl* pRadioGroupImpl = _RadioGroupImpl::GetInstance(*this);
134 SysAssertf(pRadioGroupImpl != null,
135 "Not yet constructed. Construct() should be called before use.");
137 return pRadioGroupImpl->GetSelectedItem();
140 }}} // Tizen::Ui::Controls