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.
19 * @file FUiCtrlTableViewItem.cpp
20 * @brief This file contains implementation of TableViewItem class
25 #include <FUiCtrlTableViewItem.h>
26 #include <FUiCtrlTableViewContextItem.h>
27 #include "FUiCtrl_TableViewItemImpl.h"
28 #include "FUiCtrl_ListItemBaseImpl.h"
29 #include "FUi_CoordinateSystemUtils.h"
31 namespace Tizen { namespace Ui { namespace Controls
34 TableViewItem::TableViewItem(void)
40 TableViewItem::~TableViewItem(void)
46 TableViewItem::Construct(const Tizen::Graphics::Dimension& itemSize, TableViewAnnexStyle style)
48 return Construct(_CoordinateSystemUtils::ConvertToFloat(itemSize), style);
52 TableViewItem::Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::Dimension& itemSize, TableViewAnnexStyle style)
54 return Construct(layout, layout, _CoordinateSystemUtils::ConvertToFloat(itemSize), style);
58 TableViewItem::Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::Dimension& itemSize, TableViewAnnexStyle style)
60 return Construct(portraitLayout, landscapeLayout, _CoordinateSystemUtils::ConvertToFloat(itemSize), style);
64 TableViewItem::Construct(const Tizen::Graphics::FloatDimension& itemSize, TableViewAnnexStyle style)
67 _TableViewItemImpl* pImpl = _TableViewItemImpl::GetInstance(*this);
68 SysAssertf(pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
70 pImpl = _TableViewItemImpl::CreateTableViewItemImplN(this, itemSize, style);
72 SysTryReturn(NID_UI_CTRL, pImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
74 _pControlImpl = pImpl;
80 TableViewItem::Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatDimension& itemSize, TableViewAnnexStyle style)
82 return Construct(layout, layout, itemSize, style);
86 TableViewItem::Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::FloatDimension& itemSize, TableViewAnnexStyle style)
89 _TableViewItemImpl* pImpl = _TableViewItemImpl::GetInstance(*this);
90 SysAssertf(pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
92 pImpl = _TableViewItemImpl::CreateTableViewItemImplN(this, itemSize, style, &(const_cast <Layout&>(portraitLayout)), &(const_cast <Layout&>(landscapeLayout)));
94 SysTryReturn(NID_UI_CTRL, pImpl != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
96 _pControlImpl = pImpl;
102 TableViewItem::SetContextItem(const TableViewContextItem* pItem)
104 _TableViewItemImpl* pImpl = _TableViewItemImpl::GetInstance(*this);
105 SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use.");
107 _TableViewItemImpl* pItemImpl = null;
110 pItemImpl = const_cast<_TableViewItemImpl*>(_TableViewItemImpl::GetInstance(*pItem));
113 pImpl->SetContextItem(pItemImpl);
117 TableViewItem::GetAnnexWidth(TableViewAnnexStyle style)
119 return _CoordinateSystemUtils::ConvertToInteger(_TableViewItemImpl::GetAnnexWidth(style));
123 TableViewItem::GetAnnexWidthF(TableViewAnnexStyle style)
125 return _TableViewItemImpl::GetAnnexWidth(style);
128 }}} // Tizen::Ui::Controls