26559e9fc4f3298676026286281fb07832ec88d1
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_ToolbarPresenter.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file                FUiCtrl_ToolbarPresenter.cpp
19  * @brief               This is the implementation file for the _ToolbarPresenter class.
20  */
21
22 #include <FBaseSysLog.h>
23 #include <FUiAnimVisualElementPropertyAnimation.h>
24 #include <FUiAnimVisualElement.h>
25 #include <FGrp_BitmapImpl.h>
26 #include <FGrp_CanvasImpl.h>
27 #include <FGrp_FontImpl.h>
28 #include <FGrp_TextCommon.h>
29 #include <FGrp_TextTextSimple.h>
30 #include "FUiAnim_VisualElementImpl.h"
31 #include "FUi_CoordinateSystemUtils.h"
32 #include "FUi_UiTouchEvent.h"
33 #include "FUi_ResourceManager.h"
34 #include "FUiCtrl_Label.h"
35 #include "FUiCtrl_ToolbarPresenter.h"
36 #include "FUiCtrl_ToolbarModel.h"
37
38 using namespace Tizen::Base;
39 using namespace Tizen::Base::Runtime;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Graphics::_Text;
42 using namespace Tizen::Ui::Animations;
43
44 namespace Tizen { namespace Ui { namespace Controls
45 {
46
47 _ToolbarPresenter::_ToolbarPresenter(void)
48         : __pToolbar(null)
49         , __pToolbarModel(null)
50         , __initialDraw(true)
51         , __tabEditEnabled(false)
52         , __beingEdited(false)
53         , __touchInitiatedInToolbar(false)
54         , __editItemIndex(-1)
55         , __pressedItemIndex(-1)
56         , __initialPressesItemStatus(_BUTTON_STATUS_NORMAL)
57         , __pEditItem(null)
58         , __pTitleBackgroundBitmap(null)
59         , __pTitleSlideTimer(null)
60         , __pFlickAnimationTimer(null)
61         , __titleRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
62         , __descriptionRect(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
63         , __titleText(L"")
64         , __pTitleTextFont(null)
65         , __pTextFont(null)
66         , __pDescriptionTextObject(null)
67         , __pTitleTextObject(null)
68         , __flickAnimation()
69         , __moveDistance(0.0f)
70         , __flickMove(0.0f)
71         , __flickDistance(0.0f)
72         , __flickFlag(0)
73         , __firstLoadedItemIndex(0)
74         , __lastLoadedItemIndex(0)
75         , __tabSlideLeft(false)
76         , __tabSlideRight(false)
77         , __portraitSize(FloatDimension(0.0f, 0.0f))
78         , __landscapeSize(FloatDimension(0.0f, 0.0f))
79         , __fontStyle(0)
80         , __fontSize(0.0f)
81         , __tabMoved(false)
82         , __titlePressed(false)
83         , __titleSliding(false)
84 {
85         __currentTouchPosition = FloatPoint(0.0f, 0.0f);
86 }
87
88 _ToolbarPresenter::~_ToolbarPresenter(void)
89 {
90         if (__pToolbarModel)
91         {
92                 delete __pToolbarModel;
93                 __pToolbarModel = null;
94         }
95
96         if (__pEditItem)
97         {
98                 __pToolbar->DetachChild(*__pEditItem);
99                 delete __pEditItem;
100                 __pEditItem = null;
101         }
102
103         if (__pTitleBackgroundBitmap)
104         {
105                 delete __pTitleBackgroundBitmap;
106                 __pTitleBackgroundBitmap = null;
107         }
108
109         if (__pTitleSlideTimer)
110         {
111                 delete __pTitleSlideTimer;
112                 __pTitleSlideTimer = null;
113         }
114
115         if (__pFlickAnimationTimer)
116         {
117                 delete __pFlickAnimationTimer;
118                 __pFlickAnimationTimer = null;
119         }
120
121         if (__pDescriptionTextObject)
122         {
123                 delete __pDescriptionTextObject;
124                 __pDescriptionTextObject = null;
125         }
126
127         if (__pTitleTextObject)
128         {
129                 delete __pTitleTextObject;
130                 __pTitleTextObject = null;
131         }
132 }
133
134 result
135 _ToolbarPresenter::Construct(const _Toolbar& toolbar)
136 {
137         __pToolbar = const_cast<_Toolbar*>(&toolbar);
138
139         float width = 0.0f;
140         float height = 0.0f;
141
142         __fontStyle = FONT_STYLE_BOLD;
143
144         __portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
145         __landscapeSize = FloatDimension(__portraitSize.height, __portraitSize.width);
146
147         if (__pToolbar->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
148         {
149                 width = __portraitSize.width;
150                 height = __portraitSize.height;
151         }
152         else
153         {
154                 width = __landscapeSize.width;
155                 height = __landscapeSize.height;
156         }
157
158         __flickAnimation.SetSizeInformation(width, height, DEVICE_SIZE_HORIZONTAL, DEVICE_SIZE_VERTICAL);
159         __flickAnimation.SetSensitivity(FLICK_ANIMATION_FPS_TAB, FLICK_ANIMATION_SENSITIVITY_TAB);
160         __flickAnimation.SetDirection(FD_HORIZONTAL);
161
162         return E_SUCCESS;
163 }
164
165 result
166 _ToolbarPresenter::Install(void)
167 {
168         _ToolbarModel* pModel = new (std::nothrow) _ToolbarModel();
169
170         _SetModel(*pModel);
171
172         result r = pModel->Construct();
173
174         return r;
175 }
176
177 result
178 _ToolbarPresenter::Draw(void)
179 {
180         result r = E_SUCCESS;
181
182         ToolbarStyle style = __pToolbar->GetStyle();
183
184         DrawBackground();
185
186         DrawItems();
187
188         Canvas* pCanvas = __pToolbar->GetCanvasN();
189
190         if (pCanvas == null)
191         {
192                 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
193
194                 return E_SYSTEM;
195         }
196
197         float buttonItemGap = 0.0f;
198         float dividerBaseHeight = 0.0f;
199         float dividerHeight = 0.0f;
200
201         float footerButtonItemWidth = 0.0f;
202         float footerButtonItemHeight = 0.0f;
203         float fontSize = 0.0f;
204
205         float dividerTopMargin = 0.0f;
206         float segmentedItemHeight = 0.0f;
207
208         FloatRectangle bounds(0.0f, 0.0f, __pToolbar->GetBoundsF().width, __pToolbar->GetBoundsF().height);
209
210         int itemCount = __pToolbar->GetItemCount();
211
212         __portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
213         __landscapeSize = FloatDimension(__portraitSize.height, __portraitSize.width);
214
215         if (__pToolbar->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
216         {
217                 if (bounds.width > __portraitSize.width)
218                 {
219                         bounds.width = __portraitSize.width;
220                 }
221         }
222         else
223         {
224                 if (bounds.width > __landscapeSize.width)
225                 {
226                         bounds.width = __landscapeSize.width;
227                 }
228         }
229
230         GET_SHAPE_CONFIG(HEADER::DIVIDER_WIDTH, __pToolbar->GetOrientation(), buttonItemGap);
231
232         if (style == TOOLBAR_TAB_LARGE)
233         {
234                 GET_SHAPE_CONFIG(HEADER::TAB_LARGE_DIVIDER_HEIGHT, __pToolbar->GetOrientation(), dividerHeight);
235         }
236         else
237         {
238                 GET_SHAPE_CONFIG(HEADER::DIVIDER_HEIGHT, __pToolbar->GetOrientation(), dividerHeight);
239         }
240
241         GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, __pToolbar->GetOrientation(), segmentedItemHeight);
242
243         GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_WIDTH, __pToolbar->GetOrientation(), footerButtonItemWidth);
244         GET_SHAPE_CONFIG(FOOTER::BUTTON_ITEM_HEIGHT, __pToolbar->GetOrientation(), footerButtonItemHeight);
245
246         if (style == TOOLBAR_TITLE || style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
247         {
248                 if (__pTitleBackgroundBitmap)
249                 {
250                         delete __pTitleBackgroundBitmap;
251                         __pTitleBackgroundBitmap = null;
252                 }
253
254                 if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
255                 {
256                         GET_SHAPE_CONFIG(HEADER::TITLE_FONT_SIZE_WITH_SEGMENTED, __pToolbar->GetOrientation(), fontSize);
257
258                         if (!__titleText.IsEmpty())
259                         {
260                                 __fontSize = fontSize;
261
262                                 __pTitleTextFont = __pToolbar->GetFallbackFont();
263                                 r = GetLastResult();
264                                 SysTryReturn(NID_UI_CTRL, __pTitleTextFont, r, r, "[%s] Propagating.", GetErrorMessage(r));
265
266                                 __pTitleTextObject->SetFont(__pTitleTextFont, 0, __pTitleTextObject->GetTextLength());
267                         }
268                 }
269                 else if (style == TOOLBAR_TITLE && __pToolbar->GetDescriptionText() != L""
270                                 && __pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) == ANIMATION_STOPPED)
271                 {
272                         GET_SHAPE_CONFIG(HEADER::TITLE_TOP_MARGIN_WITH_DESCRIPTION, __pToolbar->GetOrientation(), __titleRect.y);
273                         __titleRect.height = _FontImpl::GetInstance(*__pTitleTextFont)->GetLeadingF();
274                         GET_SHAPE_CONFIG(HEADER::TITLE_FONT_SIZE_WITH_DESCRIPTION, __pToolbar->GetOrientation(), fontSize);
275
276                         DrawDescriptionText();
277
278                         if(!__titleText.IsEmpty())
279                         {
280                                 __fontSize = fontSize;
281
282                                 __pTitleTextFont = __pToolbar->GetFallbackFont();
283                                 r = GetLastResult();
284                                 SysTryReturn(NID_UI_CTRL, __pTitleTextFont, r, r, "[%s] Propagating.", GetErrorMessage(r));
285
286                                 __pTitleTextObject->SetFont(__pTitleTextFont, 0, __pTitleTextObject->GetTextLength());
287                         }
288                 }
289
290                 __pTitleBackgroundBitmap = new (std::nothrow) Bitmap();
291                 __pTitleBackgroundBitmap->Construct(*pCanvas, __titleRect);
292
293                 DrawTitleText(pCanvas);
294         }
295
296         if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
297         {
298                 GET_SHAPE_CONFIG(HEADER::SEGMENTED_ITEM_HEIGHT, __pToolbar->GetOrientation(), dividerBaseHeight);
299                 GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, __pToolbar->GetOrientation(), dividerTopMargin);
300         }
301         else
302         {
303                 GET_SHAPE_CONFIG(HEADER::HEIGHT, __pToolbar->GetOrientation(), dividerBaseHeight);
304         }
305
306         if (style == TOOLBAR_TITLE || style == TOOLBAR_HEADER_SEGMENTED || style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE)
307         {
308                 if (__pToolbar->GetButton(RIGHT_BUTTON))
309                 {
310                         if (__pToolbar->GetButton(LEFT_BUTTON))
311                         {
312                                 DrawDivider(FloatPoint(bounds.width - __pToolbar->GetButton(RIGHT_BUTTON)->GetBoundsF().width - buttonItemGap,
313                                                 dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
314
315                                 DrawDivider(FloatPoint(bounds.width - __pToolbar->GetButton(RIGHT_BUTTON)->GetBoundsF().width - buttonItemGap
316                                                 - __pToolbar->GetButton(LEFT_BUTTON)->GetBoundsF().width - buttonItemGap,
317                                                 dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
318                         }
319                         else
320                         {
321                                 DrawDivider(FloatPoint(bounds.width - __pToolbar->GetButton(RIGHT_BUTTON)->GetBoundsF().width - buttonItemGap,
322                                                 dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
323                         }
324                 }
325                 else
326                 {
327                         if (__pToolbar->GetButton(LEFT_BUTTON))
328                         {
329                                 DrawDivider(FloatPoint(bounds.width - __pToolbar->GetButton(LEFT_BUTTON)->GetBoundsF().width - buttonItemGap,
330                                                 dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
331                         }
332                 }
333         }
334         else if (style == TOOLBAR_SEGMENTED || style == TOOLBAR_TEXT || style == TOOLBAR_ICON || style == TOOLBAR_ICON_TEXT || style == TOOLBAR_COMMAND)
335         {
336                 if (__pToolbar->GetButton(RIGHT_BUTTON))
337                 {
338                         DrawDivider(FloatPoint(bounds.width - __pToolbar->GetButton(RIGHT_BUTTON)->GetBoundsF().width - buttonItemGap,
339                                         dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
340                 }
341
342                 if (__pToolbar->GetButton(LEFT_BUTTON))
343                 {
344                         DrawDivider(FloatPoint(__pToolbar->GetButton(LEFT_BUTTON)->GetBoundsF().width,
345                                         dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
346                 }
347         }
348
349
350         if (itemCount == 1)
351         {
352                 ; // empty
353         }
354         else
355         {
356                 if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
357                 {
358                         for (int i = 0; i < itemCount - 1 ; i++)
359                         {
360                                 DrawDivider(FloatPoint(__pToolbar->GetItem(i)->GetBoundsF().x + __pToolbar->GetItem(i)->GetBoundsF().width,
361                                                 dividerTopMargin + (dividerBaseHeight - dividerHeight) / 2), pCanvas);
362                         }
363                 }
364                 else
365                 {
366                         for (int i = 0; i < itemCount - 1 ; i++)
367                         {
368                                 DrawDivider(FloatPoint(__pToolbar->GetItem(i)->GetBoundsF().x + __pToolbar->GetItem(i)->GetBoundsF().width,
369                                                 (__pToolbar->GetBoundsF().height - dividerHeight) / 2), pCanvas);
370                         }
371                 }
372         }
373
374         if (__initialDraw)
375         {
376                 if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE
377                                 || style == TOOLBAR_SEGMENTED || style == TOOLBAR_HEADER_SEGMENTED || style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE)
378                                 && __pToolbar->GetItemCount() > 0 && __pToolbarModel->GetSelectedItemIndex() == -1)
379                 {
380                         int firstEnabledItemIndex = __pToolbar->GetFirstEnabledItemIndex();
381
382                         if(firstEnabledItemIndex != -1)
383                         {
384                                 __pToolbar->SetItemSelected(firstEnabledItemIndex, true, false);
385                         }
386                 }
387
388                 __initialDraw = false;
389         }
390
391         delete pCanvas;
392
393         return E_SUCCESS;
394 }
395
396 void
397 _ToolbarPresenter::DrawBackground(void)
398 {
399         Canvas* pCanvas = __pToolbar->GetCanvasN();
400
401         if (pCanvas == null)
402         {
403                 SysLog(NID_UI_CTRL, "Cannot get a canvas.");
404
405                 return;
406         }
407
408         ToolbarStyle style = __pToolbar->GetStyle();
409
410         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
411         pCanvas->Clear();
412
413         if (style == TOOLBAR_SOFTKEY)
414         {
415                 delete pCanvas;
416
417                 return;
418         }
419
420         Bitmap* pReplacementColorBackgroundBitmap = null;
421         Bitmap* pBackgroundBitmap = null;
422         //Bitmap* pBackgroundEffectBitmap = null;
423
424         FloatRectangle bounds(0.0f, 0.0f, __pToolbar->GetBoundsF().width, __pToolbar->GetBoundsF().height);
425
426         __portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
427         __landscapeSize = FloatDimension(__portraitSize.height, __portraitSize.width);
428
429         if (__pToolbar->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
430         {
431                 if (bounds.width > __portraitSize.width)
432                 {
433                         bounds.width = __portraitSize.width;
434                 }
435         }
436         else
437         {
438                 if (bounds.width > __landscapeSize.width)
439                 {
440                         bounds.width = __landscapeSize.width;
441                 }
442         }
443
444         pBackgroundBitmap = __pToolbar->GetBackgroundBitmap();
445         //pBackgroundEffectBitmap = __pToolbar->GetBackgroundEffectBitmap();
446
447         pReplacementColorBackgroundBitmap =
448                                 _BitmapImpl::GetColorReplacedBitmapN(*pBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __pToolbar->GetColor());
449
450         if (__pToolbar->IsUserBackgroundBitmap())
451         {
452                 if (pBackgroundBitmap)
453                 {
454                         if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBackgroundBitmap))
455                         {
456                                 pCanvas->DrawNinePatchedBitmap(bounds, *pBackgroundBitmap);
457                         }
458                         else
459                         {
460                                 pCanvas->DrawBitmap(bounds, *pBackgroundBitmap, FloatRectangle(0.0f, 0.0f, pBackgroundBitmap->GetWidthF(), pBackgroundBitmap->GetHeightF()));
461                         }
462                 }
463                 else
464                 {
465                         pCanvas->FillRectangle(__pToolbar->GetColor(), bounds);
466                 }
467         }
468         else
469         {
470                 if (pReplacementColorBackgroundBitmap)
471                 {
472                         if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReplacementColorBackgroundBitmap))
473                         {
474                                 pCanvas->DrawNinePatchedBitmap(bounds, *pReplacementColorBackgroundBitmap);
475                         }
476                         else
477                         {
478                                 pCanvas->DrawBitmap(bounds, *pReplacementColorBackgroundBitmap, FloatRectangle(0.0f, 0.0f, pReplacementColorBackgroundBitmap->GetWidthF(), pReplacementColorBackgroundBitmap->GetHeightF()));
479                         }
480                 }
481                 else
482                 {
483                         pCanvas->FillRectangle(__pToolbar->GetColor(), bounds);
484                 }
485
486                 //if (pBackgroundEffectBitmap)
487                 //{
488                 //      if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBackgroundEffectBitmap))
489                 //      {
490                 //              pCanvas->DrawNinePatchedBitmap(bounds, *pBackgroundEffectBitmap);
491                 //      }
492                 //      else
493                 //      {
494                 //              pCanvas->DrawBitmap(bounds, *pBackgroundEffectBitmap, FloatRectangle(0.0f, 0.0f, pBackgroundEffectBitmap->GetWidthF(), pBackgroundEffectBitmap->GetHeightF()));
495                 //      }
496                 //}
497         }
498
499         if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
500         {
501                 Bitmap* pSubTitleEffectBitmap = null;
502                 Color subTitleEffectColor;
503                 float topMargin = 0.0f;
504
505                 GET_BITMAP_CONFIG_N(HEADER::SUB_TITLE_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, pSubTitleEffectBitmap);
506                 GET_COLOR_CONFIG(HEADER::SUB_TITLE_EFFECT_NORMAL, subTitleEffectColor);
507                 GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, __pToolbar->GetOrientation(), topMargin);
508
509                 FloatRectangle subTitleEffectBounds(0.0f, topMargin, __pToolbar->GetBoundsF().width, __pToolbar->GetBoundsF().height - topMargin);
510
511                 Bitmap* pReColorSubTitleEffectBitmap = null;
512
513                 pReColorSubTitleEffectBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pSubTitleEffectBitmap, Color::GetColor(COLOR_ID_MAGENTA), subTitleEffectColor);
514
515                 if (pReColorSubTitleEffectBitmap)
516                 {
517                         if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReColorSubTitleEffectBitmap))
518                         {
519                                 pCanvas->DrawNinePatchedBitmap(subTitleEffectBounds, *pReColorSubTitleEffectBitmap);
520                         }
521                         else
522                         {
523                                 pCanvas->DrawBitmap(subTitleEffectBounds, *pReColorSubTitleEffectBitmap, FloatRectangle(0.0f, 0.0f, pReColorSubTitleEffectBitmap->GetWidthF(), pReColorSubTitleEffectBitmap->GetHeightF()));
524                         }
525                 }
526
527                 delete pReColorSubTitleEffectBitmap;
528         }
529
530         delete pCanvas;
531         delete pReplacementColorBackgroundBitmap;
532
533         return;
534 }
535
536 void
537 _ToolbarPresenter::DrawDescriptionText(void)
538 {
539         result r = E_SUCCESS;
540
541         float textAreaHeight = 0.0f;
542         float fontSize = 0.0f;
543         float titleIconWidth = 0.0f;
544
545         GET_SHAPE_CONFIG(HEADER::DESCRIPTION_TEXT_HEIGHT, __pToolbar->GetOrientation(), textAreaHeight);
546         GET_SHAPE_CONFIG(HEADER::DESCRIPTION_TEXT_FONT_SIZE, __pToolbar->GetOrientation(), fontSize);
547         GET_SHAPE_CONFIG(HEADER::ICON_WIDTH, __pToolbar->GetOrientation(), titleIconWidth);
548
549         __fontSize = fontSize;
550
551         __pTextFont = __pToolbar->GetFallbackFont();
552         r = GetLastResult();
553         SysTryReturnVoidResult(NID_UI_CTRL, __pTextFont, r, "[%s] Propagating.", GetErrorMessage(r));
554
555         if (__pToolbar->GetTitleIcon() != null)
556         {
557                 __descriptionRect.x = __toolbarUsableArea.x + titleIconWidth + __toolbarUsableArea.x;
558         }
559         else
560         {
561                 __descriptionRect.x = __toolbarUsableArea.x;
562         }
563
564         __descriptionRect.y = __titleRect.y + __titleRect.height;
565
566         if(__titleText.IsEmpty())
567         {
568                 __descriptionRect.width = __toolbarUsableArea.width;
569         }
570         else
571         {
572                 __descriptionRect.width = __titleRect.width;
573         }
574
575         __descriptionRect.height = textAreaHeight;
576
577         Canvas* pCanvas = __pToolbar->GetCanvasN();
578
579         if (__pDescriptionTextObject)
580         {
581                 __pDescriptionTextObject->SetFont(__pTextFont, 0, __pDescriptionTextObject->GetTextLength());
582                 __pDescriptionTextObject->SetForegroundColor(__pToolbar->GetDescriptionTextColor(), 0, __pDescriptionTextObject->GetTextLength());
583                 __pDescriptionTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
584                 __pDescriptionTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
585                 __pDescriptionTextObject->SetBounds(__descriptionRect);
586                 __pDescriptionTextObject->Compose();
587                 __pDescriptionTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
588         }
589
590         delete pCanvas;
591
592         return;
593 }
594
595 void
596 _ToolbarPresenter::DrawEditItem(const FloatPoint& point)
597 {
598         if (__pEditItem == null )
599         {
600                 return;
601         }
602
603         FloatPoint anchor = FloatPoint(0.0f, 0.0f);
604
605         anchor.x = point.x - (__pEditItem->GetSizeF().width / 2);
606         anchor.y = point.y - (__pEditItem->GetSizeF().height / 2);
607
608         __pEditItem->SetPosition(anchor);
609
610         __pToolbar->Invalidate(true);
611
612         return;
613 }
614
615 void
616 _ToolbarPresenter::DrawDivider(const FloatPoint& point, Canvas* pCanvas)
617 {
618         ToolbarStyle style = __pToolbar->GetStyle();
619
620         if (style == TOOLBAR_SOFTKEY)
621         {
622                 return ;
623         }
624
625         float dividerWidth = 0.0f;
626         float dividerHeight = 0.0f;
627         Color dividerLeftColor;
628         //Color dividerRightColor;
629
630         GET_SHAPE_CONFIG(HEADER::DIVIDER_WIDTH, __pToolbar->GetOrientation(), dividerWidth);
631
632         if (style == TOOLBAR_TAB_LARGE)
633         {
634                 GET_SHAPE_CONFIG(HEADER::TAB_LARGE_DIVIDER_HEIGHT, __pToolbar->GetOrientation(), dividerHeight);
635         }
636         else
637         {
638                 GET_SHAPE_CONFIG(HEADER::DIVIDER_HEIGHT, __pToolbar->GetOrientation(), dividerHeight);
639         }
640
641         if (__pToolbar->IsHeader() == true)
642         {
643                 if (!__pToolbar->IsTransparent())
644                 {
645                         GET_COLOR_CONFIG(HEADER::DIVIDER_LINE_LEFT_NORMAL, dividerLeftColor);
646                         //GET_COLOR_CONFIG(HEADER::DIVIDER_LINE_RIGHT_NORMAL, dividerRightColor);
647                 }
648                 else
649                 {
650                         GET_COLOR_CONFIG(HEADER::DIVIDER_LINE_LEFT_TRANSLUCENT_NORMAL, dividerLeftColor);
651                         //GET_COLOR_CONFIG(HEADER::DIVIDER_LINE_RIGHT_TRANSLUCENT_NORMAL, dividerRightColor);
652                 }
653         }
654         else
655         {
656                 if (!__pToolbar->IsTransparent())
657                 {
658                         GET_COLOR_CONFIG(FOOTER::DIVIDER_LINE_LEFT_NORMAL, dividerLeftColor);
659                         //GET_COLOR_CONFIG(FOOTER::DIVIDER_LINE_RIGHT_NORMAL, dividerRightColor);
660                 }
661                 else
662                 {
663                         GET_COLOR_CONFIG(FOOTER::DIVIDER_LINE_LEFT_TRANSLUCENT_NORMAL, dividerLeftColor);
664                         //GET_COLOR_CONFIG(FOOTER::DIVIDER_LINE_RIGHT_TRANSLUCENT_NORMAL, dividerRightColor);
665                 }
666         }
667
668         pCanvas->SetForegroundColor(dividerLeftColor);
669         pCanvas->SetLineWidth(dividerWidth);
670
671         pCanvas->DrawLine(FloatPoint(point.x, point.y), FloatPoint(point.x, point.y + dividerHeight));
672
673         //pCanvas->SetForegroundColor(dividerRightColor);
674         //pCanvas->SetLineWidth(dividerWidth/2);
675
676         //pCanvas->DrawLine(FloatPoint(point.x + dividerWidth, point.y), FloatPoint(point.x + dividerWidth, point.y + dividerHeight));
677
678         return;
679 }
680
681 void
682 _ToolbarPresenter::DrawItems(void)
683 {
684         result r = E_SUCCESS;
685
686         Canvas* pCanvas = __pToolbar->GetCanvasN();
687
688         SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_INVALID_STATE, "[E_INVALID_STATE] System error occurred.");
689
690         ToolbarStyle style = __pToolbar->GetStyle();
691
692         FloatRectangle usableArea = __toolbarUsableArea;
693
694         Bitmap* pTitleIcon = __pToolbar->GetTitleIcon();
695
696         _Label* pTitleBadgeIcon = __pToolbar->GetTitleBadgeIcon();
697
698         float iconWidth = 0.0f;
699         float titleDisplayHeight = 0.0f;
700         float leftMargin = 0.0f;
701         float headerTopMargin = 0.0f;
702         float processingAnimationIconSize = 0.0f;
703         float processingAnimationIconGap = 0.0f;
704         float titleCharacterCount = 0.0f;
705         float titleBadgeIconGap = 0.0f;
706         float titleBadgeIconTopMargin = 0.0f;
707         float fontSize = 0.0f;
708         FloatDimension titleTextDimension(0.0f, 0.0f);
709         float totalWidth = 0.0f;
710         float titleHeight = 0.0f;
711
712         GET_SHAPE_CONFIG(HEADER::LEFT_MARGIN, __pToolbar->GetOrientation(), leftMargin);
713         GET_SHAPE_CONFIG(HEADER::PROCESSING_ANIMATION_ICON_SIZE, __pToolbar->GetOrientation(), processingAnimationIconSize);
714         GET_SHAPE_CONFIG(HEADER::PROCESSING_ANIMATION_ICON_GAP, __pToolbar->GetOrientation(), processingAnimationIconGap);
715
716         GET_SHAPE_CONFIG(HEADER::TITLE_BADGE_ICON_GAP, __pToolbar->GetOrientation(), titleBadgeIconGap);
717         GET_SHAPE_CONFIG(HEADER::TITLE_BADGE_TOP_MARGIN, __pToolbar->GetOrientation(), titleBadgeIconTopMargin);
718
719         if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
720         {
721                 GET_SHAPE_CONFIG(HEADER::TITLE_TOP_MARGIN_WITH_SEGMENTED_ITEM, __pToolbar->GetOrientation(), headerTopMargin);
722                 GET_SHAPE_CONFIG(HEADER::TITLE_DISPLAY_HEIGHT_WITH_SEGMENTED_ITEM, __pToolbar->GetOrientation(), titleDisplayHeight);
723         }
724         else
725         {
726                 GET_SHAPE_CONFIG(HEADER::TOP_MARGIN, __pToolbar->GetOrientation(), headerTopMargin);
727                 GET_SHAPE_CONFIG(HEADER::TITLE_DISPLAY_HEIGHT, __pToolbar->GetOrientation(), titleDisplayHeight);
728         }
729
730         GET_SHAPE_CONFIG(HEADER::ICON_WIDTH, __pToolbar->GetOrientation(), iconWidth);
731
732         if (!__titleText.IsEmpty())
733         {
734                 titleCharacterCount = __titleText.GetLength(); // alphabet count
735
736                 if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
737                 {
738                         r = GET_SHAPE_CONFIG(HEADER::TITLE_FONT_SIZE_WITH_SEGMENTED, __pToolbar->GetOrientation(), fontSize);
739                 }
740                 else if (style == TOOLBAR_TITLE && __pToolbar->GetDescriptionText() != L""
741                                 && __pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) == ANIMATION_STOPPED)
742                 {
743                         r = GET_SHAPE_CONFIG(HEADER::TITLE_FONT_SIZE_WITH_DESCRIPTION, __pToolbar->GetOrientation(), fontSize);
744                 }
745                 else
746                 {
747                         r = GET_SHAPE_CONFIG(HEADER::TITLE_FONT_SIZE, __pToolbar->GetOrientation(), fontSize);
748                 }
749
750                 if (IsFailed(r))
751                 {
752                         delete pCanvas;
753
754                         return;
755                 }
756
757                 __fontSize = fontSize;
758
759                 __pTitleTextFont = __pToolbar->GetFallbackFont();
760                 r = GetLastResult();
761                 SysTryReturnVoidResult(NID_UI_CTRL, __pTitleTextFont, r, "[%s] Propagating.", GetErrorMessage(r));
762
763                 __pTitleTextObject->SetFont(__pTitleTextFont, 0, __pTitleTextObject->GetTextLength());
764
765                 __pTitleTextFont->GetTextExtent(__titleText, titleCharacterCount, titleTextDimension);
766
767                 totalWidth = titleTextDimension.width; // pixel
768                 titleHeight = titleTextDimension.height; // pixel
769
770                 __titleRect.height = _FontImpl::GetInstance(*__pTitleTextFont)->GetLeadingF();
771
772                 if (pTitleIcon)
773                 {
774                         pTitleIcon->Scale(FloatDimension(iconWidth, iconWidth));
775                 }
776
777                 if (pTitleIcon)
778                 {
779                         totalWidth += (pTitleIcon->GetWidthF() + usableArea.x);
780                 }
781
782
783                 if (pTitleBadgeIcon)
784                 {
785                         totalWidth += pTitleBadgeIcon->GetBoundsF().width + titleBadgeIconGap;
786                 }
787                 else if ((__pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE)) != ANIMATION_STOPPED)
788                 {
789                         totalWidth += processingAnimationIconSize + processingAnimationIconGap;
790                 }
791
792                 if (totalWidth > usableArea.width)
793                 {
794                         __titleRect.width = titleTextDimension.width - (totalWidth - usableArea.width);
795
796                         if (pTitleIcon)
797                         {
798                                 pCanvas->DrawBitmap(FloatPoint(usableArea.x, headerTopMargin + (titleDisplayHeight - pTitleIcon->GetHeightF()) / 2), *(pTitleIcon));
799
800                                 __titleRect.x = usableArea.x + pTitleIcon->GetWidthF() + usableArea.x;
801                                 __titleRect.y = headerTopMargin + (titleDisplayHeight - titleHeight) / 2;
802
803                                 if (__pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) != ANIMATION_STOPPED)
804                                 {
805                                         __pToolbar->SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_TITLE,
806                                                         usableArea.x + (pTitleIcon->GetWidthF() + processingAnimationIconGap) + __titleRect.width + processingAnimationIconGap,
807                                                         headerTopMargin + (titleDisplayHeight - processingAnimationIconSize) / 2);
808                                 }
809
810                                 if (pTitleBadgeIcon)
811                                 {
812                                         pTitleBadgeIcon->SetPosition(FloatPoint(usableArea.x + (pTitleIcon->GetWidthF() + processingAnimationIconGap) + __titleRect.width + titleBadgeIconGap,
813                                                         titleBadgeIconTopMargin));
814                                 }
815                         }
816                         else
817                         {
818                                 __titleRect.x = usableArea.x;
819                                 __titleRect.y = headerTopMargin + (titleDisplayHeight - titleHeight) / 2;
820
821                                 if (__pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) != ANIMATION_STOPPED)
822                                 {
823                                         __pToolbar->SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_TITLE,
824                                                         usableArea.x + __titleRect.width + processingAnimationIconGap,
825                                                         headerTopMargin + (titleDisplayHeight - processingAnimationIconSize) / 2);
826                                 }
827
828                                 if (pTitleBadgeIcon)
829                                 {
830                                         pTitleBadgeIcon->SetPosition(FloatPoint(usableArea.x + __titleRect.width + titleBadgeIconGap, titleBadgeIconTopMargin));
831                                 }
832                         }
833                 }
834                 else
835                 {
836                         __titleRect.width = usableArea.width;
837
838                         if (pTitleIcon)
839                         {
840                                 __titleRect.x = leftMargin + pTitleIcon->GetWidthF() + leftMargin;
841                                 __titleRect.y = headerTopMargin + (titleDisplayHeight - titleHeight) / 2;
842
843                                 if(__pTitleTextObject->GetAlignment() & TEXT_OBJECT_ALIGNMENT_CENTER)
844                                 {
845                                         leftMargin = (__titleRect.width - titleTextDimension.width) / 2 - leftMargin;
846                                 }
847                                 else if(__pTitleTextObject->GetAlignment() & TEXT_OBJECT_ALIGNMENT_RIGHT)
848                                 {
849                                         leftMargin = __titleRect.width - titleTextDimension.width - leftMargin * 3;
850                                 }
851
852                                 pCanvas->DrawBitmap(FloatPoint(leftMargin, headerTopMargin + (titleDisplayHeight - pTitleIcon->GetHeightF()) / 2), *(pTitleIcon));
853
854                                 if (__pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) != ANIMATION_STOPPED)
855                                 {
856                                         __pToolbar->SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_TITLE,
857                                                         usableArea.x + (pTitleIcon->GetWidthF() + processingAnimationIconGap) + titleTextDimension.width + processingAnimationIconGap,
858                                                         headerTopMargin + (titleDisplayHeight - processingAnimationIconSize) / 2);
859                                 }
860
861                                 if (pTitleBadgeIcon)
862                                 {
863                                         pTitleBadgeIcon->SetPosition(FloatPoint(usableArea.x + (pTitleIcon->GetWidthF() + processingAnimationIconGap) + titleTextDimension.width + titleBadgeIconGap,
864                                                         titleBadgeIconTopMargin));
865                                 }
866
867                                 __titleRect.width -= (pTitleIcon->GetWidthF() + usableArea.x);
868                         }
869                         else
870                         {
871                                 __titleRect.x = leftMargin;
872                                 __titleRect.y = headerTopMargin + (titleDisplayHeight - titleHeight) / 2;
873
874                                 if (__pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) != ANIMATION_STOPPED)
875                                 {
876                                         __pToolbar->SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_TITLE,
877                                                         leftMargin + titleTextDimension.width + processingAnimationIconGap,
878                                                         headerTopMargin + (titleDisplayHeight - processingAnimationIconSize) / 2);
879                                 }
880
881                                 if (pTitleBadgeIcon)
882                                 {
883                                         pTitleBadgeIcon->SetPosition(FloatPoint(leftMargin + titleTextDimension.width + titleBadgeIconGap, titleBadgeIconTopMargin));
884                                 }
885                         }
886                 }
887         }
888         else // empty title
889         {
890                 if (pTitleIcon && __pToolbar->GetWaitingAnimationStatus(TOOLBAR_ANIMATION_POSITION_TITLE) != ANIMATION_STOPPED)
891                 {
892                         pTitleIcon->Scale(FloatDimension(iconWidth, iconWidth));
893
894                         if(__pToolbar->GetTitleTextHorizontalAlignment() == ALIGNMENT_CENTER)
895                         {
896                                 leftMargin = (leftMargin + usableArea.width - (pTitleIcon->GetWidthF() + processingAnimationIconGap + processingAnimationIconSize)) / 2;
897                         }
898                         else if(__pToolbar->GetTitleTextHorizontalAlignment() == ALIGNMENT_RIGHT)
899                         {
900                                 leftMargin = leftMargin + usableArea.width - (pTitleIcon->GetWidthF() + processingAnimationIconGap + processingAnimationIconSize);
901                         }
902
903                         pCanvas->DrawBitmap(FloatPoint(leftMargin, headerTopMargin + (titleDisplayHeight - pTitleIcon->GetHeightF()) / 2), *(pTitleIcon));
904
905                         __pToolbar->SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_TITLE,
906                                         leftMargin + processingAnimationIconGap + processingAnimationIconSize,
907                                         headerTopMargin + (titleDisplayHeight - processingAnimationIconSize) / 2);
908
909                         if (pTitleBadgeIcon)
910                         {
911                                 pTitleBadgeIcon->SetPosition(FloatPoint(leftMargin + processingAnimationIconGap + titleBadgeIconGap, titleBadgeIconTopMargin));
912                         }
913                 }
914                 else if (pTitleIcon)
915                 {
916                         pTitleIcon->Scale(FloatDimension(iconWidth, iconWidth));
917
918                         if(__pToolbar->GetTitleTextHorizontalAlignment() == ALIGNMENT_CENTER)
919                         {
920                                 leftMargin = usableArea.width / 2;
921                         }
922                         else if(__pToolbar->GetTitleTextHorizontalAlignment() == ALIGNMENT_RIGHT)
923                         {
924                                 leftMargin = usableArea.width - pTitleIcon->GetWidthF();
925                         }
926
927                         pCanvas->DrawBitmap(FloatPoint(leftMargin, headerTopMargin + (titleDisplayHeight - pTitleIcon->GetHeightF()) / 2), *(pTitleIcon));
928                 }
929                 else
930                 {
931                         if(__pToolbar->GetTitleTextHorizontalAlignment() == ALIGNMENT_CENTER)
932                         {
933                                 leftMargin = (usableArea.width - (processingAnimationIconGap + processingAnimationIconSize))/ 2;
934                         }
935                         else if(__pToolbar->GetTitleTextHorizontalAlignment() == ALIGNMENT_RIGHT)
936                         {
937                                 leftMargin = usableArea.width - (processingAnimationIconGap + processingAnimationIconSize);
938                         }
939
940                         __pToolbar->SetWaitingAnimationPosition(TOOLBAR_ANIMATION_POSITION_TITLE,
941                                         leftMargin, headerTopMargin + (titleDisplayHeight - processingAnimationIconSize) / 2);
942
943                         if (pTitleBadgeIcon)
944                         {
945                                 pTitleBadgeIcon->SetPosition(FloatPoint(leftMargin, titleBadgeIconTopMargin));
946                         }
947                 }
948         }
949
950         delete pCanvas;
951
952         return;
953 }
954
955 result
956 _ToolbarPresenter::DrawTitleText(Canvas* pCanvas)
957 {
958         TimerForTitleSlideInit();
959
960         if (__titleText.IsEmpty())
961         {
962                 return E_SUCCESS;
963         }
964
965         __pTitleTextObject->SetForegroundColor(__pToolbar->GetTitleTextColor(), 0, __pTitleTextObject->GetTextLength());
966         __pTitleTextObject->SetBounds(__titleRect);
967         //__pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
968         __pTitleTextObject->Compose();
969
970         if (__pTitleTextObject->IsActionOn() == true)
971         {
972                 __pTitleTextObject->DrawWithOffset(*_CanvasImpl::GetInstance(*pCanvas));
973
974                 DrawTitleTextDimBitmap();
975
976                 TimerForTitleSlideStart();
977         }
978         else
979         {
980                 __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
981         }
982
983         return E_SUCCESS;
984 }
985
986 int
987 _ToolbarPresenter::GetSelectedItemIndex(void) const
988 {
989         return __pToolbarModel->GetSelectedItemIndex();
990 }
991
992 bool
993 _ToolbarPresenter::IsInitialDraw(void) const
994 {
995         return __initialDraw;
996 }
997
998 bool
999 _ToolbarPresenter::IsTabEditModeEnabled(void) const
1000 {
1001         return __tabEditEnabled;
1002 }
1003
1004 result
1005 _ToolbarPresenter::SetDescriptionText(const String& description)
1006 {
1007         result r = E_SUCCESS;
1008
1009         float length = description.GetLength();
1010         float fontSize = 0.0f;
1011
1012         wchar_t* tempString = const_cast<wchar_t*>(description.GetPointer());
1013
1014         // description text
1015         if (__pDescriptionTextObject != null)
1016         {
1017                 delete __pDescriptionTextObject;
1018                 __pDescriptionTextObject = null;
1019         }
1020
1021         __pDescriptionTextObject = new (std::nothrow) TextObject();
1022
1023         if (__pDescriptionTextObject == null)
1024         {
1025                 return E_OUT_OF_MEMORY;
1026         }
1027         __pDescriptionTextObject->Construct();
1028         TextSimple* pSimpleText = new (std::nothrow) TextSimple(tempString, length, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1029         __pDescriptionTextObject->AppendElement(*pSimpleText);
1030         __pDescriptionTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
1031         __pDescriptionTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER);
1032
1033         GET_SHAPE_CONFIG(HEADER::DESCRIPTION_TEXT_FONT_SIZE, __pToolbar->GetOrientation(), fontSize);
1034
1035         __fontSize = fontSize;
1036
1037         __pTextFont = __pToolbar->GetFallbackFont();
1038         r = GetLastResult();
1039         SysTryReturn(NID_UI_CTRL, __pTextFont, r, r, "[%s] Propagating.", GetErrorMessage(r));
1040
1041         __pDescriptionTextObject->SetFont(__pTextFont, 0, __pDescriptionTextObject->GetTextLength());
1042
1043         return r;
1044 }
1045
1046 result
1047 _ToolbarPresenter::SetItemSelected(int itemIndex, bool adjust)
1048 {
1049         if (adjust == true)
1050         {
1051                 ToolbarStyle style = __pToolbar->GetStyle();
1052
1053                 if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE) && __pToolbar->GetItemCount() > SEGMENTED_ITEM_MAX)
1054                 {
1055                         if (itemIndex <= __pToolbar->GetItemCount() - SEGMENTED_ITEM_MAX)
1056                         {
1057                                 SetItemFit(itemIndex);
1058                         }
1059                         else
1060                         {
1061                                 SetItemFit(__pToolbar->GetItemCount() - SEGMENTED_ITEM_MAX);
1062                         }
1063                 }
1064         }
1065
1066         return __pToolbarModel->SetSelectedItemIndex(itemIndex);
1067 }
1068
1069 result
1070 _ToolbarPresenter::SetInitialDrawState(bool state)
1071 {
1072         //DrawBackground(); // remove since 2.1
1073         __initialDraw = state;
1074         __titleText = L"";
1075         __titlePressed = false;
1076         __titleSliding = false;
1077         __tabEditEnabled = false;
1078
1079         __firstLoadedItemIndex = 0;
1080         __lastLoadedItemIndex = 0;
1081
1082         return E_SUCCESS;
1083 }
1084
1085 result
1086 _ToolbarPresenter::SetTabEditModeEnabled(bool enable)
1087 {
1088         __tabEditEnabled = enable;
1089
1090         return E_SUCCESS;
1091 }
1092
1093 result
1094 _ToolbarPresenter::SetTitleText(const String& title, HorizontalAlignment alignment)
1095 {
1096         result r = E_SUCCESS;
1097
1098         float length = title.GetLength();
1099
1100         __titleText = String(title);
1101         wchar_t* tempString = const_cast<wchar_t*>(__titleText.GetPointer());
1102
1103         // title text
1104         if (__pTitleTextObject != null)
1105         {
1106                 delete __pTitleTextObject;
1107                 __pTitleTextObject = null;
1108         }
1109
1110         __pTitleTextObject = new (std::nothrow) TextObject();
1111
1112         if (__pTitleTextObject == null)
1113         {
1114                 return E_OUT_OF_MEMORY;
1115         }
1116         __pTitleTextObject->Construct();
1117         __pTitleTextObject->SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
1118         TextSimple* pSimpleText = new (std::nothrow) TextSimple(tempString, length, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1119         __pTitleTextObject->AppendElement(*pSimpleText);
1120
1121         __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
1122
1123         __titleSliding = false;
1124
1125         switch (alignment)
1126         {
1127                 case ALIGNMENT_LEFT:
1128                         __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
1129                         break;
1130                 case ALIGNMENT_CENTER:
1131                         __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER);
1132                         break;
1133                 case ALIGNMENT_RIGHT:
1134                         __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_RIGHT);
1135                         break;
1136                 default:
1137                         __pTitleTextObject->SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT);
1138                         break;
1139         }
1140
1141         float fontSize = 0.0f;
1142
1143         r = GET_SHAPE_CONFIG(HEADER::TITLE_FONT_SIZE, __pToolbar->GetOrientation(), fontSize);
1144
1145         __fontSize = fontSize;
1146
1147         __pTitleTextFont = __pToolbar->GetFallbackFont();
1148         r = GetLastResult();
1149         SysTryReturn(NID_UI_CTRL, __pTitleTextFont, r, r, "[%s] Propagating.", GetErrorMessage(r));
1150
1151         __pTitleTextObject->SetFont(__pTitleTextFont, 0, __pTitleTextObject->GetTextLength());
1152
1153         //__pTitleTextObject->Compose();
1154
1155         return r;
1156 }
1157
1158 result
1159 _ToolbarPresenter::SetUsableAreaBounds(const FloatRectangle& rect)
1160 {
1161         __toolbarUsableArea = rect;
1162
1163         return E_SUCCESS;
1164 }
1165
1166 bool
1167 _ToolbarPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1168 {
1169         ResetFlickAnimationTimer();
1170
1171         SetFirstLoadedItemIndex();
1172         SetLastLoadedItemIndex();
1173
1174         __touchInitiatedInToolbar = true;
1175
1176         __currentTouchPosition = touchinfo.GetCurrentPosition();
1177
1178         ToolbarStyle style = __pToolbar->GetStyle();
1179
1180         if (__titleRect.Contains(__currentTouchPosition)
1181                         && (style == TOOLBAR_TITLE || style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE))
1182         {
1183                 __titlePressed = true;
1184         }
1185         else
1186         {
1187                 __titlePressed = false;
1188         }
1189
1190         __pressedItemIndex = __pToolbar->GetItemIndexFromPosition(__currentTouchPosition);
1191
1192         if (__pressedItemIndex == -1)
1193         {
1194                 _Label* pLabel = dynamic_cast<_Label*>(const_cast<_Control*>(&source));
1195
1196                 if (pLabel != null)
1197                 {
1198                         if (__pToolbar->GetButton(LEFT_BUTTON) != null && __pToolbar->GetButton(LEFT_BUTTON)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
1199                         {
1200                                 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pToolbar->GetButton(LEFT_BUTTON)->GetChild(0));
1201
1202                                 if (pLabel == pTempBadgeIcon)
1203                                 {
1204                                         __pToolbar->GetButton(LEFT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_PRESSED, false);
1205                                 }
1206                         }
1207
1208                         if (__pToolbar->GetButton(RIGHT_BUTTON) != null && __pToolbar->GetButton(RIGHT_BUTTON)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
1209                         {
1210                                 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pToolbar->GetButton(RIGHT_BUTTON)->GetChild(0));
1211
1212                                 if (pLabel == pTempBadgeIcon)
1213                                 {
1214                                         __pToolbar->GetButton(RIGHT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_PRESSED, false);
1215                                 }
1216                         }
1217                 }
1218         }
1219         else
1220         {
1221                 _Button* pPressedButton = __pToolbar->GetItem(__pressedItemIndex);
1222
1223                 __initialPressesItemStatus = pPressedButton->GetButtonStatus();
1224
1225                 if (__initialPressesItemStatus == _BUTTON_STATUS_DISABLED)
1226                 {
1227                         return true;
1228                 }
1229
1230                 pPressedButton->SetButtonStatus(_BUTTON_STATUS_PRESSED);
1231         }
1232
1233         __pToolbar->Invalidate(true);
1234
1235         return true;
1236 }
1237
1238 bool
1239 _ToolbarPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1240 {
1241         if (!__touchInitiatedInToolbar)
1242         {
1243                 return false;
1244         }
1245
1246         FloatPoint touchPoint = touchinfo.GetCurrentPosition();
1247
1248         if (__titlePressed && __titleRect.Contains(touchPoint))
1249         {
1250                 if (__titleSliding == true)
1251                 {
1252                         __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
1253                         __pTitleTextObject->Compose();
1254
1255                         __titleSliding = false;
1256                 }
1257                 else
1258                 {
1259                         __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT);
1260                         __pTitleTextObject->Compose();
1261
1262                         __titleSliding = true;
1263
1264                         TimerForTitleSlideStart();
1265                 }
1266         }
1267
1268         SetFirstLoadedItemIndex();
1269         SetLastLoadedItemIndex();
1270
1271         ToolbarStyle style = __pToolbar->GetStyle();
1272
1273         __touchInitiatedInToolbar = false;
1274
1275         int releasedItemIndex = __pToolbar->GetItemIndexFromPosition(touchPoint);
1276         float tabLeftMargin = 0.0f;
1277
1278         GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, __pToolbar->GetOrientation(), tabLeftMargin);
1279
1280         if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE) && __beingEdited == true)
1281         {
1282                 __beingEdited = false;
1283
1284                 if (releasedItemIndex == -1)
1285                 {
1286                         if (__pEditItem)
1287                         {
1288                                 __pToolbar->DetachChild(*__pEditItem);
1289
1290                                 delete __pEditItem;
1291                                 __pEditItem = null;
1292                         }
1293
1294                         if (__pressedItemIndex != -1)
1295                         {
1296                                 __pToolbar->GetItem(__pressedItemIndex)->SetButtonStatus(__initialPressesItemStatus);
1297                         }
1298                 }
1299                 else
1300                 {
1301                         __pToolbar->MoveItem(__editItemIndex, releasedItemIndex);
1302
1303                         AdjustItemPositionX(-__pToolbar->GetItem(__firstLoadedItemIndex)->GetBoundsF().x + tabLeftMargin); // move auto focus
1304
1305                         if (__pEditItem)
1306                         {
1307                                 __pToolbar->DetachChild(*__pEditItem);
1308
1309                                 delete __pEditItem;
1310                                 __pEditItem = null;
1311                         }
1312                 }
1313         }
1314         else
1315         {
1316                 if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE)
1317                                 && __pToolbar->GetItemCount() > SEGMENTED_ITEM_MAX)
1318                 {
1319                         if (__pressedItemIndex != -1)
1320                         {
1321                                 if (releasedItemIndex == __pressedItemIndex)
1322                                 {
1323                                         if (__initialPressesItemStatus != _BUTTON_STATUS_DISABLED && __tabMoved != true)
1324                                         {
1325                                                 __pToolbar->SetItemSelected(releasedItemIndex, true, false);
1326                                         }
1327                                         else
1328                                         {
1329                                                 __pToolbar->GetItem(__pressedItemIndex)->SetButtonStatus(__initialPressesItemStatus, false);
1330                                         }
1331                                 }
1332                                 else
1333                                 {
1334                                         __pToolbar->GetItem(__pressedItemIndex)->SetButtonStatus(__initialPressesItemStatus, false);
1335                                 }
1336                         }
1337                 }
1338                 else
1339                 {
1340                         if (__pressedItemIndex != -1 && (releasedItemIndex != __pressedItemIndex))
1341                         {
1342                                 __pToolbar->GetItem(__pressedItemIndex)->SetButtonStatus(__initialPressesItemStatus, false);
1343                         }
1344                         else
1345                         {
1346                                 if (__pressedItemIndex != -1 && __initialPressesItemStatus != _BUTTON_STATUS_DISABLED)
1347                                 {
1348                                         if (style == TOOLBAR_HEADER_SEGMENTED || style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE
1349                                                         || style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_SEGMENTED || style == TOOLBAR_TAB_LARGE)
1350                                         {
1351                                                 __pToolbar->SetItemSelected(releasedItemIndex, true, false);
1352                                         }
1353                                         else
1354                                         {
1355                                                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pToolbar->GetItem(releasedItemIndex));
1356                                                 __pToolbar->GetItem(releasedItemIndex)->SetButtonStatus(_BUTTON_STATUS_SELECTED, true);
1357                                                 __pToolbar->GetItem(releasedItemIndex)->SetButtonStatus(_BUTTON_STATUS_NORMAL, false);
1358                                         }
1359                                 }
1360                                 else
1361                                 {
1362                                         _Label* pLabel = dynamic_cast<_Label*>(const_cast<_Control*>(&source));
1363
1364                                         if (pLabel != null)
1365                                         {
1366                                                 if (__pToolbar->GetButton(LEFT_BUTTON) != null && __pToolbar->GetButton(LEFT_BUTTON)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
1367                                                 {
1368                                                         _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pToolbar->GetButton(LEFT_BUTTON)->GetChild(0));
1369
1370                                                         if (pLabel == pTempBadgeIcon)
1371                                                         {
1372                                                                 FloatRectangle buttonItemBounds = __pToolbar->GetButton(LEFT_BUTTON)->GetBoundsF();
1373
1374                                                                 if (buttonItemBounds.Contains(touchPoint))
1375                                                                 {
1376                                                                         PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pToolbar->GetButton(LEFT_BUTTON));
1377                                                                         __pToolbar->GetButton(LEFT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_SELECTED, true);
1378                                                                 }
1379
1380                                                                 __pToolbar->GetButton(LEFT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_NORMAL, false);
1381                                                         }
1382                                                 }
1383
1384                                                 if (__pToolbar->GetButton(RIGHT_BUTTON) != null && __pToolbar->GetButton(RIGHT_BUTTON)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
1385                                                 {
1386                                                         _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pToolbar->GetButton(RIGHT_BUTTON)->GetChild(0));
1387
1388                                                         if (pLabel == pTempBadgeIcon)
1389                                                         {
1390                                                                 FloatRectangle buttonItemBounds = __pToolbar->GetButton(RIGHT_BUTTON)->GetBoundsF();
1391
1392                                                                 if (buttonItemBounds.Contains(touchPoint))
1393                                                                 {
1394                                                                         PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pToolbar->GetButton(RIGHT_BUTTON));
1395                                                                         __pToolbar->GetButton(RIGHT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_SELECTED, true);
1396                                                                 }
1397
1398                                                                 __pToolbar->GetButton(RIGHT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_NORMAL, false);
1399                                                         }
1400                                                 }
1401                                         }
1402                                 }
1403
1404                                 __pToolbar->Invalidate(true);
1405
1406                                 return true;
1407                         }
1408                 }
1409         }
1410
1411         __tabMoved = false;
1412
1413         // Restore status of other buttons to _BUTTON_STATUS_NORMAL             // this can be removed
1414         int itemCount = __pToolbar->GetItemCount();
1415
1416         for (int j = 0; j < itemCount; j++)
1417         {
1418                 if (__pToolbar->GetItem(j) != null && __pToolbar->GetItem(j)->GetButtonStatus() == _BUTTON_STATUS_PRESSED)
1419                 {
1420                         __pToolbar->GetItem(j)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1421                 }
1422         }
1423
1424         // Update children
1425         __pToolbar->Invalidate(true);
1426
1427         return true;
1428 }
1429
1430 bool
1431 _ToolbarPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1432 {
1433         if (!__touchInitiatedInToolbar)
1434         {
1435                 return false;
1436         }
1437
1438         SetFirstLoadedItemIndex();
1439         SetLastLoadedItemIndex();
1440
1441         ToolbarStyle style = __pToolbar->GetStyle();
1442         FloatPoint touchPoint = touchinfo.GetCurrentPosition();
1443
1444         if (__pressedItemIndex == -1)
1445         {
1446                 _Label* pLabel = dynamic_cast<_Label*>(const_cast<_Control*>(&source));
1447
1448                 if (pLabel != null)
1449                 {
1450                         if (__pToolbar->GetButton(LEFT_BUTTON) != null && __pToolbar->GetButton(LEFT_BUTTON)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
1451                         {
1452                                 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pToolbar->GetButton(LEFT_BUTTON)->GetChild(0));
1453
1454                                 if (pLabel == pTempBadgeIcon)
1455                                 {
1456                                         FloatRectangle buttonItemBounds = __pToolbar->GetButton(LEFT_BUTTON)->GetBoundsF();
1457
1458                                         if (buttonItemBounds.Contains(touchPoint))
1459                                         {
1460                                                 __pToolbar->GetButton(LEFT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_PRESSED);
1461                                         }
1462                                         else
1463                                         {
1464                                                 __pToolbar->GetButton(LEFT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1465                                         }
1466                                 }
1467                         }
1468
1469                         if (__pToolbar->GetButton(RIGHT_BUTTON) != null && __pToolbar->GetButton(RIGHT_BUTTON)->GetButtonStatus() != _BUTTON_STATUS_DISABLED)
1470                         {
1471                                 _Label* pTempBadgeIcon = dynamic_cast<_Label*>(__pToolbar->GetButton(RIGHT_BUTTON)->GetChild(0));
1472
1473                                 if (pLabel == pTempBadgeIcon)
1474                                 {
1475                                         FloatRectangle buttonItemBounds = __pToolbar->GetButton(RIGHT_BUTTON)->GetBoundsF();
1476
1477                                         if (buttonItemBounds.Contains(touchPoint))
1478                                         {
1479                                                 __pToolbar->GetButton(RIGHT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_PRESSED);
1480                                         }
1481                                         else
1482                                         {
1483                                                 __pToolbar->GetButton(RIGHT_BUTTON)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1484                                         }
1485                                 }
1486                         }
1487                 }
1488
1489                 __pToolbar->Invalidate(true);
1490
1491                 return true;
1492         }
1493
1494         _Button* pCurrentButton = __pToolbar->GetItem(__pressedItemIndex);
1495
1496         if (pCurrentButton == null)
1497         {
1498                 return true;
1499         }
1500
1501         FloatRectangle itemBounds = pCurrentButton->GetBoundsF();
1502
1503         if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE) && __pToolbar->GetItemCount() > SEGMENTED_ITEM_MAX)
1504         {
1505                 if (itemBounds.Contains(touchPoint))
1506                 {
1507                         __tabMoved = true;
1508                 }
1509         }
1510
1511         if ((style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE) && __beingEdited == true)
1512         {
1513                 DrawEditItem(touchinfo.GetCurrentPosition());
1514         }
1515         else
1516         {
1517                 if (__tabMoved)
1518                 {
1519                         pCurrentButton->SetButtonStatus(__initialPressesItemStatus, false);
1520                 }
1521                 else
1522                 {
1523                         if (__initialPressesItemStatus == _BUTTON_STATUS_DISABLED)
1524                         {
1525                                 return false;
1526                         }
1527
1528                         if (itemBounds.Contains(touchPoint))
1529                         {
1530                                 pCurrentButton->SetButtonStatus(_BUTTON_STATUS_PRESSED);
1531                         }
1532                         else
1533                         {
1534                                 pCurrentButton->SetButtonStatus(__initialPressesItemStatus, false);
1535                         }
1536                 }
1537
1538                 pCurrentButton->Invalidate(false);
1539         }
1540
1541         if (__tabMoved)
1542         {
1543                 float distance = (touchinfo.GetCurrentPosition()).x - __currentTouchPosition.x;
1544                 float sideMargin = 0.0f;
1545
1546                 GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, __pToolbar->GetOrientation(), sideMargin);
1547
1548                 FloatRectangle clientBounds = __pToolbar->GetBoundsF();
1549
1550                 __portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1551                 __landscapeSize = FloatDimension(__portraitSize.height, __portraitSize.width);
1552
1553                 if (__pToolbar->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
1554                 {
1555                         if (clientBounds.width > __portraitSize.width)
1556                         {
1557                                 clientBounds.width = __portraitSize.width;
1558                         }
1559                 }
1560                 else
1561                 {
1562                         if (clientBounds.width > __landscapeSize.width)
1563                         {
1564                                 clientBounds.width = __landscapeSize.width;
1565                         }
1566                 }
1567
1568                 __currentTouchPosition = touchinfo.GetCurrentPosition();
1569
1570                 _Button* pItem = null;
1571                 FloatRectangle itemBounds;
1572                 int itemCount = __pToolbar->GetItemCount();
1573
1574                 if (distance > 0) // right move
1575                 {
1576                         pItem = __pToolbar->GetItem(0);
1577                         if (pItem == null)
1578                         {
1579                                 return true;
1580                         }
1581
1582                         itemBounds = pItem->GetBoundsF();
1583
1584                         if (itemBounds.x + distance >= sideMargin && !__beingEdited)
1585                         {
1586                                 distance = sideMargin - itemBounds.x;
1587                         }
1588                 }
1589                 else if (distance < 0)
1590                 {
1591                         pItem = __pToolbar->GetItem(itemCount - 1);
1592
1593                         if (pItem == null)
1594                         {
1595                                 return true;
1596                         }
1597
1598                         itemBounds = pItem->GetBoundsF();
1599
1600                         if (itemBounds.x + itemBounds.width + distance <= clientBounds.width - sideMargin && !__beingEdited)
1601                         {
1602                                 distance = (clientBounds.width - sideMargin) - (itemBounds.x + itemBounds.width);
1603                         }
1604                 }
1605                 if (__beingEdited)
1606                 {
1607                         float tabLeftMargin = 0.0f;
1608
1609                         GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, __pToolbar->GetOrientation(), tabLeftMargin);
1610
1611                         if (distance > 0) // right move
1612                         {
1613                                 __tabSlideRight = false;
1614
1615                                 if (__pToolbar->GetItem(__lastLoadedItemIndex - 1)->GetBoundsF().x <= __pEditItem->GetBoundsF().x)
1616                                 {
1617                                         __tabSlideLeft = true;
1618                                 }
1619
1620                                 if (__tabSlideLeft && __pToolbar->GetItem(itemCount-1)->GetBoundsF().x + __pToolbar->GetItem(itemCount-1)->GetBoundsF().width > clientBounds.width - tabLeftMargin)
1621                                 {
1622                                         AdjustItemPositionX(-distance * 5); // move auto focus
1623                                 }
1624                         }
1625                         else if (distance < 0)
1626                         {
1627                                 __tabSlideLeft = false;
1628
1629                                 if (__pToolbar->GetItem(__firstLoadedItemIndex + 1)->GetBoundsF().x >= __pEditItem->GetBoundsF().x)
1630                                 {
1631                                         __tabSlideRight = true;
1632                                 }
1633
1634                                 if (__tabSlideRight     && __pToolbar->GetItem(0)->GetBoundsF().x < tabLeftMargin)
1635                                 {
1636                                         AdjustItemPositionX(-distance * 5); // move auto focus
1637                                 }
1638                         }
1639                 }
1640                 else
1641                 {
1642                         AdjustItemPositionX(distance);
1643                 }
1644
1645                 Draw();
1646         }
1647
1648         return false;
1649 }
1650
1651 bool
1652 _ToolbarPresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1653 {
1654         __touchInitiatedInToolbar = false;
1655         __beingEdited = false;
1656
1657         // Restore status of other buttons to _BUTTON_STATUS_NORMAL             // this can be removed
1658         int itemCount = __pToolbar->GetItemCount();
1659
1660         for (int i = 0; i < itemCount; i++)
1661         {
1662                 if (__pToolbar->GetItem(i) != null && __pToolbar->GetItem(i)->GetButtonStatus() == _BUTTON_STATUS_PRESSED)
1663                 {
1664                         __pToolbar->GetItem(i)->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1665                 }
1666         }
1667
1668         if (__pEditItem)
1669         {
1670                 __pToolbar->DetachChild(*__pEditItem);
1671
1672                 delete __pEditItem;
1673                 __pEditItem = null;
1674         }
1675
1676         // Update children
1677         __pToolbar->Invalidate(true);
1678
1679         return true;
1680 }
1681
1682 void
1683 _ToolbarPresenter::OnChangeLayout(Tizen::Ui::_ControlOrientation orientation)
1684 {
1685         ResetFlickAnimationTimer();
1686
1687         return;
1688 }
1689
1690 bool
1691 _ToolbarPresenter::OnLongPressGestureDetected(void)
1692 {
1693         if (__pToolbar->IsTabEditModeEnabled() == true)
1694         {
1695                 int longPressedItemIndex = __pToolbar->GetItemIndexFromPosition(__currentTouchPosition);
1696
1697                 if (longPressedItemIndex == -1)
1698                 {
1699                         return false;
1700                 }
1701
1702                 _Button* pButton = null;
1703                 pButton = __pToolbar->GetItem(longPressedItemIndex);
1704                 SysTryReturn(NID_UI_CTRL, pButton, true, E_INVALID_STATE, "[E_INVALID_STATE] Unable to retrieve a button");
1705
1706                 if (pButton->GetButtonStatus() == _BUTTON_STATUS_DISABLED)
1707                 {
1708                         return false;
1709                 }
1710
1711                 __editItemIndex = longPressedItemIndex;
1712                 __beingEdited = true;
1713
1714                 pButton->SetButtonStatus(_BUTTON_STATUS_NORMAL);
1715
1716                 FloatRectangle itemBounds = pButton->GetBoundsF();
1717
1718                 if (__pEditItem)
1719                 {
1720                         __pToolbar->DetachChild(*__pEditItem);
1721
1722                         delete __pEditItem;
1723                         __pEditItem = null;
1724                 }
1725
1726                 __pEditItem = _Label::CreateLabelN();
1727                 SysTryCatch(NID_UI_CTRL, __pEditItem, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
1728
1729                 Canvas* pCanvas = pButton->GetCanvasN();
1730                 SysTryCatch(NID_UI_CTRL, pCanvas, , E_INVALID_STATE, "[E_INVALID_STATE] Unable to retrieve a Canvas.");
1731
1732                 Bitmap* pEditItemBitmap = new (std::nothrow) Bitmap();
1733                 result r = pEditItemBitmap->Construct(*pCanvas, FloatRectangle(0.0f, 0.0f, itemBounds.width, itemBounds.height));
1734
1735                 if (IsFailed(r))
1736                 {
1737                         delete pEditItemBitmap;
1738                         pEditItemBitmap = null;
1739
1740                         delete pCanvas;
1741
1742                         goto CATCH;
1743                 }
1744
1745                 __pEditItem->SetBounds(itemBounds);
1746                 __pEditItem->SetBackgroundBitmap(*pEditItemBitmap);
1747
1748                 delete pCanvas;
1749                 delete pEditItemBitmap;
1750
1751                 __pToolbar->AttachChild(*__pEditItem);
1752                 __pToolbar->SetChildAlwaysOnTop(*__pEditItem);
1753
1754                 __pToolbar->Draw();
1755         }
1756
1757     return true;
1758
1759 CATCH:
1760         if (__pEditItem)
1761         {
1762                 delete __pEditItem;
1763                 __pEditItem = null;
1764         }
1765
1766         return true;
1767 }
1768
1769 bool
1770 _ToolbarPresenter::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
1771 {
1772         ToolbarStyle style = __pToolbar->GetStyle();
1773
1774         if (!(style == TOOLBAR_TAB || style == TOOLBAR_TAB_WITH_TITLE || style == TOOLBAR_TAB_LARGE) || __pToolbar->GetItemCount() <= SEGMENTED_ITEM_MAX || __beingEdited == true || __tabMoved == false)
1775         {
1776                 return true;
1777         }
1778
1779         if (gesture.GetDirection() != _FLICK_DIRECTION_RIGHT && gesture.GetDirection() != _FLICK_DIRECTION_LEFT)
1780         {
1781                 return false;
1782         }
1783
1784         float distanceX = 0.0f;
1785         float distanceY = 0.0f;
1786         float xPosition = 0.0f;
1787         float itemsBeyondScreen = 0.0f;
1788
1789         gesture.GetDistance(distanceX, distanceY);
1790         SetFirstLoadedItemIndex();
1791         SetLastLoadedItemIndex();
1792         int itemCount = __pToolbar->GetItemCount();
1793         float itemWidth = __pToolbar->GetItem(0)->GetBoundsF().width;
1794
1795         if (distanceX < 0)  //left
1796         {
1797                 itemsBeyondScreen = (itemCount - 1) - __lastLoadedItemIndex;
1798                 xPosition = __pToolbar->GetItem(__lastLoadedItemIndex)->GetBoundsF().x;
1799                 if (xPosition < (3 * itemWidth))
1800                 {
1801                         __flickDistance = xPosition - (4 * itemWidth);
1802                 }
1803         }
1804         else //Right
1805         {
1806                 itemsBeyondScreen = __firstLoadedItemIndex;
1807                 xPosition = __pToolbar->GetItem(__firstLoadedItemIndex)->GetBoundsF().x;
1808                 if (xPosition < 0)
1809                 {
1810                         __flickDistance = -xPosition;
1811                 }
1812
1813         }
1814
1815         int itemMaxCount = 4;
1816
1817         if (itemsBeyondScreen >= (itemMaxCount - 1))
1818         {
1819                 __flickDistance = (3 * itemWidth);
1820         }
1821         else
1822         {
1823                 __flickDistance = (itemsBeyondScreen * itemWidth);
1824         }
1825
1826         if (distanceX < 0) //Left flick
1827         {
1828                 __flickMove = 0.006f;
1829                 __flickFlag = 0;
1830         }
1831         else if (distanceX > 0) //Right flick
1832         {
1833                 __flickMove = 0.006f;
1834                 __flickDistance = -(__flickDistance);
1835                 __flickFlag = 0;
1836         }
1837         else
1838         {
1839                 __flickMove = 0.0f;
1840                 __flickDistance = 0.0f;
1841                 __flickFlag = 0;
1842                 __moveDistance = 0.0f;
1843         }
1844
1845         StartFlickAnimationTimer();
1846
1847         return true;
1848 }
1849
1850 void
1851 _ToolbarPresenter::OnTimerExpired(Timer& timer)
1852 {
1853         Timer* onTimer = &timer;
1854
1855         if (onTimer == __pTitleSlideTimer)
1856         {
1857                 TimerForTitleSlideTimeout();
1858         }
1859
1860         if (onTimer == __pFlickAnimationTimer)
1861         {
1862                 StartFlickAnimation();
1863         }
1864
1865         return;
1866 }
1867
1868 void
1869 _ToolbarPresenter::OnDrawFocus(void)
1870 {
1871         return;
1872 }
1873
1874 void
1875 _ToolbarPresenter::OnChildControlFocusMoved(const _Control& control)
1876 {
1877         return;
1878 }
1879
1880 bool
1881 _ToolbarPresenter::IsChildControlFocusManage(void) const
1882 {
1883         return true;
1884 }
1885
1886 void
1887 _ToolbarPresenter::OnFocusableStateChanged(bool focusalbeState)
1888 {
1889         return;
1890 }
1891
1892 void
1893 _ToolbarPresenter::OnFocusModeStateChanged(void)
1894 {
1895         return;
1896 }
1897
1898 bool
1899 _ToolbarPresenter::OnFocusGained(const _Control& source)
1900 {
1901         //__focusPrevStatus = __pButton->GetButtonStatus();
1902         //__pButton->SetButtonStatus(_BUTTON_STATUS_HIGHLIGHTED);
1903         //__pButton->Invalidate();
1904
1905         return false;
1906 }
1907
1908 bool
1909 _ToolbarPresenter::OnFocusLost(const _Control& source)
1910 {
1911         //__pButton->SetButtonStatus(__focusPrevStatus);
1912         //__pButton->Invalidate();
1913
1914         return true;
1915 }
1916
1917 result
1918 _ToolbarPresenter::TimerForTitleSlideInit(void)
1919 {
1920         result r = E_SUCCESS;
1921
1922         if (__pTitleSlideTimer != null)
1923         {
1924                 delete __pTitleSlideTimer;
1925                 __pTitleSlideTimer = null;
1926         }
1927
1928         return r;
1929 }
1930
1931 result
1932 _ToolbarPresenter::TimerForTitleSlideStart(void)
1933 {
1934         result r = E_SUCCESS;
1935
1936         if (__pTitleSlideTimer == null)
1937         {
1938                 __pTitleSlideTimer = new (std::nothrow) Timer();
1939                 if (__pTitleSlideTimer == null)
1940                 {
1941                         r = E_OUT_OF_MEMORY;
1942                         goto CATCH;
1943                 }
1944
1945                 r = __pTitleSlideTimer->Construct(*this);
1946
1947                 if (IsFailed(r))
1948                 {
1949                         delete __pTitleSlideTimer;
1950                         goto CATCH;
1951                 }
1952         }
1953
1954         r = __pTitleSlideTimer->Start(100);
1955
1956         if (IsFailed(r))
1957         {
1958                 goto CATCH;
1959         }
1960
1961 CATCH:
1962         return r;
1963 }
1964
1965 result
1966 _ToolbarPresenter::TimerForTitleSlideTimeout(void)
1967 {
1968         Canvas* pCanvas = __pToolbar->GetCanvasN();
1969         SysTryReturnResult(NID_UI_CTRL, pCanvas, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pCanvas is invalid!");
1970
1971         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1972         pCanvas->Clear(__titleRect);
1973
1974         if (__pTitleBackgroundBitmap)
1975         {
1976                 pCanvas->DrawBitmap(CoordinateSystem::AlignToDevice(__titleRect), *__pTitleBackgroundBitmap);
1977         }
1978
1979         if (__pTitleTextObject->IsChanged())
1980         {
1981                 DrawTitleText(pCanvas);
1982         }
1983
1984         if (__pTitleTextObject->IsActionOn() == true)
1985         {
1986                 __pTitleTextObject->DrawWithOffset(*_CanvasImpl::GetInstance(*pCanvas));
1987
1988                 DrawTitleTextDimBitmap();
1989
1990                 if (__pTitleTextObject->GetRepeatCount() < 3)
1991                 {
1992                         TimerForTitleSlideStart();
1993                 }
1994         }
1995         else
1996         {
1997                 __pTitleTextObject->Draw(*_CanvasImpl::GetInstance(*pCanvas));
1998         }
1999
2000         delete pCanvas;
2001
2002         return E_SUCCESS;
2003 }
2004
2005 void
2006 _ToolbarPresenter::DrawTitleTextDimBitmap(void)
2007 {
2008         if (__pToolbar->IsUserBackgroundBitmap())
2009         {
2010                 return;
2011         }
2012
2013         float textDimWidth = 0.0f;
2014         float textDimHeight = 0.0f;
2015
2016         GET_SHAPE_CONFIG(HEADER::TAB_TEXT_DIM_WIDTH, __pToolbar->GetOrientation(), textDimWidth);
2017
2018         ToolbarStyle style = __pToolbar->GetStyle();
2019
2020         if (style == TOOLBAR_HEADER_SEGMENTED_WITH_TITLE || style == TOOLBAR_TAB_WITH_TITLE)
2021         {
2022                 GET_SHAPE_CONFIG(HEADER::TITLE_HEIGHT_WITH_SEGMENTED_ITEM, __pToolbar->GetOrientation(), textDimHeight);
2023         }
2024         else
2025         {
2026                 if (__pToolbar->GetDescriptionText() != L"")
2027                 {
2028                         textDimHeight = __titleRect.height;
2029                 }
2030                 else
2031                 {
2032                         textDimHeight = __pToolbar->GetBoundsF().height;
2033                 }
2034         }
2035
2036         Color titleTextDimColor;
2037         GET_COLOR_CONFIG(HEADER::TITLE_TEXT_DIM_NORMAL, titleTextDimColor);
2038
2039         Bitmap* pTitleTextDimLeftBitmap = null;
2040         GET_BITMAP_CONFIG_N(HEADER::TITLE_TEXT_DIM_EFFECT_LEFT, BITMAP_PIXEL_FORMAT_ARGB8888, pTitleTextDimLeftBitmap);
2041
2042         Bitmap* pReColorTitleTextDimLeftBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTitleTextDimLeftBitmap,
2043                         Color::GetColor(COLOR_ID_MAGENTA), titleTextDimColor);
2044
2045         if (pReColorTitleTextDimLeftBitmap)
2046         {
2047                 Canvas* pCanvas = __pToolbar->GetCanvasN();
2048                 FloatRectangle bounds = FloatRectangle(0.0f, 0.0f, textDimWidth, textDimHeight);
2049
2050                 if (pCanvas == null)
2051                 {
2052                         SysLog(NID_UI_CTRL, "Cannot get a canvas.");
2053                         return;
2054                 }
2055
2056                 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReColorTitleTextDimLeftBitmap))
2057                 {
2058                         pCanvas->DrawNinePatchedBitmap(bounds, *pReColorTitleTextDimLeftBitmap);
2059                 }
2060                 else
2061                 {
2062                         pCanvas->DrawBitmap(bounds, *pReColorTitleTextDimLeftBitmap,
2063                                         FloatRectangle(0.0f, 0.0f, pReColorTitleTextDimLeftBitmap->GetWidthF(), pReColorTitleTextDimLeftBitmap->GetHeightF()));
2064                 }
2065
2066                 delete pTitleTextDimLeftBitmap;
2067                 delete pReColorTitleTextDimLeftBitmap;
2068                 delete pCanvas;
2069         }
2070
2071         Bitmap* pTitleTextDimRightBitmap = null;
2072         GET_BITMAP_CONFIG_N(HEADER::TITLE_TEXT_DIM_EFFECT_RIGHT, BITMAP_PIXEL_FORMAT_ARGB8888, pTitleTextDimRightBitmap);
2073
2074         Bitmap* pReColorTitleTextDimRightBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTitleTextDimRightBitmap,
2075                         Color::GetColor(COLOR_ID_MAGENTA), titleTextDimColor);
2076
2077         if (pReColorTitleTextDimRightBitmap)
2078         {
2079                 Canvas* pCanvas = __pToolbar->GetCanvasN();
2080                 FloatRectangle bounds = FloatRectangle(__titleRect.width, 0.0f, textDimWidth, textDimHeight);
2081
2082                 if (pCanvas == null)
2083                 {
2084                         SysLog(NID_UI_CTRL, "Cannot get a canvas.");
2085                         return;
2086                 }
2087
2088                 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pReColorTitleTextDimRightBitmap))
2089                 {
2090                         pCanvas->DrawNinePatchedBitmap(bounds, *pReColorTitleTextDimRightBitmap);
2091                 }
2092                 else
2093                 {
2094                         pCanvas->DrawBitmap(bounds, *pReColorTitleTextDimRightBitmap,
2095                                         FloatRectangle(0.0f, 0.0f, pReColorTitleTextDimRightBitmap->GetWidthF(), pReColorTitleTextDimRightBitmap->GetHeightF()));
2096                 }
2097
2098                 delete pTitleTextDimRightBitmap;
2099                 delete pReColorTitleTextDimRightBitmap;
2100                 delete pCanvas;
2101         }
2102
2103         return;
2104 }
2105
2106 result
2107 _ToolbarPresenter::AdjustItemPositionX(float distance)
2108 {
2109         int index = 0;
2110         int itemCount = __pToolbar->GetItemCount();
2111         _Button* pItem = __pToolbar->GetItem(index);
2112
2113         while (pItem != null)
2114         {
2115                 FloatRectangle bounds = pItem->GetBoundsF();
2116                 bounds.x += distance;
2117                 pItem->SetBounds(bounds);
2118                 index++;
2119
2120                 if (index < itemCount)
2121                 {
2122                         pItem = __pToolbar->GetItem(index);
2123                 }
2124                 else
2125                 {
2126                         break;
2127                 }
2128         }
2129
2130         return E_SUCCESS;
2131 }
2132
2133 FloatRectangle
2134 _ToolbarPresenter::GetTitleTextBoundsF(void) const
2135 {
2136         return __titleRect;
2137 }
2138
2139 FloatRectangle
2140 _ToolbarPresenter::GetDescriptionBoundsF(void) const
2141 {
2142         return __descriptionRect;
2143 }
2144
2145 result
2146 _ToolbarPresenter::_SetModel(const _ToolbarModel& toolbarModel)
2147 {
2148         __pToolbarModel = const_cast<_ToolbarModel*>(&toolbarModel);
2149
2150         return E_SUCCESS;
2151 }
2152
2153 void
2154 _ToolbarPresenter::OnFontChanged(Font* pFont)
2155 {
2156         __pTextFont = pFont;
2157         __pTitleTextFont = pFont;
2158
2159         return;
2160 }
2161
2162 void
2163 _ToolbarPresenter::OnFontInfoRequested(unsigned long& style, int& size)
2164 {
2165         style = __fontStyle;
2166         size = _CoordinateSystemUtils::ConvertToInteger(__fontSize);
2167
2168         return;
2169 }
2170
2171 void
2172 _ToolbarPresenter::OnFontInfoRequested(unsigned long& style, float& size)
2173 {
2174         style = __fontStyle;
2175         size =  __fontSize;
2176
2177         return;
2178 }
2179
2180 void
2181 _ToolbarPresenter::OnAncestorVisibleStateChanged(const _Control& control)
2182 {
2183         if (__pTitleTextObject != null)
2184         {
2185                 __pTitleTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
2186                 __pTitleTextObject->Compose();
2187         }
2188
2189         __titleSliding = false;
2190
2191         return ;
2192 }
2193
2194 void
2195 _ToolbarPresenter::SetFontInfo(unsigned long style, float size)
2196 {
2197         __fontStyle = style;
2198         __fontSize = size;
2199
2200         return;
2201 }
2202
2203 void
2204 _ToolbarPresenter::StartFlickAnimation(void)
2205 {
2206         float distance = CalculateProgress(__flickMove);
2207
2208         __moveDistance = -(__flickDistance * distance);
2209         __flickDistance = (__flickDistance + __moveDistance);
2210         __flickMove = __flickMove + 0.006;
2211         __flickFlag++;
2212
2213         if (__flickFlag <= FLICK_ANIMATION_COUNT)
2214         {
2215                 StartFlickAnimationTimer();
2216         }
2217         else
2218         {
2219                 ResetFlickAnimationTimer();
2220                 SetItemFit(__firstLoadedItemIndex);
2221         }
2222
2223         AdjustItemPositionX(__moveDistance);
2224
2225         SetFirstLoadedItemIndex();
2226         SetLastLoadedItemIndex();
2227
2228         Draw();
2229
2230         return;
2231 }
2232
2233 result
2234 _ToolbarPresenter::StartFlickAnimationTimer(void)
2235 {
2236         result r = E_SUCCESS;
2237
2238         if (__pFlickAnimationTimer == null)
2239         {
2240                 __pFlickAnimationTimer = new (std::nothrow) Timer();
2241                 SysTryReturn(NID_UI_CTRL, (__pFlickAnimationTimer != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
2242
2243                 r = __pFlickAnimationTimer->Construct(*this);
2244                 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2245         }
2246         else
2247         {
2248                 __pFlickAnimationTimer->Cancel();
2249         }
2250
2251         r = __pFlickAnimationTimer->Start(FLICK_ANIMATION_TIMER_PERIOD);
2252         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
2253
2254         return r;
2255
2256 CATCH:
2257         ResetFlickAnimationTimer();
2258         return r;
2259 }
2260
2261 result
2262 _ToolbarPresenter::ResetFlickAnimationTimer(void)
2263 {
2264         if (__pFlickAnimationTimer)
2265         {
2266                 delete __pFlickAnimationTimer;
2267                 __pFlickAnimationTimer = null;
2268         }
2269
2270         __moveDistance = 0.0f;
2271
2272         return E_SUCCESS;
2273 }
2274
2275 void
2276 _ToolbarPresenter::SetFirstLoadedItemIndex(void)
2277 {
2278         int itemCount = __pToolbar->GetItemCount();
2279
2280         for (int i = 0; i < itemCount; i++)
2281         {
2282                 if (__pToolbar->GetItem(i)->GetBoundsF().x + (__pToolbar->GetItem(i)->GetBoundsF().width / 2) <= __pToolbar->GetItem(i)->GetBoundsF().width)
2283                 {
2284                         __firstLoadedItemIndex = i;
2285                 }
2286         }
2287
2288         return;
2289 }
2290
2291 int
2292 _ToolbarPresenter::GetFirstLoadedItemIndex(void)
2293 {
2294         return __firstLoadedItemIndex;
2295 }
2296
2297 void
2298 _ToolbarPresenter::SetLastLoadedItemIndex(void)
2299 {
2300         float width = 0.0f;
2301         int itemCount = __pToolbar->GetItemCount();
2302
2303         if (__pToolbar->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
2304         {
2305                 width = __portraitSize.width;
2306         }
2307         else
2308         {
2309                 width = __landscapeSize.width;
2310         }
2311
2312         for (int i = 0; i < itemCount; i++)
2313         {
2314                 float X = __pToolbar->GetItem(i)->GetBoundsF().x;
2315
2316                 if ((X + (__pToolbar->GetItem(i)->GetBoundsF().width / 2)) < width)
2317                 {
2318                         __lastLoadedItemIndex = i;
2319                 }
2320         }
2321
2322         return;
2323 }
2324
2325 float
2326 _ToolbarPresenter::CalculateProgress(float timeProgress) const
2327 {
2328         const float segments[3][3] = {{0.0f, 0.01f, 0.45f}, {0.45f, 0.80f, 0.908f}, {0.908f, 0.9999f, 1.0f}};
2329         float loc_5 = timeProgress / 1;
2330         int loc_6 = 3;  //Length of the segments array
2331         int loc_9 = (int)floor(loc_6 * loc_5);
2332
2333         if (loc_9 >= loc_6)
2334         {
2335                 loc_9 = loc_6 - 1;
2336         }
2337
2338         float loc_7 = (loc_5 - loc_9 * (1.0 / loc_6)) * loc_6;
2339         float loc_8[3];
2340
2341         for (int i = 0; i < 3; i++)
2342         {
2343                  loc_8[i] = segments[loc_9][i];
2344         }
2345
2346         float ret = 0 + 1 * (loc_8[0] + loc_7 * (2 * (1 - loc_7) * (loc_8[1] - loc_8[0]) + loc_7 * (loc_8[2] - loc_8[0])));
2347
2348         return ret;
2349 }
2350
2351 void
2352 _ToolbarPresenter::SetItemFit(int index)
2353 {
2354         if (index < 0)
2355         {
2356                 return;
2357         }
2358
2359         FloatPoint pt(0.0f, 0.0f);
2360         FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
2361
2362         float fitDistance = 0.0f;
2363         float tabLeftMargin = 0.0f;
2364         int itemCount = __pToolbar->GetItemCount();
2365
2366         GET_SHAPE_CONFIG(HEADER::TAB_LEFT_MARGIN, __pToolbar->GetOrientation(), tabLeftMargin);
2367
2368         _Button* pItem = __pToolbar->GetItem(index);
2369         SysTryReturnVoidResult(NID_UI_CTRL, pItem, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2370
2371         bounds = pItem->GetBoundsF();
2372
2373         fitDistance = -bounds.x + tabLeftMargin;
2374
2375         for (int i = 0; i < itemCount; i++)
2376         {
2377                 pItem = __pToolbar->GetItem(i);
2378                 SysTryReturnVoidResult(NID_UI_CTRL, pItem, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
2379
2380                 bounds = pItem->GetBoundsF();
2381                 bounds.x = bounds.x + fitDistance;
2382                 pItem->SetBounds(bounds);
2383         }
2384
2385         SetFirstLoadedItemIndex();
2386         SetLastLoadedItemIndex();
2387
2388         Draw();
2389
2390         return;
2391 }
2392
2393 void
2394 _ToolbarPresenter::OnVisualElementAnimationStarted(const VisualElementAnimation& animation, const String& keyName, VisualElement& target)
2395 {
2396         return;
2397 }
2398
2399 void
2400 _ToolbarPresenter::OnVisualElementAnimationRepeated(const VisualElementAnimation& animation, const String& keyName, VisualElement& target, long currentRepeatCount)
2401 {
2402         return;
2403 }
2404
2405 void
2406 _ToolbarPresenter::OnVisualElementAnimationFinished(const VisualElementAnimation& animation, const String& keyName, VisualElement& target, bool completedNormally)
2407 {
2408         return;
2409 }
2410
2411 }}} // Tizen::Ui::Controls