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 FUiCtrlHeaderItem.cpp
19 * @brief This is the implementation file for HeaderItem class.
23 #include <FUiCtrlHeaderItem.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_HeaderItemImpl.h"
27 using namespace Tizen::Base;
28 using namespace Tizen::Graphics;
30 namespace Tizen { namespace Ui { namespace Controls
33 HeaderItem::HeaderItem(void)
38 HeaderItem::~HeaderItem(void)
48 HeaderItem::Construct(int actionId)
52 SysTryReturnResult(NID_UI_CTRL, (actionId >= HEADER_ITEM_ACTION_ID_MIN && actionId <= HEADER_ITEM_ACTION_ID_MAX), E_INVALID_ARG,
53 "[E_INVALID_ARG] The actionId is invalid.");
55 _HeaderItemImpl* pImpl = _HeaderItemImpl::GetInstance(*this);
56 SysAssertf(pImpl == null,
57 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
59 __pImpl = new (std::nothrow) _HeaderItemImpl(this);
60 SysTryReturnResult(NID_UI_CTRL, __pImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Impl instance is not constructed");
62 r = __pImpl->Construct(actionId);
68 SysLog(NID_UI_CTRL, "[%s] Propagated.", GetErrorMessage(r));
76 HeaderItem::GetActionId(void) const
78 SysAssertf(__pImpl != null,
79 "Not yet constructed. Construct() should be called before use.");
81 return __pImpl->GetActionId();
85 HeaderItem::GetText(void) const
87 SysAssertf(__pImpl != null,
88 "Not yet constructed. Construct() should be called before use.");
90 return __pImpl->GetText();
94 HeaderItem::SetActionId(int actionId)
96 SysAssertf(__pImpl != null,
97 "Not yet constructed. Construct() should be called before use.");
99 return __pImpl->SetActionId(actionId);
103 HeaderItem::SetBackgroundBitmap(HeaderItemStatus status, const Bitmap* pBitmap)
105 SysAssertf(__pImpl != null,
106 "Not yet constructed. Construct() should be called before use.");
108 return __pImpl->SetBackgroundBitmap(status, pBitmap);
112 HeaderItem::SetIcon(HeaderItemStatus status, const Bitmap* pIcon)
114 SysAssertf(__pImpl != null,
115 "Not yet constructed. Construct() should be called before use.");
117 return __pImpl->SetIcon(status, pIcon);
121 HeaderItem::SetText(const String& text)
123 SysAssertf(__pImpl != null,
124 "Not yet constructed. Construct() should be called before use.");
126 return __pImpl->SetText(text);
129 }}} // Tizen::Ui::Controls