2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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 FUiCtrlHeader.cpp
19 * @brief This is the implementation file for Header class.
22 #include <FUiCtrlHeader.h>
23 #include <FBaseSysLog.h>
24 #include "FUiCtrl_HeaderImpl.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Graphics;
29 namespace Tizen { namespace Ui { namespace Controls
33 Header::Construct(void)
35 SysAssertf(_pControlImpl == null,
36 "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
40 _HeaderImpl* pImpl = _HeaderImpl::CreateHeaderImplN(this);
43 SysTryReturn(NID_UI_CTRL, pImpl, r, r, "[%s] Propagating.", GetErrorMessage(r));
45 _pControlImpl = pImpl;
51 Header::AddItem(const HeaderItem& item)
53 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
55 SysAssertf(pHeaderImpl != null,
56 "Not yet constructed. Construct() should be called before use.");
58 return pHeaderImpl->AddItem(item);
62 Header::GetButtonStatus(ButtonPosition position) const
66 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
68 SysAssertf(pHeaderImpl != null,
69 "Not yet constructed. Construct() should be called before use.");
71 return pHeaderImpl->GetButtonStatus(position);
75 Header::GetButtonColor(ButtonItemStatus status) const
79 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
81 SysAssertf(pHeaderImpl != null,
82 "Not yet constructed. Construct() should be called before use.");
84 return pHeaderImpl->GetButtonColor(status);
88 Header::GetButtonTextColor(ButtonItemStatus status) const
92 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
94 SysAssertf(pHeaderImpl != null,
95 "Not yet constructed. Construct() should be called before use.");
97 return pHeaderImpl->GetButtonTextColor(status);
101 Header::GetDescriptionText(void) const
105 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
107 SysAssertf(pHeaderImpl != null,
108 "Not yet constructed. Construct() should be called before use.");
110 return pHeaderImpl->GetDescriptionText();
114 Header::GetDescriptionTextColor(void) const
118 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
120 SysAssertf(pHeaderImpl != null,
121 "Not yet constructed. Construct() should be called before use.");
123 return pHeaderImpl->GetDescriptionTextColor();
127 Header::GetItemColor(HeaderItemStatus status) const
131 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
133 SysAssertf(pHeaderImpl != null,
134 "Not yet constructed. Construct() should be called before use.");
136 return pHeaderImpl->GetItemColor(status);
140 Header::GetItemCount(void) const
144 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
146 SysAssertf(pHeaderImpl != null,
147 "Not yet constructed. Construct() should be called before use.");
149 return pHeaderImpl->GetItemCount();
153 Header::GetItemStatus(int itemIndex, HeaderItemStatus& status) const
155 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
157 SysAssertf(pHeaderImpl != null,
158 "Not yet constructed. Construct() should be called before use.");
160 return pHeaderImpl->GetItemStatus(itemIndex, status);
164 Header::GetItemTextColor(HeaderItemStatus status) const
168 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
170 SysAssertf(pHeaderImpl != null,
171 "Not yet constructed. Construct() should be called before use.");
173 return pHeaderImpl->GetItemTextColor(status);
177 Header::GetStyle(void) const
181 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
183 SysAssertf(pHeaderImpl != null,
184 "Not yet constructed. Construct() should be called before use.");
186 return pHeaderImpl->GetStyle();
190 Header::GetSelectedItemIndex(void) const
194 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
196 SysAssertf(pHeaderImpl != null,
197 "Not yet constructed. Construct() should be called before use.");
199 return pHeaderImpl->GetSelectedItemIndex();
203 Header::GetTitleText(void) const
207 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
209 SysAssertf(pHeaderImpl != null,
210 "Not yet constructed. Construct() should be called before use.");
212 return pHeaderImpl->GetTitleText();
216 Header::GetTitleTextColor(void) const
220 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
222 SysAssertf(pHeaderImpl != null,
223 "Not yet constructed. Construct() should be called before use.");
225 return pHeaderImpl->GetTitleTextColor();
229 Header::GetColor(void) const
233 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
235 SysAssertf(pHeaderImpl != null,
236 "Not yet constructed. Construct() should be called before use.");
238 return pHeaderImpl->GetColor();
242 Header::GetWaitingAnimationStatus(HeaderAnimationPosition animationPos) const
246 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
248 SysAssertf(pHeaderImpl != null,
249 "Not yet constructed. Construct() should be called before use.");
251 return pHeaderImpl->GetWaitingAnimationStatus(animationPos);
255 Header::InsertItemAt(int itemIndex, const HeaderItem& item)
257 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
259 SysAssertf(pHeaderImpl != null,
260 "Not yet constructed. Construct() should be called before use.");
262 return pHeaderImpl->InsertItemAt(itemIndex, item);
266 Header::IsButtonSet(ButtonPosition position) const
270 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
272 SysAssertf(pHeaderImpl != null,
273 "Not yet constructed. Construct() should be called before use.");
275 return pHeaderImpl->IsButtonSet(position);
279 Header::PauseWaitingAnimation(HeaderAnimationPosition animationPos)
281 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
283 SysAssertf(pHeaderImpl != null,
284 "Not yet constructed. Construct() should be called before use.");
286 return pHeaderImpl->PauseWaitingAnimation(animationPos);
290 Header::PlayWaitingAnimation(HeaderAnimationPosition animationPos)
292 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
294 SysAssertf(pHeaderImpl != null,
295 "Not yet constructed. Construct() should be called before use.");
297 return pHeaderImpl->PlayWaitingAnimation(animationPos);
301 Header::RemoveAllButtons(void)
303 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
305 SysAssertf(pHeaderImpl != null,
306 "Not yet constructed. Construct() should be called before use.");
308 return pHeaderImpl->RemoveAllButtons();
312 Header::RemoveAllItems(void)
314 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
316 SysAssertf(pHeaderImpl != null,
317 "Not yet constructed. Construct() should be called before use.");
319 return pHeaderImpl->RemoveAllItems();
323 Header::RemoveItemAt(int itemIndex)
325 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
327 SysAssertf(pHeaderImpl != null,
328 "Not yet constructed. Construct() should be called before use.");
330 return pHeaderImpl->RemoveItemAt(itemIndex);
334 Header::RemoveButtonAt(ButtonPosition position)
336 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
338 SysAssertf(pHeaderImpl != null,
339 "Not yet constructed. Construct() should be called before use.");
341 return pHeaderImpl->RemoveButtonAt(position);
345 Header::SetBackgroundBitmap(const Bitmap* pBitmap)
347 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
349 SysAssertf(pHeaderImpl != null,
350 "Not yet constructed. Construct() should be called before use.");
352 return pHeaderImpl->SetBackgroundBitmap(pBitmap);
356 Header::SetButton(ButtonPosition position, const ButtonItem& button)
358 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
360 SysAssertf(pHeaderImpl != null,
361 "Not yet constructed. Construct() should be called before use.");
363 return pHeaderImpl->SetButton(position, button);
367 Header::SetButtonColor(ButtonItemStatus status, const Color& color)
369 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
371 SysAssertf(pHeaderImpl != null,
372 "Not yet constructed. Construct() should be called before use.");
374 return pHeaderImpl->SetButtonColor(status, color);
378 Header::SetButtonEnabled(ButtonPosition position, bool enable)
380 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
382 SysAssertf(pHeaderImpl != null,
383 "Not yet constructed. Construct() should be called before use.");
385 return pHeaderImpl->SetButtonEnabled(position, enable);
389 Header::SetButtonTextColor(ButtonItemStatus status, const Color& color)
391 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
393 SysAssertf(pHeaderImpl != null,
394 "Not yet constructed. Construct() should be called before use.");
396 return pHeaderImpl->SetButtonTextColor(status, color);
400 Header::SetButtonBadgeIcon(ButtonPosition position, const Bitmap* pBadgeIcon)
402 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
404 SysAssertf(pHeaderImpl != null,
405 "Not yet constructed. Construct() should be called before use.");
407 return pHeaderImpl->SetButtonBadgeIcon(position, pBadgeIcon);
411 Header::SetButtonNumberedBadgeIcon(ButtonPosition position, int number)
413 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
415 SysAssertf(pHeaderImpl != null,
416 "Not yet constructed. Construct() should be called before use.");
418 return pHeaderImpl->SetButtonNumberedBadgeIcon(position, number);
422 Header::SetItemAt(int itemIndex, const HeaderItem& item)
424 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
426 SysAssertf(pHeaderImpl != null,
427 "Not yet constructed. Construct() should be called before use.");
429 return pHeaderImpl->SetItemAt(itemIndex, item);
433 Header::SetItemBadgeIcon(int itemIndex, const Bitmap* pBadgeIcon)
435 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
437 SysAssertf(pHeaderImpl != null,
438 "Not yet constructed. Construct() should be called before use.");
440 return pHeaderImpl->SetItemBadgeIcon(itemIndex, pBadgeIcon);
444 Header::SetItemNumberedBadgeIcon(int itemIndex, int number)
446 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
448 SysAssertf(pHeaderImpl != null,
449 "Not yet constructed. Construct() should be called before use.");
451 return pHeaderImpl->SetItemNumberedBadgeIcon(itemIndex, number);
455 Header::SetItemColor(HeaderItemStatus status, const Color& color)
457 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
459 SysAssertf(pHeaderImpl != null,
460 "Not yet constructed. Construct() should be called before use.");
462 return pHeaderImpl->SetItemColor(status, color);
466 Header::SetItemEnabled(int itemIndex, bool enable)
468 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
470 SysAssertf(pHeaderImpl != null,
471 "Not yet constructed. Construct() should be called before use.");
473 return pHeaderImpl->SetItemEnabled(itemIndex, enable);
477 Header::SetItemTextColor(HeaderItemStatus status, const Color& color)
479 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
481 SysAssertf(pHeaderImpl != null,
482 "Not yet constructed. Construct() should be called before use.");
484 return pHeaderImpl->SetItemTextColor(status, color);
488 Header::SetItemSelected(int itemIndex)
490 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
492 SysAssertf(pHeaderImpl != null,
493 "Not yet constructed. Construct() should be called before use.");
495 return pHeaderImpl->SetItemSelected(itemIndex);
499 Header::SetColor(const Color& color)
501 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
503 SysAssertf(pHeaderImpl != null,
504 "Not yet constructed. Construct() should be called before use.");
506 return pHeaderImpl->SetColor(color);
510 Header::SetStyle(HeaderStyle style)
512 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
514 SysAssertf(pHeaderImpl != null,
515 "Not yet constructed. Construct() should be called before use.");
517 return pHeaderImpl->SetStyle(style);
521 Header::SetTitleIcon(const Bitmap* pIcon)
523 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
525 SysAssertf(pHeaderImpl != null,
526 "Not yet constructed. Construct() should be called before use.");
528 return pHeaderImpl->SetTitleIcon(pIcon);
532 Header::SetTitleText(const String& text)
534 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
536 SysAssertf(pHeaderImpl != null,
537 "Not yet constructed. Construct() should be called before use.");
539 return pHeaderImpl->SetTitleText(text);
543 Header::SetTitleTextColor(const Color& color)
545 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
547 SysAssertf(pHeaderImpl != null,
548 "Not yet constructed. Construct() should be called before use.");
550 return pHeaderImpl->SetTitleTextColor(color);
554 Header::SetDescriptionText(const String& text)
556 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
558 SysAssertf(pHeaderImpl != null,
559 "Not yet constructed. Construct() should be called before use.");
561 return pHeaderImpl->SetDescriptionText(text);
565 Header::SetDescriptionTextColor(const Color& color)
567 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
569 SysAssertf(pHeaderImpl != null,
570 "Not yet constructed. Construct() should be called before use.");
572 return pHeaderImpl->SetDescriptionTextColor(color);
576 Header::StopWaitingAnimation(HeaderAnimationPosition animationPos)
578 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
580 SysAssertf(pHeaderImpl != null,
581 "Not yet constructed. Construct() should be called before use.");
583 return pHeaderImpl->StopWaitingAnimation(animationPos);
587 Header::AddActionEventListener(IActionEventListener& listener)
589 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
591 SysAssertf(pHeaderImpl != null,
592 "Not yet constructed. Construct() should be called before use.");
594 pHeaderImpl->AddActionEventListener(listener);
600 Header::RemoveActionEventListener(IActionEventListener& listener)
602 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
604 SysAssertf(pHeaderImpl != null,
605 "Not yet constructed. Construct() should be called before use.");
607 pHeaderImpl->RemoveActionEventListener(listener);
613 Header::IsTabEditModeEnabled(void) const
617 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
619 SysAssertf(pHeaderImpl != null,
620 "Not yet constructed. Construct() should be called before use.");
622 return pHeaderImpl->IsTabEditModeEnabled();
626 Header::SetTabEditModeEnabled(bool enable)
628 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
630 SysAssertf(pHeaderImpl != null,
631 "Not yet constructed. Construct() should be called before use.");
633 return pHeaderImpl->SetTabEditModeEnabled(enable);
637 Header::SetBackButton(void)
639 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
641 SysAssertf(pHeaderImpl != null,
642 "Not yet constructed. Construct() should be called before use.");
644 return pHeaderImpl->SetBackButton();
648 Header::IsBackButtonSet(void) const
652 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
654 SysAssertf(pHeaderImpl != null,
655 "Not yet constructed. Construct() should be called before use.");
657 return pHeaderImpl->IsBackButtonSet();
661 Header::RemoveBackButton(void)
663 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
665 SysAssertf(pHeaderImpl != null,
666 "Not yet constructed. Construct() should be called before use.");
668 pHeaderImpl->RemoveBackButton();
674 Header::SetBackButtonEnabled(bool enable)
676 _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
678 SysAssertf(pHeaderImpl != null,
679 "Not yet constructed. Construct() should be called before use.");
681 return pHeaderImpl->SetBackButtonEnabled(enable);
685 Header::GetBackButtonStatus(void) const
689 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
691 SysAssertf(pHeaderImpl != null,
692 "Not yet constructed. Construct() should be called before use.");
694 return pHeaderImpl->GetBackButtonStatus();
698 Header::GetButtonBounds(ButtonPosition position) const
702 const _HeaderImpl* pHeaderImpl = _HeaderImpl::GetInstance(*this);
704 SysAssertf(pHeaderImpl != null,
705 "Not yet constructed. Construct() should be called before use.");
707 return pHeaderImpl->GetButtonBounds(position);
714 Header::~Header(void)
718 }}} //Tizen::Ui::Controls