Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrlListContextItem.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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        FUiCtrlListContextItem.cpp
20  * @brief       This is the implementation file for ListContextItem class.
21  *
22  * This file contains the implementation of ListContextItem class.
23  */
24
25 #include <FBaseSysLog.h>
26 #include <FUiCtrlListContextItem.h>
27 #include "FUiCtrl_ListContextItemImpl.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Graphics;
31
32 namespace Tizen { namespace Ui { namespace Controls
33 {
34
35 ListContextItem::ListContextItem(void)
36         : __pImpl(null)
37 {
38 }
39
40 ListContextItem::~ListContextItem(void)
41 {
42         delete __pImpl;
43         __pImpl = null;
44 }
45
46 result
47 ListContextItem::Construct(void)
48 {
49         _ListContextItemImpl* pImpl = _ListContextItemImpl::GetInstance(*this);
50         SysAssertf(pImpl == null,
51                                   "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
52
53         pImpl = _ListContextItemImpl::CreateListContextItemImplN(this);
54         SysTryReturn(NID_UI_CTRL, pImpl != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
55
56         __pImpl = pImpl;
57
58         return E_SUCCESS;
59 }
60
61 result
62 ListContextItem::AddElement(int elementId, const String& text, bool enable)
63 {
64         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
65
66         return __pImpl->AddElement(elementId, text, enable);
67 }
68
69 result
70 ListContextItem::AddElement(int elementId, const Bitmap& normalBitmap, const Bitmap& pressedBitmap,
71                 const Bitmap* pHighlightedBitmap, bool enable)
72 {
73         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
74
75         return __pImpl->AddElement(elementId, normalBitmap, pressedBitmap, pHighlightedBitmap, enable);
76 }
77
78 result
79 ListContextItem::AddElement(int elementId, const String& text, const Bitmap& normalBitmap,
80                 const Bitmap& pressedBitmap, const Bitmap* pHighlightedBitmap, bool enable)
81 {
82         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
83
84         return __pImpl->AddElement(elementId, text, normalBitmap, pressedBitmap, pHighlightedBitmap, enable);
85
86 }
87
88 result
89 ListContextItem::SetBackgroundBitmap(const Bitmap* pBitmap)
90 {
91         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
92
93         return __pImpl->SetBackgroundBitmap(pBitmap);
94
95 }
96
97 result
98 ListContextItem::SetBackgroundColor(const Color& color)
99 {
100         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
101
102         return __pImpl->SetBackgroundColor(color);
103
104 }
105
106 Color
107 ListContextItem::GetBackgroundColor(void) const
108 {
109         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
110
111         return __pImpl->GetBackgroundColor();
112 }
113
114 result
115 ListContextItem::SetElementBackgroundColor(int elementId, ListContextItemElementStatus status, const Color& backgroundColor)
116 {
117         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
118
119         return __pImpl->SetElementBackgroundColor(elementId, status, backgroundColor);
120 }
121
122 Color
123 ListContextItem::GetElementBackgroundColor(int elementId, ListContextItemElementStatus status) const
124 {
125         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
126
127         return __pImpl->GetElementBackgroundColor(elementId, status);
128 }
129
130 result
131 ListContextItem::SetElementTextColor(int elementId, ListContextItemElementStatus status, const Color& textColor)
132 {
133         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
134
135         return __pImpl->SetElementTextColor(elementId, status, textColor);
136 }
137
138 Color
139 ListContextItem::GetElementTextColor(int elementId, ListContextItemElementStatus status) const
140 {
141         SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
142
143         return __pImpl->GetElementTextColor(elementId, status);
144 }
145
146 }}} // Tizen::Ui::Controls