remove APIs to apply [ACR][03/30][Remove] Remove APIs in Tizen::Ui namespace
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrlListItemBase.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19  * @file        FUiCtrlListItemBase.cpp
20  * @brief       This is the implementation file for ListItemBase class.
21  *
22  * This file contains the implementation of ListItemBase class.
23  */
24
25 #include <FBaseSysLog.h>
26 #include <FUiCtrlListItemBase.h>
27 #include "FUiCtrl_ListContextItemImpl.h"
28 #include "FUiCtrl_ListItemBaseImpl.h"
29 #include "FUi_CoordinateSystemUtils.h"
30
31 using namespace Tizen::Base;
32 using namespace Tizen::Graphics;
33
34 namespace Tizen { namespace Ui { namespace Controls
35 {
36
37 ListItemBase::ListItemBase(void)
38         : _pImpl(null)
39 {
40 }
41
42 ListItemBase::~ListItemBase(void)
43 {
44         delete _pImpl;
45         _pImpl = null;
46 }
47
48 result
49 ListItemBase::Construct(const Dimension& itemSize, ListAnnexStyle style)
50 {
51         return Construct(_CoordinateSystemUtils::ConvertToFloat(itemSize), style);
52 }
53
54 result
55 ListItemBase::Construct(const FloatDimension& itemSize, ListAnnexStyle style)
56 {
57         result r = E_SUCCESS;
58
59         _ListItemBaseImpl* pImpl = _ListItemBaseImpl::GetInstance(*this);
60         SysAssertf(pImpl == null,
61                                   "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
62
63         pImpl = _ListItemBaseImpl::CreateListItemBaseImplN(this, itemSize, style);
64         SysTryReturn(NID_UI_CTRL, pImpl != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
65
66         _pImpl = pImpl;
67
68         return r;
69 }
70
71 result
72 ListItemBase::SetBackgroundBitmap(ListItemDrawingStatus status, const Bitmap* pBitmap)
73 {
74         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
75
76         return _pImpl->SetBackgroundBitmap(status, pBitmap);
77 }
78
79 result
80 ListItemBase::SetBackgroundColor(ListItemDrawingStatus status, const Color& color)
81 {
82         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
83
84         return _pImpl->SetBackgroundColor(status, color);
85 }
86
87 Color
88 ListItemBase::GetBackgroundColor(ListItemDrawingStatus status) const
89 {
90         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
91
92         return _pImpl->GetBackgroundColor(status);
93 }
94
95 result
96 ListItemBase::SetContextItem(const ListContextItem* pItem)
97 {
98         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
99
100         return _pImpl->SetContextItem(_ListContextItemImpl::GetInstance(*pItem));
101 }
102
103 result
104 ListItemBase::SetDescriptionText(const String& text)
105 {
106         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
107
108         return _pImpl->SetDescriptionText(text);
109 }
110
111 result
112 ListItemBase::SetDescriptionTextColor(const Color& color)
113 {
114         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
115
116         return _pImpl->SetDescriptionTextColor(color);
117 }
118
119 int
120 ListItemBase::GetAnnexWidth(ListAnnexStyle style)
121 {
122         return _CoordinateSystemUtils::ConvertToInteger(GetAnnexWidthF(style));
123 }
124
125 float
126 ListItemBase::GetAnnexWidthF(ListAnnexStyle style)
127 {
128         return _ListItemBaseImpl::GetAnnexWidth(style);
129 }
130
131 }}} // Tizen::Ui::Controls