Fork for IVI: mesa fixing
[profile/ivi/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
30 using namespace Tizen::Base;
31 using namespace Tizen::Graphics;
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 ListItemBase::ListItemBase(void)
37         : _pImpl(null)
38 {
39 }
40
41 ListItemBase::~ListItemBase(void)
42 {
43         delete _pImpl;
44         _pImpl = null;
45 }
46
47 result
48 ListItemBase::Construct(const Dimension& itemSize, ListAnnexStyle style)
49 {
50         result r = E_SUCCESS;
51
52         _ListItemBaseImpl* pImpl = _ListItemBaseImpl::GetInstance(*this);
53         SysAssertf(pImpl == null,
54                                   "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
55
56         pImpl = _ListItemBaseImpl::CreateListItemBaseImplN(this, itemSize, style);
57         SysTryReturn(NID_UI_CTRL, pImpl != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
58
59         _pImpl = pImpl;
60
61         return r;
62 }
63
64 result
65 ListItemBase::SetBackgroundBitmap(ListItemDrawingStatus status, const Bitmap* pBitmap)
66 {
67         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
68
69         return _pImpl->SetBackgroundBitmap(status, pBitmap);
70 }
71
72 result
73 ListItemBase::SetBackgroundColor(ListItemDrawingStatus status, const Color& color)
74 {
75         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
76
77         return _pImpl->SetBackgroundColor(status, color);
78 }
79
80 Color
81 ListItemBase::GetBackgroundColor(ListItemDrawingStatus status) const
82 {
83         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
84
85         return _pImpl->GetBackgroundColor(status);
86 }
87
88 result
89 ListItemBase::SetContextItem(const ListContextItem* pItem)
90 {
91         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
92
93         return _pImpl->SetContextItem(_ListContextItemImpl::GetInstance(*pItem));
94 }
95
96 result
97 ListItemBase::SetDescriptionText(const String& text)
98 {
99         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
100
101         return _pImpl->SetDescriptionText(text);
102 }
103
104 result
105 ListItemBase::SetDescriptionTextColor(const Color& color)
106 {
107         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
108
109         return _pImpl->SetDescriptionTextColor(color);
110 }
111
112 result
113 ListItemBase::SetProgressValue(int value)
114 {
115         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
116
117         return _pImpl->SetProgressValue(value);
118 }
119
120 result
121 ListItemBase::SetProgressMargins(int leftMargin, int rightMargin)
122 {
123         SysAssertf(_pImpl != null, "Not yet constructed. Construct() should be called before use.");
124
125         return _pImpl->SetProgressMargins(leftMargin, rightMargin);
126 }
127
128 int
129 ListItemBase::GetAnnexWidth(ListAnnexStyle style)
130 {
131         return _ListItemBaseImpl::GetAnnexWidth(style);
132 }
133
134 }}} // Tizen::Ui::Controls