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 FUiCtrlTabBarItem.cpp
19 * @brief This file contains implementation of TabBarItem class
22 #include <FUiCtrlTabBarItem.h>
23 #include <FBaseErrors.h>
24 #include <FBaseResult.h>
25 #include <FBaseSysLog.h>
26 #include "FUiCtrl_TabBarItemImpl.h"
28 using namespace Tizen::Ui::Controls;
30 namespace Tizen { namespace Ui { namespace Controls
33 TabBarItem::TabBarItem(void)
34 : __pTabBarItemImpl(null)
39 TabBarItem::~TabBarItem(void)
41 delete __pTabBarItemImpl;
42 __pTabBarItemImpl = null;
47 TabBarItem::Construct(const Tizen::Base::String& text, int actionId)
49 if (__pTabBarItemImpl != null)
51 SysLog(NID_UI_CTRL, "[E_INVALID_STATE] This instance is already allocated.");
52 return E_INVALID_STATE;
57 SysLog(NID_UI_CTRL, "[E_INVALID_ARG] The action ID of the item must be a positive integer.");
61 __pTabBarItemImpl = new (std::nothrow) _TabBarItemImpl();
62 if (__pTabBarItemImpl == null)
64 SysLog(NID_UI_CTRL, "[E_OUT_OF_MEMORY] SeedItem of TabBarItem can not be allocated due to the memory shortage.");
65 delete __pTabBarItemImpl;
66 __pTabBarItemImpl = null;
67 return E_OUT_OF_MEMORY;
70 __pTabBarItemImpl->SetText(text);
71 __pTabBarItemImpl->SetActionId(actionId);
77 TabBarItem::SetActionId(int actionId)
79 if (__pTabBarItemImpl == null)
81 SysLog(NID_UI_CTRL, "[E_INVALID_STATE] This instance isn't constructed.");
82 return E_INVALID_STATE;
87 SysLog(NID_UI_CTRL, "[E_INVALID_ARG] The action ID of the item must be a positive integer.");
91 __pTabBarItemImpl->SetActionId(actionId);
96 TabBarItem::GetActionId(void) const
100 if (__pTabBarItemImpl == null)
102 SysLog(NID_UI_CTRL, "[E_INVALID_STATE] This instance isn't constructed.");
103 SetLastResult(E_INVALID_STATE);
107 SetLastResult(E_SUCCESS);
108 return __pTabBarItemImpl->GetActionId();
112 TabBarItem::GetText(void) const
116 if (__pTabBarItemImpl == null)
118 SysLog(NID_UI_CTRL, "[E_INVALID_STATE] This instance isn't constructed.");
119 SetLastResult(E_INVALID_STATE);
120 return Tizen::Base::String();
123 SetLastResult(E_SUCCESS);
124 return __pTabBarItemImpl->GetText();
128 TabBarItem::SetText(const Tizen::Base::String& text)
130 if (__pTabBarItemImpl == null)
132 SysLog(NID_UI_CTRL, "[E_INVALID_STATE] This instance isn't constructed.");
133 return E_INVALID_STATE;
136 __pTabBarItemImpl->SetText(text);
141 } } } // Tizen::Ui::Controls