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 FUiCtrl_Toolbar.cpp
19 * @brief This is the implementation file for the _Toolbar class.
22 #include <FBaseSysLog.h>
23 #include <FGrp_BitmapImpl.h>
24 #include "FUi_CoordinateSystemUtils.h"
25 #include "FUi_AccessibilityContainer.h"
26 #include "FUi_AccessibilityElement.h"
27 #include "FUi_AccessibilityManager.h"
28 #include "FUi_IAccessibilityListener.h"
29 #include "FUi_CoordinateSystemUtils.h"
30 #include "FUi_TouchLongPressGestureDetector.h"
31 #include "FUi_ResourceManager.h"
32 #include "FUiCtrl_ActionEvent.h"
33 #include "FUiCtrl_Toolbar.h"
34 #include "FUiCtrl_ToolbarPresenter.h"
35 #include "FUiCtrl_Label.h"
36 #include "FUiCtrl_Form.h"
38 using namespace Tizen::Base;
39 using namespace Tizen::Base::Collection;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Ui;
45 class FooterItemAccessibilityListener
46 : public _IAccessibilityListener
49 FooterItemAccessibilityListener(void){}
50 virtual ~FooterItemAccessibilityListener(void){}
51 virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
52 virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
53 virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
54 virtual bool OnAccessibilityReadedElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
55 virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
56 virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
57 virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
58 virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return true;}
59 virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
61 _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM_OF_CONTENTS);
65 FooterItemAccessibilityListener footerItemAccessibilityListener;
68 namespace Tizen { namespace Ui { namespace Controls
71 IMPLEMENT_PROPERTY(_Toolbar);
73 _Toolbar::_Toolbar(void)
75 , __pToolbarPresenter(null)
76 , __pActionEventListener(null)
77 , __pBackEventListener(null)
78 , __pLongPressGesture(null)
79 , __pFlickGesture(null)
80 , __pToolbarBackgroundBitmap(null)
83 , __descriptionText(L"")
84 , __titleTextAlignment(ALIGNMENT_LEFT)
86 , __pTitleBadgeIcon(null)
89 , __style(TOOLBAR_TITLE)
90 , __transparent(false)
91 , __isUserBackgroundBitmap(false)
92 , __titleTextArea(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
93 , __itemArea(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
94 , __pTitleTextElement(null)
96 _AccessibilityContainer* pContainer = null;
98 __pButtonItems[LEFT_BUTTON] = null;
99 __pButtonItems[RIGHT_BUTTON] = null;
100 __pButtonItems[BACK_BUTTON] = null;
101 __pButtonItems[MIDDLE_BUTTON] = null;
103 for (int i = 0; i < TOOLBAR_ANIMATION_POSITION_MAX; i++)
105 __pAnimation[i] = null;
106 __pAnimationFrameList[i] = null;
111 GET_COLOR_CONFIG(FOOTER::BG_NORMAL, bgColor);
115 _Control::SetResizable(false);
117 _Control::SetMovable(false);
119 _ToolbarPresenter* pPresenter = new (std::nothrow) _ToolbarPresenter();
121 SetPresenter(*pPresenter);
123 pPresenter->Construct(*this);
125 pPresenter->Install();
127 pContainer = GetAccessibilityContainer();
131 pContainer->Activate(true);
134 for (int i = 0; i < TOOLBAR_ITEM_MAX_STATE_COUNT; i++)
136 __isItemBgColorSetByUser[i] = false;
137 __isItemTextColorSetByUser[i] = false;
140 for (int i = 0; i < TOOLBAR_BUTTON_MAX_STATE_COUNT; i++)
142 __isButtonBgColorSetByUser[i] = false;
143 __isButtonTextColorSetByUser[i] = false;
147 _Toolbar::~_Toolbar(void)
149 RemoveAllItems(); //__pMoreButton would be deleted in this function
152 if (__pToolbarPresenter)
154 delete __pToolbarPresenter;
155 __pToolbarPresenter = null;
158 if (__pActionEventListener)
160 __pActionEventListener = null;
163 if (__pBackEventListener)
165 __pBackEventListener = null;
168 if (__pLongPressGesture != null)
170 __pLongPressGesture->RemoveGestureListener(*this);
171 RemoveGestureDetector(*__pLongPressGesture);
173 delete __pLongPressGesture;
174 __pLongPressGesture = null;
177 if (__pFlickGesture != null)
179 __pFlickGesture->RemoveGestureListener(*this);
180 RemoveGestureDetector(*__pFlickGesture);
182 delete __pFlickGesture;
183 __pFlickGesture = null;
186 if (__pToolbarBackgroundBitmap)
188 delete __pToolbarBackgroundBitmap;
189 __pToolbarBackgroundBitmap = null;
198 for (int i = 0; i < TOOLBAR_ANIMATION_POSITION_MAX; i++)
200 if (__pAnimationFrameList[i])
202 __pAnimationFrameList[i]->RemoveAll(true);
204 delete __pAnimationFrameList[i];
205 __pAnimationFrameList[i] = null;
209 if (__pAnimation[TOOLBAR_ANIMATION_POSITION_TITLE])
211 DetachChild(*__pAnimation[TOOLBAR_ANIMATION_POSITION_TITLE]);
212 delete __pAnimation[TOOLBAR_ANIMATION_POSITION_TITLE];
213 __pAnimation[TOOLBAR_ANIMATION_POSITION_TITLE] = null;
216 if (__pTitleBadgeIcon)
218 DetachChild(*__pTitleBadgeIcon);
220 delete __pTitleBadgeIcon;
221 __pTitleBadgeIcon = null;
224 if (__pTitleTextElement)
226 __pTitleTextElement->Activate(false);
227 __pTitleTextElement = null;
234 _Toolbar::CreateToolbarN(bool header)
236 _Toolbar* pToolbar = new (std::nothrow) _Toolbar();
237 SysTryReturn(NID_UI_CTRL, pToolbar, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
239 pToolbar->Initialize(header);
240 pToolbar->AcquireHandle();
246 _Toolbar::Initialize(bool header)
254 _Toolbar::IsHeader(void)
260 _Toolbar::InitToolbarColor(void)
262 if (__header == true)
264 if (__transparent) // header && transparent
266 GET_COLOR_CONFIG(HEADER::TRANSLUCENT_TITLE_TEXT_NORMAL, __transTitleTextColor);
267 GET_COLOR_CONFIG(HEADER::TRANSLUCENT_DESCRIPTION_TEXT_NORMAL, __transDescriptionTextColor);
269 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
271 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_NORMAL, __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
272 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_DISABLED, __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
273 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_PRESSED, __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
274 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_HIGHLIGHTED, __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
275 //GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_SELECTED, __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
277 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
278 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
279 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
280 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
281 //GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
283 else if (__style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE)
285 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_BG_NORMAL, __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
286 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_BG_DISABLED, __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
287 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_BG_PRESSED, __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
288 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_BG_HIGHLIGHTED, __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
289 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_BG_SELECTED, __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
291 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_TEXT_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
292 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_TEXT_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
293 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_TEXT_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
294 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_TEXT_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
295 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TRANSLUCENT_TEXT_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
297 else // TOOLBAR_TITLE, TOOLBAR_HEADER_SEGMENTED, TOOLBAR_HEADER_SEGMENTED_WITH_TITLE
299 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_BG_NORMAL, __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
300 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_BG_DISABLED, __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
301 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_BG_PRESSED, __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
302 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_BG_HIGHLIGHTED, __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
303 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_BG_SELECTED, __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
305 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
306 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
307 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
308 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
309 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
312 __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL].SetAlpha(0x00);
313 __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED].SetAlpha(0x00);
314 __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED].SetAlpha(0xFF);
315 __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED].SetAlpha(0x00);
316 __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED].SetAlpha(0x00);
318 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_BG_NORMAL, __buttonTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
319 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_BG_DISABLED, __buttonTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
320 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_BG_PRESSED, __buttonTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
321 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_BG_HIGHLIGHTED, __buttonTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
323 __buttonTransBackgroundColor[_BUTTON_STATUS_NORMAL].SetAlpha(0x00);
324 __buttonTransBackgroundColor[_BUTTON_STATUS_DISABLED].SetAlpha(0x00);
325 __buttonTransBackgroundColor[_BUTTON_STATUS_PRESSED].SetAlpha(0x00);
326 __buttonTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED].SetAlpha(0x00);
328 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_TEXT_NORMAL, __buttonTransTextColor[_BUTTON_STATUS_NORMAL]);
329 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_TEXT_DISABLED, __buttonTransTextColor[_BUTTON_STATUS_DISABLED]);
330 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_TEXT_PRESSED, __buttonTransTextColor[_BUTTON_STATUS_PRESSED]);
331 GET_COLOR_CONFIG(HEADER::BUTTON_TRANSLUCENT_TEXT_HIGHLIGHTED, __buttonTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
333 else // header && not transparent
335 GET_COLOR_CONFIG(HEADER::TITLE_TEXT_NORMAL, __titleTextColor);
336 GET_COLOR_CONFIG(HEADER::TITLE_TEXT_NORMAL, __descriptionTextColor);
339 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
341 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL])
343 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
345 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED])
347 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
349 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED])
351 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
353 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
355 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
357 //if (!__isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED])
359 // GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
362 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL])
364 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
366 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED])
368 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
370 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED])
372 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
374 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
376 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
378 //if (!__isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED])
380 // GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
383 else if (__style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE) // header
385 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL])
387 GET_COLOR_CONFIG(HEADER::TAB_ITEM_BG_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
389 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED])
391 GET_COLOR_CONFIG(HEADER::TAB_ITEM_BG_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
393 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED])
395 GET_COLOR_CONFIG(HEADER::TAB_ITEM_BG_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
397 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
399 GET_COLOR_CONFIG(HEADER::TAB_ITEM_BG_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
401 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED])
403 GET_COLOR_CONFIG(HEADER::TAB_ITEM_BG_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
406 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL])
408 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TEXT_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
410 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED])
412 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TEXT_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
414 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED])
416 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TEXT_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
418 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
420 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TEXT_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
422 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED])
424 GET_COLOR_CONFIG(HEADER::TAB_ITEM_TEXT_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
427 else // TOOLBAR_TITLE, TOOLBAR_HEADER_SEGMENTED, TOOLBAR_HEADER_SEGMENTED_WITH_TITLE,
429 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL])
431 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_BG_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
433 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED])
435 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_BG_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
437 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED])
439 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_BG_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
441 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
443 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_BG_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
445 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED])
447 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_BG_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
450 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL])
452 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TEXT_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
454 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED])
456 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TEXT_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
458 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED])
460 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TEXT_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
462 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
464 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TEXT_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
466 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED])
468 GET_COLOR_CONFIG(HEADER::SEGMENTED_ITEM_TEXT_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
472 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_NORMAL])
474 GET_COLOR_CONFIG(HEADER::BUTTON_BG_NORMAL, __buttonBackgroundColor[_BUTTON_STATUS_NORMAL]);
476 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_DISABLED])
478 GET_COLOR_CONFIG(HEADER::BUTTON_BG_DISABLED, __buttonBackgroundColor[_BUTTON_STATUS_DISABLED]);
480 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_PRESSED])
482 GET_COLOR_CONFIG(HEADER::BUTTON_BG_PRESSED, __buttonBackgroundColor[_BUTTON_STATUS_PRESSED]);
484 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
486 GET_COLOR_CONFIG(HEADER::BUTTON_BG_HIGHLIGHTED, __buttonBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
489 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_NORMAL])
491 GET_COLOR_CONFIG(HEADER::BUTTON_TEXT_NORMAL, __buttonTextColor[_BUTTON_STATUS_NORMAL]);
493 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_DISABLED])
495 GET_COLOR_CONFIG(HEADER::BUTTON_TEXT_DISABLED, __buttonTextColor[_BUTTON_STATUS_DISABLED]);
497 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_PRESSED])
499 GET_COLOR_CONFIG(HEADER::BUTTON_TEXT_PRESSED, __buttonTextColor[_BUTTON_STATUS_PRESSED]);
501 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
503 GET_COLOR_CONFIG(HEADER::BUTTON_TEXT_HIGHLIGHTED, __buttonTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
509 if (__transparent) // footer && transparent
511 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
513 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_NORMAL, __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
514 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_DISABLED, __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
515 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_PRESSED, __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
516 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_HIGHLIGHTED, __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
517 //GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_BG_SELECTED, __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
519 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
520 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
521 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
522 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
523 //GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TRANSLUCENT_TEXT_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
525 else if (__style == TOOLBAR_TAB)
527 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_BG_NORMAL, __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
528 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_BG_DISABLED, __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
529 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_BG_PRESSED, __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
530 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_BG_HIGHLIGHTED, __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
531 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_BG_SELECTED, __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
533 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_TEXT_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
534 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_TEXT_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
535 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_TEXT_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
536 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_TEXT_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
537 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TRANSLUCENT_TEXT_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
539 else // TOOLBAR_SEGMENTED
541 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_BG_NORMAL, __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
542 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_BG_DISABLED, __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
543 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_BG_PRESSED, __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
544 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_BG_HIGHLIGHTED, __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
545 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_BG_SELECTED, __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
547 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
548 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
549 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
550 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
551 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TRANSLUCENT_TEXT_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
554 __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL].SetAlpha(0x00);
555 __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED].SetAlpha(0x00);
556 __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED].SetAlpha(0xFF);
557 __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED].SetAlpha(0x00);
558 __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED].SetAlpha(0x00);
561 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_BG_NORMAL, __buttonTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
562 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_BG_DISABLED, __buttonTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
563 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_BG_PRESSED, __buttonTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
564 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_BG_HIGHLIGHTED, __buttonTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
566 __buttonTransBackgroundColor[_BUTTON_STATUS_NORMAL].SetAlpha(0x00);
567 __buttonTransBackgroundColor[_BUTTON_STATUS_DISABLED].SetAlpha(0x00);
568 __buttonTransBackgroundColor[_BUTTON_STATUS_PRESSED].SetAlpha(0x00);
569 __buttonTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED].SetAlpha(0x00);
571 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_TEXT_NORMAL, __buttonTransTextColor[_BUTTON_STATUS_NORMAL]);
572 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_TEXT_DISABLED, __buttonTransTextColor[_BUTTON_STATUS_DISABLED]);
573 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_TEXT_PRESSED, __buttonTransTextColor[_BUTTON_STATUS_PRESSED]);
574 GET_COLOR_CONFIG(FOOTER::BUTTON_TRANSLUCENT_TEXT_HIGHLIGHTED, __buttonTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
576 else // footer && not transparent
578 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
580 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL])
582 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
584 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED])
586 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
588 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED])
590 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
592 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
594 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
596 //if (!__isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED])
598 // GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_BG_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
601 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL])
603 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
605 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED])
607 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
609 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED])
611 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
613 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
615 GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
617 //if (!__isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED])
619 // GET_COLOR_CONFIG(FOOTER::BUTTON_ITEM_TEXT_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
622 else if (__style == TOOLBAR_TAB)
624 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL])
626 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_BG_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
628 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED])
630 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_BG_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
632 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED])
634 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_BG_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
636 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
638 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_BG_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
640 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED])
642 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_BG_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
645 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL])
647 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TEXT_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
649 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED])
651 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TEXT_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
653 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED])
655 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TEXT_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
657 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
659 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TEXT_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
661 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED])
663 GET_COLOR_CONFIG(FOOTER::TAB_ITEM_TEXT_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
666 else // TOOLBAR_SEGMENTED
668 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL])
670 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_BG_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
672 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED])
674 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_BG_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
676 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED])
678 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_BG_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
680 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
682 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_BG_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
684 if (!__isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED])
686 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_BG_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
689 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL])
691 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TEXT_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
693 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED])
695 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TEXT_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
697 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED])
699 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TEXT_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
701 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
703 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TEXT_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
705 if (!__isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED])
707 GET_COLOR_CONFIG(FOOTER::SEGMENTED_ITEM_TEXT_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
711 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_NORMAL])
713 GET_COLOR_CONFIG(FOOTER::BUTTON_BG_NORMAL, __buttonBackgroundColor[_BUTTON_STATUS_NORMAL]);
715 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_DISABLED])
717 GET_COLOR_CONFIG(FOOTER::BUTTON_BG_DISABLED, __buttonBackgroundColor[_BUTTON_STATUS_DISABLED]);
719 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_PRESSED])
721 GET_COLOR_CONFIG(FOOTER::BUTTON_BG_PRESSED, __buttonBackgroundColor[_BUTTON_STATUS_PRESSED]);
723 if (!__isButtonBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
725 GET_COLOR_CONFIG(FOOTER::BUTTON_BG_HIGHLIGHTED, __buttonBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
728 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_NORMAL])
730 GET_COLOR_CONFIG(FOOTER::BUTTON_TEXT_NORMAL, __buttonTextColor[_BUTTON_STATUS_NORMAL]);
732 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_DISABLED])
734 GET_COLOR_CONFIG(FOOTER::BUTTON_TEXT_DISABLED, __buttonTextColor[_BUTTON_STATUS_DISABLED]);
736 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_PRESSED])
738 GET_COLOR_CONFIG(FOOTER::BUTTON_TEXT_PRESSED, __buttonTextColor[_BUTTON_STATUS_PRESSED]);
740 if (!__isButtonTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED])
742 GET_COLOR_CONFIG(FOOTER::BUTTON_TEXT_HIGHLIGHTED, __buttonTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
751 _Toolbar::InitializeLongPressGesture(void)
753 result r = E_SUCCESS;
755 __pLongPressGesture = new (std::nothrow) _TouchLongPressGestureDetector();
756 SysTryReturn(NID_UI_CTRL, __pLongPressGesture, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create touch long press gesture.");
758 __pLongPressGesture->SetDuration(300);
760 r = AddGestureDetector(*__pLongPressGesture);
761 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture detector", GetErrorMessage(r));
763 r = __pLongPressGesture->AddGestureListener(*(dynamic_cast<_ITouchLongPressGestureEventListener*>(this)));
764 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture listener", GetErrorMessage(r));
770 _Toolbar::InitializeFlickGesture(void)
772 result r = E_SUCCESS;
774 __pFlickGesture = new (std::nothrow) _TouchFlickGestureDetector();
775 SysTryReturn(NID_UI_CTRL, __pFlickGesture, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create flick gesture.");
777 r = AddGestureDetector(*__pFlickGesture);
778 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture detector", GetErrorMessage(r));
780 r = __pFlickGesture->AddGestureListener(*(dynamic_cast<_ITouchFlickGestureEventListener*>(this)));
781 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Failed to add gesture listener", GetErrorMessage(r));
787 _Toolbar::Construct(void)
789 result r = E_SUCCESS;
795 _Toolbar::AddItem(_Button* pButton)
797 SysTryReturnResult(NID_UI_CTRL, (__itemCount < TAB_ITEM_MAX), E_MAX_EXCEEDED,
798 "[E_MAX_EXCEEDED] The number of items have exceeded the maximum limit.");
800 if (__pActionEventListener != null)
802 pButton->AddActionEventListener(*__pActionEventListener);
805 __pItems.push_back(pButton);
808 AttachChild(*pButton);
810 ApplyUserGUI(TOOLBAR_ITEM, pButton);
814 AddAccessibilityElement(pButton);
820 _Toolbar::GetBackgroundBitmap(void) const
822 result r = E_SUCCESS;
824 _Toolbar* pToolbar = const_cast<_Toolbar*>(this);
826 if (!pToolbar->__pToolbarBackgroundBitmap)
830 r = GET_BITMAP_CONFIG_N(HEADER::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pToolbar->__pToolbarBackgroundBitmap);
831 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
835 r = GET_BITMAP_CONFIG_N(FOOTER::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pToolbar->__pToolbarBackgroundBitmap);
836 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
840 return pToolbar->__pToolbarBackgroundBitmap;
844 _Toolbar::GetButton(ToolbarButton position) const
846 SysTryReturn(NID_UI_CTRL, (position >= LEFT_BUTTON && position < BUTTON_MAX), null, E_OUT_OF_RANGE,
847 ("[E_OUT_OF_RANGE] The position is out of range."));
849 return __pButtonItems[position];
853 _Toolbar::GetTitleBadgeIcon(void) const
855 return __pTitleBadgeIcon;
859 _Toolbar::GetButtonColor(_ButtonStatus status) const
865 case _BUTTON_STATUS_NORMAL:
866 color = GetProperty(L"normalButtonColor");
868 case _BUTTON_STATUS_DISABLED:
869 color = GetProperty(L"disabledButtonColor");
871 case _BUTTON_STATUS_PRESSED:
872 color = GetProperty(L"pressedButtonColor");
874 case _BUTTON_STATUS_HIGHLIGHTED:
875 color = GetProperty(L"highlightedButtonColor");
878 color = GetProperty(L"normalButtonColor");
882 return color.ToColor();
886 _Toolbar::GetButtonStatus(ToolbarButton position) const
888 return __pButtonItems[position]->GetButtonStatus();
892 _Toolbar::GetButtonTextColor(_ButtonStatus status) const
898 case _BUTTON_STATUS_NORMAL:
899 color = GetProperty(L"normalButtonTextColor");
901 case _BUTTON_STATUS_DISABLED:
902 color = GetProperty(L"disabledButtonTextColor");
904 case _BUTTON_STATUS_PRESSED:
905 color = GetProperty(L"pressedButtonTextColor");
907 case _BUTTON_STATUS_HIGHLIGHTED:
908 color = GetProperty(L"highlightedButtonTextColor");
911 color = GetProperty(L"normalButtonTextColor");
915 return color.ToColor();
919 _Toolbar::GetColor(void) const
921 Variant color = GetProperty(L"color");
923 return color.ToColor();
927 _Toolbar::GetDescriptionText(void) const
929 Variant text = GetProperty(L"descriptionText");
931 return text.ToString();
935 _Toolbar::GetDescriptionTextColor(void) const
937 Variant color = GetProperty(L"descriptionTextColor");
939 return color.ToColor();
943 _Toolbar::GetFirstEnabledItemIndex(void) const
945 int firstEnabledItemIndex = -1;
947 for (int i = 0; i < __itemCount; i++)
949 if(__pItems.at(i)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
951 firstEnabledItemIndex = i;
956 return firstEnabledItemIndex;
960 _Toolbar::GetItem(int itemIndex) const
962 if (__pItems.at(itemIndex) == null)
964 SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Unable to get item.");
968 return __pItems.at(itemIndex);
972 _Toolbar::GetItemColor(_ButtonStatus status) const
978 case _BUTTON_STATUS_NORMAL:
979 color = GetProperty(L"normalItemColor");
981 case _BUTTON_STATUS_DISABLED:
982 color = GetProperty(L"disabledItemColor");
984 case _BUTTON_STATUS_PRESSED:
985 color = GetProperty(L"pressedItemColor");
987 case _BUTTON_STATUS_HIGHLIGHTED:
988 color = GetProperty(L"highlightedItemColor");
990 case _BUTTON_STATUS_SELECTED:
991 color = GetProperty(L"selectedItemColor");
994 color = GetProperty(L"normalItemColor");
998 return color.ToColor();
1002 _Toolbar::GetItemCount(void) const
1008 _Toolbar::GetItemIndexFromPosition(const FloatPoint& point) const
1010 if (__itemCount <= 0)
1015 for (int i = 0; i < __itemCount; i++)
1017 FloatRectangle bounds = __pItems.at(i)->GetBoundsF();
1019 if (bounds.Contains(point) && __pItems.at(i)->GetVisibleState() == true)
1029 _Toolbar::GetItemStatus(int itemIndex, _ButtonStatus& status) const
1031 status = _BUTTON_STATUS_NORMAL;
1033 SysTryReturnResult(NID_UI_CTRL, (itemIndex >= 0 && itemIndex <= __itemCount), E_OUT_OF_RANGE,
1034 "[E_OUT_OF_RANGE] The itemIndex is out of range.");
1036 status = __pItems.at(itemIndex)->GetButtonStatus();
1042 _Toolbar::GetItemTextColor(_ButtonStatus status) const
1048 case _BUTTON_STATUS_NORMAL:
1049 color = GetProperty(L"normalItemTextColor");
1051 case _BUTTON_STATUS_DISABLED:
1052 color = GetProperty(L"disabledItemTextColor");
1054 case _BUTTON_STATUS_PRESSED:
1055 color = GetProperty(L"pressedItemTextColor");
1057 case _BUTTON_STATUS_HIGHLIGHTED:
1058 color = GetProperty(L"highlightedItemTextColor");
1060 case _BUTTON_STATUS_SELECTED:
1061 color = GetProperty(L"selectedItemTextColor");
1064 color = GetProperty(L"normalItemTextColor");
1068 return color.ToColor();
1072 _Toolbar::GetSelectedItemIndex(void) const
1074 return __pToolbarPresenter->GetSelectedItemIndex();
1078 _Toolbar::GetStyle(void) const
1080 return ToolbarStyle(__style);
1084 _Toolbar::GetTitleIcon(void) const
1086 return __pTitleIcon;
1090 _Toolbar::GetTitleText(void) const
1092 Variant text = GetProperty(L"titleText");
1093 return text.ToString();
1097 _Toolbar::GetTitleTextColor(void) const
1099 Variant color = GetProperty(L"titleTextColor");
1100 return color.ToColor();
1104 _Toolbar::GetTitleTextHorizontalAlignment(void) const
1106 return __titleTextAlignment;
1110 _Toolbar::IsInitialDraw(void) const
1112 return __pToolbarPresenter->IsInitialDraw();
1116 _Toolbar::IsTabEditModeEnabled(void) const
1118 return __pToolbarPresenter->IsTabEditModeEnabled();
1122 _Toolbar::IsTransparent(void) const
1124 return __transparent;
1129 _Toolbar::GetWaitingAnimationStatus(ToolbarAnimationPosition animationPos) const
1131 if (animationPos < TOOLBAR_ANIMATION_POSITION_TITLE || animationPos >= TOOLBAR_ANIMATION_POSITION_MAX)
1133 return ANIMATION_STOPPED;
1136 if (__pAnimation[animationPos] == null)
1138 return ANIMATION_STOPPED;
1141 return __pAnimation[animationPos]->GetStatus();
1145 _Toolbar::InsertItemAt(int itemIndex, _Button* pButton)
1147 SysTryReturnResult(NID_UI_CTRL, (itemIndex >= 0 && itemIndex <= __itemCount), E_OUT_OF_RANGE,
1148 "[E_OUT_OF_RANGE] The itemIndex is out of range.");
1150 if (__pActionEventListener != null)
1152 pButton->AddActionEventListener(*__pActionEventListener);
1155 __pItems.insert(__pItems.begin() + itemIndex, pButton);
1158 AttachChild(*pButton);
1160 ApplyUserGUI(TOOLBAR_ITEM, pButton);
1164 AddAccessibilityElement(pButton);
1170 _Toolbar::IsButtonSet(ToolbarButton position) const
1172 if (__pButtonItems[position] != null)
1181 _Toolbar::MoveItem(const int srcIndex, const int destIndex)
1183 if (srcIndex == destIndex)
1185 SetItemSelected(destIndex, true);
1190 if (srcIndex < 0 || destIndex < 0 || srcIndex > __itemCount || destIndex > __itemCount)
1192 return E_INVALID_OPERATION;
1195 _Button* pSrcButton = null;
1196 pSrcButton = GetItem(srcIndex);
1198 _Button* pDestButton = null;
1199 pDestButton = GetItem(destIndex);
1201 __pItems.erase(__pItems.begin() + destIndex);
1202 __pItems.insert(__pItems.begin() + destIndex, pSrcButton);
1204 __pItems.erase(__pItems.begin() + srcIndex);
1205 __pItems.insert(__pItems.begin() + srcIndex, pDestButton);
1207 for (int i = 0; i < __itemCount; i++)
1209 __pItems.at(i)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1210 _AccessibilityElement* pElement = __pItems.at(i)->GetAccessibilityContainer()->GetChildElement(0);
1213 pElement->SetStatus(L"");
1214 pElement->SetHintDisabled(false);
1218 SetItemSelected(destIndex, true);
1228 _Toolbar::PauseWaitingAnimation(ToolbarAnimationPosition animationPos)
1230 SysTryReturnResult(NID_UI_CTRL,
1231 (TOOLBAR_ANIMATION_POSITION_TITLE <= animationPos && animationPos < TOOLBAR_ANIMATION_POSITION_MAX), E_INVALID_ARG,
1232 "[E_INVALID_ARG] The animationPos is invalid.");
1233 SysTryReturnResult(NID_UI_CTRL, (__pAnimation[animationPos]), E_INVALID_STATE,
1234 "[E_INVALID_STATE] __pAnimation isn't constructed.");
1236 __pAnimation[animationPos]->Pause();
1242 _Toolbar::PlayWaitingAnimation(ToolbarAnimationPosition animationPos)
1244 SysTryReturnResult(NID_UI_CTRL,
1245 (TOOLBAR_ANIMATION_POSITION_TITLE <= animationPos && animationPos < TOOLBAR_ANIMATION_POSITION_MAX), E_INVALID_ARG,
1246 "[E_INVALID_ARG] The animationPos is invalid.");
1248 if ((animationPos == TOOLBAR_ANIMATION_POSITION_TITLE && __style != TOOLBAR_TITLE)
1249 || (animationPos == TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT && __pButtonItems[LEFT_BUTTON] == null)
1250 || (animationPos == TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT && __pButtonItems[RIGHT_BUTTON] == null))
1252 return E_UNSUPPORTED_OPERATION;
1255 if (__pAnimation[animationPos])
1257 if (__pAnimation[animationPos]->GetStatus() == ANIMATION_PLAYING)
1264 SetAnimation(animationPos);
1267 if (__pAnimation[animationPos])
1269 __pAnimation[animationPos]->Play();
1276 _Toolbar::RemoveAllButtons(void)
1278 for (int i = 0; i < BUTTON_MAX; i++)
1280 _Button* pButtonItem = __pButtonItems[i];
1282 if (pButtonItem != null)
1284 if (i == LEFT_BUTTON)
1286 StopWaitingAnimation(TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT);
1288 else if (i == RIGHT_BUTTON)
1290 StopWaitingAnimation(TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT);
1293 if (pButtonItem->GetChildCount() != 0)
1295 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(pButtonItem->GetChild(0));
1296 SysTryReturnResult(NID_UI_CTRL, pTempBadgeIcon, E_INVALID_STATE, "[E_INVALID_STATE] Couldn't get a badge icon.");
1298 pButtonItem->DetachChild(*pTempBadgeIcon);
1300 delete pTempBadgeIcon;
1301 pTempBadgeIcon = null;
1304 DetachChild(*pButtonItem);
1308 __pButtonItems[i] = null;
1316 _Toolbar::RemoveAllItems(void)
1320 int itemCount = __pItems.size();
1322 _Button* pItem = null;
1324 // frees item nodes from the memory
1327 for (int i = itemCount - 1; i >= 0; i--)
1329 pItem = __pItems.at(i);
1333 if (pItem->GetChildCount() != 0)
1335 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(pItem->GetChild(0));
1336 SysTryReturnResult(NID_UI_CTRL, pTempBadgeIcon, E_INVALID_STATE, "[E_INVALID_STATE] Couldn't get a badge icon.");
1338 pItem->DetachChild(*pTempBadgeIcon);
1340 delete pTempBadgeIcon;
1341 pTempBadgeIcon = null;
1344 DetachChild(*pItem);
1355 __pToolbarPresenter->SetInitialDrawState(true);
1357 SetItemSelected(-1);
1363 _Toolbar::RemoveButtonAt(ToolbarButton position)
1365 if (__pButtonItems[position] != null)
1367 if (position == LEFT_BUTTON)
1369 StopWaitingAnimation(TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT);
1371 else if (position == RIGHT_BUTTON)
1373 StopWaitingAnimation(TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT);
1376 DetachChild(*__pButtonItems[position]);
1377 delete __pButtonItems[position];
1378 __pButtonItems[position] = null;
1385 _Toolbar::RemoveItemAt(int itemIndex)
1387 SysTryReturnResult(NID_UI_CTRL, (__itemCount > 0 && itemIndex < __itemCount && itemIndex >= 0), E_INVALID_ARG,
1388 "[E_INVALID_ARG] itemIndex is invalid.");
1390 _Button* pItem = __pItems.at(itemIndex);
1392 SysTryReturnResult(NID_UI_CTRL, (pItem != null), E_INVALID_STATE, "[E_INVALID_ARG] No item at the designated index.");
1394 if (pItem->GetChildCount() != 0)
1396 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(pItem->GetChild(0));
1397 SysTryReturnResult(NID_UI_CTRL, pTempBadgeIcon, E_INVALID_STATE, "[E_INVALID_STATE] Couldn't get a badge icon.");
1399 pItem->DetachChild(*pTempBadgeIcon);
1401 delete pTempBadgeIcon;
1402 pTempBadgeIcon = null;
1405 // Free 'pItem' from the item nodes
1406 DetachChild(*pItem);
1412 __pItems.erase(__pItems.begin() + itemIndex);
1418 _Toolbar::SetBackgroundBitmap(const Bitmap& bitmap)
1420 result r = E_SYSTEM;
1422 Bitmap* pClonedBitmap = _BitmapImpl::CloneN(bitmap);
1426 if (__pToolbarBackgroundBitmap)
1428 delete __pToolbarBackgroundBitmap;
1431 __pToolbarBackgroundBitmap = pClonedBitmap;
1432 __isUserBackgroundBitmap = true;
1441 _Toolbar::IsUserBackgroundBitmap() const
1443 return __isUserBackgroundBitmap;
1447 _Toolbar::SetButton(ToolbarButton position, _Button* pButton)
1449 SysTryReturnResult(NID_UI_CTRL, (pButton), E_INVALID_ARG, "[E_INVALID_ARG] The pButton is invalid.");
1451 float buttonWidth = pButton->GetSizeF().width;
1453 float toolbarWidth = GetBoundsF().width;
1455 if (CalculateMinimumToolbarWidth() > toolbarWidth)
1457 toolbarWidth = CalculateMinimumToolbarWidth();
1460 float horizontalMargin = 0.0f;
1461 float verticalMargin = 0.0f;
1463 if (__header == true && __style != TOOLBAR_TEXT)
1465 float buttonItemGap = 0.0f;
1466 float buttonTopMargin = 0.0f;
1468 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_TOP_MARGIN, GetOrientation(), buttonTopMargin);
1469 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_GAP, GetOrientation(), buttonItemGap);
1474 if (__pButtonItems[LEFT_BUTTON])
1476 pButton->SetPosition(FloatPoint(toolbarWidth - buttonWidth , buttonTopMargin));
1477 __pButtonItems[LEFT_BUTTON]->SetPosition(FloatPoint(toolbarWidth - buttonWidth *2 - buttonItemGap, buttonTopMargin));
1481 pButton->SetPosition(FloatPoint(toolbarWidth - buttonWidth , buttonTopMargin));
1485 if (__pButtonItems[RIGHT_BUTTON])
1487 pButton->SetPosition(FloatPoint(toolbarWidth - buttonWidth * 2 - buttonItemGap, buttonTopMargin));
1491 pButton->SetPosition(FloatPoint(toolbarWidth - buttonWidth, buttonTopMargin));
1499 else // footer or HEADER_STYLE_BUTTON
1504 pButton->SetPosition(FloatPoint(horizontalMargin, verticalMargin));
1508 pButton->SetPosition(FloatPoint(toolbarWidth - buttonWidth - horizontalMargin, verticalMargin));
1512 pButton->SetPosition(FloatPoint(toolbarWidth - buttonWidth, 0.0f));
1513 if (__pBackEventListener)
1515 pButton->AddActionEventListener(*__pBackEventListener);
1516 pButton->SetActionId(__backActionId);
1521 pButton->SetPosition(FloatPoint((toolbarWidth - buttonWidth - horizontalMargin)/2, verticalMargin));
1529 if (position != BACK_BUTTON && __pActionEventListener != null)
1531 pButton->AddActionEventListener(*__pActionEventListener);
1534 if (__pButtonItems[position])
1536 if (position == LEFT_BUTTON)
1538 StopWaitingAnimation(TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT);
1540 else if (position == RIGHT_BUTTON)
1542 StopWaitingAnimation(TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT);
1545 if (__pButtonItems[position]->GetChildCount() != 0)
1547 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pButtonItems[position]->GetChild(0));
1548 SysTryReturnResult(NID_UI_CTRL, pTempBadgeIcon, E_INVALID_STATE, "[E_INVALID_STATE] Couldn't get a badge icon.");
1550 __pButtonItems[position]->DetachChild(*pTempBadgeIcon);
1552 delete pTempBadgeIcon;
1553 pTempBadgeIcon = null;
1556 DetachChild(*__pButtonItems[position]);
1558 delete __pButtonItems[position];
1559 __pButtonItems[position] = null;
1562 __pButtonItems[position] = pButton;
1564 AttachChild(*pButton);
1566 if (__style != TOOLBAR_SOFTKEY)
1568 ApplyUserGUI(TOOLBAR_BUTTON, __pButtonItems[position]);
1572 AddAccessibilityElement(position, pButton);
1577 _Toolbar::SetButtonColor(_ButtonStatus status, const Color& color)
1581 case _BUTTON_STATUS_NORMAL:
1582 __isButtonBgColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
1583 return SetProperty(L"normalButtonColor", Variant(color));
1585 case _BUTTON_STATUS_DISABLED:
1586 __isButtonBgColorSetByUser[_BUTTON_STATUS_DISABLED] = true;
1587 return SetProperty(L"disabledButtonColor", Variant(color));
1589 case _BUTTON_STATUS_PRESSED:
1590 __isButtonBgColorSetByUser[_BUTTON_STATUS_PRESSED] = true;
1591 return SetProperty(L"pressedButtonColor", Variant(color));
1593 case _BUTTON_STATUS_HIGHLIGHTED:
1594 __isButtonBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED] = true;
1595 return SetProperty(L"highlightedButtonColor", Variant(color));
1598 __isButtonBgColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
1599 return SetProperty(L"normalButtonColor", Variant(color));
1605 _Toolbar::SetButtonEnabled(ToolbarButton position, bool enabled)
1607 SysTryReturnResult(NID_UI_CTRL, __pButtonItems[position], E_INVALID_OPERATION,
1608 "[E_INVALID_OPERATION] No button item is at the position.");
1612 __pButtonItems[position]->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1613 _AccessibilityElement* pElement = __pButtonItems[position]->GetAccessibilityContainer()->GetChildElement(0);
1616 pElement->SetStatus(L"");
1617 pElement->SetHintDisabled(false);
1622 __pButtonItems[position]->SetButtonStatus(_BUTTON_STATUS_DISABLED);
1623 _AccessibilityElement* pElement = __pButtonItems[position]->GetAccessibilityContainer()->GetChildElement(0);
1626 pElement->SetStatus(L"");
1627 pElement->SetHintDisabled(false);
1635 _Toolbar::SetButtonTextColor(_ButtonStatus status, const Color& color)
1639 case _BUTTON_STATUS_NORMAL:
1640 __isButtonTextColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
1641 return SetProperty(L"normalButtonTextColor", Variant(color));
1643 case _BUTTON_STATUS_DISABLED:
1644 __isButtonTextColorSetByUser[_BUTTON_STATUS_DISABLED] = true;
1645 return SetProperty(L"disabledButtonTextColor", Variant(color));
1647 case _BUTTON_STATUS_PRESSED:
1648 __isButtonTextColorSetByUser[_BUTTON_STATUS_PRESSED] = true;
1649 return SetProperty(L"pressedButtonTextColor", Variant(color));
1651 case _BUTTON_STATUS_HIGHLIGHTED:
1652 __isButtonTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED] = true;
1653 return SetProperty(L"highlightedButtonTextColor", Variant(color));
1656 __isButtonTextColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
1657 return SetProperty(L"normalButtonTextColor", Variant(color));
1663 _Toolbar::SetButtonBadgeIcon(ToolbarButton position, const Bitmap* pBadgeIcon)
1667 childCount = __pButtonItems[position]->GetChildCount();
1669 if (childCount != 0)
1671 for(int i = 0; i < childCount; i++)
1673 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pButtonItems[position]->GetChild(i));
1677 __pButtonItems[position]->DetachChild(*pTempBadgeIcon);
1679 delete pTempBadgeIcon;
1680 pTempBadgeIcon = null;
1685 if (pBadgeIcon == null)
1690 FloatRectangle bounds = __pButtonItems[position]->GetBoundsF();
1692 float topTouchMargin = __pButtonItems[position]->GetTopTouchMarginF();
1693 float rightTouchMargin = __pButtonItems[position]->GetRightTouchMarginF();
1695 bounds.y = bounds.y + topTouchMargin;
1696 bounds.width = bounds.width - rightTouchMargin;
1698 float height = 0.0f;
1700 GET_SHAPE_CONFIG(HEADER::BADGE_HEIGHT_WITH_BUTTON, GetOrientation(), height);
1702 _Label* pBadgeIconLabel = _Label::CreateLabelN();
1704 if (pBadgeIconLabel)
1706 pBadgeIconLabel->SetBounds(FloatRectangle(bounds.width - height, bounds.y, height, height));
1707 pBadgeIconLabel->SetBackgroundBitmap(*pBadgeIcon);
1709 __pButtonItems[position]->AttachChild(*pBadgeIconLabel);
1710 __pButtonItems[position]->SetChildAlwaysOnTop(*pBadgeIconLabel);
1717 _Toolbar::SetButtonNumberedBadgeIcon(ToolbarButton position, int number)
1721 childCount = __pButtonItems[position]->GetChildCount();
1723 _Label* existingBadgeIcon = null;
1727 if (childCount != 0)
1729 for(int i = 0; i < childCount; i++)
1731 existingBadgeIcon = dynamic_cast<_Label*>(__pButtonItems[position]->GetChild(i));
1733 if (existingBadgeIcon)
1735 __pButtonItems[position]->DetachChild(*existingBadgeIcon);
1737 delete existingBadgeIcon;
1738 existingBadgeIcon = null;
1749 bool needToCreateNewIcon = true;
1751 if (childCount != 0)
1753 for(int i = 0; i < childCount; i++)
1755 existingBadgeIcon = dynamic_cast<_Label*>(__pButtonItems[position]->GetChild(i));
1757 if (existingBadgeIcon)
1759 if (existingBadgeIcon->GetText() == L"")
1761 __pButtonItems[position]->DetachChild(*existingBadgeIcon);
1763 delete existingBadgeIcon;
1764 existingBadgeIcon = null;
1766 needToCreateNewIcon = true;
1770 needToCreateNewIcon = false;
1776 if (needToCreateNewIcon)
1778 _Label* pLabel = _Label::CreateLabelN();
1780 SysTryReturnResult(NID_UI_CTRL, pLabel, E_INVALID_STATE,
1781 "[E_INVALID_STATE] The badge icon instance isn't constructed.");
1783 Bitmap* pNumberedBadgeIconBitmap = null;
1784 Bitmap* pNumberedBadgeIconEffectBitmap = null;
1785 Bitmap* pColorReplacedBitmap = null;
1786 Color badgeIconBgColor;
1787 Color badgeIconTextColor;
1789 GET_BITMAP_CONFIG_N(HEADER::BADGE_ICON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNumberedBadgeIconBitmap);
1791 bool themeBadgeNormalBackgroundBitmap = IS_CUSTOM_BITMAP(HEADER::BADGE_ICON_BG_NORMAL);
1792 if (!themeBadgeNormalBackgroundBitmap)
1794 GET_BITMAP_CONFIG_N(HEADER::BADGE_ICON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNumberedBadgeIconEffectBitmap);
1797 GET_COLOR_CONFIG(HEADER::BADGE_ICON_BG_NORMAL, badgeIconBgColor);
1798 GET_COLOR_CONFIG(HEADER::BADGE_ICON_TEXT_NORMAL, badgeIconTextColor);
1800 if (pNumberedBadgeIconBitmap)
1802 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNumberedBadgeIconBitmap,
1803 Color::GetColor(COLOR_ID_MAGENTA), badgeIconBgColor);
1805 pLabel->SetBackgroundBitmap(*pColorReplacedBitmap);
1807 delete pColorReplacedBitmap;
1808 delete pNumberedBadgeIconBitmap;
1811 if (pNumberedBadgeIconEffectBitmap)
1813 pLabel->SetBackgroundEffectBitmap(*pNumberedBadgeIconEffectBitmap);
1815 delete pNumberedBadgeIconEffectBitmap;
1818 pLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
1819 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
1820 pLabel->SetTextColor(badgeIconTextColor);
1821 pLabel->SetMargin(10, 0, 5, 0);
1823 __pButtonItems[position]->AttachChild(*pLabel);
1824 __pButtonItems[position]->SetChildAlwaysOnTop(*pLabel);
1826 existingBadgeIcon = pLabel;
1829 SysTryReturnResult(NID_UI_CTRL, (existingBadgeIcon), E_INVALID_STATE, "[E_INVALID_STATE] Failed to set a BadgeIcon.");
1831 FloatRectangle bounds = __pButtonItems[position]->GetBoundsF();
1833 float topTouchMargin = __pButtonItems[position]->GetTopTouchMarginF();
1834 float rightTouchMargin = __pButtonItems[position]->GetRightTouchMarginF();
1836 bounds.y = bounds.y + topTouchMargin;
1837 bounds.width = bounds.width - rightTouchMargin;
1839 if (existingBadgeIcon)
1841 float fontSize = 0.0f;
1842 float height = 0.0f;
1845 GET_SHAPE_CONFIG(HEADER::BADGE_HEIGHT_WITH_BUTTON, GetOrientation(), height);
1849 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE_WITH_BUTTON, GetOrientation(), fontSize);
1850 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_1DIGIT, GetOrientation(), width);
1852 else if (number < 100)
1854 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE_WITH_BUTTON, GetOrientation(), fontSize);
1855 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_1DIGIT, GetOrientation(), width);
1857 else if (number < 1000)
1859 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE_WITH_BUTTON, GetOrientation(), fontSize);
1860 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_2DIGIT, GetOrientation(), width);
1862 else if (number < 10000)
1864 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE_WITH_BUTTON, GetOrientation(), fontSize);
1865 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_2DIGIT, GetOrientation(), width);
1869 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE_WITH_BUTTON_2, GetOrientation(), fontSize);
1870 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_2DIGIT, GetOrientation(), width);
1873 existingBadgeIcon->SetBounds(FloatRectangle(bounds.width - width, bounds.y, width, height));
1874 existingBadgeIcon->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
1876 Integer tempNumber(number);
1877 existingBadgeIcon->SetText(tempNumber.ToString());
1885 _Toolbar::SetColor(const Color& color)
1887 return SetProperty(L"color", Variant(color));
1891 _Toolbar::SetDescriptionText(const String& text)
1893 return SetProperty(L"descriptionText", Variant(text));
1897 _Toolbar::SetDescriptionTextColor(const Color& color)
1899 return SetProperty(L"descriptionTextColor", Variant(color));
1903 _Toolbar::SetItemAt(int itemIndex, const _Button* pButton)
1905 SysTryReturnResult(NID_UI_CTRL, (itemIndex >= 0 && itemIndex < __itemCount), E_OUT_OF_RANGE,
1906 "[E_OUT_OF_RANGE] The itemIndex is out of range.");
1908 if (pButton->GetActionId() < TOOLBAR_ACTION_ID_MIN || pButton->GetActionId() > TOOLBAR_ACTION_ID_MAX)
1910 SysLog(NID_UI_CTRL, "[E_INVALID_ARG] The actionId is invalid.");
1911 return E_OUT_OF_RANGE;
1914 SysTryReturnResult(NID_UI_CTRL, (null != __pItems.at(itemIndex)), E_INVALID_OPERATION,
1915 "[E_INVALID_OPERATION] No button item is at the position.");
1917 if (__pItems.at(itemIndex)->GetChildCount() != 0)
1919 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pItems.at(itemIndex)->GetChild(0));
1920 SysTryReturnResult(NID_UI_CTRL, pTempBadgeIcon, E_INVALID_STATE, "[E_INVALID_STATE] Couldn't get a badge icon.");
1922 __pItems.at(itemIndex)->DetachChild(*pTempBadgeIcon);
1924 delete pTempBadgeIcon;
1925 pTempBadgeIcon = null;
1928 __pItems.at(itemIndex)->SetText(pButton->GetText());
1929 __pItems.at(itemIndex)->SetActionId(pButton->GetActionId());
1931 Bitmap* pIconBitmap = null;
1932 FloatPoint iconPosition(0.0f, 0.0f);
1934 pIconBitmap = const_cast<Bitmap*>(pButton->GetBitmap(_BUTTON_STATUS_NORMAL));
1938 iconPosition = pButton->GetBitmapPositionF(_BUTTON_STATUS_NORMAL);
1940 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_NORMAL, iconPosition, *pIconBitmap);
1941 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_PRESSED, iconPosition, *pIconBitmap);
1942 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_SELECTED, iconPosition, *pIconBitmap);
1943 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_HIGHLIGHTED, iconPosition, *pIconBitmap);
1944 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_DISABLED, iconPosition, *pIconBitmap);
1947 pIconBitmap = const_cast<Bitmap*>(pButton->GetBitmap(_BUTTON_STATUS_PRESSED));
1951 iconPosition = pButton->GetBitmapPositionF(_BUTTON_STATUS_PRESSED);
1953 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_PRESSED, iconPosition, *pIconBitmap);
1956 pIconBitmap = const_cast<Bitmap*>(pButton->GetBitmap(_BUTTON_STATUS_SELECTED));
1960 iconPosition = pButton->GetBitmapPositionF(_BUTTON_STATUS_SELECTED);
1962 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_SELECTED, iconPosition, *pIconBitmap);
1965 pIconBitmap = const_cast<Bitmap*>(pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED));
1969 iconPosition = pButton->GetBitmapPositionF(_BUTTON_STATUS_HIGHLIGHTED);
1971 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_HIGHLIGHTED, iconPosition, *pIconBitmap);
1974 pIconBitmap = const_cast<Bitmap*>(pButton->GetBitmap(_BUTTON_STATUS_DISABLED));
1978 iconPosition = pButton->GetBitmapPositionF(_BUTTON_STATUS_DISABLED);
1980 __pItems.at(itemIndex)->SetBitmap(_BUTTON_STATUS_DISABLED, iconPosition, *pIconBitmap);
1983 ApplyUserGUI(TOOLBAR_ITEM, __pItems.at(itemIndex));
1987 RealignItem(__pItems.at(itemIndex), __pItems.at(itemIndex)->GetTextExtentSizeF());
1995 _Toolbar::SetItemBadgeIcon(int itemIndex, const Bitmap* pBadgeIcon)
1997 SysTryReturnResult(NID_UI_CTRL, (itemIndex >= 0 && itemIndex < __itemCount), E_INVALID_ARG,
1998 "[E_INVALID_ARG] The itemIndex is invalid.");
2000 SysTryReturnResult(NID_UI_CTRL, (__pItems.at(itemIndex)), E_INVALID_STATE,
2001 "[E_INVALID_STATE] The badge icon instance isn't constructed.");
2003 if (__pItems.at(itemIndex)->GetChildCount() != 0)
2005 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pItems.at(itemIndex)->GetChild(0));
2009 __pItems.at(itemIndex)->DetachChild(*pTempBadgeIcon);
2011 delete pTempBadgeIcon;
2012 pTempBadgeIcon = null;
2016 if (pBadgeIcon == null)
2021 FloatRectangle bounds = __pItems.at(itemIndex)->GetBoundsF();
2023 _Label* pBadgeIconLabel = _Label::CreateLabelN();
2025 float height = 0.0f;
2027 GET_SHAPE_CONFIG(HEADER::BADGE_HEIGHT, GetOrientation(), height);
2029 if (pBadgeIconLabel)
2031 pBadgeIconLabel->SetBounds(FloatRectangle(bounds.width - height, 0.0f, height, height));
2032 pBadgeIconLabel->SetBackgroundBitmap(*pBadgeIcon);
2034 __pItems.at(itemIndex)->AttachChild(*pBadgeIconLabel);
2035 __pItems.at(itemIndex)->SetChildAlwaysOnTop(*pBadgeIconLabel);
2042 _Toolbar::SetItemColor(_ButtonStatus status, const Color& color)
2046 case _BUTTON_STATUS_NORMAL:
2047 __isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
2048 return SetProperty(L"normalItemColor", Variant(color));
2050 case _BUTTON_STATUS_DISABLED:
2051 __isItemBgColorSetByUser[_BUTTON_STATUS_DISABLED] = true;
2052 return SetProperty(L"disabledItemColor", Variant(color));
2054 case _BUTTON_STATUS_PRESSED:
2055 __isItemBgColorSetByUser[_BUTTON_STATUS_PRESSED] = true;
2056 return SetProperty(L"pressedItemColor", Variant(color));
2058 case _BUTTON_STATUS_HIGHLIGHTED:
2059 __isItemBgColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED] = true;
2060 return SetProperty(L"highlightedItemColor", Variant(color));
2062 case _BUTTON_STATUS_SELECTED:
2063 __isItemBgColorSetByUser[_BUTTON_STATUS_SELECTED] = true;
2064 return SetProperty(L"selectedItemColor", Variant(color));
2067 __isItemBgColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
2068 return SetProperty(L"normalItemColor", Variant(color));
2074 _Toolbar::SetItemEnabled(int itemIndex, bool enabled)
2076 SysTryReturnResult(NID_UI_CTRL, (null != __pItems.at(itemIndex)), E_INVALID_OPERATION,
2077 "[E_INVALID_OPERATION] No button item is at the position.");
2081 _AccessibilityElement* pElement = __pItems.at(itemIndex)->GetAccessibilityContainer()->GetChildElement(0);
2084 pElement->SetStatus(L"");
2085 pElement->SetHintDisabled(false);
2087 return __pItems.at(itemIndex)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
2091 _AccessibilityElement* pElement = __pItems.at(itemIndex)->GetAccessibilityContainer()->GetChildElement(0);
2094 pElement->SetStatus(L"");
2095 pElement->SetHintDisabled(true);
2097 return __pItems.at(itemIndex)->SetButtonStatus(_BUTTON_STATUS_DISABLED);
2104 _Toolbar::SetItemNumberedBadgeIcon(int itemIndex, int number)
2106 SysTryReturnResult(NID_UI_CTRL, (itemIndex >= 0 && itemIndex < __itemCount), E_INVALID_ARG,
2107 "[E_INVALID_ARG] The itemIndex is invalid.");
2109 SysTryReturnResult(NID_UI_CTRL, (number >= 0 && number < 100000), E_INVALID_ARG,
2110 "[E_INVALID_ARG] The number is out of bounds.");
2112 SysTryReturnResult(NID_UI_CTRL, (__pItems.at(itemIndex)), E_INVALID_STATE,
2113 "[E_INVALID_STATE] The badge icon instance isn't constructed.");
2117 if (__pItems.at(itemIndex)->GetChildCount() != 0)
2119 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(itemIndex)->GetChild(0));
2121 if (existingBadgeIcon)
2123 __pItems.at(itemIndex)->DetachChild(*existingBadgeIcon);
2125 delete existingBadgeIcon;
2126 existingBadgeIcon = null;
2136 if (__pItems.at(itemIndex)->GetChildCount() == 0)
2138 _Label* pLabel = _Label::CreateLabelN();
2140 SysTryReturnResult(NID_UI_CTRL, pLabel, E_INVALID_STATE,
2141 "[E_INVALID_STATE] The badge icon instance isn't constructed.");
2143 Bitmap* pNumberedBadgeIconBitmap = null;
2144 Bitmap* pNumberedBadgeIconEffectBitmap = null;
2145 Bitmap* pColorReplacedBitmap = null;
2146 Color badgeIconBgColor;
2147 Color badgeIconTextColor;
2149 GET_BITMAP_CONFIG_N(HEADER::BADGE_ICON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNumberedBadgeIconBitmap);
2151 bool themeBadgeNormalBackgroundBitmap = IS_CUSTOM_BITMAP(HEADER::BADGE_ICON_BG_NORMAL);
2152 if (!themeBadgeNormalBackgroundBitmap)
2154 GET_BITMAP_CONFIG_N(HEADER::BADGE_ICON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNumberedBadgeIconEffectBitmap);
2157 GET_COLOR_CONFIG(HEADER::BADGE_ICON_BG_NORMAL, badgeIconBgColor);
2158 GET_COLOR_CONFIG(HEADER::BADGE_ICON_TEXT_NORMAL, badgeIconTextColor);
2160 if (pNumberedBadgeIconBitmap)
2162 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNumberedBadgeIconBitmap,
2163 Color::GetColor(COLOR_ID_MAGENTA), badgeIconBgColor);
2165 pLabel->SetBackgroundBitmap(*pColorReplacedBitmap);
2167 delete pColorReplacedBitmap;
2168 delete pNumberedBadgeIconBitmap;
2171 if (pNumberedBadgeIconEffectBitmap)
2173 pLabel->SetBackgroundEffectBitmap(*pNumberedBadgeIconEffectBitmap);
2175 delete pNumberedBadgeIconEffectBitmap;
2178 pLabel->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
2179 pLabel->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
2180 pLabel->SetTextColor(badgeIconTextColor);
2181 pLabel->SetMargin(0, 10);
2183 __pItems.at(itemIndex)->AttachChild(*pLabel);
2184 __pItems.at(itemIndex)->SetChildAlwaysOnTop(*pLabel);
2187 // SetItemNumberedBadgeIcon
2189 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(itemIndex)->GetChild(0));
2191 FloatRectangle bounds = __pItems.at(itemIndex)->GetBoundsF();
2193 if (existingBadgeIcon)
2195 float fontSize = 0.0f;
2196 float height = 0.0f;
2199 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE, GetOrientation(), fontSize);
2200 GET_SHAPE_CONFIG(HEADER::BADGE_HEIGHT, GetOrientation(), height);
2204 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_1DIGIT, GetOrientation(), width);
2206 else if (number < 100)
2208 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_2DIGIT, GetOrientation(), width);
2210 else if (number < 1000)
2212 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_3DIGIT, GetOrientation(), width);
2214 else if (number < 10000)
2216 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_4DIGIT, GetOrientation(), width);
2220 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_5DIGIT, GetOrientation(), width);
2223 existingBadgeIcon->SetBounds(FloatRectangle(bounds.width - width, 0.0f, width, height));
2224 existingBadgeIcon->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
2226 Integer tempNumber(number);
2227 existingBadgeIcon->SetText(tempNumber.ToString());
2235 _Toolbar::SetItemSelected(int itemIndex, bool fire)
2237 SysTryReturnResult(NID_UI_CTRL, (itemIndex >= -1 && itemIndex < __itemCount), E_INVALID_STATE,
2238 "[E_INVALID_STATE] Failed to process SetItemSelected()");
2240 result r = E_SUCCESS;
2242 int currentSelectedItemIndex = 0;
2243 currentSelectedItemIndex = GetSelectedItemIndex();
2245 r = __pToolbarPresenter->SetItemSelected(itemIndex);
2247 if (itemIndex != -1 && itemIndex == currentSelectedItemIndex && __pItems.at(itemIndex) != null) // same item selected
2249 if (!IsInitialDraw() && fire)
2251 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
2253 __pItems.at(itemIndex)->SetButtonStatus(_BUTTON_STATUS_SELECTED, fire);
2254 __pItems.at(itemIndex)->Draw();
2255 _AccessibilityElement* pElement = __pItems.at(currentSelectedItemIndex)->GetAccessibilityContainer()->GetChildElement(0);
2258 pElement->SetStatus(L"Selected");
2259 pElement->SetHintDisabled(true);
2265 if (__itemCount == 0 || __itemCount > TAB_ITEM_MAX || itemIndex == -1)
2270 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_INVALID_STATE, "[E_INVALID_STATE] Failed to process SetItemSelected()");
2272 if (__pItems.at(itemIndex) != null)
2274 if (!IsInitialDraw() && fire)
2276 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
2278 __pItems.at(itemIndex)->SetButtonStatus(_BUTTON_STATUS_SELECTED, fire);
2279 _AccessibilityElement* pElement = __pItems.at(itemIndex)->GetAccessibilityContainer()->GetChildElement(0);
2282 pElement->SetStatus(L"Selected");
2283 pElement->SetHintDisabled(true);
2287 if (__itemCount == 0 || __itemCount > TAB_ITEM_MAX || itemIndex == -1)
2292 if (currentSelectedItemIndex != -1 && __pItems.at(currentSelectedItemIndex) != null)
2294 __pItems.at(currentSelectedItemIndex)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
2295 __pItems.at(currentSelectedItemIndex)->Draw();
2296 _AccessibilityElement* pElement = __pItems.at(currentSelectedItemIndex)->GetAccessibilityContainer()->GetChildElement(0);
2299 pElement->SetStatus(L"");
2300 pElement->SetHintDisabled(false);
2304 if (__pItems.at(itemIndex) != null)
2306 __pItems.at(itemIndex)->Draw();
2313 _Toolbar::SetItemTextColor(_ButtonStatus status, const Color& color)
2317 case _BUTTON_STATUS_NORMAL:
2318 __isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
2319 return SetProperty(L"normalItemTextColor", Variant(color));
2321 case _BUTTON_STATUS_DISABLED:
2322 __isItemTextColorSetByUser[_BUTTON_STATUS_DISABLED] = true;
2323 return SetProperty(L"disabledItemTextColor", Variant(color));
2325 case _BUTTON_STATUS_PRESSED:
2326 __isItemTextColorSetByUser[_BUTTON_STATUS_PRESSED] = true;
2327 return SetProperty(L"pressedItemTextColor", Variant(color));
2329 case _BUTTON_STATUS_HIGHLIGHTED:
2330 __isItemTextColorSetByUser[_BUTTON_STATUS_HIGHLIGHTED] = true;
2331 return SetProperty(L"highlightedItemTextColor", Variant(color));
2333 case _BUTTON_STATUS_SELECTED:
2334 __isItemTextColorSetByUser[_BUTTON_STATUS_SELECTED] = true;
2335 return SetProperty(L"selectedItemTextColor", Variant(color));
2338 __isItemTextColorSetByUser[_BUTTON_STATUS_NORMAL] = true;
2339 return SetProperty(L"normalItemTextColor", Variant(color));
2345 _Toolbar::SetStyle(ToolbarStyle style)
2349 __pToolbarPresenter->SetInitialDrawState(true);
2351 if (__style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE)
2353 SetTabEditModeEnabled(true);
2356 AdjustToolbarBounds();
2362 __descriptionText = L"";
2364 if (__style == TOOLBAR_TITLE || __style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
2366 if(__pTitleTextElement)
2368 __pTitleTextElement->SetLabel(L"");
2373 if(__pTitleTextElement)
2375 GetAccessibilityContainer()->RemoveElement(*__pTitleTextElement);
2376 __pTitleTextElement = null;
2384 _Toolbar::AdjustToolbarBounds(void)
2387 float height = 0.0f;
2389 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
2390 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
2392 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
2394 width = portraitSize.width;
2398 width = landscapeSize.width;
2403 if (__header == true)
2405 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
2407 //GET_SHAPE_CONFIG(HEADER::WIDTH, GetOrientation(), width);
2408 GET_SHAPE_CONFIG(HEADER::TITLE_TOTAL_HEIGHT_WITH_SEGMENTED_ITEM, GetOrientation(), height);
2409 SetSize(FloatDimension(width, height));
2411 else if (__style == TOOLBAR_TEXT && GetOrientation() == _CONTROL_ORIENTATION_LANDSCAPE) // sip & landscape => footer height
2413 //GET_SHAPE_CONFIG(HEADER::WIDTH, GetOrientation(), width);
2414 GET_SHAPE_CONFIG(FOOTER::HEIGHT, GetOrientation(), height);
2415 SetSize(FloatDimension(width, height));
2419 //GET_SHAPE_CONFIG(HEADER::WIDTH, GetOrientation(), width);
2420 GET_SHAPE_CONFIG(HEADER::HEIGHT, GetOrientation(), height);
2421 SetSize(FloatDimension(width, height));
2426 //GET_SHAPE_CONFIG(FOOTER::WIDTH, GetOrientation(), width);
2428 if (__style == TOOLBAR_SOFTKEY)
2430 GET_SHAPE_CONFIG(FOOTER::SOFTKEY_HEIGHT, GetOrientation(), height);
2434 GET_SHAPE_CONFIG(FOOTER::HEIGHT, GetOrientation(), height);
2437 SetSize(FloatDimension(width, height));
2440 SetResizable(false);
2442 _Form* pParent = dynamic_cast<_Form*>(GetParent());
2444 if (pParent != null)
2446 pParent->AdjustClientBounds();
2448 if (__header == false)
2450 FloatRectangle bounds(0.0f, pParent->GetClientBoundsF().y + pParent->GetClientBoundsF().height, width, height);
2451 FloatDimension dimension(width, height);
2452 dimension = pParent->TranslateSize(dimension);
2453 bounds.height = dimension.height;
2455 if (__transparent || !GetVisibleState())
2457 bounds.y -= bounds.height;
2460 pParent->SetFooterBounds(bounds);
2468 _Toolbar::SetTabEditModeEnabled(bool enable)
2470 return __pToolbarPresenter->SetTabEditModeEnabled(enable);
2474 _Toolbar::SetTitleIcon(const Bitmap& bitmap)
2476 result r = E_SYSTEM;
2478 Bitmap* pClonedBitmap = _BitmapImpl::CloneN(bitmap);
2484 delete __pTitleIcon;
2487 __pTitleIcon = pClonedBitmap;
2496 _Toolbar::SetTitleText(const String& text, HorizontalAlignment alignment)
2498 result r = E_SYSTEM;
2500 __titleTextAlignment = alignment;
2504 r = __pToolbarPresenter->SetTitleText(__titleText, __titleTextAlignment);
2506 if(likely(!(_AccessibilityManager::IsActivated())))
2511 if (__pTitleTextElement == null)
2513 __pTitleTextElement = new (std::nothrow) _AccessibilityElement(true);
2514 SysTryReturnResult(NID_UI_CTRL, __pTitleTextElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
2515 GetAccessibilityContainer()->SetPriority(ACCESSIBILITY_PRIORITY_TOP);
2516 GetAccessibilityContainer()->AddElement(*__pTitleTextElement);
2519 if( __descriptionText.IsEmpty())
2521 __pTitleTextElement->SetLabel(__titleText);
2522 __pTitleTextElement->SetBounds(FloatRectangle(__pToolbarPresenter->GetTitleTextBoundsF()));
2526 __pTitleTextElement->SetLabel(__titleText + L"," + __descriptionText);
2528 FloatRectangle descriptionBounds = __pToolbarPresenter->GetDescriptionBoundsF();
2529 FloatRectangle titleBounds = __pToolbarPresenter->GetTitleTextBoundsF();
2531 __pTitleTextElement->SetBounds(FloatRectangle(titleBounds.x, titleBounds.y, titleBounds.width, titleBounds.height + descriptionBounds.height));
2533 __pTitleTextElement->SetTrait(L"Title");
2534 __pTitleTextElement->SetName(L"HeaderTitleText");
2540 _Toolbar::SetTitleTextColor(const Color& color)
2542 __titleTextColor = color;
2548 _Toolbar::SetTransparent(bool transparent)
2550 if (__style == TOOLBAR_SOFTKEY)
2555 __transparent = transparent;
2559 __isUserBackgroundBitmap = true;
2562 Bitmap* pMagentaBackgroundBitmap = null;
2564 if (__pToolbarBackgroundBitmap)
2566 delete __pToolbarBackgroundBitmap;
2567 __pToolbarBackgroundBitmap = null;
2570 GET_BITMAP_CONFIG_N(HEADER::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pMagentaBackgroundBitmap);
2576 GET_COLOR_CONFIG(HEADER::TRANSLUCENT_BG_NORMAL, tempColor);
2578 if (pMagentaBackgroundBitmap)
2580 __pToolbarBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*(pMagentaBackgroundBitmap),
2581 Color::GetColor(COLOR_ID_MAGENTA), tempColor);
2583 if (__pToolbarBackgroundBitmap)
2585 __pToolbarBackgroundBitmap->SetAlphaConstant(0x7F);
2589 SetTitleTextColor(__transTitleTextColor);
2590 SetDescriptionTextColor(__transDescriptionTextColor);
2592 for (int i = 0; i < __itemCount ; i ++)
2594 if (__pItems.at(i) != null)
2596 ApplyUserGUI(TOOLBAR_ITEM, __pItems.at(i));
2600 for (int i = 0; i < BUTTON_MAX; i++)
2602 if (__pButtonItems[i] != null)
2604 ApplyUserGUI(TOOLBAR_BUTTON, __pButtonItems[i]);
2608 SetTransBackButton(true);
2610 else // not transparent
2612 __pToolbarBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*(pMagentaBackgroundBitmap),
2613 Color::GetColor(COLOR_ID_MAGENTA), GetColor());
2615 SetTitleTextColor(__titleTextColor);
2616 SetDescriptionTextColor(__descriptionTextColor);
2618 for (int i = 0; i < __itemCount ; i ++)
2620 if (__pItems.at(i) != null)
2622 ApplyUserGUI(TOOLBAR_ITEM, __pItems.at(i));
2626 for (int i = 0; i < BUTTON_MAX; i++)
2628 if (__pButtonItems[i] != null)
2630 ApplyUserGUI(TOOLBAR_BUTTON, __pButtonItems[i]);
2634 SetTransBackButton(false);
2637 delete pMagentaBackgroundBitmap;
2643 _Toolbar::SetWaitingAnimationPosition(ToolbarAnimationPosition animationPos, float x, float y)
2645 if (__pAnimation[animationPos])
2647 __pAnimation[animationPos]->SetPosition(FloatPoint(x, y));
2654 _Toolbar::StopWaitingAnimation(ToolbarAnimationPosition animationPos)
2656 SysTryReturnResult(NID_UI_CTRL,
2657 (TOOLBAR_ANIMATION_POSITION_TITLE <= animationPos && animationPos < TOOLBAR_ANIMATION_POSITION_MAX), E_INVALID_ARG,
2658 "[E_INVALID_ARG] The animationPos is invalid.");
2659 SysTryReturnResult(NID_UI_CTRL, (__pAnimation[animationPos]), E_INVALID_STATE,
2660 "[E_INVALID_STATE] __pAnimation isn't constructed.");
2662 __pAnimation[animationPos]->Stop();
2664 if (animationPos == TOOLBAR_ANIMATION_POSITION_TITLE)
2666 DetachChild(*__pAnimation[animationPos]);
2668 else if (animationPos == TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT && __pButtonItems[LEFT_BUTTON] != null)
2670 __pButtonItems[LEFT_BUTTON]->DetachChild(*__pAnimation[animationPos]);
2672 else if (animationPos == TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT && __pButtonItems[RIGHT_BUTTON] != null)
2674 __pButtonItems[RIGHT_BUTTON]->DetachChild(*__pAnimation[animationPos]);
2677 delete __pAnimation[animationPos];
2678 __pAnimation[animationPos] = null;
2684 _Toolbar::OnAnimationStopped(const _Control& source)
2688 if (&source == __pAnimation[TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT])
2690 __pAnimation[TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT]->Play();
2692 else if (&source == __pAnimation[TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT])
2694 __pAnimation[TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT]->Play();
2696 else if (__pAnimation[TOOLBAR_ANIMATION_POSITION_TITLE])
2698 __pAnimation[TOOLBAR_ANIMATION_POSITION_TITLE]->Play();
2705 _Toolbar::OnAttachedToMainTree(void)
2711 _Toolbar::AddAccessibilityElement(ToolbarButton position, _Button* pButton)
2713 if(likely(!(_AccessibilityManager::IsActivated())))
2721 name = L"LeftButtonText";
2724 name = L"RightButtonText";
2727 name = L"BackButtonText";
2730 name = L"MiddleButtonText";
2736 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
2737 _AccessibilityElement* pButtonElement = null;
2739 _AccessibilityContainer* pButtonContainer = pButton->GetAccessibilityContainer();
2741 if (pButtonContainer)
2743 pButtonContainer->SetPriority(__header?ACCESSIBILITY_PRIORITY_TOP:ACCESSIBILITY_PRIORITY_BOTTOM);
2744 pContainer->AddChildContainer(*pButtonContainer);
2745 pButtonElement = pButtonContainer->GetChildElement(L"ButtonText");
2750 pButtonElement->SetName(name);
2752 if (position == BACK_BUTTON)
2754 pButtonElement->SetLabel("Back");
2755 pButtonElement->SetTrait("Back Button");
2759 pButtonElement->SetTrait(L"Button");
2761 FloatRectangle floatRect = GetButtonBoundsF(position);
2762 pButtonElement->SetBounds(FloatRectangle(0,floatRect.y, pButton->GetBoundsF().width, floatRect.height));
2767 _Toolbar::AddAccessibilityElement(_Button* pButton)
2769 if(likely(!(_AccessibilityManager::IsActivated())))
2774 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
2775 if(pContainer == null)
2783 priorty = ACCESSIBILITY_PRIORITY_TOP;
2787 priorty = ACCESSIBILITY_PRIORITY_BOTTOM;
2789 pContainer->SetPriority(priorty);
2791 ToolbarStyle style = GetStyle();
2796 case TOOLBAR_HEADER_SEGMENTED:
2798 case TOOLBAR_HEADER_SEGMENTED_WITH_TITLE:
2800 case TOOLBAR_SEGMENTED:
2801 name = L"Segment" + Integer::ToString(__itemCount);
2802 name.Append(L"Text");
2803 trait = L"Segmented control";
2805 case TOOLBAR_TAB_WITH_TITLE:
2808 name = L"Tab" + Integer::ToString(__itemCount);
2809 name.Append(L"Text");
2813 name = L"Button" + Integer::ToString(__itemCount);
2814 name.Append(L"Text");
2819 if (pButton != null)
2821 _AccessibilityElement* pElement = null;
2822 _AccessibilityContainer* pButtonContainer = pButton->GetAccessibilityContainer();
2824 if (pButtonContainer)
2826 pButtonContainer->SetPriority(priorty);
2827 pContainer->AddChildContainer(*pButtonContainer);
2828 pElement = pButtonContainer->GetChildElement(L"ButtonText");
2833 pElement->SetName(name);
2834 pElement->SetTrait(trait);
2835 if(style == TOOLBAR_HEADER_SEGMENTED || style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE
2836 || style == TOOLBAR_SEGMENTED || style == TOOLBAR_TAB_WITH_TITLE
2837 || style == TOOLBAR_TAB)
2839 pElement->SetHint(L"Double tap to move to contents");
2840 pButton->GetAccessibilityContainer()->AddListener(footerItemAccessibilityListener);
2849 _Toolbar::OnBoundsChanged(void)
2853 if(likely(!(_AccessibilityManager::IsActivated())))
2858 if(__pTitleTextElement)
2860 if( __descriptionText.IsEmpty())
2862 __pTitleTextElement->SetBounds(FloatRectangle(__pToolbarPresenter->GetTitleTextBoundsF()));
2866 FloatRectangle descriptionBounds = __pToolbarPresenter->GetDescriptionBoundsF();
2867 FloatRectangle titleBounds = __pToolbarPresenter->GetTitleTextBoundsF();
2869 __pTitleTextElement->SetBounds(FloatRectangle(titleBounds.x, titleBounds.y, titleBounds.width, titleBounds.height + descriptionBounds.height));
2876 _Toolbar::OnFontChanged(Font* pFont)
2878 __pToolbarPresenter->OnFontChanged(pFont);
2884 _Toolbar::OnFontInfoRequested(unsigned long& style, int& size)
2886 __pToolbarPresenter->OnFontInfoRequested(style, size);
2892 _Toolbar::OnChangeLayout(_ControlOrientation orientationStatus)
2894 float toolbarWidth = GetBoundsF().width;
2896 if (CalculateMinimumToolbarWidth() > toolbarWidth)
2898 toolbarWidth = CalculateMinimumToolbarWidth();
2901 AdjustToolbarBounds();
2905 __pToolbarPresenter->OnChangeLayout(orientationStatus);
2911 _Toolbar::OnDraw(void)
2915 __pToolbarPresenter->Draw();
2917 if(likely(!(_AccessibilityManager::IsActivated())))
2921 if(__pTitleTextElement)
2923 if( __descriptionText.IsEmpty())
2925 __pTitleTextElement->SetBounds(FloatRectangle(__pToolbarPresenter->GetTitleTextBoundsF()));
2929 FloatRectangle descriptionBounds = __pToolbarPresenter->GetDescriptionBoundsF();
2930 FloatRectangle titleBounds = __pToolbarPresenter->GetTitleTextBoundsF();
2932 __pTitleTextElement->SetBounds(FloatRectangle(titleBounds.x, titleBounds.y, titleBounds.width, titleBounds.height + descriptionBounds.height));
2939 _Toolbar::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
2941 return __pToolbarPresenter->OnLongPressGestureDetected();
2945 _Toolbar::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
2951 _Toolbar::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
2953 return __pToolbarPresenter->OnFlickGestureDetected(gesture);
2957 _Toolbar::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
2963 _Toolbar::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
2967 return __pToolbarPresenter->OnTouchPressed(source, touchinfo);
2971 _Toolbar::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
2975 return __pToolbarPresenter->OnTouchReleased(source, touchinfo);
2979 _Toolbar::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
2983 return __pToolbarPresenter->OnTouchMoved(source, touchinfo);
2987 _Toolbar::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
2991 return __pToolbarPresenter->OnTouchCanceled(source, touchinfo);
2995 _Toolbar::AddActionEventListener(const Controls::_IActionEventListener& listener)
2997 __pActionEventListener = const_cast<Controls::_IActionEventListener*>(&listener);
2999 for (int i = 0; i < __itemCount; i++)
3001 __pItems.at(i)->AddActionEventListener(listener);
3004 for (int j = 0; j < BUTTON_MAX; j++)
3006 if (__pButtonItems[j])
3008 __pButtonItems[j]->AddActionEventListener(listener);
3016 _Toolbar::RemoveActionEventListener(const Controls::_IActionEventListener& listener)
3018 __pActionEventListener = null;
3020 for (int i = 0; i < __itemCount; i++)
3022 __pItems.at(i)->RemoveActionEventListener(listener);
3025 for (int j = 0; j < MIDDLE_BUTTON; j++)
3027 if (__pButtonItems[j])
3029 __pButtonItems[j]->RemoveActionEventListener(listener);
3038 _Toolbar::SetBackEventListener(const Controls::_IActionEventListener& listener, int actionId)
3040 __backActionId = actionId;
3041 __pBackEventListener = const_cast<_IActionEventListener*>(&listener);
3047 _Toolbar::SetPresenter(const _ToolbarPresenter& toolbarPresenter)
3049 __pToolbarPresenter = const_cast<_ToolbarPresenter*>(&toolbarPresenter);
3055 _Toolbar::ApplyUserGUI(ButtonType buttonType, _Button* pButton)
3057 SysTryReturnResult(NID_UI_CTRL, pButton, E_INVALID_ARG, "[E_INVALID_ARG] The pButton is invalid.");
3059 if (TOOLBAR_BUTTON == buttonType)
3061 Bitmap* pNormalBackgroundBitmap = null;
3062 Bitmap* pColorReplacedBitmap = null;
3066 GET_BITMAP_CONFIG_N(HEADER::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNormalBackgroundBitmap);
3070 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNormalBackgroundBitmap);
3075 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, __buttonTransTextColor[_BUTTON_STATUS_NORMAL]);
3076 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, __buttonTransTextColor[_BUTTON_STATUS_PRESSED]);
3077 pButton->SetTextColor(_BUTTON_STATUS_HIGHLIGHTED, __buttonTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
3078 pButton->SetTextColor(_BUTTON_STATUS_DISABLED, __buttonTransTextColor[_BUTTON_STATUS_DISABLED]);
3080 if (pNormalBackgroundBitmap)
3082 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3083 Color::GetColor(COLOR_ID_MAGENTA), __buttonTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
3084 pButton->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *pColorReplacedBitmap);
3085 delete pColorReplacedBitmap;
3087 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3088 Color::GetColor(COLOR_ID_MAGENTA), __buttonTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
3089 pButton->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *pColorReplacedBitmap);
3090 delete pColorReplacedBitmap;
3092 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3093 Color::GetColor(COLOR_ID_MAGENTA), __buttonTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
3094 pButton->SetBackgroundBitmap(_BUTTON_STATUS_HIGHLIGHTED, *pColorReplacedBitmap);
3095 delete pColorReplacedBitmap;
3097 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3098 Color::GetColor(COLOR_ID_MAGENTA), __buttonTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
3099 pButton->SetBackgroundBitmap(_BUTTON_STATUS_DISABLED, *pColorReplacedBitmap);
3100 delete pColorReplacedBitmap;
3102 delete pNormalBackgroundBitmap;
3107 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, __buttonTextColor[_BUTTON_STATUS_NORMAL]);
3108 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, __buttonTextColor[_BUTTON_STATUS_PRESSED]);
3109 pButton->SetTextColor(_BUTTON_STATUS_HIGHLIGHTED, __buttonTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
3110 pButton->SetTextColor(_BUTTON_STATUS_DISABLED, __buttonTextColor[_BUTTON_STATUS_DISABLED]);
3112 if (pNormalBackgroundBitmap)
3114 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3115 Color::GetColor(COLOR_ID_MAGENTA), __buttonBackgroundColor[_BUTTON_STATUS_NORMAL]);
3116 pButton->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *pColorReplacedBitmap);
3117 delete pColorReplacedBitmap;
3119 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3120 Color::GetColor(COLOR_ID_MAGENTA), __buttonBackgroundColor[_BUTTON_STATUS_PRESSED]);
3121 pButton->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *pColorReplacedBitmap);
3122 delete pColorReplacedBitmap;
3124 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3125 Color::GetColor(COLOR_ID_MAGENTA), __buttonBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
3126 pButton->SetBackgroundBitmap(_BUTTON_STATUS_HIGHLIGHTED, *pColorReplacedBitmap);
3127 delete pColorReplacedBitmap;
3129 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3130 Color::GetColor(COLOR_ID_MAGENTA), __buttonBackgroundColor[_BUTTON_STATUS_DISABLED]);
3131 pButton->SetBackgroundBitmap(_BUTTON_STATUS_DISABLED, *pColorReplacedBitmap);
3132 delete pColorReplacedBitmap;
3134 delete pNormalBackgroundBitmap;
3138 else if (TOOLBAR_ITEM == buttonType)
3140 Bitmap* pNormalBackgroundBitmap = null;
3141 Bitmap* pPressedBackgroundBitmap = null;
3142 Bitmap* pNormalBackgroundEffectBitmap = null;
3143 Bitmap* pPressedBackgroundEffectBitmap = null;
3144 Bitmap* pColorReplacedBitmap = null;
3146 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
3148 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNormalBackgroundBitmap);
3149 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pPressedBackgroundBitmap);
3151 bool themeNormalBackgroundBitmap = IS_CUSTOM_BITMAP(FOOTER::BUTTON_ITEM_BG_NORMAL);
3152 if (!themeNormalBackgroundBitmap)
3154 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNormalBackgroundEffectBitmap);
3157 bool themePressedBackgroundBitmap = IS_CUSTOM_BITMAP(FOOTER::BUTTON_ITEM_BG_PRESSED);
3158 if (!themePressedBackgroundBitmap)
3160 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pPressedBackgroundEffectBitmap);
3163 else if (__style == TOOLBAR_HEADER_SEGMENTED || __style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_SEGMENTED
3164 || __style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE || __style == TOOLBAR_TITLE)
3166 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNormalBackgroundBitmap);
3168 bool themeNormalBackgroundBitmap = IS_CUSTOM_BITMAP(HEADER::TAB_ITEM_BG_NORMAL);
3169 if (!themeNormalBackgroundBitmap)
3171 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pPressedBackgroundBitmap);
3176 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNormalBackgroundBitmap);
3177 bool themeNormalBackgroundBitmap = IS_CUSTOM_BITMAP(HEADER::TAB_ITEM_BG_NORMAL);
3178 if (!themeNormalBackgroundBitmap)
3180 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pPressedBackgroundBitmap);
3184 if (pNormalBackgroundEffectBitmap)
3186 pButton->SetBackgroundEffectBitmap(_BUTTON_STATUS_NORMAL, *pNormalBackgroundEffectBitmap);
3187 pButton->SetBackgroundEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED, *pNormalBackgroundEffectBitmap);
3188 pButton->SetBackgroundEffectBitmap(_BUTTON_STATUS_DISABLED, *pNormalBackgroundEffectBitmap);
3189 delete pNormalBackgroundEffectBitmap;
3192 if (pPressedBackgroundEffectBitmap)
3194 pButton->SetBackgroundEffectBitmap(_BUTTON_STATUS_PRESSED, *pPressedBackgroundEffectBitmap);
3195 pButton->SetBackgroundEffectBitmap(_BUTTON_STATUS_SELECTED, *pPressedBackgroundEffectBitmap);
3196 delete pPressedBackgroundEffectBitmap;
3201 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, __itemTransTextColor[_BUTTON_STATUS_NORMAL]);
3202 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, __itemTransTextColor[_BUTTON_STATUS_PRESSED]);
3203 pButton->SetTextColor(_BUTTON_STATUS_HIGHLIGHTED, __itemTransTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
3204 pButton->SetTextColor(_BUTTON_STATUS_DISABLED, __itemTransTextColor[_BUTTON_STATUS_DISABLED]);
3205 pButton->SetTextColor(_BUTTON_STATUS_SELECTED, __itemTransTextColor[_BUTTON_STATUS_SELECTED]);
3207 if (pNormalBackgroundBitmap)
3209 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3210 Color::GetColor(COLOR_ID_MAGENTA), __itemTransBackgroundColor[_BUTTON_STATUS_NORMAL]);
3211 pButton->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *pColorReplacedBitmap);
3212 delete pColorReplacedBitmap;
3214 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3215 Color::GetColor(COLOR_ID_MAGENTA), __itemTransBackgroundColor[_BUTTON_STATUS_SELECTED]);
3216 pButton->SetBackgroundBitmap(_BUTTON_STATUS_SELECTED, *pColorReplacedBitmap);
3217 delete pColorReplacedBitmap;
3219 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3220 Color::GetColor(COLOR_ID_MAGENTA), __itemTransBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
3221 pButton->SetBackgroundBitmap(_BUTTON_STATUS_HIGHLIGHTED, *pColorReplacedBitmap);
3222 delete pColorReplacedBitmap;
3224 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3225 Color::GetColor(COLOR_ID_MAGENTA), __itemTransBackgroundColor[_BUTTON_STATUS_DISABLED]);
3226 pButton->SetBackgroundBitmap(_BUTTON_STATUS_DISABLED, *pColorReplacedBitmap);
3227 delete pColorReplacedBitmap;
3229 delete pNormalBackgroundBitmap;
3232 if (pPressedBackgroundBitmap)
3234 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pPressedBackgroundBitmap,
3235 Color::GetColor(COLOR_ID_MAGENTA), __itemTransBackgroundColor[_BUTTON_STATUS_PRESSED]);
3237 pButton->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *pColorReplacedBitmap);
3238 delete pColorReplacedBitmap;
3240 delete pPressedBackgroundBitmap;
3245 pButton->SetTextColor(_BUTTON_STATUS_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
3246 pButton->SetTextColor(_BUTTON_STATUS_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
3247 pButton->SetTextColor(_BUTTON_STATUS_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
3248 pButton->SetTextColor(_BUTTON_STATUS_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
3249 pButton->SetTextColor(_BUTTON_STATUS_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
3251 if (pNormalBackgroundBitmap)
3253 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3254 Color::GetColor(COLOR_ID_MAGENTA), __itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
3255 pButton->SetBackgroundBitmap(_BUTTON_STATUS_NORMAL, *pColorReplacedBitmap);
3256 delete pColorReplacedBitmap;
3258 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3259 Color::GetColor(COLOR_ID_MAGENTA), __itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
3260 pButton->SetBackgroundBitmap(_BUTTON_STATUS_SELECTED, *pColorReplacedBitmap);
3261 delete pColorReplacedBitmap;
3263 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3264 Color::GetColor(COLOR_ID_MAGENTA), __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
3265 pButton->SetBackgroundBitmap(_BUTTON_STATUS_HIGHLIGHTED, *pColorReplacedBitmap);
3266 delete pColorReplacedBitmap;
3268 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNormalBackgroundBitmap,
3269 Color::GetColor(COLOR_ID_MAGENTA), __itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
3270 pButton->SetBackgroundBitmap(_BUTTON_STATUS_DISABLED, *pColorReplacedBitmap);
3271 delete pColorReplacedBitmap;
3273 delete pNormalBackgroundBitmap;
3276 if (pPressedBackgroundBitmap)
3278 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pPressedBackgroundBitmap,
3279 Color::GetColor(COLOR_ID_MAGENTA), __itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
3281 pButton->SetBackgroundBitmap(_BUTTON_STATUS_PRESSED, *pColorReplacedBitmap);
3282 delete pColorReplacedBitmap;
3284 delete pPressedBackgroundBitmap;
3293 _Toolbar::CalculateMinimumToolbarWidth(void)
3295 float totalWidth = 0.0f;
3296 float itemMinimumWidth = 0.0f;
3297 float horizontalMargin = 0.0f;
3299 if (__header == true && __style == TOOLBAR_TEXT)
3301 if (IsButtonSet(LEFT_BUTTON))
3303 //if (__pButtonItems[LEFT_BUTTON]->GetText().IsEmpty())
3305 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3309 // GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH_WITH_TEXT, GetOrientation(), itemMinimumWidth);
3312 totalWidth += itemMinimumWidth;
3314 if (IsButtonSet(RIGHT_BUTTON))
3316 //if (__pButtonItems[RIGHT_BUTTON]->GetText().IsEmpty())
3318 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3322 // GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH_WITH_TEXT, GetOrientation(), itemMinimumWidth);
3325 totalWidth += itemMinimumWidth;
3328 else // footer or HEADER_TITLE_BUTTON
3330 if (IsButtonSet(LEFT_BUTTON))
3332 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3333 totalWidth += itemMinimumWidth;
3335 if (IsButtonSet(RIGHT_BUTTON))
3337 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3338 totalWidth += itemMinimumWidth;
3340 else if (IsButtonSet(BACK_BUTTON))
3342 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3343 totalWidth += itemMinimumWidth;
3347 if (__style == TOOLBAR_TITLE)
3349 GET_SHAPE_CONFIG(HEADER::TITLE_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3350 totalWidth += itemMinimumWidth;
3352 else if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_HEADER_SEGMENTED)
3354 GET_SHAPE_CONFIG(HEADER::ITEM_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3355 GET_SHAPE_CONFIG(HEADER::COMMON_MINIMUM_MARGIN, GetOrientation(), horizontalMargin);
3356 totalWidth += itemMinimumWidth * __itemCount + horizontalMargin * 2;
3358 else if (__style == TOOLBAR_SEGMENTED)
3360 GET_SHAPE_CONFIG(FOOTER::ITEM_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3361 GET_SHAPE_CONFIG(FOOTER::COMMON_MINIMUM_MARGIN, GetOrientation(), horizontalMargin);
3362 totalWidth += itemMinimumWidth * __itemCount + horizontalMargin * 2;
3366 GET_SHAPE_CONFIG(FOOTER::ITEM_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3368 if ((__style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE) && __itemCount > 4)
3370 totalWidth += itemMinimumWidth * 4;
3374 totalWidth += itemMinimumWidth * __itemCount;
3382 _Toolbar::CalculateMinimumToolbarWidthF(void)
3384 float totalWidth = 0.0f;
3385 float itemMinimumWidth = 0.0f;
3386 float horizontalMargin = 0.0f;
3388 if (__header == true && __style == TOOLBAR_TEXT)
3390 if (IsButtonSet(LEFT_BUTTON))
3392 //if (__pButtonItems[LEFT_BUTTON]->GetText().IsEmpty())
3394 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3398 // GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH_WITH_TEXT, GetOrientation(), itemMinimumWidth);
3401 totalWidth += itemMinimumWidth;
3403 if (IsButtonSet(RIGHT_BUTTON))
3405 //if (__pButtonItems[RIGHT_BUTTON]->GetText().IsEmpty())
3407 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3411 // GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH_WITH_TEXT, GetOrientation(), itemMinimumWidth);
3414 totalWidth += itemMinimumWidth;
3417 else // footer or HEADER_TITLE_BUTTON
3419 if (IsButtonSet(LEFT_BUTTON))
3421 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3422 totalWidth += itemMinimumWidth;
3424 if (IsButtonSet(RIGHT_BUTTON))
3426 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3427 totalWidth += itemMinimumWidth;
3429 else if (IsButtonSet(BACK_BUTTON))
3431 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), itemMinimumWidth);
3432 totalWidth += itemMinimumWidth;
3436 if (__style == TOOLBAR_TITLE)
3438 GET_SHAPE_CONFIG(HEADER::TITLE_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3439 totalWidth += itemMinimumWidth;
3441 else if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_HEADER_SEGMENTED)
3443 GET_SHAPE_CONFIG(HEADER::ITEM_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3444 GET_SHAPE_CONFIG(HEADER::COMMON_MINIMUM_MARGIN, GetOrientation(), horizontalMargin);
3445 totalWidth += itemMinimumWidth * __itemCount + horizontalMargin * 2;
3447 else if (__style == TOOLBAR_SEGMENTED)
3449 GET_SHAPE_CONFIG(FOOTER::ITEM_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3450 GET_SHAPE_CONFIG(FOOTER::COMMON_MINIMUM_MARGIN, GetOrientation(), horizontalMargin);
3451 totalWidth += itemMinimumWidth * __itemCount + horizontalMargin * 2;
3455 GET_SHAPE_CONFIG(FOOTER::ITEM_MINIMUM_WIDTH, GetOrientation(), itemMinimumWidth);
3457 if ((__style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE) && __itemCount > 4)
3459 totalWidth += itemMinimumWidth * 4;
3463 totalWidth += itemMinimumWidth * __itemCount;
3471 _Toolbar::RealignItem(_Button* pButton, float textExtentSize)
3473 SysTryReturnResult(NID_UI_CTRL, pButton, E_INVALID_STATE, "[E_INVALID_STATE] pButton doesn't exist.");
3475 float buttonItemWidth = pButton->GetSizeF().width;
3476 float buttonItemHeight = pButton->GetSizeF().height;
3477 float sideMargin = 0.0f;
3478 float buttonTextTopMargin = 0.0f;
3479 float iconTextGap = 0.0f;
3480 float contentLength = 0.0f;
3481 float segmentedTextAreaHeight = 0.0f;
3482 float revisedTopMargin = 5.0f;
3484 float leftTouchMargin = pButton->GetLeftTouchMarginF();
3485 float topTouchMargin = pButton->GetTopTouchMarginF();
3486 float rightTouchMargin = pButton->GetRightTouchMarginF();
3487 float bottomTouchMargin = pButton->GetBottomTouchMarginF();
3489 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_LEFT_MARGIN, GetOrientation(), sideMargin);
3490 GET_SHAPE_CONFIG(HEADER::ICON_TEXT_GAP, GetOrientation(), iconTextGap);
3491 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, GetOrientation(), segmentedTextAreaHeight);
3493 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
3495 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_BUTTON_STYLE_SIDE_MARGIN, GetOrientation(), sideMargin);
3496 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_TOP_MARGIN, GetOrientation(), buttonTextTopMargin);
3498 else if (__style == TOOLBAR_HEADER_SEGMENTED || __style == TOOLBAR_SEGMENTED || __style == TOOLBAR_TAB)
3500 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_LEFT_MARGIN, GetOrientation(), sideMargin);
3502 buttonTextTopMargin = (buttonItemHeight - segmentedTextAreaHeight) / 2 - revisedTopMargin;
3504 else if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3506 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_LEFT_MARGIN, GetOrientation(), sideMargin);
3508 buttonTextTopMargin = 0;
3511 if (pButton->GetText() != L"")
3513 float iconAreaWidth = 0.0f;
3515 if (pButton->GetBitmap(_BUTTON_STATUS_NORMAL) != null)
3517 iconAreaWidth = pButton->GetBitmap(_BUTTON_STATUS_NORMAL)->GetWidthF();
3518 contentLength = iconAreaWidth + iconTextGap + textExtentSize;
3520 if (contentLength > buttonItemWidth - sideMargin * 2)
3522 contentLength = buttonItemWidth - sideMargin * 2;
3525 pButton->SetBitmap(_BUTTON_STATUS_NORMAL,
3526 FloatPoint((buttonItemWidth - contentLength) / 2, (buttonItemHeight - (pButton->GetBitmap(_BUTTON_STATUS_NORMAL))->GetHeightF()) / 2),
3527 *(pButton->GetBitmap(_BUTTON_STATUS_NORMAL)));
3529 if (pButton->GetBitmap(_BUTTON_STATUS_PRESSED) != null)
3531 iconAreaWidth = pButton->GetBitmap(_BUTTON_STATUS_PRESSED)->GetWidthF();
3532 contentLength = iconAreaWidth + iconTextGap + textExtentSize;
3534 if (contentLength > buttonItemWidth - sideMargin * 2)
3536 contentLength = buttonItemWidth - sideMargin * 2;
3539 pButton->SetBitmap(_BUTTON_STATUS_PRESSED,
3540 FloatPoint((buttonItemWidth - contentLength) / 2, (buttonItemHeight - (pButton->GetBitmap(_BUTTON_STATUS_PRESSED))->GetHeightF()) / 2),
3541 *(pButton->GetBitmap(_BUTTON_STATUS_PRESSED)));
3543 if (pButton->GetBitmap(_BUTTON_STATUS_SELECTED) != null)
3545 iconAreaWidth = pButton->GetBitmap(_BUTTON_STATUS_SELECTED)->GetWidthF();
3546 contentLength = iconAreaWidth + iconTextGap + textExtentSize;
3548 if (contentLength > buttonItemWidth - sideMargin * 2)
3550 contentLength = buttonItemWidth - sideMargin * 2;
3553 pButton->SetBitmap(_BUTTON_STATUS_SELECTED,
3554 FloatPoint((buttonItemWidth - contentLength) / 2, (buttonItemHeight - (pButton->GetBitmap(_BUTTON_STATUS_SELECTED))->GetHeightF()) / 2),
3555 *(pButton->GetBitmap(_BUTTON_STATUS_SELECTED)));
3557 if (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED) != null)
3559 iconAreaWidth = pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED)->GetWidthF();
3560 contentLength = iconAreaWidth + iconTextGap + textExtentSize;
3562 if (contentLength > buttonItemWidth - sideMargin * 2)
3564 contentLength = buttonItemWidth - sideMargin * 2;
3567 pButton->SetBitmap(_BUTTON_STATUS_HIGHLIGHTED,
3568 FloatPoint((buttonItemWidth - contentLength) / 2, (buttonItemHeight - (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetHeightF()) / 2),
3569 *(pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED)));
3571 if (pButton->GetBitmap(_BUTTON_STATUS_DISABLED) != null)
3573 iconAreaWidth = pButton->GetBitmap(_BUTTON_STATUS_DISABLED)->GetWidthF();
3574 contentLength = iconAreaWidth + iconTextGap + textExtentSize;
3576 if (contentLength > buttonItemWidth - sideMargin * 2)
3578 contentLength = buttonItemWidth - sideMargin * 2;
3581 pButton->SetBitmap(_BUTTON_STATUS_DISABLED,
3582 FloatPoint((buttonItemWidth - contentLength) / 2, (buttonItemHeight - (pButton->GetBitmap(_BUTTON_STATUS_DISABLED))->GetHeightF()) / 2),
3583 *(pButton->GetBitmap(_BUTTON_STATUS_DISABLED)));
3586 if (iconAreaWidth != 0)
3588 pButton->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
3589 pButton->SetUserDefinedTextArea(FloatRectangle((buttonItemWidth - contentLength) / 2 + iconAreaWidth + iconTextGap, buttonTextTopMargin, buttonItemWidth - iconAreaWidth - iconTextGap - sideMargin * 2, buttonItemHeight - buttonTextTopMargin * 2));
3593 pButton->SetUserDefinedTextArea(FloatRectangle(sideMargin, buttonTextTopMargin, buttonItemWidth - sideMargin * 2, buttonItemHeight - buttonTextTopMargin * 2));
3598 if (pButton->GetBitmap(_BUTTON_STATUS_NORMAL) != null)
3600 pButton->SetBitmap(_BUTTON_STATUS_NORMAL,
3601 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_NORMAL))->GetWidthF()) / 2,
3602 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_NORMAL))->GetHeightF()) / 2),
3603 *(pButton->GetBitmap(_BUTTON_STATUS_NORMAL)));
3605 if (pButton->GetBitmap(_BUTTON_STATUS_PRESSED) != null)
3607 pButton->SetBitmap(_BUTTON_STATUS_PRESSED,
3608 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_PRESSED))->GetWidthF()) / 2,
3609 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_PRESSED))->GetHeightF()) / 2),
3610 *(pButton->GetBitmap(_BUTTON_STATUS_PRESSED)));
3612 if (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED) != null)
3614 pButton->SetBitmap(_BUTTON_STATUS_HIGHLIGHTED,
3615 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetWidthF()) / 2,
3616 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetHeightF()) / 2),
3617 *(pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED)));
3619 if (pButton->GetBitmap(_BUTTON_STATUS_DISABLED) != null)
3621 pButton->SetBitmap(_BUTTON_STATUS_DISABLED,
3622 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_DISABLED))->GetWidthF()) / 2,
3623 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_DISABLED))->GetHeightF()) / 2),
3624 *(pButton->GetBitmap(_BUTTON_STATUS_DISABLED)));
3626 if (pButton->GetBitmap(_BUTTON_STATUS_SELECTED) != null)
3628 pButton->SetBitmap(_BUTTON_STATUS_SELECTED,
3629 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_SELECTED))->GetWidthF()) / 2,
3630 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_SELECTED))->GetHeightF()) / 2),
3631 *(pButton->GetBitmap(_BUTTON_STATUS_SELECTED)));
3634 pButton->SetMargin(sideMargin, buttonTextTopMargin, sideMargin, buttonTextTopMargin);
3641 _Toolbar::RealignButtonItem(_Button* pButton)
3643 SysTryReturnResult(NID_UI_CTRL, pButton, E_INVALID_STATE, "[E_INVALID_STATE] pButton doesn't exist.");
3645 float buttonItemWidth = pButton->GetSizeF().width;
3646 float buttonItemHeight = pButton->GetSizeF().height;
3648 float leftTouchMargin = pButton->GetLeftTouchMarginF();
3649 float topTouchMargin = pButton->GetTopTouchMarginF();
3650 float rightTouchMargin = pButton->GetRightTouchMarginF();
3651 float bottomTouchMargin = pButton->GetBottomTouchMarginF();
3653 if (pButton->GetBitmap(_BUTTON_STATUS_NORMAL) != null)
3655 pButton->SetBitmap(_BUTTON_STATUS_NORMAL,
3656 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_NORMAL))->GetWidthF()) / 2,
3657 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_NORMAL))->GetHeightF()) / 2),
3658 *(pButton->GetBitmap(_BUTTON_STATUS_NORMAL)));
3660 if (pButton->GetBitmap(_BUTTON_STATUS_PRESSED) != null)
3662 pButton->SetBitmap(_BUTTON_STATUS_PRESSED,
3663 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_PRESSED))->GetWidthF()) / 2,
3664 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_PRESSED))->GetHeightF()) / 2),
3665 *(pButton->GetBitmap(_BUTTON_STATUS_PRESSED)));
3667 if (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED) != null)
3669 pButton->SetBitmap(_BUTTON_STATUS_HIGHLIGHTED,
3670 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetWidthF()) / 2,
3671 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetHeightF()) / 2),
3672 *(pButton->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED)));
3674 if (pButton->GetBitmap(_BUTTON_STATUS_DISABLED) != null)
3676 pButton->SetBitmap(_BUTTON_STATUS_DISABLED,
3677 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_DISABLED))->GetWidthF()) / 2,
3678 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_DISABLED))->GetHeightF()) / 2),
3679 *(pButton->GetBitmap(_BUTTON_STATUS_DISABLED)));
3681 if (pButton->GetBitmap(_BUTTON_STATUS_SELECTED) != null)
3683 pButton->SetBitmap(_BUTTON_STATUS_SELECTED,
3684 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_SELECTED))->GetWidthF()) / 2,
3685 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetBitmap(_BUTTON_STATUS_SELECTED))->GetHeightF()) / 2),
3686 *(pButton->GetBitmap(_BUTTON_STATUS_SELECTED)));
3689 if (pButton->GetEffectBitmap(_BUTTON_STATUS_NORMAL) != null)
3691 pButton->SetEffectBitmap(_BUTTON_STATUS_NORMAL,
3692 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_NORMAL))->GetWidthF()) / 2,
3693 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_NORMAL))->GetHeightF()) / 2),
3694 *(pButton->GetEffectBitmap(_BUTTON_STATUS_NORMAL)));
3697 if (pButton->GetEffectBitmap(_BUTTON_STATUS_PRESSED) != null)
3699 pButton->SetEffectBitmap(_BUTTON_STATUS_PRESSED,
3700 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_PRESSED))->GetWidthF()) / 2,
3701 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_PRESSED))->GetHeightF()) / 2),
3702 *(pButton->GetEffectBitmap(_BUTTON_STATUS_PRESSED)));
3704 if (pButton->GetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED) != null)
3706 pButton->SetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED,
3707 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetWidthF()) / 2,
3708 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED))->GetHeightF()) / 2),
3709 *(pButton->GetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED)));
3711 if (pButton->GetEffectBitmap(_BUTTON_STATUS_DISABLED) != null)
3713 pButton->SetEffectBitmap(_BUTTON_STATUS_DISABLED,
3714 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_DISABLED))->GetWidthF()) / 2,
3715 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_DISABLED))->GetHeightF()) / 2),
3716 *(pButton->GetEffectBitmap(_BUTTON_STATUS_DISABLED)));
3718 if (pButton->GetEffectBitmap(_BUTTON_STATUS_SELECTED) != null)
3720 pButton->SetEffectBitmap(_BUTTON_STATUS_SELECTED,
3721 FloatPoint((buttonItemWidth - (leftTouchMargin + rightTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_SELECTED))->GetWidthF()) / 2,
3722 (buttonItemHeight - (topTouchMargin + bottomTouchMargin) - (pButton->GetEffectBitmap(_BUTTON_STATUS_SELECTED))->GetHeightF()) / 2),
3723 *(pButton->GetEffectBitmap(_BUTTON_STATUS_SELECTED)));
3730 _Toolbar::RearrangeItems(void)
3732 __titleTextArea = _Control::GetBoundsF();
3734 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
3735 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
3737 if (CalculateMinimumToolbarWidth() > __titleTextArea.width)
3739 __titleTextArea.width = CalculateMinimumToolbarWidth();
3742 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
3744 if (__titleTextArea.width > portraitSize.width)
3746 __titleTextArea.width = portraitSize.width;
3751 if (__titleTextArea.width > landscapeSize.width)
3753 __titleTextArea.width = landscapeSize.width;
3757 __itemArea = __titleTextArea;
3759 if (__header == true && __style != TOOLBAR_TEXT) // right align
3761 float headerLeftButtonWidth = 0.0f;
3762 float headerRightButtonWidth = 0.0f;
3763 float headerTopMargin = 0.0f;
3764 float vmargin = 0.0f;
3765 float buttonItemGap = 0.0f;
3766 float headerButtonItemHeight = 0.0f;
3767 float headerLeftMargin = 0.0f;
3768 float headerRightMargin = 0.0f;
3769 float tabLeftMargin = 0.0f;
3771 float leftTouchMargin = 0.0f;
3772 float topTouchMargin = 0.0f;
3773 float rightTouchMargin = 0.0f;
3774 float bottomTouchMargin = 0.0f;
3776 GET_SHAPE_CONFIG(HEADER::TOP_MARGIN, GetOrientation(), headerTopMargin);
3777 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_GAP, GetOrientation(), buttonItemGap);
3778 GET_SHAPE_CONFIG(HEADER::LEFT_MARGIN, GetOrientation(), headerLeftMargin);
3779 GET_SHAPE_CONFIG(HEADER::RIGHT_MARGIN, GetOrientation(), headerRightMargin);
3780 GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, GetOrientation(), tabLeftMargin);
3782 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_LEFT_TOUCH_MARGIN, GetOrientation(), leftTouchMargin);
3783 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_TOP_TOUCH_MARGIN, GetOrientation(), topTouchMargin);
3784 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_RIGHT_TOUCH_MARGIN, GetOrientation(), rightTouchMargin);
3785 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_BOTTOM_TOUCH_MARGIN, GetOrientation(), bottomTouchMargin);
3787 if (__pButtonItems[LEFT_BUTTON])
3789 headerLeftButtonWidth = __pButtonItems[LEFT_BUTTON]->GetSizeF().width;
3792 if (__pButtonItems[RIGHT_BUTTON])
3794 headerRightButtonWidth = __pButtonItems[RIGHT_BUTTON]->GetSizeF().width;
3797 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3799 GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, GetOrientation(), vmargin);
3800 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, GetOrientation(), headerButtonItemHeight);
3804 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_TOP_MARGIN, GetOrientation(), vmargin);
3805 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_HEIGHT, GetOrientation(), headerButtonItemHeight);
3808 __titleTextArea.x = headerLeftMargin;
3809 __titleTextArea.y = headerTopMargin;
3811 if (__pButtonItems[RIGHT_BUTTON])
3813 if (__pButtonItems[LEFT_BUTTON])
3815 if (__pButtonItems[LEFT_BUTTON]->GetText() == L"")
3817 if (__pButtonItems[RIGHT_BUTTON]->GetText() == L"")
3819 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerRightMargin + rightTouchMargin, vmargin,
3820 headerRightButtonWidth, headerButtonItemHeight));
3821 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerLeftButtonWidth - headerRightMargin + rightTouchMargin, vmargin,
3822 headerLeftButtonWidth, headerButtonItemHeight));
3824 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3826 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, 0.0f, rightTouchMargin, 0.0f);
3827 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, 0.0f, rightTouchMargin, 0.0f);
3829 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin * 2);
3833 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
3834 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
3836 __titleTextArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin * 2);
3837 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin * 2);
3842 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerRightMargin, vmargin,
3843 headerRightButtonWidth, headerButtonItemHeight));
3844 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerLeftButtonWidth - headerRightMargin, vmargin,
3845 headerLeftButtonWidth, headerButtonItemHeight));
3847 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3849 //__pButtonItems[RIGHT_BUTTON]->SetTouchMargin(0, 0, 0, 0);
3850 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, 0.0f, rightTouchMargin, 0.0f);
3852 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin);
3856 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(0.0f, topTouchMargin, 0.0f, bottomTouchMargin);
3857 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
3859 __titleTextArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin);
3860 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin);
3866 if (__pButtonItems[RIGHT_BUTTON]->GetText() == L"")
3868 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerRightMargin + rightTouchMargin, vmargin,
3869 headerRightButtonWidth, headerButtonItemHeight));
3870 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerLeftButtonWidth - headerRightMargin + rightTouchMargin, vmargin,
3871 headerLeftButtonWidth, headerButtonItemHeight));
3873 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3875 //__pButtonItems[LEFT_BUTTON]->SetTouchMargin(0, 0, 0, 0);
3876 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, 0.0f, rightTouchMargin, 0.0f);
3878 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin);
3882 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(0.0f, topTouchMargin, 0.0f, bottomTouchMargin);
3883 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
3885 __titleTextArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin);
3886 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + headerLeftMargin - leftTouchMargin);
3891 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerRightMargin, vmargin,
3892 headerRightButtonWidth, headerButtonItemHeight));
3893 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerLeftButtonWidth - buttonItemGap - headerRightMargin, vmargin,
3894 headerLeftButtonWidth, headerButtonItemHeight));
3896 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3898 //__pButtonItems[LEFT_BUTTON]->SetTouchMargin(0, 0, 0, 0);
3899 //__pButtonItems[RIGHT_BUTTON]->SetTouchMargin(0, 0, 0, 0);
3901 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + buttonItemGap + headerLeftMargin);
3905 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(0.0f, topTouchMargin, 0.0f, bottomTouchMargin);
3906 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(0.0f, topTouchMargin, 0.0f, bottomTouchMargin);
3908 __titleTextArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + buttonItemGap + headerLeftMargin);
3909 __itemArea.width -= (headerLeftButtonWidth + headerRightButtonWidth + buttonItemGap + headerLeftMargin);
3916 if (__pButtonItems[RIGHT_BUTTON]->GetText() == L"")
3918 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerRightMargin + rightTouchMargin, vmargin,
3919 headerRightButtonWidth, headerButtonItemHeight));
3921 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3923 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, 0.0f, rightTouchMargin, 0.0f);
3925 __itemArea.width -= (headerRightButtonWidth + headerLeftMargin - leftTouchMargin - rightTouchMargin);
3929 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
3931 __titleTextArea.width -= (headerRightButtonWidth + headerLeftMargin - leftTouchMargin - rightTouchMargin);
3932 __itemArea.width -= (headerRightButtonWidth + headerLeftMargin - leftTouchMargin - rightTouchMargin);
3937 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerRightButtonWidth - headerRightMargin, vmargin,
3938 headerRightButtonWidth, headerButtonItemHeight));
3940 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3942 //__pButtonItems[RIGHT_BUTTON]->SetTouchMargin(0, 0, 0, 0);
3944 __itemArea.width -= (headerRightButtonWidth + headerLeftMargin);
3948 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(0.0f, topTouchMargin, 0.0f, bottomTouchMargin);
3950 __titleTextArea.width -= (headerRightButtonWidth + headerLeftMargin);
3951 __itemArea.width -= (headerRightButtonWidth + headerLeftMargin);
3956 else if (__pButtonItems[LEFT_BUTTON])
3958 if (__pButtonItems[LEFT_BUTTON]->GetText() == L"")
3960 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerLeftButtonWidth - headerRightMargin + rightTouchMargin, vmargin,
3961 headerLeftButtonWidth, headerButtonItemHeight));
3963 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3965 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, 0.0f, rightTouchMargin, 0.0f);
3967 __itemArea.width -= (headerLeftButtonWidth + headerLeftMargin - leftTouchMargin - rightTouchMargin);
3971 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
3973 __titleTextArea.width -= (headerLeftButtonWidth + headerLeftMargin - leftTouchMargin - rightTouchMargin);
3974 __itemArea.width -= (headerLeftButtonWidth + headerLeftMargin - leftTouchMargin - rightTouchMargin);
3979 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(__titleTextArea.width - headerLeftButtonWidth - headerRightMargin, vmargin,
3980 headerLeftButtonWidth, headerButtonItemHeight));
3982 if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_TAB_WITH_TITLE)
3984 //__pButtonItems[LEFT_BUTTON]->SetTouchMargin(0, 0, 0, 0);
3986 __itemArea.width -= (headerLeftButtonWidth + headerLeftMargin);
3990 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(0.0f, topTouchMargin, 0.0f, bottomTouchMargin);
3992 __titleTextArea.width -= (headerLeftButtonWidth + headerLeftMargin);
3993 __itemArea.width -= (headerLeftButtonWidth + headerLeftMargin);
3998 if ((__style == TOOLBAR_HEADER_SEGMENTED || __style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE)
3999 && __pButtonItems[LEFT_BUTTON] == null && __pButtonItems[RIGHT_BUTTON] == null)
4001 // segment style with no button's right margin is same as left
4002 __titleTextArea.width -= (headerLeftMargin + headerRightMargin);
4003 __itemArea.width -= (headerLeftMargin + headerLeftMargin);
4005 else if (!(__style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE))
4007 __titleTextArea.width -= (headerLeftMargin + headerRightMargin);
4008 __itemArea.width -= (headerLeftMargin + headerRightMargin);
4011 if (__style == TOOLBAR_TAB_WITH_TITLE)
4013 __titleTextArea.width -= (headerLeftMargin + headerRightMargin);
4016 float processingAnimationIconSize = 0.0f;
4018 GET_SHAPE_CONFIG(HEADER::PROCESSING_ANIMATION_ICON_SIZE, GetOrientation(), processingAnimationIconSize);
4020 if (__pButtonItems[LEFT_BUTTON] && GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT) != ANIMATION_STOPPED)
4022 SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT,
4023 (__pButtonItems[LEFT_BUTTON]->GetSizeF().width - processingAnimationIconSize) / 2,
4024 topTouchMargin + (__pButtonItems[LEFT_BUTTON]->GetSizeF().height - topTouchMargin - bottomTouchMargin - processingAnimationIconSize) / 2);
4027 if (__pButtonItems[RIGHT_BUTTON] && GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT) != ANIMATION_STOPPED)
4029 SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT,
4030 (__pButtonItems[RIGHT_BUTTON]->GetSizeF().width - processingAnimationIconSize) / 2,
4031 topTouchMargin + (__pButtonItems[RIGHT_BUTTON]->GetSizeF().height - topTouchMargin - bottomTouchMargin - processingAnimationIconSize) / 2);
4034 else // footer or edit or HEADER_STYLE_BUTTON // side align
4036 float footerButtonItemWidth = 0.0f;
4037 float footerButtonItemHeight = 0.0f;
4038 float sipButtonItemTopMargin = 0.0f;
4039 float footerLeftMargin = 0.0f;
4040 FloatDimension softkeyDimension(0.0f, 0.0f);
4042 float leftTouchMargin = 0.0f;
4043 float topTouchMargin = 0.0f;
4044 float rightTouchMargin = 0.0f;
4045 float bottomTouchMargin = 0.0f;
4047 if (__header == true && __style == TOOLBAR_TEXT) // sip
4049 GET_SHAPE_CONFIG(HEADER::SIP_BUTTON_ITEM_LEFT_TOUCH_MARGIN, GetOrientation(), leftTouchMargin);
4050 GET_SHAPE_CONFIG(HEADER::SIP_BUTTON_ITEM_TOP_TOUCH_MARGIN, GetOrientation(), topTouchMargin);
4051 GET_SHAPE_CONFIG(HEADER::SIP_BUTTON_ITEM_RIGHT_TOUCH_MARGIN, GetOrientation(), rightTouchMargin);
4052 GET_SHAPE_CONFIG(HEADER::SIP_BUTTON_ITEM_BOTTOM_TOUCH_MARGIN, GetOrientation(), bottomTouchMargin);
4056 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_LEFT_TOUCH_MARGIN, GetOrientation(), leftTouchMargin);
4057 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TOP_TOUCH_MARGIN, GetOrientation(), topTouchMargin);
4058 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_RIGHT_TOUCH_MARGIN, GetOrientation(), rightTouchMargin);
4059 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_BOTTOM_TOUCH_MARGIN, GetOrientation(), bottomTouchMargin);
4062 if (__header == true && __style == TOOLBAR_TEXT)
4064 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_WIDTH, GetOrientation(), footerButtonItemWidth);
4066 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) // sip && portrait
4068 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_HEIGHT, GetOrientation(), footerButtonItemHeight);
4072 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_HEIGHT, GetOrientation(), footerButtonItemHeight);
4077 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, GetOrientation(), footerButtonItemWidth);
4078 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_HEIGHT, GetOrientation(), footerButtonItemHeight);
4081 GET_SHAPE_CONFIG(HEADER::SIP_BUTTON_ITEM_TOP_MARGIN, GetOrientation(), sipButtonItemTopMargin);
4082 GET_SHAPE_CONFIG(FOOTER::LEFT_MARGIN, GetOrientation(), footerLeftMargin);
4083 GET_DIMENSION_CONFIG(FOOTER::SOFTKEY_RECT_WITH_TEXT, GetOrientation(), softkeyDimension);
4085 if (__pButtonItems[MIDDLE_BUTTON])
4087 __pButtonItems[MIDDLE_BUTTON]->SetPosition(FloatPoint((__itemArea.width - __pButtonItems[MIDDLE_BUTTON]->GetSizeF().width) / 2,
4088 __itemArea.height - __pButtonItems[MIDDLE_BUTTON]->GetSizeF().height));
4091 // footer or edit or HEADER_STYLE_BUTTON // side align
4092 if (__pButtonItems[RIGHT_BUTTON])
4094 if (__pButtonItems[LEFT_BUTTON])
4096 if (__pButtonItems[BACK_BUTTON])
4098 __pButtonItems[BACK_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - footerButtonItemWidth - footerLeftMargin + rightTouchMargin,
4099 (__itemArea.height - footerButtonItemHeight) / 2, footerButtonItemWidth, footerButtonItemHeight));
4101 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(footerLeftMargin - leftTouchMargin, (__itemArea.height - footerButtonItemHeight) / 2,
4102 footerButtonItemWidth, footerButtonItemHeight));
4104 __pButtonItems[BACK_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4105 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4109 if (__style != TOOLBAR_SOFTKEY)
4111 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - footerButtonItemWidth - footerLeftMargin + rightTouchMargin,
4112 (__itemArea.height - footerButtonItemHeight) / 2, footerButtonItemWidth, footerButtonItemHeight));
4114 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(footerLeftMargin - leftTouchMargin, sipButtonItemTopMargin,
4115 footerButtonItemWidth, footerButtonItemHeight));
4117 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4118 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4122 if (__pButtonItems[RIGHT_BUTTON]->GetText() == L"")
4124 __pButtonItems[RIGHT_BUTTON]->SetPosition(FloatPoint(__itemArea.width - __pButtonItems[RIGHT_BUTTON]->GetSizeF().width,
4125 __itemArea.height - __pButtonItems[RIGHT_BUTTON]->GetSizeF().height));
4129 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - softkeyDimension.width, __itemArea.height - softkeyDimension.height,
4130 softkeyDimension.width, softkeyDimension.height));
4134 if (__style != TOOLBAR_SOFTKEY)
4136 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(footerLeftMargin - leftTouchMargin, (__itemArea.height - footerButtonItemHeight) / 2,
4137 footerButtonItemWidth, footerButtonItemHeight));
4139 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4143 if (__pButtonItems[LEFT_BUTTON]->GetText() == L"")
4145 __pButtonItems[LEFT_BUTTON]->SetPosition(FloatPoint(0.0f, __itemArea.height - __pButtonItems[LEFT_BUTTON]->GetSizeF().height));
4149 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(0.0f, __itemArea.height - softkeyDimension.height,
4150 softkeyDimension.width, softkeyDimension.height));
4157 if (__pButtonItems[BACK_BUTTON])
4159 __pButtonItems[BACK_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - footerButtonItemWidth - footerLeftMargin + rightTouchMargin,
4160 (__itemArea.height - footerButtonItemHeight) / 2, footerButtonItemWidth, footerButtonItemHeight));
4162 __pButtonItems[BACK_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4166 if (__style != TOOLBAR_SOFTKEY)
4168 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - footerButtonItemWidth - footerLeftMargin + rightTouchMargin,
4169 (__itemArea.height - footerButtonItemHeight) / 2, footerButtonItemWidth, footerButtonItemHeight));
4171 __pButtonItems[RIGHT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4175 if (__pButtonItems[RIGHT_BUTTON]->GetText() == L"")
4177 __pButtonItems[RIGHT_BUTTON]->SetPosition(FloatPoint(__itemArea.width - __pButtonItems[RIGHT_BUTTON]->GetSizeF().width,
4178 __itemArea.height - __pButtonItems[RIGHT_BUTTON]->GetSizeF().height));
4182 __pButtonItems[RIGHT_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - softkeyDimension.width, __itemArea.height - softkeyDimension.height,
4183 softkeyDimension.width, softkeyDimension.height));
4189 else if (__pButtonItems[LEFT_BUTTON])
4191 if (__pButtonItems[BACK_BUTTON])
4193 __pButtonItems[BACK_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - footerButtonItemWidth - footerLeftMargin + rightTouchMargin,
4194 (__itemArea.height - footerButtonItemHeight) / 2, footerButtonItemWidth, footerButtonItemHeight));
4196 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(footerLeftMargin - leftTouchMargin, (__itemArea.height - footerButtonItemHeight) / 2,
4197 footerButtonItemWidth, footerButtonItemHeight));
4199 __pButtonItems[BACK_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4200 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4204 if (__style != TOOLBAR_SOFTKEY)
4206 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(footerLeftMargin - leftTouchMargin, (__itemArea.height - footerButtonItemHeight) / 2,
4207 footerButtonItemWidth, footerButtonItemHeight));
4209 __pButtonItems[LEFT_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4213 if (__pButtonItems[LEFT_BUTTON]->GetText() == L"")
4215 __pButtonItems[LEFT_BUTTON]->SetPosition(FloatPoint(0.0f, __itemArea.height - __pButtonItems[LEFT_BUTTON]->GetSizeF().height));
4219 __pButtonItems[LEFT_BUTTON]->SetBounds(FloatRectangle(0.0f, __itemArea.height - softkeyDimension.height,
4220 softkeyDimension.width, softkeyDimension.height));
4227 if (__pButtonItems[BACK_BUTTON])
4229 __pButtonItems[BACK_BUTTON]->SetBounds(FloatRectangle(__itemArea.width - footerButtonItemWidth - footerLeftMargin + rightTouchMargin,
4230 (__itemArea.height - footerButtonItemHeight) / 2, footerButtonItemWidth, footerButtonItemHeight));
4232 __pButtonItems[BACK_BUTTON]->SetTouchMargin(leftTouchMargin, topTouchMargin, rightTouchMargin, bottomTouchMargin);
4237 if (__style != TOOLBAR_SOFTKEY)
4239 for (int i = 0; i < BUTTON_MAX; i++)
4241 if (__pButtonItems[i] != null)
4243 RealignButtonItem(__pButtonItems[i]);
4248 __pToolbarPresenter->SetUsableAreaBounds(__titleTextArea);
4250 if (0 == __itemCount)
4257 case TOOLBAR_HEADER_SEGMENTED:
4259 case TOOLBAR_HEADER_SEGMENTED_WITH_TITLE:
4260 RearrangeHeaderSegmentedItems();
4263 case TOOLBAR_SEGMENTED:
4264 RearrangeFooterSegmentedItems();
4269 case TOOLBAR_TAB_WITH_TITLE:
4270 RearrangeTabItmes();
4274 RearrangeButtonItems();
4282 _Toolbar::RearrangeHeaderSegmentedItems(void)
4284 float segmentedItemHeight = 0.0f;
4285 float leftMargin = 0.0f;
4286 float dividerWidth = 0.0f;
4287 float vmargin = 0.0f;
4288 float blockWidth[__itemCount];
4289 float fontSize = 0.0f;
4290 float multilineFontSize = 0.0f;
4292 GET_SHAPE_CONFIG(HEADER::LEFT_MARGIN, GetOrientation(), leftMargin);
4293 GET_SHAPE_CONFIG(HEADER::DIVIDER_WIDTH, GetOrientation(), dividerWidth);
4295 if (__style == TOOLBAR_HEADER_SEGMENTED)
4297 segmentedItemHeight = __itemArea.height;
4298 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_TOP_MARGIN, GetOrientation(), vmargin);
4300 else if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE)
4302 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, GetOrientation(), segmentedItemHeight);
4303 GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, GetOrientation(), vmargin);
4306 if (__itemCount == 1 || __itemCount == 2)
4308 blockWidth[0] = blockWidth[1] = (__itemArea.width - dividerWidth) / 2;
4310 for (int i = 0; i < __itemCount ; i++)
4312 __pItems.at(i)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] * i + dividerWidth * i, vmargin, blockWidth[i], segmentedItemHeight));
4314 if (__pItems.at(i)->GetChildCount() != 0)
4316 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4318 if (existingBadgeIcon)
4320 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[1] - existingBadgeIcon->GetSizeF().width, 0));
4321 existingBadgeIcon = null;
4326 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE, GetOrientation(), fontSize); // 30
4328 if (__style == TOOLBAR_HEADER_SEGMENTED)
4330 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_MULTILINE_FONT_SIZE, GetOrientation(), multilineFontSize); // 28
4332 else if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE)
4334 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize); // 24
4337 else if (__itemCount == 3)
4339 blockWidth[0] = blockWidth[1] = blockWidth[2] = (__itemArea.width - dividerWidth * 2) / 3;
4341 __pItems.at(0)->SetBounds(FloatRectangle(leftMargin, vmargin, blockWidth[0], segmentedItemHeight));
4342 __pItems.at(1)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + dividerWidth, vmargin, blockWidth[1], segmentedItemHeight));
4343 __pItems.at(2)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4344 vmargin, blockWidth[2], segmentedItemHeight));
4346 for (int i = 0; i < __itemCount; i++)
4348 if (__pItems.at(i)->GetChildCount() != 0)
4350 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4352 if (existingBadgeIcon)
4354 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4355 existingBadgeIcon = null;
4360 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_3_ITEM, GetOrientation(), fontSize); // 26
4362 if (__style == TOOLBAR_HEADER_SEGMENTED)
4364 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_3_ITEM, GetOrientation(), multilineFontSize); // 26
4366 else if (__style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE)
4368 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize); //24
4371 else if (__itemCount == 4)
4373 blockWidth[0] = blockWidth[1] = blockWidth[2] = blockWidth[3] = (__itemArea.width - dividerWidth * 3) / 4;
4375 __pItems.at(0)->SetBounds(FloatRectangle(leftMargin, vmargin, blockWidth[0], segmentedItemHeight));
4376 __pItems.at(1)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + dividerWidth, vmargin, blockWidth[1], segmentedItemHeight));
4377 __pItems.at(2)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4378 vmargin, blockWidth[2], segmentedItemHeight));
4379 __pItems.at(3)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + dividerWidth * 3,
4380 vmargin, blockWidth[3], segmentedItemHeight));
4382 for (int i = 0; i < __itemCount ; i++)
4384 if (__pItems.at(i)->GetChildCount() != 0)
4386 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4388 if (existingBadgeIcon)
4390 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4391 existingBadgeIcon = null;
4396 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), fontSize);
4397 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize);
4400 for (int i = 0; i < __itemCount; i++)
4402 __pItems.at(i)->SetTextSize(fontSize, FONT_STYLE_BOLD);
4403 __pItems.at(i)->SetMultilineTextSize(multilineFontSize);
4405 RealignItem(__pItems.at(i), __pItems.at(i)->GetTextExtentSizeF());
4412 _Toolbar::RearrangeFooterSegmentedItems(void)
4414 float segmentedItemHeight = __itemArea.height;
4416 float leftMargin = 0.0f;
4417 float rightMargin = 0.0f;
4418 float footerLeftMargin = 0.0f;
4419 float iconSize = 0.0f;
4420 float dividerWidth = 0.0f;
4421 float blockWidth[__itemCount];
4422 float fontSize = 0.0f;
4423 float multilineFontSize = 0.0f;
4425 float itemButtonLeftGap = 0.0f;
4426 float itemButtonRightGap = 0.0f;
4428 GET_SHAPE_CONFIG(HEADER::LEFT_MARGIN, GetOrientation(), leftMargin);
4429 GET_SHAPE_CONFIG(FOOTER::LEFT_MARGIN, GetOrientation(), footerLeftMargin);
4430 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_ICON_SIZE, GetOrientation(), iconSize);
4431 GET_SHAPE_CONFIG(HEADER::DIVIDER_WIDTH, GetOrientation(), dividerWidth);
4433 rightMargin = leftMargin;
4435 if (__itemCount == 1 || __itemCount == 2)
4437 leftMargin = footerLeftMargin;
4438 itemButtonLeftGap = footerLeftMargin;
4439 __itemArea.width -= ((leftMargin + iconSize + itemButtonLeftGap) * 2);
4441 blockWidth[0] = blockWidth[1] = (__itemArea.width - dividerWidth) / 2;
4443 for (int i = 0; i < __itemCount ; i++)
4445 __pItems.at(i)->SetBounds(FloatRectangle(leftMargin + iconSize + itemButtonLeftGap + blockWidth[0] * i + dividerWidth * i,
4446 (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[i], segmentedItemHeight));
4448 if (__pItems.at(i)->GetChildCount() != 0)
4450 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4452 if (existingBadgeIcon)
4454 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4455 existingBadgeIcon = null;
4460 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE, GetOrientation(), fontSize);
4461 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_MULTILINE_FONT_SIZE, GetOrientation(), multilineFontSize);
4463 else if (__itemCount == 3)
4465 if (__pButtonItems[LEFT_BUTTON])
4467 if (__pButtonItems[RIGHT_BUTTON] || __pButtonItems[BACK_BUTTON])
4469 leftMargin = footerLeftMargin;
4470 itemButtonLeftGap = footerLeftMargin;
4471 __itemArea.width -= ((leftMargin + iconSize + itemButtonLeftGap) * 2);
4475 leftMargin = footerLeftMargin;
4476 itemButtonLeftGap = footerLeftMargin;
4477 __itemArea.width -= (leftMargin + iconSize + itemButtonLeftGap + rightMargin);
4482 if (__pButtonItems[RIGHT_BUTTON] || __pButtonItems[BACK_BUTTON])
4484 rightMargin = footerLeftMargin;
4485 itemButtonRightGap = footerLeftMargin;
4486 __itemArea.width -= (leftMargin + itemButtonRightGap + iconSize + rightMargin);
4490 __itemArea.width -= leftMargin * 2;
4496 blockWidth[0] = blockWidth[1] = blockWidth[2] = (__itemArea.width - dividerWidth * 2) / 3;
4498 __pItems.at(0)->SetBounds(FloatRectangle(leftMargin + iconSize + itemButtonLeftGap, (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[0], segmentedItemHeight));
4499 __pItems.at(1)->SetBounds(FloatRectangle(leftMargin + iconSize + itemButtonLeftGap + blockWidth[0] + dividerWidth, (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[1], segmentedItemHeight));
4500 __pItems.at(2)->SetBounds(FloatRectangle(leftMargin + iconSize + itemButtonLeftGap + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4501 (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[2], segmentedItemHeight));
4503 for (int i = 0; i < __itemCount ; i++)
4505 if (__pItems.at(i)->GetChildCount() != 0)
4507 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4509 if (existingBadgeIcon)
4511 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4512 existingBadgeIcon = null;
4517 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_3_ITEM, GetOrientation(), fontSize);
4518 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_3_ITEM, GetOrientation(), multilineFontSize);
4520 else if (__itemCount == 4)
4522 if (__pButtonItems[BACK_BUTTON])
4524 rightMargin = footerLeftMargin;
4525 itemButtonRightGap = footerLeftMargin;
4526 __itemArea.width -= (leftMargin + itemButtonRightGap + iconSize + rightMargin);
4530 __itemArea.width -= leftMargin * 2;
4533 blockWidth[0] = blockWidth[1] = blockWidth[2] = blockWidth[3] = (__itemArea.width - dividerWidth * 3) / 4;
4535 __pItems.at(0)->SetBounds(FloatRectangle(leftMargin, (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[0], segmentedItemHeight));
4536 __pItems.at(1)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + dividerWidth, (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[1], segmentedItemHeight));
4537 __pItems.at(2)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4538 (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[2], segmentedItemHeight));
4539 __pItems.at(3)->SetBounds(FloatRectangle(leftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + dividerWidth * 3,
4540 (GetSizeF().height - segmentedItemHeight) / 2, blockWidth[3], segmentedItemHeight));
4542 for (int i = 0; i < __itemCount ; i++)
4544 if (__pItems.at(i)->GetChildCount() != 0)
4546 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4548 if (existingBadgeIcon)
4550 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4551 existingBadgeIcon = null;
4556 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), fontSize);
4557 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize);
4560 for (int i = 0; i < __itemCount ; i++)
4562 __pItems.at(i)->SetTextSize(fontSize, FONT_STYLE_BOLD);
4563 __pItems.at(i)->SetMultilineTextSize(multilineFontSize);
4565 RealignItem(__pItems.at(i), __pItems.at(i)->GetTextExtentSizeF());
4572 _Toolbar::RearrangeTabItmes(void)
4574 float itemWidth[__itemCount];
4575 float fontSize = 0.0f;
4576 float multilineFontSize = 0.0f;
4577 float segmentedItemHeight = 0.0f;
4578 float tabLeftMargin = 0.0f;
4579 float vmargin = 0.0f;
4580 float dividerWidth = 0.0f;
4582 GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, GetOrientation(), tabLeftMargin);
4583 GET_SHAPE_CONFIG(HEADER::DIVIDER_WIDTH, GetOrientation(), dividerWidth);
4585 if (__style == TOOLBAR_TAB)
4587 segmentedItemHeight = __itemArea.height;
4589 else if (__style == TOOLBAR_TAB_WITH_TITLE)
4591 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, GetOrientation(), segmentedItemHeight);
4592 GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, GetOrientation(), vmargin);
4595 if (__itemCount == 1)
4597 itemWidth[0] = __itemArea.width - tabLeftMargin * 2;
4598 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, vmargin, itemWidth[0], segmentedItemHeight));
4601 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE, GetOrientation(), fontSize); // 30
4603 if (__style == TOOLBAR_TAB)
4605 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_MULTILINE_FONT_SIZE, GetOrientation(), multilineFontSize); // 28
4607 else if (__style == TOOLBAR_TAB_WITH_TITLE)
4609 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize); // 24
4612 else if (__itemCount == 2)
4614 itemWidth[0] = itemWidth[1] = (__itemArea.width - tabLeftMargin * 2 - dividerWidth) / 2;
4616 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, vmargin, itemWidth[0], segmentedItemHeight));
4617 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + itemWidth[0] + dividerWidth, vmargin, itemWidth[1], segmentedItemHeight));
4619 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE, GetOrientation(), fontSize); // 30
4621 if (__style == TOOLBAR_TAB)
4623 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_MULTILINE_FONT_SIZE, GetOrientation(), multilineFontSize); // 28
4625 else if (__style == TOOLBAR_TAB_WITH_TITLE)
4627 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize); // 24
4630 else if (__itemCount == 3)
4632 itemWidth[0] = itemWidth[1] = itemWidth[2] = (__itemArea.width - tabLeftMargin * 2 - dividerWidth * 2) / 3;
4634 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, vmargin, itemWidth[0], segmentedItemHeight));
4635 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + itemWidth[0] + dividerWidth, vmargin, itemWidth[1], segmentedItemHeight));
4636 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + itemWidth[0] + itemWidth[1] + dividerWidth * 2, vmargin, itemWidth[2], segmentedItemHeight));
4638 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_3_ITEM, GetOrientation(), fontSize); // 26
4640 if (__style == TOOLBAR_TAB)
4642 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_3_ITEM, GetOrientation(), multilineFontSize); // 26
4644 else if (__style == TOOLBAR_TAB_WITH_TITLE)
4646 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize); // 24
4651 itemWidth[0] = itemWidth[1] = itemWidth[2] = itemWidth[3] = (__itemArea.width - tabLeftMargin * 2 - dividerWidth * 3) / 4;
4653 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, vmargin, itemWidth[0], segmentedItemHeight));
4654 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + itemWidth[0] + dividerWidth, vmargin, itemWidth[1], segmentedItemHeight));
4655 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + itemWidth[0] + itemWidth[1] + dividerWidth * 2,
4656 vmargin, itemWidth[2], segmentedItemHeight));
4657 __pItems.at(3)->SetBounds(FloatRectangle(tabLeftMargin + itemWidth[0] + itemWidth[1] + itemWidth[2] + dividerWidth * 3,
4658 vmargin, itemWidth[3], segmentedItemHeight));
4660 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), fontSize); // 24
4661 GET_SHAPE_CONFIG(HEADER::TAB_ITEM_FONT_SIZE_4_ITEM, GetOrientation(), multilineFontSize); // 24
4664 for (int i = 4; i < __itemCount ; i++)
4666 itemWidth[i] = itemWidth[0];
4668 __pItems.at(i)->SetBounds(FloatRectangle(__pItems.at(i-1)->GetBoundsF().x + dividerWidth + itemWidth[i], vmargin, itemWidth[i], segmentedItemHeight));
4671 for (int i = 0; i < __itemCount ; i++)
4673 __pItems.at(i)->SetTextSize(fontSize, FONT_STYLE_BOLD);
4674 __pItems.at(i)->SetMultilineTextSize(multilineFontSize);
4676 if (__pItems.at(i)->GetChildCount() != 0)
4678 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4680 if (existingBadgeIcon)
4682 existingBadgeIcon->SetPosition(FloatPoint(__pItems.at(i)->GetSizeF().width - existingBadgeIcon->GetSizeF().width, 0));
4683 existingBadgeIcon = null;
4687 RealignItem(__pItems.at(i), __pItems.at(i)->GetTextExtentSizeF());
4694 _Toolbar::RearrangeButtonItems(void)
4696 float itemHeight = 0.0f;
4697 float maxItemLength = 0.0f;
4698 float minItemLength = 0.0f;
4699 float iconSizeWithText = 0.0f;
4700 float sideMargin = 0.0f;
4701 float topMargin = 0.0f;
4702 float itemButtonLeftGap = 0.0f;
4703 float itemButtonRightGap = 0.0f;
4704 float tabLeftMargin = 0.0f;
4705 float sipFooterItemTopMargin = 0.0f;
4706 float dividerWidth = 0.0f;
4707 float iconSize = 0.0f;
4708 float footerLeftMargin = 0.0f;
4709 float segmentedItemHeight = 0.0f;
4710 float headerLeftMargin = 0.0f;
4711 float blockWidth[__itemCount];
4712 float fontSize = 0.0f;
4713 float multilineFontSize = 0.0f;
4715 GET_SHAPE_CONFIG(HEADER::SIP_FOOTER_ITEM_TOP_MARGIN, GetOrientation(), sipFooterItemTopMargin);
4716 GET_SHAPE_CONFIG(HEADER::DIVIDER_WIDTH, GetOrientation(), dividerWidth);
4717 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_ICON_SIZE, GetOrientation(), iconSize);
4718 GET_SHAPE_CONFIG(FOOTER::LEFT_MARGIN, GetOrientation(), footerLeftMargin);
4719 GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, GetOrientation(), tabLeftMargin);
4720 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_BUTTON_STYLE_SIDE_MARGIN, GetOrientation(), sideMargin);
4721 GET_SHAPE_CONFIG(HEADER::BUTTON_ITEM_ICON_TOP_MARGIN, GetOrientation(), topMargin);
4722 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, GetOrientation(), segmentedItemHeight);
4723 GET_SHAPE_CONFIG(HEADER::LEFT_MARGIN, GetOrientation(), headerLeftMargin);
4725 float tabRightMargin = tabLeftMargin;
4727 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
4729 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_HEIGHT, GetOrientation(), itemHeight);
4733 itemHeight = GetSizeF().height;
4736 if (__itemCount == 1)
4738 float textExtentSize_0 = __pItems.at(0)->GetTextExtentSizeF();
4740 if (__style == TOOLBAR_TITLE) // item 1, HEADER_STYLE_TITLE_BUTTON
4742 blockWidth[0] = __titleTextArea.width;
4743 itemHeight = segmentedItemHeight;
4744 __pItems.at(0)->SetBounds(FloatRectangle(headerLeftMargin, topMargin, blockWidth[0], itemHeight));
4745 __pItems.at(0)->SetMargin(0.0f, 0.0f, 0.0f, 0.0f);
4749 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_WIDTH_1_MAX, GetOrientation(), maxItemLength);
4750 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_WIDTH_1_MIN, GetOrientation(), minItemLength);
4751 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_BUTTON_STYLE_ICON_SIZE_WITH_TEXT, GetOrientation(), iconSizeWithText);
4753 if (!(__pItems.at(0)->GetBitmap(_BUTTON_STATUS_NORMAL) == null
4754 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_DISABLED) == null
4755 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_PRESSED) == null
4756 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_SELECTED) == null
4757 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED) == null)) // at least 1 bitmap
4759 blockWidth[0] = textExtentSize_0 + iconSizeWithText + sideMargin * 3;
4763 blockWidth[0] = textExtentSize_0 + sideMargin * 2;
4766 if (blockWidth[0] > maxItemLength)
4768 blockWidth[0] = maxItemLength;
4770 if (blockWidth[0] < minItemLength)
4772 blockWidth[0] = minItemLength;
4775 tabLeftMargin = footerLeftMargin;
4776 itemButtonLeftGap = footerLeftMargin;
4777 __itemArea.width -= ((tabLeftMargin + iconSize + itemButtonLeftGap) * 2);
4779 if (blockWidth[0] > __itemArea.width)
4781 blockWidth[0] = __itemArea.width;
4784 if (__header == true && __style == TOOLBAR_TEXT && GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) // sip
4786 __pItems.at(0)->SetBounds(FloatRectangle((GetSizeF().width - blockWidth[0]) / 2, sipFooterItemTopMargin, blockWidth[0], itemHeight));
4790 __pItems.at(0)->SetBounds(FloatRectangle((GetSizeF().width - blockWidth[0]) / 2, (GetSizeF().height - itemHeight) / 2, blockWidth[0], itemHeight));
4794 for (int i = 0; i < __itemCount; i++)
4796 if (__pItems.at(i)->GetChildCount() != 0)
4798 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4800 if (existingBadgeIcon)
4802 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4803 existingBadgeIcon = null;
4808 RealignItem(__pItems.at(0), textExtentSize_0);
4810 else if(__itemCount == 2)
4812 float itemGap = 0.0f;
4814 float textExtentSize_0 = __pItems.at(0)->GetTextExtentSizeF();
4815 float textExtentSize_1 = __pItems.at(1)->GetTextExtentSizeF();
4817 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_WIDTH_2_MAX, GetOrientation(), maxItemLength);
4818 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_WIDTH_2_MIN, GetOrientation(), minItemLength);
4819 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_BUTTON_STYLE_ICON_SIZE_WITH_TEXT, GetOrientation(), iconSizeWithText);
4820 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_BUTTON_STYLE_ITEM_GAP, GetOrientation(), itemGap);
4822 if (!(__pItems.at(0)->GetBitmap(_BUTTON_STATUS_NORMAL) == null
4823 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_DISABLED) == null
4824 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_PRESSED) == null
4825 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_SELECTED) == null
4826 && __pItems.at(0)->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED) == null)) // at least 1 bitmap
4828 blockWidth[0] = textExtentSize_0 + iconSizeWithText + sideMargin * 3;
4832 blockWidth[0] = textExtentSize_0 + sideMargin * 2;
4835 if (blockWidth[0] > maxItemLength)
4837 blockWidth[0] = maxItemLength;
4839 if (blockWidth[0] < minItemLength)
4841 blockWidth[0] = minItemLength;
4844 if (!(__pItems.at(1)->GetBitmap(_BUTTON_STATUS_NORMAL) == null
4845 && __pItems.at(1)->GetBitmap(_BUTTON_STATUS_DISABLED) == null
4846 && __pItems.at(1)->GetBitmap(_BUTTON_STATUS_PRESSED) == null
4847 && __pItems.at(1)->GetBitmap(_BUTTON_STATUS_SELECTED) == null
4848 && __pItems.at(1)->GetBitmap(_BUTTON_STATUS_HIGHLIGHTED) == null)) // at least 1 bitmap
4850 blockWidth[1] = textExtentSize_1 + iconSizeWithText + sideMargin * 3;
4854 blockWidth[1] = textExtentSize_1 + sideMargin * 2;
4857 if (blockWidth[1] > maxItemLength)
4859 blockWidth[1] = maxItemLength;
4861 if (blockWidth[1] < minItemLength)
4863 blockWidth[1] = minItemLength;
4866 tabLeftMargin = footerLeftMargin;
4867 itemButtonLeftGap = footerLeftMargin;
4868 __itemArea.width -= ((tabLeftMargin + iconSize + itemButtonLeftGap) * 2);
4870 if (blockWidth[0] > (__itemArea.width - itemGap * 2) / 2)
4872 blockWidth[0] = (__itemArea.width - itemGap * 2) / 2;
4875 if (blockWidth[1] > (__itemArea.width - itemGap * 2) / 2)
4877 blockWidth[1] = (__itemArea.width - itemGap * 2) / 2;
4880 if (__header == true && __style == TOOLBAR_TEXT && GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) // sip
4882 __pItems.at(0)->SetBounds(FloatRectangle(GetSizeF().width / 2 - itemGap - blockWidth[0], sipFooterItemTopMargin, blockWidth[0], itemHeight));
4883 __pItems.at(1)->SetBounds(FloatRectangle(GetSizeF().width / 2 + itemGap, sipFooterItemTopMargin, blockWidth[1], itemHeight));
4887 __pItems.at(0)->SetBounds(FloatRectangle(GetSizeF().width / 2 - itemGap - blockWidth[0], (GetSizeF().height - itemHeight) / 2, blockWidth[0], itemHeight));
4888 __pItems.at(1)->SetBounds(FloatRectangle(GetSizeF().width / 2 + itemGap, (GetSizeF().height - itemHeight) / 2, blockWidth[1], itemHeight));
4891 for (int i = 0; i < __itemCount; i++)
4893 if (__pItems.at(i)->GetChildCount() != 0)
4895 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4897 if (existingBadgeIcon)
4899 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4900 existingBadgeIcon = null;
4905 RealignItem(__pItems.at(0), textExtentSize_0);
4906 RealignItem(__pItems.at(1), textExtentSize_1);
4908 else if (__itemCount == 3)
4910 if (__pButtonItems[LEFT_BUTTON])
4912 if (__pButtonItems[RIGHT_BUTTON] || __pButtonItems[BACK_BUTTON])
4914 tabLeftMargin = footerLeftMargin;
4915 itemButtonLeftGap = footerLeftMargin;
4916 __itemArea.width -= ((tabLeftMargin + iconSize + itemButtonLeftGap) * 2);
4920 tabLeftMargin = footerLeftMargin;
4921 itemButtonLeftGap = footerLeftMargin;
4922 __itemArea.width -= (tabLeftMargin + iconSize + itemButtonLeftGap + tabRightMargin);
4927 if (__pButtonItems[RIGHT_BUTTON] || __pButtonItems[BACK_BUTTON])
4929 tabRightMargin = footerLeftMargin;
4930 itemButtonRightGap = footerLeftMargin;
4931 __itemArea.width -= (tabLeftMargin + itemButtonRightGap + iconSize + tabRightMargin);
4935 __itemArea.width -= tabLeftMargin * 2;
4941 blockWidth[0] = blockWidth[1] = blockWidth[2] = (__itemArea.width - dividerWidth * 2) / 3;
4943 if (__header == true && __style == TOOLBAR_TEXT && GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) // sip
4945 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin + iconSize + itemButtonLeftGap, sipFooterItemTopMargin, blockWidth[0], itemHeight));
4946 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + iconSize + itemButtonLeftGap + blockWidth[0] + dividerWidth, sipFooterItemTopMargin, blockWidth[1], itemHeight));
4947 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + iconSize + itemButtonLeftGap + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4948 sipFooterItemTopMargin, blockWidth[2], itemHeight));
4952 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin + iconSize + itemButtonLeftGap, (GetSizeF().height - itemHeight) / 2, blockWidth[0], itemHeight));
4953 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + iconSize + itemButtonLeftGap + blockWidth[0] + dividerWidth, (GetSizeF().height - itemHeight) / 2, blockWidth[1], itemHeight));
4954 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + iconSize + itemButtonLeftGap + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4955 (GetSizeF().height - itemHeight) / 2, blockWidth[2], itemHeight));
4958 for (int i = 0; i < __itemCount; i++)
4960 if (__pItems.at(i)->GetChildCount() != 0)
4962 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
4964 if (existingBadgeIcon)
4966 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
4967 existingBadgeIcon = null;
4971 RealignItem(__pItems.at(i), __pItems.at(i)->GetTextExtentSizeF());
4974 else if (__itemCount == 4)
4976 if (__pButtonItems[BACK_BUTTON])
4978 tabRightMargin = footerLeftMargin;
4979 itemButtonRightGap = footerLeftMargin;
4980 __itemArea.width -= (tabLeftMargin + itemButtonRightGap + iconSize + tabRightMargin);
4984 __itemArea.width -= tabLeftMargin * 2;
4987 blockWidth[0] = blockWidth[1] = blockWidth[2] = blockWidth[3] = (__itemArea.width - dividerWidth * 3) / 4;
4989 if (__header == true && __style == TOOLBAR_TEXT && GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) // sip
4991 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, sipFooterItemTopMargin, blockWidth[0], itemHeight));
4992 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + dividerWidth, sipFooterItemTopMargin, blockWidth[1], itemHeight));
4993 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
4994 sipFooterItemTopMargin, blockWidth[2], itemHeight));
4995 __pItems.at(3)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + dividerWidth * 3,
4996 sipFooterItemTopMargin, blockWidth[3], itemHeight));
5000 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, (GetSizeF().height - itemHeight) / 2, blockWidth[0], itemHeight));
5001 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + dividerWidth, (GetSizeF().height - itemHeight) / 2, blockWidth[1], itemHeight));
5002 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
5003 (GetSizeF().height - itemHeight) / 2, blockWidth[2], itemHeight));
5004 __pItems.at(3)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + dividerWidth * 3,
5005 (GetSizeF().height - itemHeight) / 2, blockWidth[3], itemHeight));
5008 for (int i = 0; i < __itemCount; i++)
5010 if (__pItems.at(i)->GetChildCount() != 0)
5012 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
5014 if (existingBadgeIcon)
5016 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
5017 existingBadgeIcon = null;
5021 RealignItem(__pItems.at(i), __pItems.at(i)->GetTextExtentSizeF());
5024 else if (__itemCount == 5)
5026 if (__pButtonItems[BACK_BUTTON])
5028 tabRightMargin = footerLeftMargin;
5029 itemButtonRightGap = footerLeftMargin;
5030 __itemArea.width -= (tabLeftMargin + itemButtonRightGap + iconSize + tabRightMargin);
5034 __itemArea.width -= tabLeftMargin * 2;
5037 blockWidth[0] = blockWidth[1] = blockWidth[2] = blockWidth[3] = blockWidth[4] = (__itemArea.width - dividerWidth * 4) / 5;
5039 if (__header == true && __style == TOOLBAR_TEXT && GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) // sip
5041 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, sipFooterItemTopMargin, blockWidth[0], itemHeight));
5042 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + dividerWidth, sipFooterItemTopMargin, blockWidth[1], itemHeight));
5043 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
5044 sipFooterItemTopMargin, blockWidth[2], itemHeight));
5045 __pItems.at(3)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + dividerWidth * 3,
5046 sipFooterItemTopMargin, blockWidth[3], itemHeight));
5047 __pItems.at(4)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + blockWidth[3] + dividerWidth * 4,
5048 sipFooterItemTopMargin, blockWidth[4], itemHeight));
5052 __pItems.at(0)->SetBounds(FloatRectangle(tabLeftMargin, (GetSizeF().height - itemHeight) / 2, blockWidth[0], itemHeight));
5053 __pItems.at(1)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + dividerWidth, (GetSizeF().height - itemHeight) / 2, blockWidth[1], itemHeight));
5054 __pItems.at(2)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + dividerWidth * 2,
5055 (GetSizeF().height - itemHeight) / 2, blockWidth[2], itemHeight));
5056 __pItems.at(3)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + dividerWidth * 3,
5057 (GetSizeF().height - itemHeight) / 2, blockWidth[3], itemHeight));
5058 __pItems.at(4)->SetBounds(FloatRectangle(tabLeftMargin + blockWidth[0] + blockWidth[1] + blockWidth[2] + blockWidth[3] + dividerWidth * 4,
5059 (GetSizeF().height - itemHeight) / 2, blockWidth[4], itemHeight));
5062 for (int i = 0; i < __itemCount; i++)
5064 if (__pItems.at(i)->GetChildCount() != 0)
5066 _Label* existingBadgeIcon = dynamic_cast<_Label*>(__pItems.at(i)->GetChild(0));
5068 if (existingBadgeIcon)
5070 existingBadgeIcon->SetPosition(FloatPoint(blockWidth[i] - existingBadgeIcon->GetSizeF().width, 0));
5071 existingBadgeIcon = null;
5075 RealignItem(__pItems.at(i), __pItems.at(i)->GetTextExtentSizeF());
5079 GET_SHAPE_CONFIG(FOOTER::FOOTER_ITEM_FONT_SIZE, GetOrientation(), fontSize);//32
5081 for (int i = 0; i < __itemCount; i++)
5083 if (__style == TOOLBAR_ICON_TEXT && (__pItems.at(i)->GetBitmap(_BUTTON_STATUS_NORMAL) || __pItems.at(i)->GetBitmap(_BUTTON_STATUS_PRESSED)))
5085 if (__itemCount == 5)
5087 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_FONT_SIZE_ITEM_5_WITH_ICON, GetOrientation(), multilineFontSize);//18
5091 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_FONT_SIZE_ITEM_3_WITH_ICON, GetOrientation(), multilineFontSize);//22
5096 if (__itemCount == 5)
5098 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_FONT_SIZE_ITEM_5, GetOrientation(), multilineFontSize);//22
5102 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_TEXT_FONT_SIZE_ITEM_3, GetOrientation(), multilineFontSize);//24
5106 __pItems.at(i)->SetTextSize(fontSize, FONT_STYLE_BOLD);
5107 __pItems.at(i)->SetMultilineTextSize(multilineFontSize);
5114 _Toolbar::SetAnimation(ToolbarAnimationPosition animationPos)
5116 SysTryReturnResult(NID_UI_CTRL, (0 <= animationPos && animationPos < 3), E_INVALID_ARG,
5117 "[E_INVALID_ARG] The animationPos is invalid.");
5119 if (__pAnimation[animationPos])
5121 if (__pAnimation[animationPos]->GetStatus() == ANIMATION_PLAYING)
5127 if (__pAnimationFrameList[animationPos])
5129 __pAnimationFrameList[animationPos]->RemoveAll(true);
5131 delete __pAnimationFrameList[animationPos];
5132 __pAnimationFrameList[animationPos] = null;
5135 result r = GET_ANIMATION_CONFIG_N(HEADER::PROCESSING_ANIMATION, __pAnimationFrameList[animationPos]);
5136 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[E_SYSTEM] Couldn't get an animationframe.");
5138 delete __pAnimation[animationPos];
5139 __pAnimation[animationPos] = null;
5141 __pAnimation[animationPos] = _Animation::CreateAnimationN();
5143 float processingAnimationIconSize = 0.0f;
5145 GET_SHAPE_CONFIG(HEADER::PROCESSING_ANIMATION_ICON_SIZE, GetOrientation(), processingAnimationIconSize);
5147 if (__pAnimation[animationPos])
5149 __pAnimation[animationPos]->SetSize(FloatDimension(processingAnimationIconSize, processingAnimationIconSize));
5151 if (__pAnimationFrameList[animationPos])
5153 __pAnimation[animationPos]->SetAnimationFrames(*__pAnimationFrameList[animationPos]);
5154 __pAnimation[animationPos]->SetImageCount(__pAnimationFrameList[animationPos]->GetCount());
5155 __pAnimation[animationPos]->SetRepeatCount(100);
5156 __pAnimation[animationPos]->AddAnimationEventListener(*this);
5159 if (animationPos == TOOLBAR_ANIMATION_POSITION_TITLE)
5161 AttachChild(*__pAnimation[animationPos]);
5163 else if (animationPos == TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT)
5165 __pButtonItems[LEFT_BUTTON]->AttachChild(*__pAnimation[animationPos]);
5167 float topTouchMargin = __pButtonItems[LEFT_BUTTON]->GetTopTouchMarginF();
5168 float bottomTouchMargin = __pButtonItems[LEFT_BUTTON]->GetBottomTouchMarginF();
5170 SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_BUTTON_LEFT,
5171 (__pButtonItems[LEFT_BUTTON]->GetSizeF().width - processingAnimationIconSize) / 2,
5172 topTouchMargin + (__pButtonItems[LEFT_BUTTON]->GetSizeF().height - topTouchMargin - bottomTouchMargin - processingAnimationIconSize) / 2);
5174 else if (animationPos == TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT)
5176 __pButtonItems[RIGHT_BUTTON]->AttachChild(*__pAnimation[animationPos]);
5178 float topTouchMargin = __pButtonItems[RIGHT_BUTTON]->GetTopTouchMarginF();
5179 float bottomTouchMargin = __pButtonItems[RIGHT_BUTTON]->GetBottomTouchMarginF();
5181 SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_BUTTON_RIGHT,
5182 (__pButtonItems[RIGHT_BUTTON]->GetSizeF().width - processingAnimationIconSize) / 2,
5183 topTouchMargin + (__pButtonItems[RIGHT_BUTTON]->GetSizeF().height - topTouchMargin - bottomTouchMargin - processingAnimationIconSize) / 2);
5185 _AccessibilityContainer* pContainer = __pAnimation[animationPos]->GetAccessibilityContainer();
5188 pContainer->Activate(false);
5196 _Toolbar::SetColorReplacedBitmap(_Button* pButton, const _ButtonStatus status,
5197 const Color& color, const Bitmap* pBitmap)
5199 SysTryReturnResult(NID_UI_CTRL, pButton, E_INVALID_ARG, "[E_INVALID_ARG] The button pointer is null.");
5200 SysTryReturnResult(NID_UI_CTRL, pBitmap, E_INVALID_ARG, "[E_INVALID_ARG] The bitmap pointer is null.");
5202 Bitmap* __pColorReplacedBitmap = null;
5204 __pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
5206 if (__pColorReplacedBitmap)
5208 if (color.GetAlpha() != 0xFF)
5210 __pColorReplacedBitmap->SetAlphaConstant(color.GetAlpha());
5213 pButton->SetBackgroundBitmap(status, *__pColorReplacedBitmap);
5214 delete __pColorReplacedBitmap;
5221 _Toolbar::SetPropertyColor(const Variant& color)
5223 result r = E_SUCCESS;
5225 _Control::SetBackgroundColor(color.ToColor());
5231 _Toolbar::GetPropertyColor(void) const
5233 return Variant(_Control::GetBackgroundColor());
5237 _Toolbar::SetPropertyDescriptionText(const Variant& text)
5239 __descriptionText = text.ToString();
5241 result r = E_SUCCESS;
5243 r = __pToolbarPresenter->SetDescriptionText(__descriptionText);
5245 if(__pTitleTextElement)
5249 __pTitleTextElement->SetLabel(__titleText);
5253 __pTitleTextElement->SetLabel(__titleText + L", " + __descriptionText);
5261 _Toolbar::GetPropertyDescriptionText(void) const
5263 return Variant(__descriptionText);
5267 _Toolbar::SetPropertyDescriptionTextColor(const Variant& color)
5269 __descriptionTextColor = color.ToColor();
5275 _Toolbar::GetPropertyDescriptionTextColor(void) const
5277 return Variant(__descriptionTextColor);
5281 _Toolbar::SetPropertyTitleText(const Variant& text)
5283 __titleText = text.ToString();
5285 if(__pTitleTextElement)
5287 __pTitleTextElement->SetLabel(__titleText);
5294 _Toolbar::GetPropertyTitleText(void) const
5296 return Variant(__titleText);
5300 _Toolbar::SetPropertyTitleTextColor(const Variant& color)
5302 __titleTextColor = color.ToColor();
5308 _Toolbar::GetPropertyTitleTextColor(void) const
5310 return Variant(__titleTextColor);
5314 _Toolbar::SetPropertyDisabledButtonColor(const Variant& color)
5316 __buttonBackgroundColor[_BUTTON_STATUS_DISABLED] = color.ToColor();
5318 Bitmap* __pBaseBackgroundBitmap = null;
5320 GET_BITMAP_CONFIG_N(HEADER::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5322 for (int i = 0; i < BUTTON_MAX; i++)
5324 if (__pButtonItems[i] != null)
5326 if (__pBaseBackgroundBitmap)
5328 SetColorReplacedBitmap(__pButtonItems[i], _BUTTON_STATUS_DISABLED, __buttonBackgroundColor[_BUTTON_STATUS_DISABLED], __pBaseBackgroundBitmap);
5333 delete __pBaseBackgroundBitmap;
5339 _Toolbar::GetPropertyDisabledButtonColor(void) const
5341 return Variant(__buttonBackgroundColor[_BUTTON_STATUS_DISABLED]);
5345 _Toolbar::SetPropertyDisabledButtonTextColor(const Variant& color)
5347 __buttonTextColor[_BUTTON_STATUS_DISABLED] = color.ToColor();
5349 for (int i = 0; i < BUTTON_MAX; i++)
5351 if (__pButtonItems[i] != null)
5353 __pButtonItems[i]->SetTextColor(_BUTTON_STATUS_DISABLED, __buttonTextColor[_BUTTON_STATUS_DISABLED]);
5361 _Toolbar::GetPropertyDisabledButtonTextColor(void) const
5363 return Variant(__buttonTextColor[_BUTTON_STATUS_DISABLED]);
5367 _Toolbar::SetPropertyHighlightedButtonColor(const Variant& color)
5369 __buttonBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED] = color.ToColor();
5371 Bitmap* __pBaseBackgroundBitmap = null;
5373 GET_BITMAP_CONFIG_N(HEADER::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5375 for (int i = 0; i < BUTTON_MAX; i++)
5377 if (__pButtonItems[i] != null)
5379 if (__pBaseBackgroundBitmap)
5381 SetColorReplacedBitmap(__pButtonItems[i], _BUTTON_STATUS_HIGHLIGHTED, __buttonBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED], __pBaseBackgroundBitmap);
5386 delete __pBaseBackgroundBitmap;
5392 _Toolbar::GetPropertyHighlightedButtonColor(void) const
5394 return Variant(__buttonBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
5398 _Toolbar::SetPropertyHighlightedButtonTextColor(const Variant& color)
5400 __buttonTextColor[_BUTTON_STATUS_HIGHLIGHTED] = color.ToColor();
5402 for (int i = 0; i < BUTTON_MAX; i++)
5404 if (__pButtonItems[i] != null)
5406 __pButtonItems[i]->SetTextColor(_BUTTON_STATUS_HIGHLIGHTED, __buttonTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
5414 _Toolbar::GetPropertyHighlightedButtonTextColor(void) const
5416 return Variant(__buttonTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
5420 _Toolbar::SetPropertyNormalButtonColor(const Variant& color)
5422 __buttonBackgroundColor[_BUTTON_STATUS_NORMAL] = color.ToColor();
5424 Bitmap* __pBaseBackgroundBitmap = null;
5426 GET_BITMAP_CONFIG_N(HEADER::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5428 for (int i = 0; i < BUTTON_MAX; i++)
5430 if (__pButtonItems[i] != null)
5432 if (__pBaseBackgroundBitmap)
5434 SetColorReplacedBitmap(__pButtonItems[i], _BUTTON_STATUS_NORMAL, __buttonBackgroundColor[_BUTTON_STATUS_NORMAL], __pBaseBackgroundBitmap);
5439 delete __pBaseBackgroundBitmap;
5445 _Toolbar::GetPropertyNormalButtonColor(void) const
5447 return Variant(__buttonBackgroundColor[_BUTTON_STATUS_NORMAL]);
5451 _Toolbar::SetPropertyNormalButtonTextColor(const Variant& color)
5453 __buttonTextColor[_BUTTON_STATUS_NORMAL] = color.ToColor();
5455 for (int i = 0; i < BUTTON_MAX; i++)
5457 if (__pButtonItems[i] != null)
5459 __pButtonItems[i]->SetTextColor(_BUTTON_STATUS_NORMAL, __buttonTextColor[_BUTTON_STATUS_NORMAL]);
5467 _Toolbar::GetPropertyNormalButtonTextColor(void) const
5469 return Variant(__buttonTextColor[_BUTTON_STATUS_NORMAL]);
5473 _Toolbar::SetPropertyPressedButtonColor(const Variant& color)
5475 __buttonBackgroundColor[_BUTTON_STATUS_PRESSED] = color.ToColor();
5477 Bitmap* __pBaseBackgroundBitmap = null;
5479 GET_BITMAP_CONFIG_N(HEADER::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5481 for (int i = 0; i < BUTTON_MAX; i++)
5483 if (__pButtonItems[i] != null)
5485 if (__pBaseBackgroundBitmap)
5487 SetColorReplacedBitmap(__pButtonItems[i], _BUTTON_STATUS_PRESSED, __buttonBackgroundColor[_BUTTON_STATUS_PRESSED], __pBaseBackgroundBitmap);
5492 delete __pBaseBackgroundBitmap;
5498 _Toolbar::GetPropertyPressedButtonColor(void) const
5500 return Variant(__buttonBackgroundColor[_BUTTON_STATUS_PRESSED]);
5504 _Toolbar::SetPropertyPressedButtonTextColor(const Variant& color)
5506 __buttonTextColor[_BUTTON_STATUS_PRESSED] = color.ToColor();
5508 for (int i = 0; i < BUTTON_MAX; i++)
5510 if (__pButtonItems[i] != null)
5512 __pButtonItems[i]->SetTextColor(_BUTTON_STATUS_PRESSED, __buttonTextColor[_BUTTON_STATUS_PRESSED]);
5520 _Toolbar::GetPropertyPressedButtonTextColor(void) const
5522 return Variant(__buttonTextColor[_BUTTON_STATUS_PRESSED]);
5526 _Toolbar::SetPropertyDisabledItemColor(const Variant& color)
5528 __itemBackgroundColor[_BUTTON_STATUS_DISABLED] = color.ToColor();
5530 Bitmap* __pBaseBackgroundBitmap = null;
5532 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
5534 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5538 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5541 for (int i = 0; i < __itemCount; i++)
5543 if (__pItems.at(i) != null)
5545 if (__pBaseBackgroundBitmap)
5547 SetColorReplacedBitmap(__pItems.at(i), _BUTTON_STATUS_DISABLED, __itemBackgroundColor[_BUTTON_STATUS_DISABLED], __pBaseBackgroundBitmap);
5552 delete __pBaseBackgroundBitmap;
5558 _Toolbar::GetPropertyDisabledItemColor(void) const
5560 return Variant(__itemBackgroundColor[_BUTTON_STATUS_DISABLED]);
5564 _Toolbar::SetPropertyDisabledItemTextColor(const Variant& color)
5566 __itemTextColor[_BUTTON_STATUS_DISABLED] = color.ToColor();
5568 for (int i = 0; i < __itemCount; i++)
5570 if (__pItems.at(i) != null)
5572 __pItems.at(i)->SetTextColor(_BUTTON_STATUS_DISABLED, __itemTextColor[_BUTTON_STATUS_DISABLED]);
5580 _Toolbar::GetPropertyDisabledItemTextColor(void) const
5582 return Variant(__itemTextColor[_BUTTON_STATUS_DISABLED]);
5586 _Toolbar::SetPropertyHighlightedItemColor(const Variant& color)
5588 __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED] = color.ToColor();
5590 Bitmap* __pBaseBackgroundBitmap = null;
5592 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
5594 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5598 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5601 for (int i = 0; i < __itemCount; i++)
5603 if (__pItems.at(i) != null)
5605 if (__pBaseBackgroundBitmap)
5607 SetColorReplacedBitmap(__pItems.at(i), _BUTTON_STATUS_HIGHLIGHTED, __itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED], __pBaseBackgroundBitmap);
5612 delete __pBaseBackgroundBitmap;
5618 _Toolbar::GetPropertyHighlightedItemColor(void) const
5620 return Variant(__itemBackgroundColor[_BUTTON_STATUS_HIGHLIGHTED]);
5624 _Toolbar::SetPropertyHighlightedItemTextColor(const Variant& color)
5626 __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED] = color.ToColor();
5628 for (int i = 0; i < __itemCount; i++)
5630 if (__pItems.at(i) != null)
5632 __pItems.at(i)->SetTextColor(_BUTTON_STATUS_HIGHLIGHTED, __itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
5640 _Toolbar::GetPropertyHighlightedItemTextColor(void) const
5642 return Variant(__itemTextColor[_BUTTON_STATUS_HIGHLIGHTED]);
5646 _Toolbar::SetPropertyNormalItemColor(const Variant& color)
5648 __itemBackgroundColor[_BUTTON_STATUS_NORMAL] = color.ToColor();
5650 Bitmap* __pBaseBackgroundBitmap = null;
5652 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
5654 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5658 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5661 for (int i = 0; i < __itemCount; i++)
5663 if (__pItems.at(i) != null)
5665 if (__pBaseBackgroundBitmap)
5667 SetColorReplacedBitmap(__pItems.at(i), _BUTTON_STATUS_NORMAL, __itemBackgroundColor[_BUTTON_STATUS_NORMAL], __pBaseBackgroundBitmap);
5672 delete __pBaseBackgroundBitmap;
5678 _Toolbar::GetPropertyNormalItemColor(void) const
5680 return Variant(__itemBackgroundColor[_BUTTON_STATUS_NORMAL]);
5684 _Toolbar::SetPropertyNormalItemTextColor(const Variant& color)
5686 __itemTextColor[_BUTTON_STATUS_NORMAL] = color.ToColor();
5688 for (int i = 0; i < __itemCount; i++)
5690 if (__pItems.at(i) != null)
5692 __pItems.at(i)->SetTextColor(_BUTTON_STATUS_NORMAL, __itemTextColor[_BUTTON_STATUS_NORMAL]);
5700 _Toolbar::GetPropertyNormalItemTextColor(void) const
5702 return Variant(__itemTextColor[_BUTTON_STATUS_NORMAL]);
5706 _Toolbar::SetPropertyPressedItemColor(const Variant& color)
5708 __itemBackgroundColor[_BUTTON_STATUS_PRESSED] = color.ToColor();
5710 Bitmap* __pBaseBackgroundBitmap = null;
5712 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
5714 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5716 else if (__style == TOOLBAR_HEADER_SEGMENTED || __style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || __style == TOOLBAR_SEGMENTED
5717 || __style == TOOLBAR_TAB || __style == TOOLBAR_TAB_WITH_TITLE || __style == TOOLBAR_TITLE)
5719 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5723 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5726 for (int i = 0; i < __itemCount; i++)
5728 if (__pItems.at(i) != null)
5730 if (__pBaseBackgroundBitmap)
5732 SetColorReplacedBitmap(__pItems.at(i), _BUTTON_STATUS_PRESSED, __itemBackgroundColor[_BUTTON_STATUS_PRESSED], __pBaseBackgroundBitmap);
5737 delete __pBaseBackgroundBitmap;
5743 _Toolbar::GetPropertyPressedItemColor(void) const
5745 return Variant(__itemBackgroundColor[_BUTTON_STATUS_PRESSED]);
5749 _Toolbar::SetPropertyPressedItemTextColor(const Variant& color)
5751 __itemTextColor[_BUTTON_STATUS_PRESSED] = color.ToColor();
5753 for (int i = 0; i < __itemCount; i++)
5755 if (__pItems.at(i) != null)
5757 __pItems.at(i)->SetTextColor(_BUTTON_STATUS_PRESSED, __itemTextColor[_BUTTON_STATUS_PRESSED]);
5765 _Toolbar::GetPropertyPressedItemTextColor(void) const
5767 return Variant(__itemTextColor[_BUTTON_STATUS_PRESSED]);
5771 _Toolbar::SetPropertySelectedItemColor(const Variant& color)
5773 __itemBackgroundColor[_BUTTON_STATUS_SELECTED] = color.ToColor();
5775 Bitmap* __pBaseBackgroundBitmap = null;
5777 if (__style == TOOLBAR_TEXT || __style == TOOLBAR_ICON || __style == TOOLBAR_ICON_TEXT)
5779 GET_BITMAP_CONFIG_N(FOOTER::BUTTON_ITEM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5783 GET_BITMAP_CONFIG_N(HEADER::TAB_ITEM_BG_SELECTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pBaseBackgroundBitmap);
5786 for (int i = 0; i < __itemCount; i++)
5788 if (__pItems.at(i) != null)
5790 if (__pBaseBackgroundBitmap)
5792 SetColorReplacedBitmap(__pItems.at(i), _BUTTON_STATUS_SELECTED, __itemBackgroundColor[_BUTTON_STATUS_SELECTED], __pBaseBackgroundBitmap);
5797 delete __pBaseBackgroundBitmap;
5803 _Toolbar::GetPropertySelectedItemColor(void) const
5805 return Variant(__itemBackgroundColor[_BUTTON_STATUS_SELECTED]);
5809 _Toolbar::SetPropertySelectedItemTextColor(const Variant& color)
5811 __itemTextColor[_BUTTON_STATUS_SELECTED] = color.ToColor();
5813 for (int i = 0; i < __itemCount; i++)
5815 if (__pItems.at(i) != null)
5817 __pItems.at(i)->SetTextColor(_BUTTON_STATUS_SELECTED, __itemTextColor[_BUTTON_STATUS_SELECTED]);
5825 _Toolbar::GetPropertySelectedItemTextColor(void) const
5827 return Variant(__itemTextColor[_BUTTON_STATUS_SELECTED]);
5831 _Toolbar::GetButtonBounds(ToolbarButton position) const
5833 return _CoordinateSystemUtils::ConvertToInteger(GetButtonBoundsF(position));
5837 _Toolbar::GetButtonBoundsF(ToolbarButton position) const
5839 FloatRectangle bounds = __pButtonItems[position]->GetBoundsF();
5841 float leftTouchMargin = __pButtonItems[position]->GetLeftTouchMarginF();
5842 float topTouchMargin = __pButtonItems[position]->GetTopTouchMarginF();
5843 float rightTouchMargin = __pButtonItems[position]->GetRightTouchMarginF();
5844 float bottomTouchMargin = __pButtonItems[position]->GetBottomTouchMarginF();
5846 bounds.x = bounds.x + leftTouchMargin;
5847 bounds.y = bounds.y + topTouchMargin;
5848 bounds.width = bounds.width - (leftTouchMargin + rightTouchMargin);
5849 bounds.height = bounds.height - (topTouchMargin + bottomTouchMargin);
5855 _Toolbar::SetTitleBadgeIcon(const Bitmap* pBadgeIcon)
5857 if (pBadgeIcon == null)
5862 if (__pTitleBadgeIcon)
5864 DetachChild(*__pTitleBadgeIcon);
5866 delete __pTitleBadgeIcon;
5867 __pTitleBadgeIcon = null;
5870 float height = 0.0f;
5871 GET_SHAPE_CONFIG(HEADER::BADGE_HEIGHT, GetOrientation(), height);
5873 __pTitleBadgeIcon = _Label::CreateLabelN();
5875 if (__pTitleBadgeIcon)
5877 __pTitleBadgeIcon->SetBounds(FloatRectangle(0.0f, 0.0f, height, height));
5878 __pTitleBadgeIcon->SetBackgroundBitmap(*pBadgeIcon);
5880 AttachChild(*__pTitleBadgeIcon);
5881 SetChildAlwaysOnTop(*__pTitleBadgeIcon);
5888 _Toolbar::SetTitleNumberedBadgeIcon(int number)
5890 SysTryReturnResult(NID_UI_CTRL, (number >= 0 && number < 100000), E_INVALID_ARG,
5891 "[E_INVALID_ARG] The number is out of bounds.");
5893 if (__pTitleBadgeIcon)
5895 DetachChild(*__pTitleBadgeIcon);
5897 delete __pTitleBadgeIcon;
5898 __pTitleBadgeIcon = null;
5903 __pTitleBadgeIcon = _Label::CreateLabelN();
5905 SysTryReturnResult(NID_UI_CTRL, __pTitleBadgeIcon, E_INVALID_STATE, "[E_INVALID_STATE] The badge icon instance isn't constructed.");
5907 Bitmap* pNumberedBadgeIconBitmap = null;
5908 Bitmap* pNumberedBadgeIconEffectBitmap = null;
5909 Bitmap* pColorReplacedBitmap = null;
5910 Color badgeIconBgColor;
5911 Color badgeIconTextColor;
5913 GET_BITMAP_CONFIG_N(HEADER::BADGE_ICON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNumberedBadgeIconBitmap);
5915 bool themeBadgeNormalBackgroundBitmap = IS_CUSTOM_BITMAP(HEADER::BADGE_ICON_BG_NORMAL);
5916 if (!themeBadgeNormalBackgroundBitmap)
5918 GET_BITMAP_CONFIG_N(HEADER::BADGE_ICON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pNumberedBadgeIconEffectBitmap);
5921 GET_COLOR_CONFIG(HEADER::BADGE_ICON_BG_NORMAL, badgeIconBgColor);
5922 GET_COLOR_CONFIG(HEADER::BADGE_ICON_TEXT_NORMAL, badgeIconTextColor);
5924 if (pNumberedBadgeIconBitmap)
5926 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pNumberedBadgeIconBitmap,
5927 Color::GetColor(COLOR_ID_MAGENTA), badgeIconBgColor);
5929 __pTitleBadgeIcon->SetBackgroundBitmap(*pColorReplacedBitmap);
5931 delete pColorReplacedBitmap;
5932 delete pNumberedBadgeIconBitmap;
5935 if (pNumberedBadgeIconEffectBitmap)
5937 __pTitleBadgeIcon->SetBackgroundEffectBitmap(*pNumberedBadgeIconEffectBitmap);
5939 delete pNumberedBadgeIconEffectBitmap;
5942 __pTitleBadgeIcon->SetTextHorizontalAlignment(ALIGNMENT_RIGHT);
5943 __pTitleBadgeIcon->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
5944 __pTitleBadgeIcon->SetTextColor(badgeIconTextColor);
5945 __pTitleBadgeIcon->SetMargin(0, 10);
5947 float fontSize = 0.0f;
5948 float height = 0.0f;
5951 GET_SHAPE_CONFIG(HEADER::BADGE_FONT_SIZE, GetOrientation(), fontSize);
5952 GET_SHAPE_CONFIG(HEADER::BADGE_HEIGHT, GetOrientation(), height);
5956 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_1DIGIT, GetOrientation(), width);
5958 else if (number < 100)
5960 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_2DIGIT, GetOrientation(), width);
5962 else if (number < 1000)
5964 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_3DIGIT, GetOrientation(), width);
5966 else if (number < 10000)
5968 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_4DIGIT, GetOrientation(), width);
5972 GET_SHAPE_CONFIG(HEADER::BADGE_WIDTH_5DIGIT, GetOrientation(), width);
5975 __pTitleBadgeIcon->SetBounds(FloatRectangle(0.0f, 0.0f, width, height));
5976 __pTitleBadgeIcon->SetTextConfig(fontSize, LABEL_TEXT_STYLE_NORMAL);
5978 Integer tempNumber(number);
5979 __pTitleBadgeIcon->SetText(tempNumber.ToString());
5981 AttachChild(*__pTitleBadgeIcon);
5982 SetChildAlwaysOnTop(*__pTitleBadgeIcon);
5989 _Toolbar::SetHideButton(bool hideButton)
5991 SysTryReturnResult(NID_UI_CTRL, __pButtonItems[BACK_BUTTON], E_INVALID_OPERATION,
5992 "[E_INVALID_OPERATION] BackButton is not exist.");
5994 Bitmap* pColorReplacedBitmap = null;
5995 Bitmap* pIconNormalBitmap = null;
5996 Bitmap* pIconNormalEffectBitmap = null;
5998 float iconSize = 0.0f;
5999 float buttonWidth = __pButtonItems[BACK_BUTTON]->GetSizeF().width;
6000 float buttonHeight = __pButtonItems[BACK_BUTTON]->GetSizeF().height;
6001 bool themeBackNormalBitmap = IS_CUSTOM_BITMAP(FOOTER::BACK_ICON_NORMAL);
6003 float leftTouchMargin = __pButtonItems[BACK_BUTTON]->GetLeftTouchMarginF();
6004 float topTouchMargin = __pButtonItems[BACK_BUTTON]->GetTopTouchMarginF();
6005 float rightTouchMargin = __pButtonItems[BACK_BUTTON]->GetRightTouchMarginF();
6006 float bottomTouchMargin = __pButtonItems[BACK_BUTTON]->GetBottomTouchMarginF();
6008 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_ICON_SIZE, GetOrientation(), iconSize);
6010 _AccessibilityElement* pBackButtonElement = __pButtonItems[BACK_BUTTON]->GetAccessibilityContainer()->GetChildElement(0);
6014 GET_BITMAP_CONFIG_N(FOOTER::HIDE_ICON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pIconNormalBitmap);
6016 if (!themeBackNormalBitmap)
6018 GET_BITMAP_CONFIG_N(FOOTER::HIDE_ICON_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pIconNormalEffectBitmap);
6021 if (pBackButtonElement)
6023 pBackButtonElement->SetLabel("Hide");
6024 pBackButtonElement->SetTrait("Hide Button");
6029 GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pIconNormalBitmap);
6031 if (!themeBackNormalBitmap)
6033 GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pIconNormalEffectBitmap);
6036 if (pBackButtonElement)
6038 pBackButtonElement->SetLabel("Back");
6039 pBackButtonElement->SetTrait("Back Button");
6043 if (pIconNormalBitmap)
6047 Color disabledColor;
6049 GET_COLOR_CONFIG(FOOTER::BACK_ICON_NORMAL, normalColor);
6050 GET_COLOR_CONFIG(FOOTER::BACK_ICON_PRESSED, pressedColor);
6051 GET_COLOR_CONFIG(FOOTER::BACK_ICON_DISABLED, disabledColor);
6053 pIconNormalBitmap->Scale(FloatDimension(iconSize, iconSize));
6055 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), normalColor);
6056 if (pColorReplacedBitmap)
6058 __pButtonItems[BACK_BUTTON]->SetBitmap(_BUTTON_STATUS_NORMAL, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6059 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pColorReplacedBitmap);
6061 delete pColorReplacedBitmap;
6064 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), disabledColor);
6065 if (pColorReplacedBitmap)
6067 __pButtonItems[BACK_BUTTON]->SetBitmap(_BUTTON_STATUS_DISABLED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6068 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pColorReplacedBitmap);
6069 delete pColorReplacedBitmap;
6072 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), pressedColor);
6073 if (pColorReplacedBitmap)
6075 __pButtonItems[BACK_BUTTON]->SetBitmap(_BUTTON_STATUS_PRESSED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6076 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pColorReplacedBitmap);
6077 delete pColorReplacedBitmap;
6080 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), normalColor);
6081 if (pColorReplacedBitmap)
6083 __pButtonItems[BACK_BUTTON]->SetBitmap(_BUTTON_STATUS_HIGHLIGHTED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6084 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pColorReplacedBitmap);
6085 delete pColorReplacedBitmap;
6088 pColorReplacedBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pIconNormalBitmap, Color::GetColor(COLOR_ID_MAGENTA), normalColor);
6089 if (pColorReplacedBitmap)
6091 __pButtonItems[BACK_BUTTON]->SetBitmap(_BUTTON_STATUS_SELECTED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6092 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pColorReplacedBitmap);
6093 delete pColorReplacedBitmap;
6096 delete pIconNormalBitmap;
6099 if (pIconNormalEffectBitmap)
6101 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_NORMAL, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6102 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6103 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_DISABLED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6104 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6105 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_PRESSED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6106 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6107 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6108 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6109 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_SELECTED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6110 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6112 delete pIconNormalEffectBitmap;
6119 _Toolbar::SetTransBackButton(bool transparent)
6121 SysTryReturnResult(NID_UI_CTRL, __pButtonItems[BACK_BUTTON], E_INVALID_OPERATION,
6122 "[E_INVALID_OPERATION] BackButton is not exist.");
6124 Bitmap* pIconNormalEffectBitmap = null;
6126 float iconSize = 0.0f;
6127 float buttonWidth = __pButtonItems[BACK_BUTTON]->GetSizeF().width;
6128 float buttonHeight = __pButtonItems[BACK_BUTTON]->GetSizeF().height;
6129 bool themeBackNormalBitmap = IS_CUSTOM_BITMAP(FOOTER::BACK_ICON_NORMAL);
6131 float leftTouchMargin = __pButtonItems[BACK_BUTTON]->GetLeftTouchMarginF();
6132 float topTouchMargin = __pButtonItems[BACK_BUTTON]->GetTopTouchMarginF();
6133 float rightTouchMargin = __pButtonItems[BACK_BUTTON]->GetRightTouchMarginF();
6134 float bottomTouchMargin = __pButtonItems[BACK_BUTTON]->GetBottomTouchMarginF();
6136 GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_ICON_SIZE, GetOrientation(), iconSize);
6140 if (!themeBackNormalBitmap)
6142 GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_TRANSLUCENT_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pIconNormalEffectBitmap);
6147 if (!themeBackNormalBitmap)
6149 GET_BITMAP_CONFIG_N(FOOTER::BACK_ICON_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pIconNormalEffectBitmap);
6153 if (pIconNormalEffectBitmap)
6155 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_NORMAL, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6156 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6157 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_DISABLED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6158 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6159 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_PRESSED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6160 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6161 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_HIGHLIGHTED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6162 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6163 __pButtonItems[BACK_BUTTON]->SetEffectBitmap(_BUTTON_STATUS_SELECTED, FloatPoint((buttonWidth - (leftTouchMargin + rightTouchMargin) - iconSize) / 2,
6164 (buttonHeight - (topTouchMargin + bottomTouchMargin) - iconSize) / 2), *pIconNormalEffectBitmap);
6166 delete pIconNormalEffectBitmap;
6172 }}} // Tizen::Ui::Controls