Fork for IVI: mesa fixing
[profile/ivi/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 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 /**
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
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31
32 namespace Tizen { namespace Ui { namespace Controls
33 {
34
35 GroupItem::GroupItem(void)
36         : _pImpl(null)
37 {
38 }
39
40 GroupItem::~GroupItem(void)
41 {
42         delete _pImpl;
43         _pImpl = null;
44 }
45
46 result
47 GroupItem::Construct(const Dimension& itemSize)
48 {
49         result r = E_SUCCESS;
50
51         _GroupItemImpl* pGroupItemImpl = _GroupItemImpl::GetInstance(*this);
52         SysAssertf((pGroupItemImpl == null),
53                                   "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
54
55         pGroupItemImpl = _GroupItemImpl::CreateGroupItemImpN(this, itemSize);
56         SysTryReturn(NID_UI_CTRL, (pGroupItemImpl != null), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
57
58         _pImpl = pGroupItemImpl;
59
60         return r;
61 }
62
63 result
64 GroupItem::SetBackgroundBitmap(const Bitmap* pBitmap)
65 {
66         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
67
68         return _pImpl->SetBackgroundBitmap(pBitmap);
69 }
70
71 result
72 GroupItem::SetBackgroundColor(const Color& color)
73 {
74         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
75
76         return _pImpl->SetBackgroundColor(color);
77 }
78
79 Color
80 GroupItem::GetBackgroundColor(void) const
81 {
82         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
83
84         return _pImpl->GetBackgroundColor();
85 }
86
87 result
88 GroupItem::SetTextColor(const Color& color)
89 {
90         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
91
92         return _pImpl->SetTextColor(color);
93 }
94
95 Color
96 GroupItem::GetTextColor(void) const
97 {
98         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
99
100         return _pImpl->GetTextColor();
101 }
102
103 result
104 GroupItem::SetTextSize(int size)
105 {
106         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
107
108         return _pImpl->SetTextSize(size);
109 }
110
111 int
112 GroupItem::GetTextSize(void) const
113 {
114         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
115
116         return _pImpl->GetTextSize();
117 }
118
119 result
120 GroupItem::SetElement(const String& text, const Bitmap* pBitmap)
121 {
122         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
123
124         return _pImpl->SetElement(text, pBitmap);
125 }
126
127 }}} //Tizen::Ui::Controls