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 pSimpleText->SetTextShadowEnabled(true);
438 pSimpleText->SetTextShadowOffset(FloatPoint(0.0f, -1.0f));
440 dateObject.AppendElement(*pSimpleText);
441 dateObject.SetFont(__pFont, 0, dateObject.GetTextLength());
442 dim = dateObject.GetTextExtentF(0, dateObject.GetTextLength());
444 dateObject.RemoveAll();
449 _EditTimePresenter::SetTitleBounds(void)
451 GET_SHAPE_CONFIG(EDITTIME::TITLE_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), __titleBounds.x);
452 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), __titleBounds.height);
454 __titleBounds.width = __pEditTime->GetBoundsF().width - __titleBounds.x;
459 _EditTimePresenter::GetTitleBounds(void) const
461 return __titleBounds;
465 _EditTimePresenter::LoadResource(void)
467 result r = E_SUCCESS;
469 Color buttonNormalBgColor;
470 Color buttonDisabledBgColor;
471 Color buttonPressedColor;
472 Color buttonHighlightedColor;
473 Color contentNormalBgColor;
474 Color contentDisabledBgColor;
475 Color contentPressedColor;
476 Color contentHighlightedColor;
477 Color colonTextColor;
478 Color colonTextDisabledColor;
481 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_NORMAL, buttonNormalBgColor);
482 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_PRESSED, buttonPressedColor);
483 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_DISABLED, buttonDisabledBgColor);
484 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_HIGHLIGHTED, buttonHighlightedColor);
486 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_NORMAL, contentNormalBgColor);
487 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_DISABLED, contentDisabledBgColor);
488 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentPressedColor);
489 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_HIGHLIGHTED, contentHighlightedColor);
491 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, colonTextColor);
492 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, colonTextDisabledColor);
494 GET_SHAPE_CONFIG(EDITTIME::AMPM_FONT_SIZE, __pEditTime->GetOrientation(), __amPmTextSize);
496 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, colonTextColor, __pColonColorReplacementBitmap);
497 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
499 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, colonTextDisabledColor, __pColonDisabledColorReplacementBitmap);
500 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
503 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, buttonNormalBgColor, __pAmPmBgNormalColorReplacementBitmap);
504 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
506 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonDisabledBgColor, __pAmPmBgDisabledColorReplacementBitmap);
507 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
509 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonPressedColor, __pAmPmBgPressedColorReplacementBitmap);
510 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
512 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, buttonHighlightedColor, __pAmPmBgHighlightedColorReplacementBitmap);
513 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
515 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, contentNormalBgColor, __pContentBgNormalColorReplacementBitmap);
516 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
518 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, contentPressedColor, __pContentBgPressedColorReplacementBitmap);
519 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
521 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, contentDisabledBgColor, __pContentBgDisabledColorReplacementBitmap);
522 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
524 r = GET_REPLACED_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, contentHighlightedColor, __pContentBgHighlightedColorReplacementBitmap);
525 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
527 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectNomralBitmap);
528 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
530 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectPressedBitmap);
531 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
533 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectDisabledBitmap);
534 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
536 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectNormalBitmap);
537 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
539 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectPressedBitmap);
540 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
542 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectDisabledBitmap);
543 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
549 delete __pColonColorReplacementBitmap;
550 __pColonColorReplacementBitmap = null;
552 delete __pColonDisabledColorReplacementBitmap;
553 __pColonDisabledColorReplacementBitmap = null;
555 delete __pAmPmBgNormalColorReplacementBitmap;
556 __pAmPmBgNormalColorReplacementBitmap = null;
558 delete __pAmPmBgPressedColorReplacementBitmap;
559 __pAmPmBgPressedColorReplacementBitmap = null;
561 delete __pAmPmBgDisabledColorReplacementBitmap;
562 __pAmPmBgDisabledColorReplacementBitmap = null;
564 delete __pAmPmBgHighlightedColorReplacementBitmap;
565 __pAmPmBgHighlightedColorReplacementBitmap = null;
567 delete __pContentBgNormalColorReplacementBitmap;
568 __pContentBgNormalColorReplacementBitmap = null;
570 delete __pContentBgPressedColorReplacementBitmap;
571 __pContentBgPressedColorReplacementBitmap = null;
573 delete __pContentBgDisabledColorReplacementBitmap;
574 __pContentBgDisabledColorReplacementBitmap = null;
576 delete __pContentBgHighlightedColorReplacementBitmap;
577 __pContentBgHighlightedColorReplacementBitmap = null;
579 delete __pAmPmBgEffectNomralBitmap;
580 __pAmPmBgEffectNomralBitmap = null;
582 delete __pAmPmBgEffectPressedBitmap;
583 __pAmPmBgEffectPressedBitmap = null;
585 delete __pAmPmBgEffectDisabledBitmap;
586 __pAmPmBgEffectDisabledBitmap = null;
588 delete __pContentBgEffectNormalBitmap;
589 __pContentBgEffectNormalBitmap = null;
591 delete __pContentBgEffectPressedBitmap;
592 __pContentBgEffectPressedBitmap = null;
594 delete __pContentBgEffectDisabledBitmap;
595 __pContentBgEffectDisabledBitmap = null;
597 delete __pColonColorReplacementBitmap;
598 __pColonColorReplacementBitmap = null;
600 delete __pColonDisabledColorReplacementBitmap;
601 __pColonDisabledColorReplacementBitmap = null;
607 _EditTimePresenter::DrawResourceBitmap(Canvas& canvas, const FloatRectangle& bounds, Bitmap* pBitmap, bool isCustomBitmap)
609 result r = E_SUCCESS;
616 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
618 r = canvas.DrawNinePatchedBitmap(bounds, *pBitmap);
619 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
625 Canvas *pContentCanvas = __pEditTime->GetCanvasN(bounds);
626 SysTryReturnResult(NID_UI_CTRL, (pContentCanvas != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
630 position.x = (bounds.width - pBitmap->GetWidthF()) / 2;
631 position.y = (bounds.height - pBitmap->GetHeightF()) / 2;
632 r = pContentCanvas->DrawBitmap(position, *pBitmap);
633 delete pContentCanvas;
637 r = canvas.DrawBitmap(FloatPoint(bounds.x, bounds.y), *pBitmap);
640 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
647 _EditTimePresenter::GetTimeElementWidth(void) const
649 FloatRectangle bounds;
650 FloatDimension minSize;
651 bounds = __pEditTime->GetBoundsF();
653 float timeElementWidth = 0.0f;
654 float timeElementMinWidth = 0.0f;
655 float editTimeWidth = 0.0f;
657 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), timeElementWidth);
658 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_MIN_WIDTH, __pEditTime->GetOrientation(), timeElementMinWidth);
659 GET_SHAPE_CONFIG(EDITTIME::WIDTH, __pEditTime->GetOrientation(), editTimeWidth);
661 GET_DIMENSION_CONFIG(EDITTIME::MIN_SIZE, __pEditTime->GetOrientation(), minSize);
663 if (bounds.width >= editTimeWidth)
665 return timeElementWidth;
668 if (bounds.width <= minSize.width)
670 timeElementWidth = timeElementMinWidth;
672 else if (bounds.width < editTimeWidth && bounds.width > minSize.width)
674 timeElementWidth = timeElementWidth -
675 ((timeElementWidth - timeElementMinWidth) / (editTimeWidth - minSize.width)) * (editTimeWidth - bounds.width);
678 return timeElementWidth;
682 _EditTimePresenter::InitializeTitleObject(void)
684 result r = E_SUCCESS;
686 Color titleNormalColor;
688 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_NORMAL, titleNormalColor);
690 r = __titleObject.Construct();
691 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
693 TextSimple* pSimpleText = null;
695 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__title.GetPointer())), __title.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
696 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
698 __titleObject.AppendElement(*pSimpleText);
700 __titleObject.SetForegroundColor(titleNormalColor, 0, __titleObject.GetTextLength());
701 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
702 __titleObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
703 __titleObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
704 __titleObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
705 __titleObject.SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
711 _EditTimePresenter::InitializeTextObject(void)
713 result r = E_SUCCESS;
715 r = __textObject.Construct();
716 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
718 TextSimple* pSimpleText = new (std::nothrow)TextSimple(null, 0, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
719 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
720 "[E_OUT_OF_MEMORY] Memory allocation failed.");
722 pSimpleText->SetTextShadowEnabled(true);
723 pSimpleText->SetTextShadowOffset(FloatPoint(0.0f, -1.0f));
725 __textObject.AppendElement(*pSimpleText);
727 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
728 __textObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
729 __textObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
730 __textObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
736 _EditTimePresenter::Draw(void)
738 result r = E_SUCCESS;
745 Canvas* pCanvas = __pEditTime->GetCanvasN();
747 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), r, "Failed to get canvas.");
749 FloatRectangle colonBounds(0.0f, 0.0f, 0.0f, 0.0f);
751 float colonMargin = 0.0f;
755 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
758 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
759 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
760 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
761 bool isCustomBitmap = false;
762 Bitmap* pReplacementBitmap = null;
763 Bitmap* pEffectBitmap = null;
765 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
766 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
770 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
772 if (!__pEditTime->IsEnabled())
774 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_DISABLED);
775 pReplacementBitmap = __pAmPmBgDisabledColorReplacementBitmap;
776 pEffectBitmap = __pAmPmBgEffectDisabledBitmap;
778 else if (__selectedId != DATETIME_ID_AMPM)
780 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_NORMAL);
781 pReplacementBitmap = __pAmPmBgNormalColorReplacementBitmap;
782 pEffectBitmap = __pAmPmBgEffectNomralBitmap;
786 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_PRESSED);
787 pReplacementBitmap = __pAmPmBgPressedColorReplacementBitmap;
788 pEffectBitmap = __pAmPmBgEffectPressedBitmap;
792 if (GetHour() >= DATETIME_HOUR_MAX_FOR_24NOTATION)
803 GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonBounds.width);
804 GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
805 GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), colonBounds.height);
807 colonBounds.x = hourBounds.x + hourBounds.width + colonMargin;
808 colonBounds.y = hourBounds.y + (hourBounds.height - colonBounds.height) / 2.0f;
810 if (!__title.IsEmpty())
812 r = DrawTitle(*pCanvas);
813 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
816 r = DrawText(*pCanvas, hourBounds, __hourString, DATETIME_ID_HOUR);
817 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
819 r = DrawText(*pCanvas, minuteBounds, __minuteString, DATETIME_ID_MINUTE);
820 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
822 r = DrawColon(*pCanvas, colonBounds);
823 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
827 r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap, isCustomBitmap);
828 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
832 r = DrawResourceBitmap(*pCanvas, ampmBounds, pEffectBitmap);
833 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
836 r = DrawText(*pCanvas, ampmBounds, __ampmString, DATETIME_ID_AMPM, __amPmTextSize);
837 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
846 _EditTimePresenter::DrawFocus(void)
848 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
850 Canvas* pContentCanvas = null;
851 Canvas* pCanvas = __pEditTime->GetCanvasN();
852 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
854 if (__focusId == DATETIME_ID_HOUR)
856 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
858 else if (__focusId == DATETIME_ID_MINUTE)
860 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
862 else if (__focusId == DATETIME_ID_AMPM)
864 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
866 result r = E_SUCCESS;
868 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
870 r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
871 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
875 pContentCanvas = __pEditTime->GetCanvasN(bounds);
876 SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
878 bounds.x = (bounds.width - __pContentBgHighlightedColorReplacementBitmap->GetWidthF()) / 2;
879 bounds.y = (bounds.height - __pContentBgHighlightedColorReplacementBitmap->GetHeightF()) / 2;
881 r = pContentCanvas->DrawBitmap(FloatPoint(bounds.x, bounds.y), *__pContentBgHighlightedColorReplacementBitmap);
882 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
883 delete pContentCanvas;
891 delete pContentCanvas;
896 _EditTimePresenter::DrawColon(Canvas& canvas, const FloatRectangle& bounds)
898 result r = E_SUCCESS;
900 if (!__pEditTime->IsEnabled())
902 r = DrawResourceBitmap(canvas, bounds, __pColonDisabledColorReplacementBitmap);
906 r = DrawResourceBitmap(canvas, bounds, __pColonColorReplacementBitmap);
913 _EditTimePresenter::DrawTitle(Canvas& canvas)
915 if (!__pEditTime->IsEnabled())
917 Color titleDisabledColor;
918 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_DISABLED, titleDisabledColor);
919 __titleObject.SetForegroundColor(titleDisabledColor, 0, __titleObject.GetTextLength());
922 (_FontImpl::GetInstance(*__pFont))->SetSize(__titleFontSize);
923 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
924 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
926 __titleObject.Draw(*_CanvasImpl::GetInstance(canvas));
932 _EditTimePresenter::DrawContentBitmap(Canvas& canvas, const FloatRectangle& bounds, _DateTimeId boxId)
934 result r = E_SUCCESS;
936 bool isCustomBitmap = false;
937 Bitmap* pReplacementBitmap = null;
938 Bitmap* pEffectBitmap = null;
940 if (!__pEditTime->IsEnabled())
942 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_DISABLED);
943 pReplacementBitmap = __pContentBgDisabledColorReplacementBitmap;
944 pEffectBitmap = __pContentBgEffectDisabledBitmap;
946 else if (GetLastSelectedId() != boxId)
948 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_NORMAL);
949 pReplacementBitmap = __pContentBgNormalColorReplacementBitmap;
950 pEffectBitmap = __pContentBgEffectNormalBitmap;
954 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
955 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
956 pEffectBitmap = __pContentBgEffectPressedBitmap;
959 r = DrawResourceBitmap(canvas, bounds, pReplacementBitmap, isCustomBitmap);
960 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
964 r = DrawResourceBitmap(canvas, bounds, pEffectBitmap);
965 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
972 _EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId, float textSize)
974 result r = E_SUCCESS;
977 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
979 if (!__pEditTime->IsEnabled())
981 if (boxId == DATETIME_ID_AMPM)
983 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_DISABLED, textColor);
987 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, textColor);
992 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, textColor);
994 if (boxId == DATETIME_ID_AMPM)
996 if (boxId == __selectedId)
998 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_PRESSED, textColor);
1002 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_NORMAL, textColor);
1006 else if (boxId > -1 && boxId == GetLastSelectedId())
1008 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
1009 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
1013 if (boxId != DATETIME_ID_AMPM)
1015 DrawContentBitmap(canvas, bounds, boxId);
1018 FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
1019 drawAreaBounds = bounds;
1021 TextSimple* pSimpleText = null;
1022 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(text.GetPointer())), text.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1023 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1025 __textObject.RemoveAll();
1027 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1029 pSimpleText->SetTextShadowEnabled(true);
1030 pSimpleText->SetTextShadowOffset(FloatPoint(0.0f, -1.0f));
1032 __textObject.AppendElement(*pSimpleText);
1034 if (boxId == DATETIME_ID_AMPM)
1036 (_FontImpl::GetInstance(*__pFont))->SetSize(textSize);
1038 if (__isFocused && __focusId == boxId)
1040 if (boxId == DATETIME_ID_AMPM)
1042 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_HIGHLIGHTED, textColor);
1046 GET_COLOR_CONFIG(EDITTIME::TEXT_HIGHLIGHTED, textColor);
1052 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1054 __textObject.SetForegroundColor(textColor, 0, __textObject.GetTextLength());
1055 __textObject.SetBounds(drawAreaBounds);
1056 __textObject.Draw(*_CanvasImpl::GetInstance(canvas));
1062 _EditTimePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
1064 _DateTimeId displayBoxId = DATETIME_ID_NONE;
1066 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1067 FloatRectangle hoursBounds(0.0f, 0.0f, 0.0f, 0.0f);
1068 FloatRectangle minutesBounds(0.0f, 0.0f, 0.0f, 0.0f);
1072 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1075 hoursBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1076 minutesBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1078 if (point.y < hoursBounds.y || point.y > hoursBounds.y + hoursBounds.height)
1080 return displayBoxId;
1083 if (hoursBounds.Contains(point))
1085 displayBoxId = DATETIME_ID_HOUR;
1087 else if (minutesBounds.Contains(point))
1089 displayBoxId = DATETIME_ID_MINUTE;
1091 else if (ampmBounds.Contains(point))
1093 displayBoxId = DATETIME_ID_AMPM;
1096 return displayBoxId;
1100 _EditTimePresenter::SetLastSelectedId(_DateTimeId boxId)
1102 __lastSelectedId = boxId;
1107 _EditTimePresenter::GetLastSelectedId(void) const
1109 return __lastSelectedId;
1113 _EditTimePresenter::SetFocusedElement()
1115 if (__isEnterKeyPressed)
1117 __isEnterKeyPressed = false;
1119 if (__pEditTime->IsFocusModeStateEnabled())
1124 if (__focusId == DATETIME_ID_NONE || __focusId == DATETIME_ID_AMPM)
1126 __focusId = DATETIME_ID_HOUR;
1133 _EditTimePresenter::SetFocusState(bool isFocused)
1135 __isFocused = isFocused;
1140 _EditTimePresenter::OnFocusLost(const _Control &source)
1142 if (!__isEnterKeyPressed || __focusId == DATETIME_ID_AMPM)
1144 __focusId = DATETIME_ID_NONE;
1145 __selectedId = DATETIME_ID_NONE;
1147 __isFocused = false;
1148 __pEditTime->Invalidate();
1153 _EditTimePresenter::OnFocusModeStateChanged(void)
1155 __isFocused = false;
1156 __focusId = DATETIME_ID_NONE;
1157 __isEnterKeyPressed = false;
1158 __selectedId = DATETIME_ID_NONE;
1159 __pEditTime->Invalidate();
1164 _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1170 _KeyCode keyCode = keyInfo.GetKeyCode();
1176 __isEnterKeyPressed = false;
1177 if (__focusId == DATETIME_ID_HOUR)
1179 __focusId = DATETIME_ID_MINUTE;
1181 else if (__focusId == DATETIME_ID_MINUTE)
1183 if (!Is24HourNotationEnabled())
1185 __focusId = DATETIME_ID_AMPM;
1188 else if (__focusId == DATETIME_ID_AMPM)
1193 __pEditTime->Invalidate();
1198 __isEnterKeyPressed = false;
1199 if (__focusId == DATETIME_ID_MINUTE)
1201 __focusId = DATETIME_ID_HOUR;
1203 else if (__focusId == DATETIME_ID_AMPM)
1205 __focusId = DATETIME_ID_MINUTE;
1207 else if (__focusId == DATETIME_ID_HOUR)
1211 __pEditTime->Invalidate();
1216 if (__focusId == DATETIME_ID_AMPM)
1218 __selectedId = DATETIME_ID_AMPM;
1219 __pEditTime->Invalidate();
1237 _EditTimePresenter::OnKeyReleased(const _Control& source, const _KeyCode& keyCode)
1246 VisualElement* pEditTimeElement = __pEditTime->GetVisualElement();
1247 result r = GetLastResult();
1248 SysTryReturn(NID_UI_CTRL, (pEditTimeElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
1249 pEditTimeElement->RemoveAllAnimations();
1254 int displayValue = -1;
1256 _DateTimeId boxId = DATETIME_ID_HOUR;
1262 __isEnterKeyPressed = true;
1263 if (__focusId == DATETIME_ID_HOUR)
1265 boxId = DATETIME_ID_HOUR;
1266 if (__pEditTime->GetDateTimeBar() != null)
1268 if (!Is24HourNotationEnabled())
1272 minValue = DATETIME_HOUR_MIN + 1;
1273 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1274 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1276 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1278 minValue = DATETIME_HOUR_MIN + 1;
1279 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1280 displayValue = __pEditTime->GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1284 minValue = DATETIME_HOUR_MIN + 1;
1285 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1286 displayValue = __pEditTime->GetHour();
1291 minValue = DATETIME_HOUR_MIN;
1292 maxValue = DATETIME_HOUR_MAX;
1293 displayValue = __pEditTime->GetHour();
1296 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1298 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1302 else if (__focusId == DATETIME_ID_MINUTE)
1304 if (__pEditTime->GetDateTimeBar() != null)
1306 minValue = DATETIME_MINUTE_MIN;
1307 maxValue = DATETIME_MINUTE_MAX;
1308 displayValue = __pEditTime->GetMinute();
1310 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1312 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1315 boxId = DATETIME_ID_MINUTE;
1317 else if (__focusId == DATETIME_ID_AMPM)
1319 SetAmEnabled(!GetAmEnabled());
1320 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1321 boxId = DATETIME_ID_AMPM;
1322 __selectedId = DATETIME_ID_NONE;
1324 __pEditTime->Invalidate();
1327 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM))
1329 FloatRectangle absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1331 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1332 bounds = GetDisplayAreaBoundsFromHoursStyle(boxId);
1333 bounds.x += absoluteBounds.x;
1335 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1336 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1337 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1338 __pEditTime->GetDateTimeBar()->Open();
1339 UpdateLastSelectedValue(boxId, false);
1353 _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1355 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1357 if (&source != __pEditTime)
1362 __touchMoveHandled = false;
1364 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
1365 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1366 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1368 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1369 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1373 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1376 FloatPoint point = touchinfo.GetCurrentPosition();
1378 _DateTimeId boxId = GetBoxIdFromPosition(point);
1382 int displayValue = -1;
1384 if (boxId == DATETIME_ID_HOUR)
1386 if (__pEditTime->GetDateTimeBar() != null)
1392 minValue = DATETIME_HOUR_MIN + 1;
1393 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1394 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1396 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1398 minValue = DATETIME_HOUR_MIN + 1;
1399 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1400 displayValue = GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1404 minValue = DATETIME_HOUR_MIN + 1;
1405 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1406 displayValue = GetHour();
1411 minValue = DATETIME_HOUR_MIN;
1412 maxValue = DATETIME_HOUR_MAX;
1413 displayValue = GetHour();
1416 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1418 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1421 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1424 __bounds = hourBounds;
1426 else if (boxId == DATETIME_ID_MINUTE)
1428 if (__pEditTime->GetDateTimeBar() != null)
1430 minValue = DATETIME_MINUTE_MIN;
1431 maxValue = DATETIME_MINUTE_MAX;
1432 displayValue = GetMinute();
1434 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1436 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1439 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1442 __bounds = minuteBounds;
1444 else if (boxId == DATETIME_ID_AMPM)
1446 __selectedId = boxId;
1447 __bounds = ampmBounds;
1452 __selectedId = DATETIME_ID_NONE;
1456 __selectedId = boxId;
1462 _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1464 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1466 if (&source != __pEditTime)
1471 FloatRectangle bounds = __pEditTime->GetBoundsF();
1473 FloatPoint startPoint(0.0f, 0.0f);
1475 float titleHeight = 0;
1476 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), titleHeight);
1478 __bounds = FloatRectangle(0.0f, titleHeight, bounds.width, bounds.height);
1480 FloatPoint point = touchinfo.GetCurrentPosition();
1482 _DateTimeId boxId = GetBoxIdFromPosition(point);
1484 if ((boxId == GetLastSelectedId() && boxId != DATETIME_ID_AMPM) || boxId != __selectedId || boxId == DATETIME_ID_NONE)
1486 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1488 __pEditTime->GetDateTimeBar()->CloseDateTimeBar();
1491 __selectedId = DATETIME_ID_NONE;
1492 SetLastSelectedId(__selectedId);
1498 UpdateLastSelectedValue(__selectedId, true);
1499 if (GetLastSelectedId() == DATETIME_ID_AMPM)
1506 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
1508 __pEditTime->SetFocused(true);
1510 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1511 bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
1512 FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1513 absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1514 bounds.x += absoluteBounds.x;
1516 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1518 if (__pEditTime->GetDateTimeBar()->IsActivated())
1520 __pEditTime->GetDateTimeBar()->RemoveAllAnimations();
1521 __pEditTime->GetDateTimeBar()->Close();
1522 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1523 __pEditTime->GetDateTimeBar()->Open();
1527 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1528 __pEditTime->GetDateTimeBar()->Open();
1532 __selectedId = DATETIME_ID_NONE;
1537 _EditTimePresenter::UpdateLastSelectedValue(_DateTimeId boxId, bool isTouchPressed)
1539 __selectedId = boxId;
1540 SetLastSelectedId(boxId);
1542 __lastSelectedValue = "";
1544 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1546 int hours = GetHour();
1548 if (!Is24HourNotationEnabled())
1552 if (hours == DATETIME_HOUR_MIN)
1554 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1557 __lastSelectedValue.Format(10, L"%02d", hours);
1560 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1563 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1565 __lastSelectedValue.Format(10, L"%02d", GetMinute());
1568 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1571 else if (GetLastSelectedId() == DATETIME_ID_AMPM)
1573 SetAmEnabled(!GetAmEnabled());
1574 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1577 __pEditTime->UpdateAccessibilityElement();
1578 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1580 __selectedId = DATETIME_ID_NONE;
1582 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1584 __pEditTime->GetDateTimeBar()->SetVisibleState(false);
1585 __pEditTime->GetDateTimeBar()->Close();
1589 __selectedId = DATETIME_ID_NONE;
1590 __pEditTime->Invalidate();
1595 _EditTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1597 if (&source != __pEditTime)
1602 __selectedId = DATETIME_ID_NONE;
1608 _EditTimePresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1610 if (&source != __pEditTime)
1615 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1624 _EditTimePresenter::OnTouchMoveHandled(const _Control& control)
1626 __touchMoveHandled = true;
1627 __selectedId = DATETIME_ID_NONE;
1633 _EditTimePresenter::OnFontChanged(Font* pFont)
1637 if (__pEditTime->GetDateTimeBar() != null)
1639 __pEditTime->GetDateTimeBar()->SetFont(*pFont);
1646 _EditTimePresenter::OnFontInfoRequested(unsigned long& style, float& size)
1648 style = FONT_STYLE_PLAIN;
1649 size = __timeFontSize;
1655 _EditTimePresenter::Initialize(void)
1657 result r = E_SUCCESS;
1659 float titleTimeMargin = 0;
1660 float timeHeight = 0;
1661 float editTimeHeight = 0;
1663 GET_SHAPE_CONFIG(EDITTIME::TEXT_FONT_SIZE, __pEditTime->GetOrientation(), __titleFontSize);
1664 GET_SHAPE_CONFIG(EDITTIME::TIME_FONT_SIZE, __pEditTime->GetOrientation(), __timeFontSize);
1665 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
1666 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
1667 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
1669 if (__pEditTime->GetBoundsF().height > editTimeHeight)
1671 editTimeHeight = __pEditTime->GetBoundsF().height;
1674 if (!__title.IsEmpty())
1677 if (!__isEditTimeInitialized)
1679 r = InitializeTitleObject();
1680 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1683 __titleBounds.y = (editTimeHeight - (__titleBounds.height + titleTimeMargin + timeHeight)) / 2.0f;
1684 __titleObject.SetBounds(__titleBounds);
1687 __pFont = __pEditTime->GetFallbackFont();
1688 r = GetLastResult();
1689 SysTryReturn(NID_UI_CTRL, __pFont != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
1691 if (!__isEditTimeInitialized)
1694 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1696 r = InitializeTextObject();
1697 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1700 __isEditTimeInitialized = true;
1707 _EditTimePresenter::UpdateTimeFormat(void)
1709 if (!__is24hoursSet)
1711 String key(L"http://tizen.org/setting/locale.time.format.24hour");
1712 SettingInfo::GetValue(key , __24hours);
1719 _EditTimePresenter::Animate(void)
1721 SysTryReturnVoidResult(NID_UI_CTRL, !__isAnimating, E_SUCCESS, "Rolling animation is in progress.");
1722 SysAssertf((__pFont != null), "Font instance must not be null.");
1724 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1726 result r = E_SUCCESS;
1727 FloatRectangle rect;
1729 String minuteString;
1731 TextSimple* pOldSimpleText = null;
1732 TextSimple* pNewSimpleText = null;
1733 bool isCustomBitmap = false;
1735 _DateTimeUtils dateTimeUtils;
1736 int hours = GetHour();
1737 if (!Is24HourNotationEnabled())
1741 if (hours == DATETIME_HOUR_MIN)
1743 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1746 hourString.Format(10, L"%02d", hours);
1747 minuteString.Format(10, L"%02d", GetMinute());
1749 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1751 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(hourString) == false), E_SUCCESS, "[E_SUCCESS] Hour string matched.");
1753 newValue = hourString;
1754 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1756 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1758 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(minuteString) == false), E_SUCCESS, "[E_SUCCESS] Minute string matched.");
1760 newValue = minuteString;
1761 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1764 FloatDimension newTextDim;
1765 FloatDimension oldTextDim;
1766 FloatPoint textPoint;
1767 VisualElement* pNewVisualElement = null;
1768 VisualElement* pOldVisualElement = null;
1769 VisualElement* pEditTimeElement = null;
1770 VisualElementPropertyAnimation* pNewBoundsAnimation = null;
1771 VisualElementPropertyAnimation* pOldBoundsAnimation = null;
1772 Canvas* pCanvas = null;
1773 Canvas* pContentCanvas = null;
1774 Color contentBgColor;
1775 Color textNormalColor;
1776 Color textPressedColor;
1777 float contentTextMargin;
1779 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentBgColor);
1780 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textPressedColor);
1781 GET_SHAPE_CONFIG(EDITDATE::CONTENT_TEXT_MARGIN, __pEditTime->GetOrientation(), contentTextMargin);
1783 __pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
1784 __pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
1786 if (newTextDim.width > oldTextDim.width)
1788 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1792 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1795 SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditTime->GetBounds().width), E_SUCCESS, "Rolling animation cann't be played.");
1797 __isAnimating = true;
1799 __pContentProvider = new (std::nothrow) VisualElement();
1800 SysTryReturnVoidResult(NID_UI_CTRL, (__pContentProvider != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1802 r = __pContentProvider->Construct();
1803 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1805 __pContentProvider->SetShowState(true);
1806 __pContentProvider->SetClipChildrenEnabled(true);
1807 __pContentProvider->SetImplicitAnimationEnabled(false);
1809 pEditTimeElement = __pEditTime->GetVisualElement();
1810 r = GetLastResult();
1811 SysTryCatch(NID_UI_CTRL, (pEditTimeElement != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1813 pNewVisualElement = new (std::nothrow) VisualElement();
1814 SysTryCatch(NID_UI_CTRL, (pNewVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1816 r = pNewVisualElement->Construct();
1819 pNewVisualElement->Destroy();
1820 pNewVisualElement = null;
1822 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1824 pNewVisualElement->SetShowState(true);
1826 pOldVisualElement = new (std::nothrow) VisualElement();
1827 if (pOldVisualElement == null)
1829 pNewVisualElement->Destroy();
1830 pNewVisualElement = null;
1832 SysTryCatch(NID_UI_CTRL, (pOldVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1834 r = pOldVisualElement->Construct();
1837 pNewVisualElement->Destroy();
1838 pOldVisualElement->Destroy();
1839 pNewVisualElement = null;
1840 pOldVisualElement = null;
1842 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1844 pOldVisualElement->SetShowState(true);
1846 __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + (contentTextMargin * 2.0f)), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 4.0f))));
1848 pNewVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1849 pOldVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1851 pContentCanvas = pEditTimeElement->GetCanvasN(__pContentProvider->GetBounds());
1852 r = GetLastResult();
1853 SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1854 pContentCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1855 pContentCanvas->Clear();
1857 pCanvas = pEditTimeElement->GetCanvasN(rect);
1858 r = GetLastResult();
1859 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1860 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1864 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
1865 r = DrawResourceBitmap(*pCanvas, rect, __pContentBgPressedColorReplacementBitmap, isCustomBitmap);
1867 if (!isCustomBitmap)
1869 result res = DrawResourceBitmap(*pCanvas, rect, __pContentBgEffectPressedBitmap);
1871 if (res != E_SUCCESS)
1873 SysLog(NID_UI_CTRL, "[%s] Propagating.", GetErrorMessage(res));
1882 pContentCanvas->SetBackgroundColor(contentBgColor);
1883 pContentCanvas->Clear();
1886 delete pContentCanvas;
1887 pContentCanvas = null;
1889 pEditTimeElement->AttachChild(*__pContentProvider);
1891 __pContentProvider->AttachChild(*pOldVisualElement);
1892 __pContentProvider->AttachChild(*pNewVisualElement);
1894 pNewBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1895 SysTryCatch(NID_UI_CTRL, (pNewBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1897 pNewBoundsAnimation->SetDuration(300);
1898 pNewBoundsAnimation->SetPropertyName("bounds.position");
1899 pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, oldTextDim.height)));
1900 pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, 0.0f)));
1902 pOldBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1903 SysTryCatch(NID_UI_CTRL, (pOldBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1905 pOldBoundsAnimation->SetDuration(300);
1906 pOldBoundsAnimation->SetPropertyName("bounds.position");
1907 pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, 0.0f)));
1908 pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, oldTextDim.height * -1.0f)));
1910 pOldSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__lastSelectedValue.GetPointer())), __lastSelectedValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1911 SysTryCatch(NID_UI_CTRL, (pOldSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1913 pOldSimpleText->SetTextShadowEnabled(true);
1914 pOldSimpleText->SetTextShadowOffset(FloatPoint(0.0f, -1.0f));
1916 pCanvas = pOldVisualElement->GetCanvasN();
1917 r = GetLastResult();
1918 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1920 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1922 pCanvas->SetForegroundColor(textPressedColor);
1924 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1925 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1926 __textObject.RemoveAll();
1927 __textObject.AppendElement(*pOldSimpleText);
1929 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1930 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1931 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1932 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1937 pNewSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(newValue.GetPointer())), newValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1938 SysTryCatch(NID_UI_CTRL, (pNewSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1940 pNewSimpleText->SetTextShadowEnabled(true);
1941 pNewSimpleText->SetTextShadowOffset(FloatPoint(0.0f, -1.0f));
1943 pCanvas = pNewVisualElement->GetCanvasN();
1944 r = GetLastResult();
1945 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1947 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1949 pCanvas->SetForegroundColor(textPressedColor);
1951 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1952 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1953 __textObject.RemoveAll();
1954 __textObject.AppendElement(*pNewSimpleText);
1956 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1957 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1958 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1959 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1964 pOldVisualElement->SetImplicitAnimationEnabled(false);
1965 pNewVisualElement->SetImplicitAnimationEnabled(false);
1967 AnimationTransaction::Begin(__transactionId);
1968 pOldVisualElement->AddAnimation(*pOldBoundsAnimation);
1969 pNewVisualElement->AddAnimation(*pNewBoundsAnimation);
1970 AnimationTransaction::SetCurrentTransactionEventListener(__pEditTime);
1971 AnimationTransaction::Commit();
1973 delete pOldBoundsAnimation;
1974 delete pNewBoundsAnimation;
1979 __isAnimating = false;
1980 __pContentProvider->Destroy();
1981 __pContentProvider = null;
1983 delete pNewBoundsAnimation;
1984 pNewBoundsAnimation = null;
1986 delete pOldBoundsAnimation;
1987 pOldBoundsAnimation = null;
1989 delete pOldSimpleText;
1990 pOldSimpleText = null;
1992 delete pNewSimpleText;
1993 pNewSimpleText = null;
1995 delete pContentCanvas;
1996 pContentCanvas = null;
2002 _EditTimePresenter::EndTransaction(void)
2004 result r = E_SUCCESS;
2006 __isAnimating = false;
2007 VisualElement* pEditTimeElement = __pEditTime->GetVisualElement();
2008 r = GetLastResult();
2009 SysTryReturnVoidResult(NID_UI_CTRL, (pEditTimeElement != null), r, "[%s] Propagating.", GetErrorMessage(r));
2011 if (__pContentProvider != null)
2013 pEditTimeElement->DetachChild(*__pContentProvider);
2014 __pContentProvider->Destroy();
2015 __pContentProvider = null;
2020 __transactionId = 0;
2023 }}} // Tizen::Ui::Controls