Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_RadioGroupPresenter.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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                FUiCtrl_RadioGroupPresenter.cpp
19  * @brief               This is the implementation file for the _RadioGroupPresenter class.
20  */
21
22 #include <FBaseErrorDefine.h>
23 #include <FBaseSysLog.h>
24 #include "FUiAnim_VisualElement.h"
25 #include "FUiCtrl_RadioGroupPresenter.h"
26 #include "FUiCtrl_RadioGroupModel.h"
27 #include "FUiCtrl_RadioGroup.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31
32 namespace Tizen { namespace Ui { namespace Controls
33 {
34
35 _RadioGroupPresenter::_RadioGroupPresenter(void)
36         : __pRadioGroup(null)
37         , __pRadioGroupModel(null)
38         , __pRoot(null)
39 {
40
41 }
42
43 _RadioGroupPresenter::~_RadioGroupPresenter(void)
44 {
45         if (__pRadioGroupModel)
46         {
47                 delete __pRadioGroupModel;
48                 __pRadioGroupModel = null;
49         }
50 }
51
52 result
53 _RadioGroupPresenter::Construct(const _RadioGroup& radioGroup)
54 {
55         result r = E_SUCCESS;
56
57         __pRadioGroup = const_cast <_RadioGroup*>(&radioGroup);
58
59         __pRoot = __pRadioGroup->GetVisualElement();
60
61         if (__pRoot)
62         {
63                 __pRoot->SetSurfaceOpaque(false);
64         }
65
66         return r;
67 }
68
69 result
70 _RadioGroupPresenter::Install(void)
71 {
72         result r = E_SUCCESS;
73
74         _RadioGroupModel* pModel = new (std::nothrow) _RadioGroupModel();
75         SysTryReturn(NID_UI_CTRL, pModel, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
76
77         r = SetModel(*pModel);
78         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
79
80         r = pModel->Construct();
81         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
82
83         return E_SUCCESS;
84
85 CATCH:
86         delete pModel;
87         return r;
88 }
89
90 result
91 _RadioGroupPresenter::SetModel(const _RadioGroupModel& radioGroupModel)
92 {
93         __pRadioGroupModel = const_cast <_RadioGroupModel*>(&radioGroupModel);
94
95         return E_SUCCESS;
96 }
97
98 }}} // Tizen::Ui::Controls