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 FUiCtrl_TabBarItem.cpp
19 * @brief This is the implementation file for the _TabBarItem class.
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_TabBarItem.h"
26 #include "FUi_ResourceManager.h"
27 #include "FUi_AccessibilityElement.h"
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Ui;
32 namespace Tizen { namespace Ui { namespace Controls
35 _TabBarItem::_TabBarItem(_ControlOrientation orientation)
38 , __status(ITEM_STATUS_MAX)
42 GET_SHAPE_CONFIG(TABBAR::TOP_MARGIN, orientation, __bounds.y);
43 GET_SHAPE_CONFIG(TABBAR::ITEM_MIN_WIDTH, orientation, __bounds.width);
44 GET_SHAPE_CONFIG(TABBAR::ITEM_HEIGHT, orientation, __bounds.height);
48 _TabBarItem::~_TabBarItem(void)
54 _TabBarItem::SetActionId(int actionId)
56 __actionId = actionId;
60 _TabBarItem::GetActionId(void) const
66 _TabBarItem::SetText(const Tizen::Base::String& text, _ControlOrientation orientation)
68 float fontSize = 0.0f;
69 GET_SHAPE_CONFIG(TABBAR::FONT_SIZE, orientation, fontSize);
70 FloatDimension bounds(0.0f, 0.0f);
72 float minWidth = 0.0f;
73 float maxWidth = 0.0f;
74 float fontMargin = 0.0f;
75 GET_SHAPE_CONFIG(TABBAR::ITEM_MIN_WIDTH, orientation, minWidth);
76 GET_SHAPE_CONFIG(TABBAR::ITEM_MAX_WIDTH, orientation, maxWidth);
77 GET_SHAPE_CONFIG(TABBAR::FONT_MARGIN, orientation, fontMargin);
80 font.Construct(FONT_STYLE_BOLD, fontSize);
81 font.GetTextExtent(text, text.GetLength(), bounds);
83 bounds.width += 2.0f * fontMargin;
84 __bounds.width = bounds.width;
86 if (bounds.width < minWidth)
88 __bounds.width = minWidth;
91 if (bounds.width > maxWidth)
93 __bounds.width = maxWidth;
100 _TabBarItem::GetText(void) const
106 _TabBarItem::SetStatus(_TabBarItemStatus status)
112 _TabBarItem::GetStatus(void) const
118 _TabBarItem::SetBounds(const Tizen::Graphics::FloatRectangle& bounds)
123 Tizen::Graphics::FloatRectangle
124 _TabBarItem::GetBounds(void) const
130 _TabBarItem::SetAccessibilityElement(_AccessibilityElement* pElement)
132 __pElement = pElement;
135 _AccessibilityElement*
136 _TabBarItem::GetAccessibilityElement(void)
141 }}} // Tizen::Ui::Controls