2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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"
28 using namespace Tizen::Graphics;
30 namespace Tizen { namespace Ui { namespace Controls
33 _TabBarItem::_TabBarItem(_ControlOrientation orientation)
36 , __status(ITEM_STATUS_MAX)
39 GET_SHAPE_CONFIG(TABBAR::ITEM_MIN_WIDTH, orientation, __bounds.width);
40 GET_SHAPE_CONFIG(TABBAR::ITEM_HEIGHT, orientation, __bounds.height);
41 GET_SHAPE_CONFIG(TABBAR::TOP_MARGIN, orientation, __bounds.y);
45 _TabBarItem::~_TabBarItem(void)
51 _TabBarItem::SetActionId(int actionId)
53 __actionId = actionId;
57 _TabBarItem::GetActionId(void) const
63 _TabBarItem::SetText(const Tizen::Base::String& text, _ControlOrientation orientation)
66 GET_SHAPE_CONFIG(TABBAR::FONT_SIZE, orientation, fontSize);
67 Dimension bounds(0, 0);
72 GET_SHAPE_CONFIG(TABBAR::ITEM_MIN_WIDTH, orientation, minWidth);
73 GET_SHAPE_CONFIG(TABBAR::ITEM_MAX_WIDTH, orientation, maxWidth);
74 GET_SHAPE_CONFIG(TABBAR::FONT_MARGIN, orientation, fontMargin);
77 font.Construct(FONT_STYLE_BOLD, fontSize);
78 font.GetTextExtent(text, text.GetLength(), bounds);
80 bounds.width += 2 * fontMargin;
81 __bounds.width = bounds.width;
83 if (bounds.width < minWidth)
85 __bounds.width = minWidth;
88 if (bounds.width > maxWidth)
90 __bounds.width = maxWidth;
97 _TabBarItem::GetText(void) const
103 _TabBarItem::SetStatus(_TabBarItemStatus status)
109 _TabBarItem::GetStatus(void) const
115 _TabBarItem::SetBounds(const Tizen::Graphics::Rectangle& bounds)
120 Tizen::Graphics::Rectangle
121 _TabBarItem::GetBounds(void) const
126 }}} // Tizen::Ui::Controls