2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiCtrl_EditTimePresenter.cpp
20 * @brief This is the implementation file for the _EditTimePresenter class.
23 #include <FSysSettingInfo.h>
24 #include <FGrpColor.h>
25 #include <FUiAnimAnimationTransaction.h>
26 #include <FUiAnimVisualElementPropertyAnimation.h>
27 #include <FGrp_BitmapImpl.h>
28 #include <FGrp_TextTextObject.h>
29 #include <FGrp_TextTextSimple.h>
30 #include <FGrp_FontImpl.h>
31 #include "FUi_CoordinateSystemUtils.h"
32 #include "FUi_ResourceManager.h"
33 #include "FUiAnim_VisualElement.h"
34 #include "FUiCtrl_EditTimePresenter.h"
35 #include "FUiCtrl_EditTime.h"
36 #include "FUiCtrl_DateTimeModel.h"
37 #include "FUiCtrl_DateTimeUtils.h"
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Base;
42 using namespace Tizen::Graphics::_Text;
43 using namespace Tizen::Ui::Animations;
44 using namespace Tizen::System;
46 namespace Tizen { namespace Ui { namespace Controls
48 _EditTimePresenter::_EditTimePresenter(const String& title)
49 : __pEditDateTimeModel(null)
51 , __bounds(FloatRectangle())
52 , __titleBounds(FloatRectangle())
53 , __ampmString(String())
54 , __hourString(String())
55 , __minuteString(String())
58 , __is24hoursSet(false)
60 , __timePickerEnabled(true)
61 , __selectedId(DATETIME_ID_NONE)
62 , __lastSelectedId(DATETIME_ID_NONE)
63 , __focusId(DATETIME_ID_NONE)
64 , __touchMoveHandled(false)
65 , __pAmPmBgNormalColorReplacementBitmap(null)
66 , __pAmPmBgDisabledColorReplacementBitmap(null)
67 , __pAmPmBgPressedColorReplacementBitmap(null)
68 , __pAmPmBgHighlightedColorReplacementBitmap(null)
69 , __pAmPmBgEffectNomralBitmap(null)
70 , __pAmPmBgEffectPressedBitmap(null)
71 , __pAmPmBgEffectDisabledBitmap(null)
72 , __pColonColorReplacementBitmap(null)
73 , __pColonDisabledColorReplacementBitmap(null)
74 , __pContentBgNormalColorReplacementBitmap(null)
75 , __pContentBgDisabledColorReplacementBitmap(null)
76 , __pContentBgPressedColorReplacementBitmap(null)
77 , __pContentBgHighlightedColorReplacementBitmap(null)
78 , __pContentBgEffectNormalBitmap(null)
79 , __pContentBgEffectPressedBitmap(null)
80 , __pContentBgEffectDisabledBitmap(null)
81 , __pContentProvider(null)
85 , __amPmTextSize(0.0f)
86 , __titleFontSize(0.0f)
87 , __timeFontSize(0.0f)
88 , __isAnimating(false)
89 , __isEditTimeInitialized(false)
90 , __isEnterKeyPressed(false)
96 _EditTimePresenter::~_EditTimePresenter(void)
98 __textObject.RemoveAll();
99 __titleObject.RemoveAll();
101 delete __pEditDateTimeModel;
102 __pEditDateTimeModel = null;
104 delete __pAmPmBgNormalColorReplacementBitmap;
105 __pAmPmBgNormalColorReplacementBitmap = null;
107 delete __pAmPmBgDisabledColorReplacementBitmap;
108 __pAmPmBgDisabledColorReplacementBitmap = null;
110 delete __pAmPmBgPressedColorReplacementBitmap;
111 __pAmPmBgPressedColorReplacementBitmap = null;
113 delete __pAmPmBgHighlightedColorReplacementBitmap;
114 __pAmPmBgHighlightedColorReplacementBitmap = null;
116 delete __pAmPmBgEffectNomralBitmap;
117 __pAmPmBgEffectNomralBitmap = null;
119 delete __pAmPmBgEffectPressedBitmap;
120 __pAmPmBgEffectPressedBitmap = null;
122 delete __pAmPmBgEffectDisabledBitmap;
123 __pAmPmBgEffectDisabledBitmap = null;
125 delete __pColonColorReplacementBitmap;
126 __pColonColorReplacementBitmap = null;
128 delete __pColonDisabledColorReplacementBitmap;
129 __pColonDisabledColorReplacementBitmap = null;
131 delete __pContentBgNormalColorReplacementBitmap;
132 __pContentBgNormalColorReplacementBitmap = null;
134 delete __pContentBgDisabledColorReplacementBitmap;
135 __pContentBgDisabledColorReplacementBitmap = null;
137 delete __pContentBgPressedColorReplacementBitmap;
138 __pContentBgPressedColorReplacementBitmap = null;
140 delete __pContentBgHighlightedColorReplacementBitmap;
141 __pContentBgHighlightedColorReplacementBitmap = null;
143 delete __pContentBgEffectNormalBitmap;
144 __pContentBgEffectNormalBitmap = null;
146 delete __pContentBgEffectPressedBitmap;
147 __pContentBgEffectPressedBitmap = null;
149 delete __pContentBgEffectDisabledBitmap;
150 __pContentBgEffectDisabledBitmap = null;
152 if (__transactionId != 0)
154 AnimationTransaction::Stop(__transactionId);
157 if (__pContentProvider != null)
159 __pEditTime->GetVisualElement()->DetachChild(__pContentProvider);
160 __pContentProvider->Destroy();
161 __pContentProvider = null;
166 _EditTimePresenter::CreateInstanceN(const _EditTime& editTime, const String& title)
168 _EditTimePresenter* pEditTimePresenter = new (std::nothrow) _EditTimePresenter(title);
169 SysTryReturn(NID_UI_CTRL, pEditTimePresenter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
171 pEditTimePresenter->__pEditTime = const_cast <_EditTime*>(&editTime);
173 pEditTimePresenter->__pEditDateTimeModel = new (std::nothrow) _DateTimeModel;
174 SysTryCatch(NID_UI_CTRL, pEditTimePresenter->__pEditDateTimeModel, , E_OUT_OF_MEMORY,
175 "[E_OUT_OF_MEMORY] Memory allocation failed.");
177 return pEditTimePresenter;
180 delete pEditTimePresenter;
185 _EditTimePresenter::GetTime(void) const
188 time.SetValue(DATETIME_YEAR_MIN, DATETIME_MONTH_MIN, DATETIME_DAY_MIN, GetHour(), GetMinute(), 0);
194 _EditTimePresenter::GetHour(void) const
196 return __pEditDateTimeModel->GetHour();
200 _EditTimePresenter::GetMinute(void) const
202 return __pEditDateTimeModel->GetMinute();
206 _EditTimePresenter::SetTime(const DateTime& time)
208 __pEditDateTimeModel->SetDateTime(time);
212 _EditTimePresenter::SetCurrentTime(void)
214 __pEditDateTimeModel->SetCurrentDateTime();
219 _EditTimePresenter::SetHour(int hour)
221 return __pEditDateTimeModel->SetHour(hour);
225 _EditTimePresenter::SetMinute(int minute)
227 return __pEditDateTimeModel->SetMinute(minute);
231 _EditTimePresenter::SetTimePickerEnabled(bool enable)
233 __timePickerEnabled = enable;
238 _EditTimePresenter::IsTimePickerEnabled(void) const
240 return __timePickerEnabled;
244 _EditTimePresenter::Set24HourNotationEnabled(bool enable)
247 __is24hoursSet = true;
252 _EditTimePresenter::Is24HourNotationEnabled(void) const
258 _EditTimePresenter::SetTimeConversion(void)
260 int hour = GetHour();
261 int minute = GetMinute();
265 int max = DATETIME_HOUR_MAX_FOR_24NOTATION;
269 __hourString.Format(10, L"%02d", hour - max);
271 else if (hour == DATETIME_HOUR_MIN)
273 __hourString.Format(10, L"%02d", hour + DATETIME_HOUR_MAX_FOR_24NOTATION);
277 __hourString.Format(10, L"%02d", hour);
280 __minuteString.Format(10, L"%02d", minute);
284 __hourString.Format(10, L"%02d", hour);
285 __minuteString.Format(10, L"%02d", minute);
292 _EditTimePresenter::SetAmEnabled(bool amEnable)
297 _DateTimeUtils dateTimeUtils;
298 dateTimeUtils.GetAmPm(textAm, AM_TYPE);
299 dateTimeUtils.GetAmPm(textPm, PM_TYPE);
301 __amEnable = amEnable;
302 int hour = GetHour();
306 __ampmString = textAm;
307 if (hour >= DATETIME_HOUR_MAX_FOR_24NOTATION)
309 SetHour(hour - DATETIME_HOUR_MAX_FOR_24NOTATION);
314 __ampmString = textPm;
315 if (hour < DATETIME_HOUR_MAX_FOR_24NOTATION)
317 SetHour(hour + DATETIME_HOUR_MAX_FOR_24NOTATION);
325 _EditTimePresenter::GetAmEnabled(void) const
331 _EditTimePresenter::GetDisplayAreaBoundsFromHoursStyle(_DateTimeId displayBoxId) const
333 SysTryReturn(NID_UI_CTRL, displayBoxId >= DATETIME_ID_HOUR && displayBoxId <= DATETIME_ID_AMPM, FloatRectangle(),
334 E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] displayBoxId is out of range.");
336 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
338 float editTimeHeight = 0.0f;
339 float colonWidth = 0.0f;
340 float timeAmPmMargin = 0.0f;
341 float colonMargin = 0.0f;
342 float timeElementWidth = 0.0f;
343 float amPmHeight = 0.0f;
344 float timeHeight = 0.0f;
345 float titleTimeMargin = 0.0f;
346 float leftMargin = 0.0f;
348 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
349 GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonWidth);
350 GET_SHAPE_CONFIG(EDITTIME::TIME_AMPM_MARGIN, __pEditTime->GetOrientation(), timeAmPmMargin);
351 GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
352 GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), amPmHeight);
353 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
354 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
356 GET_SHAPE_CONFIG(EDITTIME::TIME_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), leftMargin);
358 if (__pEditTime->GetBoundsF().height > editTimeHeight)
360 editTimeHeight = __pEditTime->GetBoundsF().height;
363 bounds.y = (editTimeHeight - timeHeight) / 2.0f;
365 if (!__title.IsEmpty())
367 if (displayBoxId == DATETIME_ID_AMPM)
369 bounds.y = __titleBounds.y + __titleBounds.height;
373 bounds.y = __titleBounds.y + __titleBounds.height + titleTimeMargin;
377 bounds.x = leftMargin;
378 bounds.height = timeHeight;
380 timeElementWidth = GetTimeElementWidth();
382 if (displayBoxId == DATETIME_ID_HOUR)
384 bounds.width = timeElementWidth;
386 else if (displayBoxId == DATETIME_ID_MINUTE)
388 bounds.x = bounds.x + timeElementWidth + colonWidth + (2.0f * colonMargin);
389 bounds.width = timeElementWidth;
391 else if (displayBoxId == DATETIME_ID_AMPM)
393 bounds.x = leftMargin + (2.0f * timeElementWidth) + colonWidth + (2.0f * colonMargin) + timeAmPmMargin;
395 if (__title.IsEmpty())
397 bounds.y = (editTimeHeight - amPmHeight) / 2.0f;
400 GET_SHAPE_CONFIG(EDITTIME::AMPM_WIDTH, __pEditTime->GetOrientation(), bounds.width);
401 bounds.height = amPmHeight;
408 _EditTimePresenter::GetTextWidth(_DateTimeId boxId) const
410 result r = E_SUCCESS;
412 TextObject dateObject;
416 hourString.Format(10, L"%02d", GetHour());
417 minuteString.Format(10, L"%02d", GetMinute());
419 r = dateObject.Construct();
420 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
422 TextSimple* pSimpleText = null;
424 if (boxId == DATETIME_ID_HOUR)
426 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(hourString.GetPointer())), hourString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
428 else if (boxId == DATETIME_ID_MINUTE)
430 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(minuteString.GetPointer())), minuteString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
433 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), dim.width, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
435 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
437 dateObject.AppendElement(*pSimpleText);
438 dateObject.SetFont(__pFont, 0, dateObject.GetTextLength());
439 dim = dateObject.GetTextExtentF(0, dateObject.GetTextLength());
441 dateObject.RemoveAll();
446 _EditTimePresenter::SetTitleBounds(void)
448 GET_SHAPE_CONFIG(EDITTIME::TITLE_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), __titleBounds.x);
449 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), __titleBounds.height);
451 __titleBounds.width = __pEditTime->GetBoundsF().width - __titleBounds.x;
456 _EditTimePresenter::GetTitleBounds(void) const
458 return __titleBounds;
462 _EditTimePresenter::LoadResource(void)
464 result r = E_SUCCESS;
466 Color buttonNormalBgColor;
467 Color buttonDisabledBgColor;
468 Color buttonPressedColor;
469 Color buttonHighlightedColor;
470 Color contentNormalBgColor;
471 Color contentDisabledBgColor;
472 Color contentPressedColor;
473 Color contentHighlightedColor;
474 Color colonTextColor;
475 Color colonTextDisabledColor;
476 Bitmap* pTempBitmap = null;
478 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_NORMAL, buttonNormalBgColor);
479 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_PRESSED, buttonPressedColor);
480 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_DISABLED, buttonDisabledBgColor);
481 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_HIGHLIGHTED, buttonHighlightedColor);
483 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_NORMAL, contentNormalBgColor);
484 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_DISABLED, contentDisabledBgColor);
485 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentPressedColor);
486 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_HIGHLIGHTED, contentHighlightedColor);
488 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, colonTextColor);
489 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, colonTextDisabledColor);
491 GET_SHAPE_CONFIG(EDITTIME::AMPM_FONT_SIZE, __pEditTime->GetOrientation(), __amPmTextSize);
493 r = GET_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
494 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
496 __pColonColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA),
498 SysTryCatch(NID_UI_CTRL, (__pColonColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
499 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
501 __pColonDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA),
502 colonTextDisabledColor);
503 SysTryCatch(NID_UI_CTRL, (__pColonDisabledColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
504 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
509 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, buttonNormalBgColor, __pAmPmBgNormalColorReplacementBitmap);
510 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
512 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonDisabledBgColor, __pAmPmBgDisabledColorReplacementBitmap);
513 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
515 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonPressedColor, __pAmPmBgPressedColorReplacementBitmap);
516 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
518 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonHighlightedColor, __pAmPmBgHighlightedColorReplacementBitmap);
519 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
521 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, contentNormalBgColor, __pContentBgNormalColorReplacementBitmap);
522 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
524 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, contentPressedColor, __pContentBgPressedColorReplacementBitmap);
525 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
527 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, contentDisabledBgColor, __pContentBgDisabledColorReplacementBitmap);
528 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
530 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, contentHighlightedColor, __pContentBgHighlightedColorReplacementBitmap);
531 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
533 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectNomralBitmap);
534 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
536 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectPressedBitmap);
537 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
539 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectDisabledBitmap);
540 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
542 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectNormalBitmap);
543 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
545 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectPressedBitmap);
546 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
548 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectDisabledBitmap);
549 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
554 delete __pAmPmBgNormalColorReplacementBitmap;
555 __pAmPmBgNormalColorReplacementBitmap = null;
557 delete __pAmPmBgPressedColorReplacementBitmap;
558 __pAmPmBgPressedColorReplacementBitmap = null;
560 delete __pAmPmBgDisabledColorReplacementBitmap;
561 __pAmPmBgDisabledColorReplacementBitmap = null;
563 delete __pAmPmBgHighlightedColorReplacementBitmap;
564 __pAmPmBgHighlightedColorReplacementBitmap = null;
566 delete __pContentBgNormalColorReplacementBitmap;
567 __pContentBgNormalColorReplacementBitmap = null;
569 delete __pContentBgPressedColorReplacementBitmap;
570 __pContentBgPressedColorReplacementBitmap = null;
572 delete __pContentBgDisabledColorReplacementBitmap;
573 __pContentBgDisabledColorReplacementBitmap = null;
575 delete __pContentBgHighlightedColorReplacementBitmap;
576 __pContentBgHighlightedColorReplacementBitmap = null;
578 delete __pAmPmBgEffectNomralBitmap;
579 __pAmPmBgEffectNomralBitmap = null;
581 delete __pAmPmBgEffectPressedBitmap;
582 __pAmPmBgEffectPressedBitmap = null;
584 delete __pAmPmBgEffectDisabledBitmap;
585 __pAmPmBgEffectDisabledBitmap = null;
587 delete __pContentBgEffectNormalBitmap;
588 __pContentBgEffectNormalBitmap = null;
590 delete __pContentBgEffectPressedBitmap;
591 __pContentBgEffectPressedBitmap = null;
593 delete __pContentBgEffectDisabledBitmap;
594 __pContentBgEffectDisabledBitmap = null;
596 delete __pColonColorReplacementBitmap;
597 __pColonColorReplacementBitmap = null;
599 delete __pColonDisabledColorReplacementBitmap;
600 __pColonDisabledColorReplacementBitmap = null;
606 _EditTimePresenter::DrawResourceBitmap(Canvas& canvas, const FloatRectangle& bounds, Bitmap* pBitmap)
608 result r = E_SUCCESS;
615 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
617 r = canvas.DrawNinePatchedBitmap(bounds, *pBitmap);
618 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
622 r = canvas.DrawBitmap(bounds, *pBitmap);
623 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
630 _EditTimePresenter::GetTimeElementWidth(void) const
632 FloatRectangle bounds;
633 FloatDimension minSize;
634 bounds = __pEditTime->GetBoundsF();
636 float timeElementWidth = 0.0f;
637 float timeElementMinWidth = 0.0f;
638 float editTimeWidth = 0.0f;
640 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), timeElementWidth);
641 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_MIN_WIDTH, __pEditTime->GetOrientation(), timeElementMinWidth);
642 GET_SHAPE_CONFIG(EDITTIME::WIDTH, __pEditTime->GetOrientation(), editTimeWidth);
644 GET_DIMENSION_CONFIG(EDITTIME::MIN_SIZE, __pEditTime->GetOrientation(), minSize);
646 if (bounds.width >= editTimeWidth)
648 return timeElementWidth;
651 if (bounds.width <= minSize.width)
653 timeElementWidth = timeElementMinWidth;
655 else if (bounds.width < editTimeWidth && bounds.width > minSize.width)
657 timeElementWidth = timeElementWidth -
658 ((timeElementWidth - timeElementMinWidth) / (editTimeWidth - minSize.width)) * (editTimeWidth - bounds.width);
661 return timeElementWidth;
665 _EditTimePresenter::InitializeTitleObject(void)
667 result r = E_SUCCESS;
669 Color titleNormalColor;
671 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_NORMAL, titleNormalColor);
673 r = __titleObject.Construct();
674 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
676 TextSimple* pSimpleText = null;
678 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__title.GetPointer())), __title.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
679 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
681 __titleObject.AppendElement(*pSimpleText);
683 __titleObject.SetForegroundColor(titleNormalColor, 0, __titleObject.GetTextLength());
684 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
685 __titleObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
686 __titleObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
687 __titleObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
688 __titleObject.SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
694 _EditTimePresenter::InitializeTextObject(void)
696 result r = E_SUCCESS;
698 r = __textObject.Construct();
699 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
701 TextSimple* pSimpleText = new (std::nothrow)TextSimple(null, 0, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
702 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
703 "[E_OUT_OF_MEMORY] Memory allocation failed.");
705 __textObject.AppendElement(*pSimpleText);
707 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
708 __textObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
709 __textObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
710 __textObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
716 _EditTimePresenter::Draw(void)
718 result r = E_SUCCESS;
725 Canvas* pCanvas = __pEditTime->GetCanvasN();
727 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), r, "Failed to get canvas.");
729 FloatRectangle colonBounds(0.0f, 0.0f, 0.0f, 0.0f);
731 float colonMargin = 0.0f;
735 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
738 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
739 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
740 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
741 bool isCustomBitmap = false;
742 Bitmap* pReplacementBitmap = null;
743 Bitmap* pEffectBitmap = null;
745 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
746 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
750 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
752 if (!__pEditTime->IsEnabled())
754 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_DISABLED);
755 pReplacementBitmap = __pAmPmBgDisabledColorReplacementBitmap;
756 pEffectBitmap = __pAmPmBgEffectDisabledBitmap;
758 else if (__selectedId != DATETIME_ID_AMPM)
760 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_NORMAL);
761 pReplacementBitmap = __pAmPmBgNormalColorReplacementBitmap;
762 pEffectBitmap = __pAmPmBgEffectNomralBitmap;
766 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_PRESSED);
767 pReplacementBitmap = __pAmPmBgPressedColorReplacementBitmap;
768 pEffectBitmap = __pAmPmBgEffectPressedBitmap;
772 if (GetHour() >= DATETIME_HOUR_MAX_FOR_24NOTATION)
783 GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonBounds.width);
784 GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
785 GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), colonBounds.height);
787 colonBounds.x = hourBounds.x + hourBounds.width + colonMargin;
788 colonBounds.y = hourBounds.y + (hourBounds.height - colonBounds.height) / 2.0f;
790 if (!__title.IsEmpty())
792 r = DrawTitle(*pCanvas);
793 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
796 r = DrawText(*pCanvas, hourBounds, __hourString, DATETIME_ID_HOUR);
797 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
799 r = DrawText(*pCanvas, minuteBounds, __minuteString, DATETIME_ID_MINUTE);
800 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
802 r = DrawColon(*pCanvas, colonBounds);
803 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
807 r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap);
808 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
812 r = DrawResourceBitmap(*pCanvas, ampmBounds, pEffectBitmap);
813 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
816 r = DrawText(*pCanvas, ampmBounds, __ampmString, DATETIME_ID_AMPM, __amPmTextSize);
817 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
826 _EditTimePresenter::DrawFocus(void)
828 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
830 Canvas* pCanvas = __pEditTime->GetCanvasN();
831 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
833 if (__focusId == DATETIME_ID_HOUR)
835 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
837 else if (__focusId == DATETIME_ID_MINUTE)
839 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
841 else if (__focusId == DATETIME_ID_AMPM)
843 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
845 result r = E_SUCCESS;
847 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
849 r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
850 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
854 r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
855 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
867 _EditTimePresenter::DrawColon(Canvas& canvas, const FloatRectangle& bounds)
869 result r = E_SUCCESS;
871 if (!__pEditTime->IsEnabled())
873 r = DrawResourceBitmap(canvas, bounds, __pColonDisabledColorReplacementBitmap);
877 r = DrawResourceBitmap(canvas, bounds, __pColonColorReplacementBitmap);
884 _EditTimePresenter::DrawTitle(Canvas& canvas)
886 if (!__pEditTime->IsEnabled())
888 Color titleDisabledColor;
889 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_DISABLED, titleDisabledColor);
890 __titleObject.SetForegroundColor(titleDisabledColor, 0, __titleObject.GetTextLength());
893 (_FontImpl::GetInstance(*__pFont))->SetSize(__titleFontSize);
894 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
895 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
897 __titleObject.Draw(*_CanvasImpl::GetInstance(canvas));
903 _EditTimePresenter::DrawContentBitmap(Canvas& canvas, const FloatRectangle& bounds, _DateTimeId boxId)
905 result r = E_SUCCESS;
907 bool isCustomBitmap = false;
908 Bitmap* pReplacementBitmap = null;
909 Bitmap* pEffectBitmap = null;
911 if (!__pEditTime->IsEnabled())
913 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_DISABLED);
914 pReplacementBitmap = __pContentBgDisabledColorReplacementBitmap;
915 pEffectBitmap = __pContentBgEffectDisabledBitmap;
917 else if (__selectedId != boxId)
919 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated() &&
920 (GetLastSelectedId() == boxId))
922 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
923 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
924 pEffectBitmap = __pContentBgEffectPressedBitmap;
928 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_NORMAL);
929 pReplacementBitmap = __pContentBgNormalColorReplacementBitmap;
930 pEffectBitmap = __pContentBgEffectNormalBitmap;
935 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
936 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
937 pEffectBitmap = __pContentBgEffectPressedBitmap;
940 r = DrawResourceBitmap(canvas, bounds, pReplacementBitmap);
941 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
945 r = DrawResourceBitmap(canvas, bounds, pEffectBitmap);
946 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
953 _EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId, float textSize)
955 result r = E_SUCCESS;
958 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
960 if (!__pEditTime->IsEnabled())
962 if (boxId == DATETIME_ID_AMPM)
964 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_DISABLED, textColor);
968 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, textColor);
973 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, textColor);
975 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated() &&
976 (GetLastSelectedId() == boxId))
978 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
979 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
982 if (boxId == DATETIME_ID_AMPM)
984 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_NORMAL, textColor);
987 if (boxId > -1 && boxId == __selectedId)
989 if (boxId == DATETIME_ID_AMPM)
991 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_PRESSED, textColor);
995 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
996 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
1001 if (boxId != DATETIME_ID_AMPM)
1003 DrawContentBitmap(canvas, bounds, boxId);
1006 FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
1007 drawAreaBounds = bounds;
1009 TextSimple* pSimpleText = null;
1010 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(text.GetPointer())), text.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1011 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1013 __textObject.RemoveAll();
1015 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1016 __textObject.AppendElement(*pSimpleText);
1018 if (boxId == DATETIME_ID_AMPM)
1020 (_FontImpl::GetInstance(*__pFont))->SetSize(textSize);
1022 if (__isFocused && __focusId == boxId)
1024 if (boxId == DATETIME_ID_AMPM)
1026 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_HIGHLIGHTED, textColor);
1030 GET_COLOR_CONFIG(EDITTIME::TEXT_HIGHLIGHTED, textColor);
1036 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1038 __textObject.SetForegroundColor(textColor, 0, __textObject.GetTextLength());
1039 __textObject.SetBounds(drawAreaBounds);
1040 __textObject.Draw(*_CanvasImpl::GetInstance(canvas));
1046 _EditTimePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
1048 _DateTimeId displayBoxId = DATETIME_ID_NONE;
1050 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1051 FloatRectangle hoursBounds(0.0f, 0.0f, 0.0f, 0.0f);
1052 FloatRectangle minutesBounds(0.0f, 0.0f, 0.0f, 0.0f);
1056 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1059 hoursBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1060 minutesBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1062 if (point.y < hoursBounds.y || point.y > hoursBounds.y + hoursBounds.height)
1064 return displayBoxId;
1067 if (hoursBounds.Contains(point))
1069 displayBoxId = DATETIME_ID_HOUR;
1071 else if (minutesBounds.Contains(point))
1073 displayBoxId = DATETIME_ID_MINUTE;
1075 else if (ampmBounds.Contains(point))
1077 displayBoxId = DATETIME_ID_AMPM;
1080 return displayBoxId;
1084 _EditTimePresenter::SetLastSelectedId(_DateTimeId boxId)
1086 __lastSelectedId = boxId;
1091 _EditTimePresenter::GetLastSelectedId(void) const
1093 return __lastSelectedId;
1097 _EditTimePresenter::SetFocusedElement()
1099 if (__isEnterKeyPressed)
1101 __isEnterKeyPressed = false;
1104 if (__focusId == DATETIME_ID_NONE || __focusId == DATETIME_ID_AMPM)
1106 __focusId = DATETIME_ID_HOUR;
1113 _EditTimePresenter::SetFocusState(bool isFocused)
1115 __isFocused = isFocused;
1120 _EditTimePresenter::OnFocusLost(const _Control &source)
1122 if (!__isEnterKeyPressed || __focusId == DATETIME_ID_AMPM)
1124 __focusId = DATETIME_ID_NONE;
1126 __isFocused = false;
1127 __pEditTime->Invalidate();
1132 _EditTimePresenter::OnFocusModeStateChanged(void)
1134 __isFocused = false;
1135 __focusId = DATETIME_ID_NONE;
1136 __pEditTime->Invalidate();
1141 _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1147 _KeyCode keyCode = keyInfo.GetKeyCode();
1153 __isEnterKeyPressed = false;
1154 if (__focusId == DATETIME_ID_HOUR)
1156 __focusId = DATETIME_ID_MINUTE;
1158 else if (__focusId == DATETIME_ID_MINUTE)
1160 if (!Is24HourNotationEnabled())
1162 __focusId = DATETIME_ID_AMPM;
1165 else if (__focusId == DATETIME_ID_AMPM)
1170 __pEditTime->Invalidate();
1175 __isEnterKeyPressed = false;
1176 if (__focusId == DATETIME_ID_MINUTE)
1178 __focusId = DATETIME_ID_HOUR;
1180 else if (__focusId == DATETIME_ID_AMPM)
1182 __focusId = DATETIME_ID_MINUTE;
1184 else if (__focusId == DATETIME_ID_HOUR)
1188 __pEditTime->Invalidate();
1201 _EditTimePresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1207 _KeyCode keyCode = keyInfo.GetKeyCode();
1211 VisualElement *pEditTimeElement = __pEditTime->GetVisualElement();
1212 result r = GetLastResult();
1213 SysTryReturn(NID_UI_CTRL, (pEditTimeElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
1214 pEditTimeElement->RemoveAllAnimations();
1219 int displayValue = -1;
1221 _DateTimeId boxId = DATETIME_ID_HOUR;
1227 __isEnterKeyPressed = true;
1228 if (__focusId == DATETIME_ID_HOUR)
1230 boxId = DATETIME_ID_HOUR;
1231 if (__pEditTime->GetDateTimeBar() != null)
1233 if (!Is24HourNotationEnabled())
1237 minValue = DATETIME_HOUR_MIN + 1;
1238 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1239 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1241 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1243 minValue = DATETIME_HOUR_MIN + 1;
1244 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1245 displayValue = __pEditTime->GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1249 minValue = DATETIME_HOUR_MIN + 1;
1250 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1251 displayValue = __pEditTime->GetHour();
1256 minValue = DATETIME_HOUR_MIN;
1257 maxValue = DATETIME_HOUR_MAX;
1258 displayValue = __pEditTime->GetHour();
1261 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1263 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1267 else if (__focusId == DATETIME_ID_MINUTE)
1269 if (__pEditTime->GetDateTimeBar() != null)
1271 minValue = DATETIME_MINUTE_MIN;
1272 maxValue = DATETIME_MINUTE_MAX;
1273 displayValue = __pEditTime->GetMinute();
1275 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1277 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1280 boxId = DATETIME_ID_MINUTE;
1282 else if (__focusId == DATETIME_ID_AMPM)
1284 SetAmEnabled(!GetAmEnabled());
1285 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1286 boxId = DATETIME_ID_AMPM;
1288 __pEditTime->Invalidate();
1291 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM))
1293 FloatRectangle absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1295 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1296 bounds = GetDisplayAreaBoundsFromHoursStyle(boxId);
1297 bounds.x += absoluteBounds.x;
1299 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1300 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1301 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1302 __pEditTime->GetDateTimeBar()->Open();
1303 UpdateLastSelectedValue(boxId, false);
1317 _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1319 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1321 if (&source != __pEditTime)
1326 __touchMoveHandled = false;
1328 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
1329 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1330 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1332 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1333 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1337 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1340 FloatPoint point = touchinfo.GetCurrentPosition();
1342 _DateTimeId boxId = GetBoxIdFromPosition(point);
1346 int displayValue = -1;
1348 if (boxId == DATETIME_ID_HOUR)
1350 if (__pEditTime->GetDateTimeBar() != null)
1356 minValue = DATETIME_HOUR_MIN + 1;
1357 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1358 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1360 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1362 minValue = DATETIME_HOUR_MIN + 1;
1363 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1364 displayValue = GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1368 minValue = DATETIME_HOUR_MIN + 1;
1369 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1370 displayValue = GetHour();
1375 minValue = DATETIME_HOUR_MIN;
1376 maxValue = DATETIME_HOUR_MAX;
1377 displayValue = GetHour();
1380 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1382 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1385 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1388 __bounds = hourBounds;
1390 else if (boxId == DATETIME_ID_MINUTE)
1392 if (__pEditTime->GetDateTimeBar() != null)
1394 minValue = DATETIME_MINUTE_MIN;
1395 maxValue = DATETIME_MINUTE_MAX;
1396 displayValue = GetMinute();
1398 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1400 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1403 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1406 __bounds = minuteBounds;
1408 else if (boxId == DATETIME_ID_AMPM)
1410 __selectedId = boxId;
1411 __bounds = ampmBounds;
1416 __selectedId = DATETIME_ID_NONE;
1420 __selectedId = boxId;
1426 _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1428 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1430 if (&source != __pEditTime)
1435 FloatRectangle bounds = __pEditTime->GetBoundsF();
1437 FloatPoint startPoint(0.0f, 0.0f);
1439 float titleHeight = 0;
1440 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), titleHeight);
1442 __bounds = FloatRectangle(0.0f, titleHeight, bounds.width, bounds.height);
1444 FloatPoint point = touchinfo.GetCurrentPosition();
1446 _DateTimeId boxId = GetBoxIdFromPosition(point);
1448 if ((boxId == GetLastSelectedId() && boxId != DATETIME_ID_AMPM) || boxId != __selectedId || boxId == DATETIME_ID_NONE)
1450 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1452 __pEditTime->GetDateTimeBar()->CloseDateTimeBar();
1455 __selectedId = DATETIME_ID_NONE;
1456 SetLastSelectedId(__selectedId);
1462 UpdateLastSelectedValue(__selectedId, true);
1463 if (GetLastSelectedId() == DATETIME_ID_AMPM)
1470 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
1472 __pEditTime->SetFocused(true);
1474 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1475 bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
1476 FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1477 absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1478 bounds.x += absoluteBounds.x;
1480 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1482 if (__pEditTime->GetDateTimeBar()->IsActivated())
1484 __pEditTime->GetDateTimeBar()->RemoveAllAnimations();
1485 __pEditTime->GetDateTimeBar()->Close();
1486 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1487 __pEditTime->GetDateTimeBar()->Open();
1491 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1492 __pEditTime->GetDateTimeBar()->Open();
1496 __selectedId = DATETIME_ID_NONE;
1501 _EditTimePresenter::UpdateLastSelectedValue(_DateTimeId boxId, bool isTouchPressed)
1503 __selectedId = boxId;
1504 SetLastSelectedId(boxId);
1506 __lastSelectedValue = "";
1508 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1510 int hours = GetHour();
1512 if (!Is24HourNotationEnabled())
1516 if (hours == DATETIME_HOUR_MIN)
1518 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1521 __lastSelectedValue.Format(10, L"%02d", hours);
1524 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1527 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1529 __lastSelectedValue.Format(10, L"%02d", GetMinute());
1532 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1535 else if (GetLastSelectedId() == DATETIME_ID_AMPM)
1537 SetAmEnabled(!GetAmEnabled());
1538 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1541 __pEditTime->UpdateAccessibilityElement();
1542 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1544 __selectedId = DATETIME_ID_NONE;
1546 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1548 __pEditTime->GetDateTimeBar()->SetVisibleState(false);
1549 __pEditTime->GetDateTimeBar()->Close();
1553 __selectedId = DATETIME_ID_NONE;
1554 __pEditTime->Invalidate();
1559 _EditTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1561 if (&source != __pEditTime)
1566 __selectedId = DATETIME_ID_NONE;
1572 _EditTimePresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1574 if (&source != __pEditTime)
1579 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1588 _EditTimePresenter::OnTouchMoveHandled(const _Control& control)
1590 __touchMoveHandled = true;
1591 __selectedId = DATETIME_ID_NONE;
1597 _EditTimePresenter::OnFontChanged(Font* pFont)
1601 if (__pEditTime->GetDateTimeBar() != null)
1603 __pEditTime->GetDateTimeBar()->SetFont(*pFont);
1610 _EditTimePresenter::OnFontInfoRequested(unsigned long& style, float& size)
1612 style = FONT_STYLE_PLAIN;
1613 size = __timeFontSize;
1619 _EditTimePresenter::Initialize(void)
1621 result r = E_SUCCESS;
1623 float titleTimeMargin = 0;
1624 float timeHeight = 0;
1625 float editTimeHeight = 0;
1627 GET_SHAPE_CONFIG(EDITTIME::TEXT_FONT_SIZE, __pEditTime->GetOrientation(), __titleFontSize);
1628 GET_SHAPE_CONFIG(EDITTIME::TIME_FONT_SIZE, __pEditTime->GetOrientation(), __timeFontSize);
1629 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
1630 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
1631 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
1633 if (__pEditTime->GetBoundsF().height > editTimeHeight)
1635 editTimeHeight = __pEditTime->GetBoundsF().height;
1638 if (!__title.IsEmpty())
1641 if (!__isEditTimeInitialized)
1643 r = InitializeTitleObject();
1644 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1647 __titleBounds.y = (editTimeHeight - (__titleBounds.height + titleTimeMargin + timeHeight)) / 2.0f;
1648 __titleObject.SetBounds(__titleBounds);
1651 __pFont = __pEditTime->GetFallbackFont();
1652 r = GetLastResult();
1653 SysTryReturn(NID_UI_CTRL, __pFont != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
1655 if (!__isEditTimeInitialized)
1658 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1660 r = InitializeTextObject();
1661 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1664 __isEditTimeInitialized = true;
1671 _EditTimePresenter::UpdateTimeFormat(void)
1673 if (!__is24hoursSet)
1675 String key(L"http://tizen.org/setting/locale.time.format.24hour");
1676 SettingInfo::GetValue(key , __24hours);
1683 _EditTimePresenter::Animate(void)
1685 SysTryReturnVoidResult(NID_UI_CTRL, !__isAnimating, E_SUCCESS, "Rolling animation is in progress.");
1686 SysAssertf((__pFont != null), "Font instance must not be null.");
1688 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1690 result r = E_SUCCESS;
1691 FloatRectangle rect;
1693 String minuteString;
1695 TextSimple* pOldSimpleText = null;
1696 TextSimple* pNewSimpleText = null;
1697 bool isCustomBitmap = false;
1699 _DateTimeUtils dateTimeUtils;
1700 int hours = GetHour();
1701 if (!Is24HourNotationEnabled())
1705 if (hours == DATETIME_HOUR_MIN)
1707 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1710 hourString.Format(10, L"%02d", hours);
1711 minuteString.Format(10, L"%02d", GetMinute());
1713 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1715 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(hourString) == false), E_SUCCESS, "[E_SUCCESS] Hour string matched.");
1717 newValue = hourString;
1718 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1720 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1722 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(minuteString) == false), E_SUCCESS, "[E_SUCCESS] Minute string matched.");
1724 newValue = minuteString;
1725 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1728 FloatDimension newTextDim;
1729 FloatDimension oldTextDim;
1730 FloatPoint textPoint;
1731 VisualElement* pNewVisualElement = null;
1732 VisualElement* pOldVisualElement = null;
1733 VisualElement* pEditTimeElement = null;
1734 VisualElementPropertyAnimation* pNewBoundsAnimation = null;
1735 VisualElementPropertyAnimation* pOldBoundsAnimation = null;
1736 Canvas *pCanvas = null;
1737 Canvas *pContentCanvas = null;
1738 Color contentBgColor;
1739 Color textNormalColor;
1740 Color textPressedColor;
1741 float contentTextMargin;
1743 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentBgColor);
1744 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textPressedColor);
1745 GET_SHAPE_CONFIG(EDITDATE::CONTENT_TEXT_MARGIN, __pEditTime->GetOrientation(), contentTextMargin);
1747 __pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
1748 __pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
1750 if (newTextDim.width > oldTextDim.width)
1752 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1756 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1759 SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditTime->GetBounds().width), E_SUCCESS, "Rolling animation cann't be played.");
1761 __isAnimating = true;
1763 __pContentProvider = new (std::nothrow) VisualElement();
1764 SysTryReturnVoidResult(NID_UI_CTRL, (__pContentProvider != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1766 r = __pContentProvider->Construct();
1767 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1769 __pContentProvider->SetShowState(true);
1770 __pContentProvider->SetClipChildrenEnabled(true);
1771 __pContentProvider->SetImplicitAnimationEnabled(false);
1773 pEditTimeElement = __pEditTime->GetVisualElement();
1774 r = GetLastResult();
1775 SysTryCatch(NID_UI_CTRL, (pEditTimeElement != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1777 pNewVisualElement = new (std::nothrow) VisualElement();
1778 SysTryCatch(NID_UI_CTRL, (pNewVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1780 r = pNewVisualElement->Construct();
1783 pNewVisualElement->Destroy();
1784 pNewVisualElement = null;
1786 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1788 pNewVisualElement->SetShowState(true);
1790 pOldVisualElement = new (std::nothrow) VisualElement();
1791 if (pOldVisualElement == null)
1793 pNewVisualElement->Destroy();
1794 pNewVisualElement = null;
1796 SysTryCatch(NID_UI_CTRL, (pOldVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1798 r = pOldVisualElement->Construct();
1801 pNewVisualElement->Destroy();
1802 pOldVisualElement->Destroy();
1803 pNewVisualElement = null;
1804 pOldVisualElement = null;
1806 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1808 pOldVisualElement->SetShowState(true);
1810 __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + (contentTextMargin * 2.0f)), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 4.0f))));
1812 pNewVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1813 pOldVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1815 pContentCanvas = pEditTimeElement->GetCanvasN(__pContentProvider->GetBounds());
1816 r = GetLastResult();
1817 SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1818 pContentCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1819 pContentCanvas->Clear();
1821 pCanvas = pEditTimeElement->GetCanvasN(rect);
1822 r = GetLastResult();
1823 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1824 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1828 r = DrawResourceBitmap(*pCanvas, rect, __pContentBgPressedColorReplacementBitmap);
1829 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
1831 if (!isCustomBitmap)
1833 result res = DrawResourceBitmap(*pCanvas, rect, __pContentBgEffectPressedBitmap);
1835 if (res != E_SUCCESS)
1837 SysLog(NID_UI_CTRL, "[%s] Propagating.", GetErrorMessage(res));
1846 pContentCanvas->SetBackgroundColor(contentBgColor);
1847 pContentCanvas->Clear();
1850 delete pContentCanvas;
1851 pContentCanvas = null;
1853 pEditTimeElement->AttachChild(*__pContentProvider);
1855 __pContentProvider->AttachChild(*pOldVisualElement);
1856 __pContentProvider->AttachChild(*pNewVisualElement);
1858 pNewBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1859 SysTryCatch(NID_UI_CTRL, (pNewBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1861 pNewBoundsAnimation->SetDuration(300);
1862 pNewBoundsAnimation->SetPropertyName("bounds.position");
1863 pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, oldTextDim.height)));
1864 pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, 0.0f)));
1866 pOldBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1867 SysTryCatch(NID_UI_CTRL, (pOldBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1869 pOldBoundsAnimation->SetDuration(300);
1870 pOldBoundsAnimation->SetPropertyName("bounds.position");
1871 pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, 0.0f)));
1872 pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, oldTextDim.height * -1.0f)));
1874 pOldSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__lastSelectedValue.GetPointer())), __lastSelectedValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1875 SysTryCatch(NID_UI_CTRL, (pOldSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1877 pCanvas = pOldVisualElement->GetCanvasN();
1878 r = GetLastResult();
1879 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1881 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1883 pCanvas->SetForegroundColor(textPressedColor);
1885 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1886 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1887 __textObject.RemoveAll();
1888 __textObject.AppendElement(*pOldSimpleText);
1890 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1891 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1892 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1893 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1898 pNewSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(newValue.GetPointer())), newValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1899 SysTryCatch(NID_UI_CTRL, (pNewSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1901 pCanvas = pNewVisualElement->GetCanvasN();
1902 r = GetLastResult();
1903 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1905 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1907 pCanvas->SetForegroundColor(textPressedColor);
1909 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1910 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1911 __textObject.RemoveAll();
1912 __textObject.AppendElement(*pNewSimpleText);
1914 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1915 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1916 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1917 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1922 pOldVisualElement->SetImplicitAnimationEnabled(false);
1923 pNewVisualElement->SetImplicitAnimationEnabled(false);
1925 AnimationTransaction::Begin(__transactionId);
1926 pOldVisualElement->AddAnimation(*pOldBoundsAnimation);
1927 pNewVisualElement->AddAnimation(*pNewBoundsAnimation);
1928 AnimationTransaction::SetCurrentTransactionEventListener(__pEditTime);
1929 AnimationTransaction::Commit();
1931 delete pOldBoundsAnimation;
1932 delete pNewBoundsAnimation;
1937 __isAnimating = false;
1938 __pContentProvider->Destroy();
1939 __pContentProvider = null;
1941 delete pNewBoundsAnimation;
1942 pNewBoundsAnimation = null;
1944 delete pOldBoundsAnimation;
1945 pOldBoundsAnimation = null;
1947 delete pOldSimpleText;
1948 pOldSimpleText = null;
1950 delete pNewSimpleText;
1951 pNewSimpleText = null;
1953 delete pContentCanvas;
1954 pContentCanvas = null;
1960 _EditTimePresenter::EndTransaction(void)
1962 result r = E_SUCCESS;
1964 __isAnimating = false;
1965 VisualElement* pEditTimeElement = __pEditTime->GetVisualElement();
1966 r = GetLastResult();
1967 SysTryReturnVoidResult(NID_UI_CTRL, (pEditTimeElement != null), r, "[%s] Propagating.", GetErrorMessage(r));
1969 if (__pContentProvider != null)
1971 pEditTimeElement->DetachChild(*__pContentProvider);
1972 __pContentProvider->Destroy();
1973 __pContentProvider = null;
1978 __transactionId = 0;
1981 }}} // Tizen::Ui::Controls