Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_TabItem.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                FUiCtrl_TabItem.cpp
19  * @brief               This is the header file for the _TabItem class.
20  *
21  */
22
23 #include <FGrp_BitmapImpl.h>
24 #include "FUi_Control.h"
25 #include "FUi_ResourceManager.h"
26 #include "FUiCtrl_TabItem.h"
27
28
29 using namespace Tizen::Graphics;
30
31 namespace Tizen { namespace Ui { namespace Controls {
32
33 _TabItem::_TabItem(void)
34         : __actionId(-1)
35         , __bUpdate(false)
36         , __style(_TABITEM_STYLE_TEXT)
37         , __text(L"")
38         , __pbmIcon(null)
39         , __pbmBadge(null)
40         , __status(_TABITEM_STATUS_NORMAL)
41 {
42         __bounds.x = 0;
43         __bounds.y = 0;
44         __bounds.width = 10;
45         __bounds.height = 10;
46 }
47
48
49 _TabItem::~_TabItem(void)
50 {
51         if (__pbmIcon)
52         {
53                 delete __pbmIcon;
54                 __pbmIcon = null;
55         }
56
57         if (__pbmBadge)
58         {
59                 delete __pbmBadge;
60                 __pbmBadge = null;
61         }
62 }
63
64
65 void
66 _TabItem::SetActionId(int actionId)
67 {
68         __actionId = actionId;
69 }
70
71
72 int
73 _TabItem::GetActionId(void) const
74 {
75         return __actionId;
76 }
77
78
79 void
80 _TabItem::SetUpdateState(bool bUpdate)
81 {
82         __bUpdate = bUpdate;
83 }
84
85
86 int
87 _TabItem::GetUpdateState(void) const
88 {
89         return __bUpdate;
90 }
91
92
93 void
94 _TabItem::SetText(const Tizen::Base::String& text)
95 {
96         __text = text;
97 }
98
99
100 Tizen::Base::String
101 _TabItem::GetText(void) const
102 {
103         return __text;
104 }
105
106
107 void
108 _TabItem::SetIcon(const Bitmap& icon)
109 {
110
111         Tizen::Graphics::Bitmap* __pBitmap = _BitmapImpl::CloneN(icon);
112         result r = GetLastResult();
113         SysTryReturnVoidResult(NID_UI_CTRL, (__pBitmap), r, "[%s] Propagating.", GetErrorMessage(r));
114
115         __pbmIcon = __pBitmap;
116
117         __pBitmap = null;
118 }
119
120
121 Bitmap*
122 _TabItem::GetIcon(void) const
123 {
124         return __pbmIcon;
125 }
126
127
128 void
129 _TabItem::SetBadgeIcon(const Bitmap& icon)
130 {
131         Tizen::Graphics::Bitmap* __pBitmap = _BitmapImpl::CloneN(icon);
132         result r = GetLastResult();
133         SysTryReturnVoidResult(NID_UI_CTRL, (__pBitmap), r, "[%s] Propagating.", GetErrorMessage(r));
134
135         __pbmBadge = __pBitmap;
136
137         __pBitmap = null;
138 }
139
140
141 Bitmap*
142 _TabItem::GetBadgeIcon(void) const
143 {
144         return __pbmBadge;
145 }
146
147
148 void
149 _TabItem::SetItemBounds(Rectangle bounds)
150 {
151         __bounds = bounds;
152 }
153
154
155 Rectangle
156 _TabItem::GetItemBounds(void) const
157 {
158         return __bounds;
159 }
160
161
162 void
163 _TabItem::SetStatus(_TabItemStatus status)
164 {
165         __status = status;
166 }
167
168
169 _TabItemStatus
170 _TabItem::GetStatus(void) const
171 {
172         return __status;
173 }
174
175
176 void
177 _TabItem::SetStyle(int style)
178 {
179         __style = style;
180 }
181
182
183 _TabItemStyle
184 _TabItem::GetStyle(void) const
185 {
186         return _TabItemStyle(__style);
187 }
188
189
190 }}} // Tizen::Ui::Controls