Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrlGroupItem.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 /**
19  * @file        FUiCtrlGroupItem.cpp
20  * @brief       This is the implementation file for GroupItem class.
21  *
22  * This header file contains the implementation of GroupItem class.
23  */
24
25 #include <FBaseSysLog.h>
26 #include <FUiCtrlGroupItem.h>
27 #include "FUiCtrl_GroupItemImpl.h"
28 #include "FUi_CoordinateSystemUtils.h"
29
30 using namespace Tizen::Base;
31 using namespace Tizen::Graphics;
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 GroupItem::GroupItem(void)
37         : _pImpl(null)
38 {
39 }
40
41 GroupItem::~GroupItem(void)
42 {
43         delete _pImpl;
44         _pImpl = null;
45 }
46
47 result
48 GroupItem::Construct(const Dimension& itemSize)
49 {
50         return Construct(_CoordinateSystemUtils::ConvertToFloat(itemSize));
51 }
52
53 result
54 GroupItem::Construct(const FloatDimension& itemSize)
55 {
56         result r = E_SUCCESS;
57
58         _GroupItemImpl* pGroupItemImpl = _GroupItemImpl::GetInstance(*this);
59         SysAssertf((pGroupItemImpl == null),
60                                   "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
61
62         pGroupItemImpl = _GroupItemImpl::CreateGroupItemImpN(this, itemSize);
63         SysTryReturn(NID_UI_CTRL, (pGroupItemImpl != null), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
64
65         _pImpl = pGroupItemImpl;
66
67         return r;
68 }
69
70 result
71 GroupItem::SetBackgroundBitmap(const Bitmap* pBitmap)
72 {
73         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
74
75         return _pImpl->SetBackgroundBitmap(pBitmap);
76 }
77
78 result
79 GroupItem::SetBackgroundColor(const Color& color)
80 {
81         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
82
83         return _pImpl->SetBackgroundColor(color);
84 }
85
86 Color
87 GroupItem::GetBackgroundColor(void) const
88 {
89         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
90
91         return _pImpl->GetBackgroundColor();
92 }
93
94 result
95 GroupItem::SetTextColor(const Color& color)
96 {
97         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
98
99         return _pImpl->SetTextColor(color);
100 }
101
102 Color
103 GroupItem::GetTextColor(void) const
104 {
105         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
106
107         return _pImpl->GetTextColor();
108 }
109
110 result
111 GroupItem::SetTextSize(int size)
112 {
113         return SetTextSize(_CoordinateSystemUtils::ConvertToFloat(size));
114 }
115
116 result
117 GroupItem::SetTextSize(float size)
118 {
119         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
120
121         return _pImpl->SetTextSize(size);
122 }
123
124 int
125 GroupItem::GetTextSize(void) const
126 {
127         return _CoordinateSystemUtils::ConvertToInteger(GetTextSizeF());
128 }
129
130 float
131 GroupItem::GetTextSizeF(void) const
132 {
133         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
134
135         return _pImpl->GetTextSize();
136 }
137
138
139 result
140 GroupItem::SetElement(const String& text, const Bitmap* pBitmap)
141 {
142         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
143
144         return _pImpl->SetElement(text, pBitmap);
145 }
146
147 }}} //Tizen::Ui::Controls