2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
18 * @file FUiCtrlFooter.cpp
19 * @brief This is the implementation file for Footer class.
22 #include <FUiCtrlFooter.h>
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_FooterImpl.h"
26 using namespace Tizen::Graphics;
28 namespace Tizen { namespace Ui { namespace Controls
32 Footer::AddItem(const FooterItem& item)
34 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
36 SysAssertf(pFooterImpl != null,
37 "Not yet constructed. Construct() should be called before use.");
39 return pFooterImpl->AddItem(item);
43 Footer::InsertItemAt(int itemIndex, const FooterItem& item)
45 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
47 SysAssertf(pFooterImpl != null,
48 "Not yet constructed. Construct() should be called before use.");
50 return pFooterImpl->InsertItemAt(itemIndex, item);
54 Footer::IsButtonSet(ButtonPosition position) const
58 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
60 SysAssertf(pFooterImpl != null,
61 "Not yet constructed. Construct() should be called before use.");
63 return pFooterImpl->IsButtonSet(position);
67 Footer::IsBackButtonSet(void) const
71 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
73 SysAssertf(pFooterImpl != null,
74 "Not yet constructed. Construct() should be called before use.");
76 return pFooterImpl->IsBackButtonSet();
80 Footer::IsTabEditModeEnabled(void) const
84 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
86 SysAssertf(pFooterImpl != null,
87 "Not yet constructed. Construct() should be called before use.");
89 return pFooterImpl->IsTabEditModeEnabled();
93 Footer::GetButtonColor(ButtonItemStatus status) const
97 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
99 SysAssertf(pFooterImpl != null,
100 "Not yet constructed. Construct() should be called before use.");
102 return pFooterImpl->GetButtonColor(status);
106 Footer::GetButtonTextColor(ButtonItemStatus status) const
110 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
112 SysAssertf(pFooterImpl != null,
113 "Not yet constructed. Construct() should be called before use.");
115 return pFooterImpl->GetButtonTextColor(status);
119 Footer::GetButtonStatus(ButtonPosition position) const
123 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
125 SysAssertf(pFooterImpl != null,
126 "Not yet constructed. Construct() should be called before use.");
128 return pFooterImpl->GetButtonStatus(position);
132 Footer::GetBackButtonStatus(void) const
136 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
138 SysAssertf(pFooterImpl != null,
139 "Not yet constructed. Construct() should be called before use.");
141 return pFooterImpl->GetBackButtonStatus();
145 Footer::GetItemColor(FooterItemStatus status) const
149 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
151 SysAssertf(pFooterImpl != null,
152 "Not yet constructed. Construct() should be called before use.");
154 return pFooterImpl->GetItemColor(status);
158 Footer::GetItemCount(void) const
162 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
164 SysAssertf(pFooterImpl != null,
165 "Not yet constructed. Construct() should be called before use.");
167 return pFooterImpl->GetItemCount();
171 Footer::GetItemStatus(int itemIndex, FooterItemStatus& status) const
173 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
175 SysAssertf(pFooterImpl != null,
176 "Not yet constructed. Construct() should be called before use.");
178 return pFooterImpl->GetItemStatus(itemIndex, status);
182 Footer::GetItemTextColor(FooterItemStatus status) const
186 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
188 SysAssertf(pFooterImpl != null,
189 "Not yet constructed. Construct() should be called before use.");
191 return pFooterImpl->GetItemTextColor(status);
195 Footer::GetStyle(void) const
199 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
201 SysAssertf(pFooterImpl != null,
202 "Not yet constructed. Construct() should be called before use.");
204 return pFooterImpl->GetStyle();
208 Footer::GetSelectedItemIndex(void) const
212 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
214 SysAssertf(pFooterImpl != null,
215 "Not yet constructed. Construct() should be called before use.");
217 return pFooterImpl->GetSelectedItemIndex();
221 Footer::GetColor(void) const
225 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
227 SysAssertf(pFooterImpl != null,
228 "Not yet constructed. Construct() should be called before use.");
230 return pFooterImpl->GetColor();
234 Footer::RemoveAllButtons(void)
236 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
238 SysAssertf(pFooterImpl != null,
239 "Not yet constructed. Construct() should be called before use.");
241 return pFooterImpl->RemoveAllButtons();
245 Footer::RemoveButtonAt(ButtonPosition position)
247 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
249 SysAssertf(pFooterImpl != null,
250 "Not yet constructed. Construct() should be called before use.");
252 return pFooterImpl->RemoveButtonAt(position);
256 Footer::RemoveBackButton(void)
258 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
260 SysAssertf(pFooterImpl != null,
261 "Not yet constructed. Construct() should be called before use.");
263 return pFooterImpl->RemoveBackButton();
267 Footer::RemoveAllItems(void)
269 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
271 SysAssertf(pFooterImpl != null,
272 "Not yet constructed. Construct() should be called before use.");
274 return pFooterImpl->RemoveAllItems();
278 Footer::RemoveItemAt(int itemIndex)
280 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
282 SysAssertf(pFooterImpl != null,
283 "Not yet constructed. Construct() should be called before use.");
285 return pFooterImpl->RemoveItemAt(itemIndex);
289 Footer::SetBackgroundBitmap(const Bitmap* pBitmap)
291 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
293 SysAssertf(pFooterImpl != null,
294 "Not yet constructed. Construct() should be called before use.");
296 return pFooterImpl->SetBackgroundBitmap(pBitmap);
300 Footer::SetButton(ButtonPosition position, const ButtonItem& button)
302 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
304 SysAssertf(pFooterImpl != null,
305 "Not yet constructed. Construct() should be called before use.");
307 return pFooterImpl->SetButton(position, button);
311 Footer::SetButtonColor(ButtonItemStatus status, const Color& color)
313 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
315 SysAssertf(pFooterImpl != null,
316 "Not yet constructed. Construct() should be called before use.");
318 return pFooterImpl->SetButtonColor(status, color);
322 Footer::SetButtonTextColor(ButtonItemStatus status, const Color& color)
324 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
326 SysAssertf(pFooterImpl != null,
327 "Not yet constructed. Construct() should be called before use.");
329 return pFooterImpl->SetButtonTextColor(status, color);
333 Footer::SetButtonEnabled(ButtonPosition position, bool enable)
335 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
337 SysAssertf(pFooterImpl != null,
338 "Not yet constructed. Construct() should be called before use.");
340 return pFooterImpl->SetButtonEnabled(position, enable);
344 Footer::SetBackButtonEnabled(bool enable)
346 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
348 SysAssertf(pFooterImpl != null,
349 "Not yet constructed. Construct() should be called before use.");
351 return pFooterImpl->SetBackButtonEnabled(enable);
355 Footer::SetBackButton(void)
357 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
359 SysAssertf(pFooterImpl != null,
360 "Not yet constructed. Construct() should be called before use.");
362 return pFooterImpl->SetBackButton();
366 Footer::SetItemAt(int itemIndex, const FooterItem& item)
368 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
370 SysAssertf(pFooterImpl != null,
371 "Not yet constructed. Construct() should be called before use.");
373 return pFooterImpl->SetItemAt(itemIndex, item);
377 Footer::SetItemColor(FooterItemStatus status, const Color& color)
379 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
381 SysAssertf(pFooterImpl != null,
382 "Not yet constructed. Construct() should be called before use.");
384 return pFooterImpl->SetItemColor(status, color);
388 Footer::SetItemEnabled(int itemIndex, bool enabled)
390 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
392 SysAssertf(pFooterImpl != null,
393 "Not yet constructed. Construct() should be called before use.");
395 return pFooterImpl->SetItemEnabled(itemIndex, enabled);
399 Footer::SetItemBadgeIcon(int itemIndex, const Bitmap* pBadgeIcon)
401 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
403 SysAssertf(pFooterImpl != null,
404 "Not yet constructed. Construct() should be called before use.");
406 return pFooterImpl->SetItemBadgeIcon(itemIndex, pBadgeIcon);
410 Footer::SetItemTextColor(FooterItemStatus status, const Color& color)
412 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
414 SysAssertf(pFooterImpl != null,
415 "Not yet constructed. Construct() should be called before use.");
417 return pFooterImpl->SetItemTextColor(status, color);
421 Footer::SetItemSelected(int itemIndex)
423 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
425 SysAssertf(pFooterImpl != null,
426 "Not yet constructed. Construct() should be called before use.");
428 return pFooterImpl->SetItemSelected(itemIndex);
432 Footer::SetItemNumberedBadgeIcon(int itemIndex, int number)
434 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
436 SysAssertf(pFooterImpl != null,
437 "Not yet constructed. Construct() should be called before use.");
439 return pFooterImpl->SetItemNumberedBadgeIcon(itemIndex, number);
443 Footer::SetColor(const Color& color)
445 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
447 SysAssertf(pFooterImpl != null,
448 "Not yet constructed. Construct() should be called before use.");
450 return pFooterImpl->SetColor(color);
454 Footer::SetStyle(FooterStyle style)
456 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
458 SysAssertf(pFooterImpl != null,
459 "Not yet constructed. Construct() should be called before use.");
461 return pFooterImpl->SetStyle(style);
465 Footer::SetTabEditModeEnabled(bool enable)
467 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
469 SysAssertf(pFooterImpl != null,
470 "Not yet constructed. Construct() should be called before use.");
472 return pFooterImpl->SetTabEditModeEnabled(enable);
476 Footer::AddActionEventListener(IActionEventListener& listener)
478 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
480 SysAssertf(pFooterImpl != null,
481 "Not yet constructed. Construct() should be called before use.");
483 pFooterImpl->AddActionEventListener(listener);
489 Footer::RemoveActionEventListener(IActionEventListener& listener)
491 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
493 SysAssertf(pFooterImpl != null,
494 "Not yet constructed. Construct() should be called before use.");
496 pFooterImpl->RemoveActionEventListener(listener);
505 Footer::~Footer(void)
510 Footer::Construct(void)
512 SysAssertf(_pControlImpl == null,
513 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
515 result r = E_SUCCESS;
517 _FooterImpl* pImpl = _FooterImpl::CreateFooterImplN(this);
519 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
521 _pControlImpl = pImpl;
527 Footer::GetButtonBounds(ButtonPosition position) const
531 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
533 SysAssertf(pFooterImpl != null,
534 "Not yet constructed. Construct() should be called before use.");
536 return pFooterImpl->GetButtonBounds(position);
540 Footer::GetButtonBoundsF(ButtonPosition position) const
544 const _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
546 SysAssertf(pFooterImpl != null,
547 "Not yet constructed. Construct() should be called before use.");
549 return pFooterImpl->GetButtonBoundsF(position);
553 Footer::SetButtonBadgeIcon(ButtonPosition position, const Bitmap* pBadgeIcon)
555 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
557 SysAssertf(pFooterImpl != null,
558 "Not yet constructed. Construct() should be called before use.");
560 return pFooterImpl->SetButtonBadgeIcon(position, pBadgeIcon);
564 Footer::SetButtonNumberedBadgeIcon(ButtonPosition position, int number)
566 _FooterImpl* pFooterImpl = _FooterImpl::GetInstance(*this);
568 SysAssertf(pFooterImpl != null,
569 "Not yet constructed. Construct() should be called before use.");
571 return pFooterImpl->SetButtonNumberedBadgeIcon(position, number);
574 }}} // Tizen::Ui::Controls