Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_FooterItemImpl.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 * @file                 FUiCtrl_FooterItemImpl.cpp
19 * @brief                This is the implementation file for _FooterItemImpl class.
20 */
21
22 #include <FBaseSysLog.h>
23 #include "FUiCtrl_FooterItemImpl.h"
24
25 using namespace Tizen::Base;
26 using namespace Tizen::Graphics;
27
28 namespace Tizen { namespace Ui { namespace Controls
29 {
30
31 _FooterItemImpl::_FooterItemImpl(FooterItem* pPublic)
32         : __actionId(-1)
33         , __itemText(L"")
34         , __accessibilityHint(L"")
35 {
36         for (int i = 0; i < FOOTER_ITEM_MAX_STATE_COUNT; i++)
37         {
38                 __pIconBitmap[i] = null;
39                 __pFooterItemBackgroundBitmap[i] = null;
40         }
41 }
42
43 _FooterItemImpl::~_FooterItemImpl(void)
44 {
45         for (int i = 0; i < FOOTER_ITEM_MAX_STATE_COUNT; i++)
46         {
47                 __pIconBitmap[i] = null;
48                 __pFooterItemBackgroundBitmap[i] = null;
49         }
50 }
51
52 const _FooterItemImpl*
53 _FooterItemImpl::GetInstance(const FooterItem& footerItem)
54 {
55         return static_cast<const _FooterItemImpl*> (footerItem.__pImpl);
56 }
57
58 _FooterItemImpl*
59 _FooterItemImpl::GetInstance(FooterItem& footerItem)
60 {
61         return static_cast<_FooterItemImpl*> (footerItem.__pImpl);
62 }
63
64 result
65 _FooterItemImpl::Construct(int actionId)
66 {
67         SysTryReturnResult(NID_UI_CTRL, (actionId >= FOOTER_ITEM_ACTION_ID_MIN && actionId <= FOOTER_ITEM_ACTION_ID_MAX),
68                                 E_INVALID_ARG, "[E_INVALID_ARG] The actionId is invalid.");
69
70         __actionId = actionId;
71         __itemText = String(L"");
72
73         for (int i = 0; i < FOOTER_ITEM_MAX_STATE_COUNT; i++)
74         {
75                 __pIconBitmap[i] = null;
76                 __pFooterItemBackgroundBitmap[i] = null;
77         }
78
79         return E_SUCCESS;
80 }
81
82 int
83 _FooterItemImpl::GetActionId(void) const
84 {
85         ClearLastResult();
86
87         return __actionId;
88 }
89
90 const Bitmap*
91 _FooterItemImpl::GetBackgroundBitmap(FooterItemStatus status) const
92 {
93         ClearLastResult();
94
95         SysTryReturn(NID_UI_CTRL, (status >= FOOTER_ITEM_STATUS_NORMAL && status < FOOTER_ITEM_MAX_STATE_COUNT), null, E_INVALID_ARG,
96                                 "[E_INVALID_ARG] status is invalid.");
97
98         return __pFooterItemBackgroundBitmap[status];
99 }
100
101 const Bitmap*
102 _FooterItemImpl::GetIcon(FooterItemStatus status) const
103 {
104         ClearLastResult();
105
106         SysTryReturn(NID_UI_CTRL, (status >= FOOTER_ITEM_STATUS_NORMAL && status < FOOTER_ITEM_MAX_STATE_COUNT), null, E_INVALID_ARG,
107                                 "[E_INVALID_ARG] status is invalid.");
108
109         return __pIconBitmap[status];
110 }
111
112 String
113 _FooterItemImpl::GetText(void) const
114 {
115         ClearLastResult();
116
117         return __itemText;
118 }
119
120 result
121 _FooterItemImpl::SetActionId(int actionId)
122 {
123         SysTryReturnResult(NID_UI_CTRL, (actionId >= FOOTER_ITEM_ACTION_ID_MIN && actionId <= FOOTER_ITEM_ACTION_ID_MAX),
124                         E_INVALID_ARG, "[E_INVALID_ARG] The actionId is invalid.");
125
126         __actionId = actionId;
127
128         return E_SUCCESS;
129 }
130
131 result
132 _FooterItemImpl::SetBackgroundBitmap(FooterItemStatus status, const Bitmap* pBitmap)
133 {
134         SysTryReturnResult(NID_UI_CTRL, (status >= FOOTER_ITEM_STATUS_NORMAL && status < FOOTER_ITEM_MAX_STATE_COUNT), E_INVALID_ARG,
135                                 "[E_INVALID_ARG] status is invalid.");
136
137         __pFooterItemBackgroundBitmap[status] = pBitmap;
138
139         return E_SUCCESS;
140 }
141
142 result
143 _FooterItemImpl::SetIcon(FooterItemStatus status, const Bitmap* pIcon)
144 {
145         SysTryReturnResult(NID_UI_CTRL, (status >= FOOTER_ITEM_STATUS_NORMAL && status < FOOTER_ITEM_MAX_STATE_COUNT), E_INVALID_ARG,
146                                 "[E_INVALID_ARG] status is invalid.");
147
148         __pIconBitmap[status] = pIcon;
149
150         return E_SUCCESS;
151 }
152
153 result
154 _FooterItemImpl::SetText(const String& text)
155 {
156         __itemText = text;
157
158         return E_SUCCESS;
159 }
160
161 void
162 _FooterItemImpl::SetAccessibilityHint(const Tizen::Base::String& hint)
163 {
164         __accessibilityHint = hint;
165 }
166
167 }}} // Tizen::Ui::Controls