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;
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_REPLACED_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, colonTextColor, __pColonColorReplacementBitmap);
494 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
496 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, colonTextDisabledColor, __pColonDisabledColorReplacementBitmap);
497 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
500 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, buttonNormalBgColor, __pAmPmBgNormalColorReplacementBitmap);
501 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
503 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonDisabledBgColor, __pAmPmBgDisabledColorReplacementBitmap);
504 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
506 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonPressedColor, __pAmPmBgPressedColorReplacementBitmap);
507 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
509 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonHighlightedColor, __pAmPmBgHighlightedColorReplacementBitmap);
510 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
512 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, contentNormalBgColor, __pContentBgNormalColorReplacementBitmap);
513 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
515 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, contentPressedColor, __pContentBgPressedColorReplacementBitmap);
516 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
518 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, contentDisabledBgColor, __pContentBgDisabledColorReplacementBitmap);
519 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
521 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, contentHighlightedColor, __pContentBgHighlightedColorReplacementBitmap);
522 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
524 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectNomralBitmap);
525 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
527 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectPressedBitmap);
528 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
530 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectDisabledBitmap);
531 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
533 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectNormalBitmap);
534 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
536 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectPressedBitmap);
537 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
539 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectDisabledBitmap);
540 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
546 delete __pColonColorReplacementBitmap;
547 __pColonColorReplacementBitmap = null;
549 delete __pColonDisabledColorReplacementBitmap;
550 __pColonDisabledColorReplacementBitmap = null;
552 delete __pAmPmBgNormalColorReplacementBitmap;
553 __pAmPmBgNormalColorReplacementBitmap = null;
555 delete __pAmPmBgPressedColorReplacementBitmap;
556 __pAmPmBgPressedColorReplacementBitmap = null;
558 delete __pAmPmBgDisabledColorReplacementBitmap;
559 __pAmPmBgDisabledColorReplacementBitmap = null;
561 delete __pAmPmBgHighlightedColorReplacementBitmap;
562 __pAmPmBgHighlightedColorReplacementBitmap = null;
564 delete __pContentBgNormalColorReplacementBitmap;
565 __pContentBgNormalColorReplacementBitmap = null;
567 delete __pContentBgPressedColorReplacementBitmap;
568 __pContentBgPressedColorReplacementBitmap = null;
570 delete __pContentBgDisabledColorReplacementBitmap;
571 __pContentBgDisabledColorReplacementBitmap = null;
573 delete __pContentBgHighlightedColorReplacementBitmap;
574 __pContentBgHighlightedColorReplacementBitmap = null;
576 delete __pAmPmBgEffectNomralBitmap;
577 __pAmPmBgEffectNomralBitmap = null;
579 delete __pAmPmBgEffectPressedBitmap;
580 __pAmPmBgEffectPressedBitmap = null;
582 delete __pAmPmBgEffectDisabledBitmap;
583 __pAmPmBgEffectDisabledBitmap = null;
585 delete __pContentBgEffectNormalBitmap;
586 __pContentBgEffectNormalBitmap = null;
588 delete __pContentBgEffectPressedBitmap;
589 __pContentBgEffectPressedBitmap = null;
591 delete __pContentBgEffectDisabledBitmap;
592 __pContentBgEffectDisabledBitmap = null;
594 delete __pColonColorReplacementBitmap;
595 __pColonColorReplacementBitmap = null;
597 delete __pColonDisabledColorReplacementBitmap;
598 __pColonDisabledColorReplacementBitmap = null;
604 _EditTimePresenter::DrawResourceBitmap(Canvas& canvas, const FloatRectangle& bounds, Bitmap* pBitmap)
606 result r = E_SUCCESS;
613 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
615 r = canvas.DrawNinePatchedBitmap(bounds, *pBitmap);
616 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
620 r = canvas.DrawBitmap(bounds, *pBitmap);
621 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
628 _EditTimePresenter::GetTimeElementWidth(void) const
630 FloatRectangle bounds;
631 FloatDimension minSize;
632 bounds = __pEditTime->GetBoundsF();
634 float timeElementWidth = 0.0f;
635 float timeElementMinWidth = 0.0f;
636 float editTimeWidth = 0.0f;
638 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), timeElementWidth);
639 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_MIN_WIDTH, __pEditTime->GetOrientation(), timeElementMinWidth);
640 GET_SHAPE_CONFIG(EDITTIME::WIDTH, __pEditTime->GetOrientation(), editTimeWidth);
642 GET_DIMENSION_CONFIG(EDITTIME::MIN_SIZE, __pEditTime->GetOrientation(), minSize);
644 if (bounds.width >= editTimeWidth)
646 return timeElementWidth;
649 if (bounds.width <= minSize.width)
651 timeElementWidth = timeElementMinWidth;
653 else if (bounds.width < editTimeWidth && bounds.width > minSize.width)
655 timeElementWidth = timeElementWidth -
656 ((timeElementWidth - timeElementMinWidth) / (editTimeWidth - minSize.width)) * (editTimeWidth - bounds.width);
659 return timeElementWidth;
663 _EditTimePresenter::InitializeTitleObject(void)
665 result r = E_SUCCESS;
667 Color titleNormalColor;
669 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_NORMAL, titleNormalColor);
671 r = __titleObject.Construct();
672 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
674 TextSimple* pSimpleText = null;
676 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__title.GetPointer())), __title.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
677 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
679 __titleObject.AppendElement(*pSimpleText);
681 __titleObject.SetForegroundColor(titleNormalColor, 0, __titleObject.GetTextLength());
682 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
683 __titleObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
684 __titleObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
685 __titleObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
686 __titleObject.SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
692 _EditTimePresenter::InitializeTextObject(void)
694 result r = E_SUCCESS;
696 r = __textObject.Construct();
697 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
699 TextSimple* pSimpleText = new (std::nothrow)TextSimple(null, 0, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
700 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
701 "[E_OUT_OF_MEMORY] Memory allocation failed.");
703 __textObject.AppendElement(*pSimpleText);
705 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
706 __textObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
707 __textObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
708 __textObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
714 _EditTimePresenter::Draw(void)
716 result r = E_SUCCESS;
723 Canvas* pCanvas = __pEditTime->GetCanvasN();
725 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), r, "Failed to get canvas.");
727 FloatRectangle colonBounds(0.0f, 0.0f, 0.0f, 0.0f);
729 float colonMargin = 0.0f;
733 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
736 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
737 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
738 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
739 bool isCustomBitmap = false;
740 Bitmap* pReplacementBitmap = null;
741 Bitmap* pEffectBitmap = null;
743 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
744 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
748 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
750 if (!__pEditTime->IsEnabled())
752 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_DISABLED);
753 pReplacementBitmap = __pAmPmBgDisabledColorReplacementBitmap;
754 pEffectBitmap = __pAmPmBgEffectDisabledBitmap;
756 else if (__selectedId != DATETIME_ID_AMPM)
758 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_NORMAL);
759 pReplacementBitmap = __pAmPmBgNormalColorReplacementBitmap;
760 pEffectBitmap = __pAmPmBgEffectNomralBitmap;
764 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_PRESSED);
765 pReplacementBitmap = __pAmPmBgPressedColorReplacementBitmap;
766 pEffectBitmap = __pAmPmBgEffectPressedBitmap;
770 if (GetHour() >= DATETIME_HOUR_MAX_FOR_24NOTATION)
781 GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonBounds.width);
782 GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
783 GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), colonBounds.height);
785 colonBounds.x = hourBounds.x + hourBounds.width + colonMargin;
786 colonBounds.y = hourBounds.y + (hourBounds.height - colonBounds.height) / 2.0f;
788 if (!__title.IsEmpty())
790 r = DrawTitle(*pCanvas);
791 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
794 r = DrawText(*pCanvas, hourBounds, __hourString, DATETIME_ID_HOUR);
795 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
797 r = DrawText(*pCanvas, minuteBounds, __minuteString, DATETIME_ID_MINUTE);
798 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
800 r = DrawColon(*pCanvas, colonBounds);
801 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
805 r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap);
806 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
810 r = DrawResourceBitmap(*pCanvas, ampmBounds, pEffectBitmap);
811 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
814 r = DrawText(*pCanvas, ampmBounds, __ampmString, DATETIME_ID_AMPM, __amPmTextSize);
815 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
824 _EditTimePresenter::DrawFocus(void)
826 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
828 Canvas* pCanvas = __pEditTime->GetCanvasN();
829 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
831 if (__focusId == DATETIME_ID_HOUR)
833 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
835 else if (__focusId == DATETIME_ID_MINUTE)
837 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
839 else if (__focusId == DATETIME_ID_AMPM)
841 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
843 result r = E_SUCCESS;
845 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
847 r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
848 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
852 r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
853 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
865 _EditTimePresenter::DrawColon(Canvas& canvas, const FloatRectangle& bounds)
867 result r = E_SUCCESS;
869 if (!__pEditTime->IsEnabled())
871 r = DrawResourceBitmap(canvas, bounds, __pColonDisabledColorReplacementBitmap);
875 r = DrawResourceBitmap(canvas, bounds, __pColonColorReplacementBitmap);
882 _EditTimePresenter::DrawTitle(Canvas& canvas)
884 if (!__pEditTime->IsEnabled())
886 Color titleDisabledColor;
887 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_DISABLED, titleDisabledColor);
888 __titleObject.SetForegroundColor(titleDisabledColor, 0, __titleObject.GetTextLength());
891 (_FontImpl::GetInstance(*__pFont))->SetSize(__titleFontSize);
892 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
893 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
895 __titleObject.Draw(*_CanvasImpl::GetInstance(canvas));
901 _EditTimePresenter::DrawContentBitmap(Canvas& canvas, const FloatRectangle& bounds, _DateTimeId boxId)
903 result r = E_SUCCESS;
905 bool isCustomBitmap = false;
906 Bitmap* pReplacementBitmap = null;
907 Bitmap* pEffectBitmap = null;
909 if (!__pEditTime->IsEnabled())
911 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_DISABLED);
912 pReplacementBitmap = __pContentBgDisabledColorReplacementBitmap;
913 pEffectBitmap = __pContentBgEffectDisabledBitmap;
915 else if (__selectedId != boxId)
917 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated() &&
918 (GetLastSelectedId() == boxId))
920 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
921 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
922 pEffectBitmap = __pContentBgEffectPressedBitmap;
926 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_NORMAL);
927 pReplacementBitmap = __pContentBgNormalColorReplacementBitmap;
928 pEffectBitmap = __pContentBgEffectNormalBitmap;
933 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
934 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
935 pEffectBitmap = __pContentBgEffectPressedBitmap;
938 r = DrawResourceBitmap(canvas, bounds, pReplacementBitmap);
939 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
943 r = DrawResourceBitmap(canvas, bounds, pEffectBitmap);
944 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
951 _EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId, float textSize)
953 result r = E_SUCCESS;
956 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
958 if (!__pEditTime->IsEnabled())
960 if (boxId == DATETIME_ID_AMPM)
962 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_DISABLED, textColor);
966 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, textColor);
971 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, textColor);
973 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated() &&
974 (GetLastSelectedId() == boxId))
976 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
977 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
980 if (boxId == DATETIME_ID_AMPM)
982 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_NORMAL, textColor);
985 if (boxId > -1 && boxId == __selectedId)
987 if (boxId == DATETIME_ID_AMPM)
989 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_PRESSED, textColor);
993 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
994 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
999 if (boxId != DATETIME_ID_AMPM)
1001 DrawContentBitmap(canvas, bounds, boxId);
1004 FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
1005 drawAreaBounds = bounds;
1007 TextSimple* pSimpleText = null;
1008 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(text.GetPointer())), text.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1009 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1011 __textObject.RemoveAll();
1013 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1014 __textObject.AppendElement(*pSimpleText);
1016 if (boxId == DATETIME_ID_AMPM)
1018 (_FontImpl::GetInstance(*__pFont))->SetSize(textSize);
1020 if (__isFocused && __focusId == boxId)
1022 if (boxId == DATETIME_ID_AMPM)
1024 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_HIGHLIGHTED, textColor);
1028 GET_COLOR_CONFIG(EDITTIME::TEXT_HIGHLIGHTED, textColor);
1034 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1036 __textObject.SetForegroundColor(textColor, 0, __textObject.GetTextLength());
1037 __textObject.SetBounds(drawAreaBounds);
1038 __textObject.Draw(*_CanvasImpl::GetInstance(canvas));
1044 _EditTimePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
1046 _DateTimeId displayBoxId = DATETIME_ID_NONE;
1048 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1049 FloatRectangle hoursBounds(0.0f, 0.0f, 0.0f, 0.0f);
1050 FloatRectangle minutesBounds(0.0f, 0.0f, 0.0f, 0.0f);
1054 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1057 hoursBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1058 minutesBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1060 if (point.y < hoursBounds.y || point.y > hoursBounds.y + hoursBounds.height)
1062 return displayBoxId;
1065 if (hoursBounds.Contains(point))
1067 displayBoxId = DATETIME_ID_HOUR;
1069 else if (minutesBounds.Contains(point))
1071 displayBoxId = DATETIME_ID_MINUTE;
1073 else if (ampmBounds.Contains(point))
1075 displayBoxId = DATETIME_ID_AMPM;
1078 return displayBoxId;
1082 _EditTimePresenter::SetLastSelectedId(_DateTimeId boxId)
1084 __lastSelectedId = boxId;
1089 _EditTimePresenter::GetLastSelectedId(void) const
1091 return __lastSelectedId;
1095 _EditTimePresenter::SetFocusedElement()
1097 if (__isEnterKeyPressed)
1099 __isEnterKeyPressed = false;
1102 if (__focusId == DATETIME_ID_NONE || __focusId == DATETIME_ID_AMPM)
1104 __focusId = DATETIME_ID_HOUR;
1111 _EditTimePresenter::SetFocusState(bool isFocused)
1113 __isFocused = isFocused;
1118 _EditTimePresenter::OnFocusLost(const _Control &source)
1120 if (!__isEnterKeyPressed || __focusId == DATETIME_ID_AMPM)
1122 __focusId = DATETIME_ID_NONE;
1124 __isFocused = false;
1125 __pEditTime->Invalidate();
1130 _EditTimePresenter::OnFocusModeStateChanged(void)
1132 __isFocused = false;
1133 __focusId = DATETIME_ID_NONE;
1134 __pEditTime->Invalidate();
1139 _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1145 _KeyCode keyCode = keyInfo.GetKeyCode();
1151 __isEnterKeyPressed = false;
1152 if (__focusId == DATETIME_ID_HOUR)
1154 __focusId = DATETIME_ID_MINUTE;
1156 else if (__focusId == DATETIME_ID_MINUTE)
1158 if (!Is24HourNotationEnabled())
1160 __focusId = DATETIME_ID_AMPM;
1163 else if (__focusId == DATETIME_ID_AMPM)
1168 __pEditTime->Invalidate();
1173 __isEnterKeyPressed = false;
1174 if (__focusId == DATETIME_ID_MINUTE)
1176 __focusId = DATETIME_ID_HOUR;
1178 else if (__focusId == DATETIME_ID_AMPM)
1180 __focusId = DATETIME_ID_MINUTE;
1182 else if (__focusId == DATETIME_ID_HOUR)
1186 __pEditTime->Invalidate();
1199 _EditTimePresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1205 _KeyCode keyCode = keyInfo.GetKeyCode();
1209 VisualElement *pEditTimeElement = __pEditTime->GetVisualElement();
1210 result r = GetLastResult();
1211 SysTryReturn(NID_UI_CTRL, (pEditTimeElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
1212 pEditTimeElement->RemoveAllAnimations();
1217 int displayValue = -1;
1219 _DateTimeId boxId = DATETIME_ID_HOUR;
1225 __isEnterKeyPressed = true;
1226 if (__focusId == DATETIME_ID_HOUR)
1228 boxId = DATETIME_ID_HOUR;
1229 if (__pEditTime->GetDateTimeBar() != null)
1231 if (!Is24HourNotationEnabled())
1235 minValue = DATETIME_HOUR_MIN + 1;
1236 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1237 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1239 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1241 minValue = DATETIME_HOUR_MIN + 1;
1242 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1243 displayValue = __pEditTime->GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1247 minValue = DATETIME_HOUR_MIN + 1;
1248 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1249 displayValue = __pEditTime->GetHour();
1254 minValue = DATETIME_HOUR_MIN;
1255 maxValue = DATETIME_HOUR_MAX;
1256 displayValue = __pEditTime->GetHour();
1259 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1261 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1265 else if (__focusId == DATETIME_ID_MINUTE)
1267 if (__pEditTime->GetDateTimeBar() != null)
1269 minValue = DATETIME_MINUTE_MIN;
1270 maxValue = DATETIME_MINUTE_MAX;
1271 displayValue = __pEditTime->GetMinute();
1273 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1275 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1278 boxId = DATETIME_ID_MINUTE;
1280 else if (__focusId == DATETIME_ID_AMPM)
1282 SetAmEnabled(!GetAmEnabled());
1283 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1284 boxId = DATETIME_ID_AMPM;
1286 __pEditTime->Invalidate();
1289 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM))
1291 FloatRectangle absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1293 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1294 bounds = GetDisplayAreaBoundsFromHoursStyle(boxId);
1295 bounds.x += absoluteBounds.x;
1297 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1298 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1299 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1300 __pEditTime->GetDateTimeBar()->Open();
1301 UpdateLastSelectedValue(boxId, false);
1315 _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1317 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1319 if (&source != __pEditTime)
1324 __touchMoveHandled = false;
1326 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
1327 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1328 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1330 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1331 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1335 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1338 FloatPoint point = touchinfo.GetCurrentPosition();
1340 _DateTimeId boxId = GetBoxIdFromPosition(point);
1344 int displayValue = -1;
1346 if (boxId == DATETIME_ID_HOUR)
1348 if (__pEditTime->GetDateTimeBar() != null)
1354 minValue = DATETIME_HOUR_MIN + 1;
1355 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1356 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1358 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1360 minValue = DATETIME_HOUR_MIN + 1;
1361 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1362 displayValue = GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1366 minValue = DATETIME_HOUR_MIN + 1;
1367 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1368 displayValue = GetHour();
1373 minValue = DATETIME_HOUR_MIN;
1374 maxValue = DATETIME_HOUR_MAX;
1375 displayValue = GetHour();
1378 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1380 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1383 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1386 __bounds = hourBounds;
1388 else if (boxId == DATETIME_ID_MINUTE)
1390 if (__pEditTime->GetDateTimeBar() != null)
1392 minValue = DATETIME_MINUTE_MIN;
1393 maxValue = DATETIME_MINUTE_MAX;
1394 displayValue = GetMinute();
1396 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1398 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1401 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1404 __bounds = minuteBounds;
1406 else if (boxId == DATETIME_ID_AMPM)
1408 __selectedId = boxId;
1409 __bounds = ampmBounds;
1414 __selectedId = DATETIME_ID_NONE;
1418 __selectedId = boxId;
1424 _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1426 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1428 if (&source != __pEditTime)
1433 FloatRectangle bounds = __pEditTime->GetBoundsF();
1435 FloatPoint startPoint(0.0f, 0.0f);
1437 float titleHeight = 0;
1438 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), titleHeight);
1440 __bounds = FloatRectangle(0.0f, titleHeight, bounds.width, bounds.height);
1442 FloatPoint point = touchinfo.GetCurrentPosition();
1444 _DateTimeId boxId = GetBoxIdFromPosition(point);
1446 if ((boxId == GetLastSelectedId() && boxId != DATETIME_ID_AMPM) || boxId != __selectedId || boxId == DATETIME_ID_NONE)
1448 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1450 __pEditTime->GetDateTimeBar()->CloseDateTimeBar();
1453 __selectedId = DATETIME_ID_NONE;
1454 SetLastSelectedId(__selectedId);
1460 UpdateLastSelectedValue(__selectedId, true);
1461 if (GetLastSelectedId() == DATETIME_ID_AMPM)
1468 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
1470 __pEditTime->SetFocused(true);
1472 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1473 bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
1474 FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1475 absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1476 bounds.x += absoluteBounds.x;
1478 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1480 if (__pEditTime->GetDateTimeBar()->IsActivated())
1482 __pEditTime->GetDateTimeBar()->RemoveAllAnimations();
1483 __pEditTime->GetDateTimeBar()->Close();
1484 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1485 __pEditTime->GetDateTimeBar()->Open();
1489 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1490 __pEditTime->GetDateTimeBar()->Open();
1494 __selectedId = DATETIME_ID_NONE;
1499 _EditTimePresenter::UpdateLastSelectedValue(_DateTimeId boxId, bool isTouchPressed)
1501 __selectedId = boxId;
1502 SetLastSelectedId(boxId);
1504 __lastSelectedValue = "";
1506 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1508 int hours = GetHour();
1510 if (!Is24HourNotationEnabled())
1514 if (hours == DATETIME_HOUR_MIN)
1516 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1519 __lastSelectedValue.Format(10, L"%02d", hours);
1522 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1525 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1527 __lastSelectedValue.Format(10, L"%02d", GetMinute());
1530 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1533 else if (GetLastSelectedId() == DATETIME_ID_AMPM)
1535 SetAmEnabled(!GetAmEnabled());
1536 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1539 __pEditTime->UpdateAccessibilityElement();
1540 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1542 __selectedId = DATETIME_ID_NONE;
1544 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1546 __pEditTime->GetDateTimeBar()->SetVisibleState(false);
1547 __pEditTime->GetDateTimeBar()->Close();
1551 __selectedId = DATETIME_ID_NONE;
1552 __pEditTime->Invalidate();
1557 _EditTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1559 if (&source != __pEditTime)
1564 __selectedId = DATETIME_ID_NONE;
1570 _EditTimePresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1572 if (&source != __pEditTime)
1577 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1586 _EditTimePresenter::OnTouchMoveHandled(const _Control& control)
1588 __touchMoveHandled = true;
1589 __selectedId = DATETIME_ID_NONE;
1595 _EditTimePresenter::OnFontChanged(Font* pFont)
1599 if (__pEditTime->GetDateTimeBar() != null)
1601 __pEditTime->GetDateTimeBar()->SetFont(*pFont);
1608 _EditTimePresenter::OnFontInfoRequested(unsigned long& style, float& size)
1610 style = FONT_STYLE_PLAIN;
1611 size = __timeFontSize;
1617 _EditTimePresenter::Initialize(void)
1619 result r = E_SUCCESS;
1621 float titleTimeMargin = 0;
1622 float timeHeight = 0;
1623 float editTimeHeight = 0;
1625 GET_SHAPE_CONFIG(EDITTIME::TEXT_FONT_SIZE, __pEditTime->GetOrientation(), __titleFontSize);
1626 GET_SHAPE_CONFIG(EDITTIME::TIME_FONT_SIZE, __pEditTime->GetOrientation(), __timeFontSize);
1627 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
1628 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
1629 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
1631 if (__pEditTime->GetBoundsF().height > editTimeHeight)
1633 editTimeHeight = __pEditTime->GetBoundsF().height;
1636 if (!__title.IsEmpty())
1639 if (!__isEditTimeInitialized)
1641 r = InitializeTitleObject();
1642 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1645 __titleBounds.y = (editTimeHeight - (__titleBounds.height + titleTimeMargin + timeHeight)) / 2.0f;
1646 __titleObject.SetBounds(__titleBounds);
1649 __pFont = __pEditTime->GetFallbackFont();
1650 r = GetLastResult();
1651 SysTryReturn(NID_UI_CTRL, __pFont != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
1653 if (!__isEditTimeInitialized)
1656 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1658 r = InitializeTextObject();
1659 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1662 __isEditTimeInitialized = true;
1669 _EditTimePresenter::UpdateTimeFormat(void)
1671 if (!__is24hoursSet)
1673 String key(L"http://tizen.org/setting/locale.time.format.24hour");
1674 SettingInfo::GetValue(key , __24hours);
1681 _EditTimePresenter::Animate(void)
1683 SysTryReturnVoidResult(NID_UI_CTRL, !__isAnimating, E_SUCCESS, "Rolling animation is in progress.");
1684 SysAssertf((__pFont != null), "Font instance must not be null.");
1686 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1688 result r = E_SUCCESS;
1689 FloatRectangle rect;
1691 String minuteString;
1693 TextSimple* pOldSimpleText = null;
1694 TextSimple* pNewSimpleText = null;
1695 bool isCustomBitmap = false;
1697 _DateTimeUtils dateTimeUtils;
1698 int hours = GetHour();
1699 if (!Is24HourNotationEnabled())
1703 if (hours == DATETIME_HOUR_MIN)
1705 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1708 hourString.Format(10, L"%02d", hours);
1709 minuteString.Format(10, L"%02d", GetMinute());
1711 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1713 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(hourString) == false), E_SUCCESS, "[E_SUCCESS] Hour string matched.");
1715 newValue = hourString;
1716 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1718 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1720 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(minuteString) == false), E_SUCCESS, "[E_SUCCESS] Minute string matched.");
1722 newValue = minuteString;
1723 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1726 FloatDimension newTextDim;
1727 FloatDimension oldTextDim;
1728 FloatPoint textPoint;
1729 VisualElement* pNewVisualElement = null;
1730 VisualElement* pOldVisualElement = null;
1731 VisualElement* pEditTimeElement = null;
1732 VisualElementPropertyAnimation* pNewBoundsAnimation = null;
1733 VisualElementPropertyAnimation* pOldBoundsAnimation = null;
1734 Canvas *pCanvas = null;
1735 Canvas *pContentCanvas = null;
1736 Color contentBgColor;
1737 Color textNormalColor;
1738 Color textPressedColor;
1739 float contentTextMargin;
1741 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentBgColor);
1742 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textPressedColor);
1743 GET_SHAPE_CONFIG(EDITDATE::CONTENT_TEXT_MARGIN, __pEditTime->GetOrientation(), contentTextMargin);
1745 __pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
1746 __pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
1748 if (newTextDim.width > oldTextDim.width)
1750 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1754 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1757 SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditTime->GetBounds().width), E_SUCCESS, "Rolling animation cann't be played.");
1759 __isAnimating = true;
1761 __pContentProvider = new (std::nothrow) VisualElement();
1762 SysTryReturnVoidResult(NID_UI_CTRL, (__pContentProvider != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1764 r = __pContentProvider->Construct();
1765 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1767 __pContentProvider->SetShowState(true);
1768 __pContentProvider->SetClipChildrenEnabled(true);
1769 __pContentProvider->SetImplicitAnimationEnabled(false);
1771 pEditTimeElement = __pEditTime->GetVisualElement();
1772 r = GetLastResult();
1773 SysTryCatch(NID_UI_CTRL, (pEditTimeElement != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1775 pNewVisualElement = new (std::nothrow) VisualElement();
1776 SysTryCatch(NID_UI_CTRL, (pNewVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1778 r = pNewVisualElement->Construct();
1781 pNewVisualElement->Destroy();
1782 pNewVisualElement = null;
1784 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1786 pNewVisualElement->SetShowState(true);
1788 pOldVisualElement = new (std::nothrow) VisualElement();
1789 if (pOldVisualElement == null)
1791 pNewVisualElement->Destroy();
1792 pNewVisualElement = null;
1794 SysTryCatch(NID_UI_CTRL, (pOldVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1796 r = pOldVisualElement->Construct();
1799 pNewVisualElement->Destroy();
1800 pOldVisualElement->Destroy();
1801 pNewVisualElement = null;
1802 pOldVisualElement = null;
1804 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1806 pOldVisualElement->SetShowState(true);
1808 __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + (contentTextMargin * 2.0f)), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 4.0f))));
1810 pNewVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1811 pOldVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1813 pContentCanvas = pEditTimeElement->GetCanvasN(__pContentProvider->GetBounds());
1814 r = GetLastResult();
1815 SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1816 pContentCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1817 pContentCanvas->Clear();
1819 pCanvas = pEditTimeElement->GetCanvasN(rect);
1820 r = GetLastResult();
1821 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1822 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1826 r = DrawResourceBitmap(*pCanvas, rect, __pContentBgPressedColorReplacementBitmap);
1827 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
1829 if (!isCustomBitmap)
1831 result res = DrawResourceBitmap(*pCanvas, rect, __pContentBgEffectPressedBitmap);
1833 if (res != E_SUCCESS)
1835 SysLog(NID_UI_CTRL, "[%s] Propagating.", GetErrorMessage(res));
1844 pContentCanvas->SetBackgroundColor(contentBgColor);
1845 pContentCanvas->Clear();
1848 delete pContentCanvas;
1849 pContentCanvas = null;
1851 pEditTimeElement->AttachChild(*__pContentProvider);
1853 __pContentProvider->AttachChild(*pOldVisualElement);
1854 __pContentProvider->AttachChild(*pNewVisualElement);
1856 pNewBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1857 SysTryCatch(NID_UI_CTRL, (pNewBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1859 pNewBoundsAnimation->SetDuration(300);
1860 pNewBoundsAnimation->SetPropertyName("bounds.position");
1861 pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, oldTextDim.height)));
1862 pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, 0.0f)));
1864 pOldBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1865 SysTryCatch(NID_UI_CTRL, (pOldBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1867 pOldBoundsAnimation->SetDuration(300);
1868 pOldBoundsAnimation->SetPropertyName("bounds.position");
1869 pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, 0.0f)));
1870 pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, oldTextDim.height * -1.0f)));
1872 pOldSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__lastSelectedValue.GetPointer())), __lastSelectedValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1873 SysTryCatch(NID_UI_CTRL, (pOldSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1875 pCanvas = pOldVisualElement->GetCanvasN();
1876 r = GetLastResult();
1877 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1879 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1881 pCanvas->SetForegroundColor(textPressedColor);
1883 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1884 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1885 __textObject.RemoveAll();
1886 __textObject.AppendElement(*pOldSimpleText);
1888 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1889 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1890 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1891 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1896 pNewSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(newValue.GetPointer())), newValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1897 SysTryCatch(NID_UI_CTRL, (pNewSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1899 pCanvas = pNewVisualElement->GetCanvasN();
1900 r = GetLastResult();
1901 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1903 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1905 pCanvas->SetForegroundColor(textPressedColor);
1907 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1908 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1909 __textObject.RemoveAll();
1910 __textObject.AppendElement(*pNewSimpleText);
1912 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1913 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1914 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1915 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1920 pOldVisualElement->SetImplicitAnimationEnabled(false);
1921 pNewVisualElement->SetImplicitAnimationEnabled(false);
1923 AnimationTransaction::Begin(__transactionId);
1924 pOldVisualElement->AddAnimation(*pOldBoundsAnimation);
1925 pNewVisualElement->AddAnimation(*pNewBoundsAnimation);
1926 AnimationTransaction::SetCurrentTransactionEventListener(__pEditTime);
1927 AnimationTransaction::Commit();
1929 delete pOldBoundsAnimation;
1930 delete pNewBoundsAnimation;
1935 __isAnimating = false;
1936 __pContentProvider->Destroy();
1937 __pContentProvider = null;
1939 delete pNewBoundsAnimation;
1940 pNewBoundsAnimation = null;
1942 delete pOldBoundsAnimation;
1943 pOldBoundsAnimation = null;
1945 delete pOldSimpleText;
1946 pOldSimpleText = null;
1948 delete pNewSimpleText;
1949 pNewSimpleText = null;
1951 delete pContentCanvas;
1952 pContentCanvas = null;
1958 _EditTimePresenter::EndTransaction(void)
1960 result r = E_SUCCESS;
1962 __isAnimating = false;
1963 VisualElement* pEditTimeElement = __pEditTime->GetVisualElement();
1964 r = GetLastResult();
1965 SysTryReturnVoidResult(NID_UI_CTRL, (pEditTimeElement != null), r, "[%s] Propagating.", GetErrorMessage(r));
1967 if (__pContentProvider != null)
1969 pEditTimeElement->DetachChild(*__pContentProvider);
1970 __pContentProvider->Destroy();
1971 __pContentProvider = null;
1976 __transactionId = 0;
1979 }}} // Tizen::Ui::Controls