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 <FGrp_BitmapImpl.h>
25 #include <FGrp_TextTextObject.h>
26 #include <FGrp_TextTextSimple.h>
27 #include <FGrp_FontImpl.h>
28 #include "FUi_CoordinateSystemUtils.h"
29 #include "FUi_ResourceManager.h"
30 #include "FUiCtrl_EditTimePresenter.h"
31 #include "FUiCtrl_EditTime.h"
32 #include "FUiCtrl_DateTimeModel.h"
33 #include "FUiCtrl_DateTimeUtils.h"
34 #include "FUiAnim_VisualElement.h"
35 #include "FUiAnimVisualElementPropertyAnimation.h"
36 #include "FGrpColor.h"
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Base;
40 using namespace Tizen::Graphics::_Text;
41 using namespace Tizen::Ui::Animations;
42 using namespace Tizen::System;
44 namespace Tizen { namespace Ui { namespace Controls
46 _EditTimePresenter::_EditTimePresenter(const String& title)
47 : __pEditDateTimeModel(null)
49 , __bounds(FloatRectangle())
50 , __titleBounds(FloatRectangle())
51 , __ampmString(String())
52 , __hourString(String())
53 , __minuteString(String())
56 , __is24hoursSet(false)
58 , __timePickerEnabled(true)
59 , __selectedId(DATETIME_ID_NONE)
60 , __lastSelectedId(DATETIME_ID_NONE)
61 , __focusId(DATETIME_ID_NONE)
62 , __touchMoveHandled(false)
63 , __pAmPmBgNormalColorReplacementBitmap(null)
64 , __pAmPmBgDisabledColorReplacementBitmap(null)
65 , __pAmPmBgPressedColorReplacementBitmap(null)
66 , __pAmPmBgHighlightedColorReplacementBitmap(null)
67 , __pAmPmBgEffectNomralBitmap(null)
68 , __pAmPmBgEffectPressedBitmap(null)
69 , __pAmPmBgEffectDisabledBitmap(null)
70 , __pColonColorReplacementBitmap(null)
71 , __pColonDisabledColorReplacementBitmap(null)
72 , __pContentBgNormalColorReplacementBitmap(null)
73 , __pContentBgDisabledColorReplacementBitmap(null)
74 , __pContentBgPressedColorReplacementBitmap(null)
75 , __pContentBgHighlightedColorReplacementBitmap(null)
76 , __pContentBgEffectNormalBitmap(null)
77 , __pContentBgEffectPressedBitmap(null)
78 , __pContentBgEffectDisabledBitmap(null)
79 , __pContentProvider(null)
83 , __amPmTextSize(0.0f)
84 , __titleFontSize(0.0f)
85 , __timeFontSize(0.0f)
86 , __isAnimating(false)
87 , __isEditTimeInitialized(false)
88 , __isEnterKeyPressed(false)
93 _EditTimePresenter::~_EditTimePresenter(void)
95 __textObject.RemoveAll();
96 __titleObject.RemoveAll();
98 delete __pEditDateTimeModel;
99 __pEditDateTimeModel = null;
101 delete __pAmPmBgNormalColorReplacementBitmap;
102 __pAmPmBgNormalColorReplacementBitmap = null;
104 delete __pAmPmBgDisabledColorReplacementBitmap;
105 __pAmPmBgDisabledColorReplacementBitmap = null;
107 delete __pAmPmBgPressedColorReplacementBitmap;
108 __pAmPmBgPressedColorReplacementBitmap = null;
110 delete __pAmPmBgHighlightedColorReplacementBitmap;
111 __pAmPmBgHighlightedColorReplacementBitmap = null;
113 delete __pAmPmBgEffectNomralBitmap;
114 __pAmPmBgEffectNomralBitmap = null;
116 delete __pAmPmBgEffectPressedBitmap;
117 __pAmPmBgEffectPressedBitmap = null;
119 delete __pAmPmBgEffectDisabledBitmap;
120 __pAmPmBgEffectDisabledBitmap = null;
122 delete __pColonColorReplacementBitmap;
123 __pColonColorReplacementBitmap = null;
125 delete __pColonDisabledColorReplacementBitmap;
126 __pColonDisabledColorReplacementBitmap = null;
128 delete __pContentBgNormalColorReplacementBitmap;
129 __pContentBgNormalColorReplacementBitmap = null;
131 delete __pContentBgDisabledColorReplacementBitmap;
132 __pContentBgDisabledColorReplacementBitmap = null;
134 delete __pContentBgPressedColorReplacementBitmap;
135 __pContentBgPressedColorReplacementBitmap = null;
137 delete __pContentBgHighlightedColorReplacementBitmap;
138 __pContentBgHighlightedColorReplacementBitmap = null;
140 delete __pContentBgEffectNormalBitmap;
141 __pContentBgEffectNormalBitmap = null;
143 delete __pContentBgEffectPressedBitmap;
144 __pContentBgEffectPressedBitmap = null;
146 delete __pContentBgEffectDisabledBitmap;
147 __pContentBgEffectDisabledBitmap = null;
151 _EditTimePresenter::CreateInstanceN(const _EditTime& editTime, const String& title)
153 _EditTimePresenter* pEditTimePresenter = new (std::nothrow) _EditTimePresenter(title);
154 SysTryReturn(NID_UI_CTRL, pEditTimePresenter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
156 pEditTimePresenter->__pEditTime = const_cast <_EditTime*>(&editTime);
158 pEditTimePresenter->__pEditDateTimeModel = new (std::nothrow) _DateTimeModel;
159 SysTryCatch(NID_UI_CTRL, pEditTimePresenter->__pEditDateTimeModel, , E_OUT_OF_MEMORY,
160 "[E_OUT_OF_MEMORY] Memory allocation failed.");
162 return pEditTimePresenter;
165 delete pEditTimePresenter;
170 _EditTimePresenter::GetTime(void) const
173 time.SetValue(DATETIME_YEAR_MIN, DATETIME_MONTH_MIN, DATETIME_DAY_MIN, GetHour(), GetMinute(), 0);
179 _EditTimePresenter::GetHour(void) const
181 return __pEditDateTimeModel->GetHour();
185 _EditTimePresenter::GetMinute(void) const
187 return __pEditDateTimeModel->GetMinute();
191 _EditTimePresenter::SetTime(const DateTime& time)
193 __pEditDateTimeModel->SetDateTime(time);
197 _EditTimePresenter::SetCurrentTime(void)
199 __pEditDateTimeModel->SetCurrentDateTime();
204 _EditTimePresenter::SetHour(int hour)
206 return __pEditDateTimeModel->SetHour(hour);
210 _EditTimePresenter::SetMinute(int minute)
212 return __pEditDateTimeModel->SetMinute(minute);
216 _EditTimePresenter::SetTimePickerEnabled(bool enable)
218 __timePickerEnabled = enable;
223 _EditTimePresenter::IsTimePickerEnabled(void) const
225 return __timePickerEnabled;
229 _EditTimePresenter::Set24HourNotationEnabled(bool enable)
232 __is24hoursSet = true;
237 _EditTimePresenter::Is24HourNotationEnabled(void) const
243 _EditTimePresenter::SetTimeConversion(void)
245 int hour = GetHour();
246 int minute = GetMinute();
248 if (__24hours == false)
250 int max = DATETIME_HOUR_MAX_FOR_24NOTATION;
254 __hourString.Format(10, L"%02d", hour - max);
256 else if (hour == DATETIME_HOUR_MIN)
258 __hourString.Format(10, L"%02d", hour + DATETIME_HOUR_MAX_FOR_24NOTATION);
262 __hourString.Format(10, L"%02d", hour);
265 __minuteString.Format(10, L"%02d", minute);
269 __hourString.Format(10, L"%02d", hour);
270 __minuteString.Format(10, L"%02d", minute);
277 _EditTimePresenter::SetAmEnabled(bool amEnable)
282 _DateTimeUtils dateTimeUtils;
283 dateTimeUtils.GetAmPm(textAm, AM_TYPE);
284 dateTimeUtils.GetAmPm(textPm, PM_TYPE);
286 __amEnable = amEnable;
287 int hour = GetHour();
289 if (__amEnable == true)
291 __ampmString = textAm;
292 if (hour >= DATETIME_HOUR_MAX_FOR_24NOTATION)
294 SetHour(hour - DATETIME_HOUR_MAX_FOR_24NOTATION);
299 __ampmString = textPm;
300 if (hour < DATETIME_HOUR_MAX_FOR_24NOTATION)
302 SetHour(hour + DATETIME_HOUR_MAX_FOR_24NOTATION);
310 _EditTimePresenter::GetAmEnabled(void) const
316 _EditTimePresenter::GetDisplayAreaBoundsFromHoursStyle(_DateTimeId displayBoxId) const
318 SysTryReturn(NID_UI_CTRL, displayBoxId >= DATETIME_ID_HOUR && displayBoxId <= DATETIME_ID_AMPM, FloatRectangle(),
319 E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] displayBoxId is out of range.");
321 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
323 float editTimeHeight = 0.0f;
324 float colonWidth = 0.0f;
325 float timeAmPmMargin = 0.0f;
326 float colonMargin = 0.0f;
327 float timeElementWidth = 0.0f;
328 float amPmHeight = 0.0f;
329 float timeHeight = 0.0f;
330 float titleTimeMargin = 0.0f;
331 float leftMargin = 0.0f;
333 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
334 GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonWidth);
335 GET_SHAPE_CONFIG(EDITTIME::TIME_AMPM_MARGIN, __pEditTime->GetOrientation(), timeAmPmMargin);
336 GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
337 GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), amPmHeight);
338 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
339 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
341 GET_SHAPE_CONFIG(EDITTIME::TIME_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), leftMargin);
343 if (__pEditTime->GetBoundsF().height > editTimeHeight)
345 editTimeHeight = __pEditTime->GetBoundsF().height;
348 bounds.y = (editTimeHeight - timeHeight) / 2.0f;
350 if (!__title.IsEmpty())
352 if (displayBoxId == DATETIME_ID_AMPM)
354 bounds.y = __titleBounds.y + __titleBounds.height;
358 bounds.y = __titleBounds.y + __titleBounds.height + titleTimeMargin;
362 bounds.x = leftMargin;
363 bounds.height = timeHeight;
365 timeElementWidth = GetTimeElementWidth();
367 if (displayBoxId == DATETIME_ID_HOUR)
369 bounds.width = timeElementWidth;
371 else if (displayBoxId == DATETIME_ID_MINUTE)
373 bounds.x = bounds.x + timeElementWidth + colonWidth + (2.0f * colonMargin);
374 bounds.width = timeElementWidth;
376 else if (displayBoxId == DATETIME_ID_AMPM)
378 bounds.x = leftMargin + (2.0f * timeElementWidth) + colonWidth + (2.0f * colonMargin) + timeAmPmMargin;
380 if (__title.IsEmpty())
382 bounds.y = (editTimeHeight - amPmHeight) / 2.0f;
385 GET_SHAPE_CONFIG(EDITTIME::AMPM_WIDTH, __pEditTime->GetOrientation(), bounds.width);
386 bounds.height = amPmHeight;
393 _EditTimePresenter::GetTextWidth(_DateTimeId boxId) const
395 result r = E_SUCCESS;
397 TextObject dateObject;
401 hourString.Format(10, L"%02d", GetHour());
402 minuteString.Format(10, L"%02d", GetMinute());
404 r = dateObject.Construct();
405 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
407 TextSimple* pSimpleText = null;
409 if (boxId == DATETIME_ID_HOUR)
411 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(hourString.GetPointer())), hourString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
413 else if (boxId == DATETIME_ID_MINUTE)
415 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(minuteString.GetPointer())), minuteString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
418 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), dim.width, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
420 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
422 dateObject.AppendElement(*pSimpleText);
423 dateObject.SetFont(__pFont, 0, dateObject.GetTextLength());
424 dim = dateObject.GetTextExtentF(0, dateObject.GetTextLength());
426 dateObject.RemoveAll();
431 _EditTimePresenter::SetTitleBounds(void)
433 GET_SHAPE_CONFIG(EDITTIME::TITLE_TEXT_LEFT_MARGIN, __pEditTime->GetOrientation(), __titleBounds.x);
434 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), __titleBounds.height);
436 __titleBounds.width = __pEditTime->GetBoundsF().width - __titleBounds.x;
441 _EditTimePresenter::GetTitleBounds(void) const
443 return __titleBounds;
447 _EditTimePresenter::LoadResource(void)
449 result r = E_SUCCESS;
451 Color buttonNormalBgColor;
452 Color buttonDisabledBgColor;
453 Color buttonPressedColor;
454 Color buttonHighlightedColor;
455 Color contentNormalBgColor;
456 Color contentDisabledBgColor;
457 Color contentPressedColor;
458 Color contentHighlightedColor;
459 Color colonTextColor;
460 Color colonTextDisabledColor;
461 Bitmap* pTempBitmap = null;
463 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_NORMAL, buttonNormalBgColor);
464 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_PRESSED, buttonPressedColor);
465 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_DISABLED, buttonDisabledBgColor);
466 GET_COLOR_CONFIG(EDITTIME::BUTTON_BG_HIGHLIGHTED, buttonHighlightedColor);
468 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_NORMAL, contentNormalBgColor);
469 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_DISABLED, contentDisabledBgColor);
470 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentPressedColor);
471 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_HIGHLIGHTED, contentHighlightedColor);
473 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, colonTextColor);
474 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, colonTextDisabledColor);
476 GET_SHAPE_CONFIG(EDITTIME::AMPM_FONT_SIZE, __pEditTime->GetOrientation(), __amPmTextSize);
478 r = GET_BITMAP_CONFIG_N(EDITTIME::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
479 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
481 __pColonColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA),
483 SysTryCatch(NID_UI_CTRL, (__pColonColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
484 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
486 __pColonDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA),
487 colonTextDisabledColor);
488 SysTryCatch(NID_UI_CTRL, (__pColonDisabledColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
489 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
494 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
495 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
497 __pAmPmBgNormalColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonNormalBgColor);
498 SysTryCatch(NID_UI_CTRL, (__pAmPmBgNormalColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
499 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
504 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
505 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
507 __pAmPmBgDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonDisabledBgColor);
508 SysTryCatch(NID_UI_CTRL, (__pAmPmBgDisabledColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
509 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
514 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
515 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
517 __pAmPmBgPressedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonPressedColor);
518 SysTryCatch(NID_UI_CTRL, (__pAmPmBgPressedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
519 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
524 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
525 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
527 __pAmPmBgHighlightedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), buttonHighlightedColor);
528 SysTryCatch(NID_UI_CTRL, (__pAmPmBgHighlightedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
529 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
534 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
535 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
537 __pContentBgNormalColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentNormalBgColor);
538 SysTryCatch(NID_UI_CTRL, (__pContentBgNormalColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
539 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
544 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
545 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
547 __pContentBgPressedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentPressedColor);
548 SysTryCatch(NID_UI_CTRL, (__pContentBgPressedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
549 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
554 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
555 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
557 __pContentBgDisabledColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentDisabledBgColor);
558 SysTryCatch(NID_UI_CTRL, (__pContentBgDisabledColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
559 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
564 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pTempBitmap);
565 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
567 __pContentBgHighlightedColorReplacementBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pTempBitmap, Color::GetColor(COLOR_ID_MAGENTA), contentHighlightedColor);
568 SysTryCatch(NID_UI_CTRL, (__pContentBgHighlightedColorReplacementBitmap != null), r = GetLastResult(), GetLastResult(),
569 "[%s] Propagating.", GetErrorMessage(GetLastResult()));
571 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectNomralBitmap);
572 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
574 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectPressedBitmap);
575 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
577 r = GET_BITMAP_CONFIG_N(EDITTIME::BUTTON_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmBgEffectDisabledBitmap);
578 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
580 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectNormalBitmap);
581 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
583 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectPressedBitmap);
584 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
586 r = GET_BITMAP_CONFIG_N(EDITTIME::CONTENT_BG_EFFECT_DISABLED, BITMAP_PIXEL_FORMAT_ARGB8888, __pContentBgEffectDisabledBitmap);
587 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
599 delete __pAmPmBgNormalColorReplacementBitmap;
600 __pAmPmBgNormalColorReplacementBitmap = null;
602 delete __pAmPmBgPressedColorReplacementBitmap;
603 __pAmPmBgPressedColorReplacementBitmap = null;
605 delete __pAmPmBgDisabledColorReplacementBitmap;
606 __pAmPmBgDisabledColorReplacementBitmap = null;
608 delete __pAmPmBgHighlightedColorReplacementBitmap;
609 __pAmPmBgHighlightedColorReplacementBitmap = null;
611 delete __pContentBgNormalColorReplacementBitmap;
612 __pContentBgNormalColorReplacementBitmap = null;
614 delete __pContentBgPressedColorReplacementBitmap;
615 __pContentBgPressedColorReplacementBitmap = null;
617 delete __pContentBgDisabledColorReplacementBitmap;
618 __pContentBgDisabledColorReplacementBitmap = null;
620 delete __pContentBgHighlightedColorReplacementBitmap;
621 __pContentBgHighlightedColorReplacementBitmap = null;
623 delete __pAmPmBgEffectNomralBitmap;
624 __pAmPmBgEffectNomralBitmap = null;
626 delete __pAmPmBgEffectPressedBitmap;
627 __pAmPmBgEffectPressedBitmap = null;
629 delete __pAmPmBgEffectDisabledBitmap;
630 __pAmPmBgEffectDisabledBitmap = null;
632 delete __pContentBgEffectNormalBitmap;
633 __pContentBgEffectNormalBitmap = null;
635 delete __pContentBgEffectPressedBitmap;
636 __pContentBgEffectPressedBitmap = null;
638 delete __pContentBgEffectDisabledBitmap;
639 __pContentBgEffectDisabledBitmap = null;
641 delete __pColonColorReplacementBitmap;
642 __pColonColorReplacementBitmap = null;
644 delete __pColonDisabledColorReplacementBitmap;
645 __pColonDisabledColorReplacementBitmap = null;
651 _EditTimePresenter::DrawResourceBitmap(Canvas& canvas, const FloatRectangle& bounds, Bitmap* pBitmap)
653 result r = E_SUCCESS;
660 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*pBitmap))
662 r = canvas.DrawNinePatchedBitmap(bounds, *pBitmap);
663 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
667 r = canvas.DrawBitmap(bounds, *pBitmap);
668 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
675 _EditTimePresenter::GetTimeElementWidth(void) const
677 FloatRectangle bounds;
678 FloatDimension minSize;
679 bounds = __pEditTime->GetBoundsF();
681 float timeElementWidth = 0.0f;
682 float timeElementMinWidth = 0.0f;
683 float editTimeWidth = 0.0f;
685 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_WIDTH, __pEditTime->GetOrientation(), timeElementWidth);
686 GET_SHAPE_CONFIG(EDITTIME::HOUR_MINUTE_MIN_WIDTH, __pEditTime->GetOrientation(), timeElementMinWidth);
687 GET_SHAPE_CONFIG(EDITTIME::WIDTH, __pEditTime->GetOrientation(), editTimeWidth);
689 GET_DIMENSION_CONFIG(EDITTIME::MIN_SIZE, __pEditTime->GetOrientation(), minSize);
691 if (bounds.width >= editTimeWidth)
693 return timeElementWidth;
696 if (bounds.width <= minSize.width)
698 timeElementWidth = timeElementMinWidth;
700 else if (bounds.width < editTimeWidth && bounds.width > minSize.width)
702 timeElementWidth = timeElementWidth -
703 ((timeElementWidth - timeElementMinWidth) / (editTimeWidth - minSize.width)) * (editTimeWidth - bounds.width);
706 return timeElementWidth;
710 _EditTimePresenter::InitializeTitleObject(void)
712 result r = E_SUCCESS;
714 Color titleNormalColor;
716 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_NORMAL, titleNormalColor);
718 r = __titleObject.Construct();
719 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
721 TextSimple* pSimpleText = null;
723 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__title.GetPointer())), __title.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
724 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
726 __titleObject.AppendElement(*pSimpleText);
728 __titleObject.SetForegroundColor(titleNormalColor, 0, __titleObject.GetTextLength());
729 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
730 __titleObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
731 __titleObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
732 __titleObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
733 __titleObject.SetTextObjectEllipsisType(TEXT_OBJECT_ELLIPSIS_TYPE_TAIL);
739 _EditTimePresenter::InitializeTextObject(void)
741 result r = E_SUCCESS;
743 r = __textObject.Construct();
744 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
746 TextSimple* pSimpleText = new (std::nothrow)TextSimple(null, 0, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
747 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
748 "[E_OUT_OF_MEMORY] Memory allocation failed.");
750 __textObject.AppendElement(*pSimpleText);
752 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
753 __textObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
754 __textObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
755 __textObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
761 _EditTimePresenter::Draw(void)
763 result r = E_SUCCESS;
770 Canvas* pCanvas = __pEditTime->GetCanvasN();
771 SysAssertf((pCanvas != null), "Failed to get canvas.");
773 FloatRectangle colonBounds(0.0f, 0.0f, 0.0f, 0.0f);
775 float colonMargin = 0.0f;
779 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
782 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
783 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
784 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
785 bool isCustomBitmap = false;
786 Bitmap* pReplacementBitmap = null;
787 Bitmap* pEffectBitmap = null;
789 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
790 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
792 if (__24hours == false)
794 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
796 if (!__pEditTime->IsEnabled())
798 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_DISABLED);
799 pReplacementBitmap = __pAmPmBgDisabledColorReplacementBitmap;
800 pEffectBitmap = __pAmPmBgEffectDisabledBitmap;
802 else if (__selectedId != DATETIME_ID_AMPM)
804 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_NORMAL);
805 pReplacementBitmap = __pAmPmBgNormalColorReplacementBitmap;
806 pEffectBitmap = __pAmPmBgEffectNomralBitmap;
810 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::BUTTON_BG_PRESSED);
811 pReplacementBitmap = __pAmPmBgPressedColorReplacementBitmap;
812 pEffectBitmap = __pAmPmBgEffectPressedBitmap;
816 if (GetHour() >= DATETIME_HOUR_MAX_FOR_24NOTATION)
827 GET_SHAPE_CONFIG(EDITTIME::COLON_WIDTH, __pEditTime->GetOrientation(), colonBounds.width);
828 GET_SHAPE_CONFIG(EDITTIME::COLON_MARGIN, __pEditTime->GetOrientation(), colonMargin);
829 GET_SHAPE_CONFIG(EDITTIME::AMPM_HEIGHT, __pEditTime->GetOrientation(), colonBounds.height);
831 colonBounds.x = hourBounds.x + hourBounds.width + colonMargin;
832 colonBounds.y = hourBounds.y + (hourBounds.height - colonBounds.height) / 2.0f;
834 if (__title.IsEmpty() == false)
836 r = DrawTitle(*pCanvas);
837 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
840 r = DrawText(*pCanvas, hourBounds, __hourString, DATETIME_ID_HOUR);
841 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
843 r = DrawText(*pCanvas, minuteBounds, __minuteString, DATETIME_ID_MINUTE);
844 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
846 r = DrawColon(*pCanvas, colonBounds);
847 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
849 if (__24hours == false)
851 r = DrawResourceBitmap(*pCanvas, ampmBounds, pReplacementBitmap);
852 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
856 r = DrawResourceBitmap(*pCanvas, ampmBounds, pEffectBitmap);
857 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
860 r = DrawText(*pCanvas, ampmBounds, __ampmString, DATETIME_ID_AMPM, __amPmTextSize);
861 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
870 _EditTimePresenter::DrawFocus(void)
872 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
874 Canvas* pCanvas = __pEditTime->GetCanvasN();
875 SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
877 if (__focusId == DATETIME_ID_HOUR)
879 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
881 else if (__focusId == DATETIME_ID_MINUTE)
883 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
885 else if (__focusId == DATETIME_ID_AMPM)
887 bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
889 result r = E_SUCCESS;
891 if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
893 r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
894 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
898 r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
899 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
911 _EditTimePresenter::DrawColon(Canvas& canvas, const FloatRectangle& bounds)
913 result r = E_SUCCESS;
915 if (!__pEditTime->IsEnabled())
917 r = DrawResourceBitmap(canvas, bounds, __pColonDisabledColorReplacementBitmap);
921 r = DrawResourceBitmap(canvas, bounds, __pColonColorReplacementBitmap);
928 _EditTimePresenter::DrawTitle(Canvas& canvas)
930 if (!__pEditTime->IsEnabled())
932 Color titleDisabledColor;
933 GET_COLOR_CONFIG(EDITTIME::TITLE_TEXT_DISABLED, titleDisabledColor);
934 __titleObject.SetForegroundColor(titleDisabledColor, 0, __titleObject.GetTextLength());
937 (_FontImpl::GetInstance(*__pFont))->SetSize(__titleFontSize);
938 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
939 __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
941 __titleObject.Draw(*_CanvasImpl::GetInstance(canvas));
947 _EditTimePresenter::DrawContentBitmap(Canvas& canvas, const FloatRectangle& bounds, _DateTimeId boxId)
949 result r = E_SUCCESS;
951 bool isCustomBitmap = false;
952 Bitmap* pReplacementBitmap = null;
953 Bitmap* pEffectBitmap = null;
955 if (!__pEditTime->IsEnabled())
957 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_DISABLED);
958 pReplacementBitmap = __pContentBgDisabledColorReplacementBitmap;
959 pEffectBitmap = __pContentBgEffectDisabledBitmap;
961 else if (__selectedId != boxId)
963 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated() &&
964 (GetLastSelectedId() == boxId))
966 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
967 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
968 pEffectBitmap = __pContentBgEffectPressedBitmap;
972 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_NORMAL);
973 pReplacementBitmap = __pContentBgNormalColorReplacementBitmap;
974 pEffectBitmap = __pContentBgEffectNormalBitmap;
979 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
980 pReplacementBitmap = __pContentBgPressedColorReplacementBitmap;
981 pEffectBitmap = __pContentBgEffectPressedBitmap;
984 r = DrawResourceBitmap(canvas, bounds, pReplacementBitmap);
985 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
989 r = DrawResourceBitmap(canvas, bounds, pEffectBitmap);
990 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
997 _EditTimePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId, float textSize)
999 result r = E_SUCCESS;
1002 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1004 if (!__pEditTime->IsEnabled())
1006 if (boxId == DATETIME_ID_AMPM)
1008 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_DISABLED, textColor);
1012 GET_COLOR_CONFIG(EDITTIME::TEXT_DISABLED, textColor);
1017 GET_COLOR_CONFIG(EDITTIME::TEXT_NORMAL, textColor);
1019 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated() &&
1020 (GetLastSelectedId() == boxId))
1022 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
1023 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
1026 if (boxId == DATETIME_ID_AMPM)
1028 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_NORMAL, textColor);
1031 if (boxId > -1 && boxId == __selectedId)
1033 if (boxId == DATETIME_ID_AMPM)
1035 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_PRESSED, textColor);
1039 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textColor);
1040 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_BOLD);
1045 if (boxId != DATETIME_ID_AMPM)
1047 DrawContentBitmap(canvas, bounds, boxId);
1050 FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
1051 drawAreaBounds = bounds;
1053 TextSimple* pSimpleText = null;
1054 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(text.GetPointer())), text.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1055 SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1057 __textObject.RemoveAll();
1059 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1060 __textObject.AppendElement(*pSimpleText);
1062 if (boxId == DATETIME_ID_AMPM)
1064 (_FontImpl::GetInstance(*__pFont))->SetSize(textSize);
1066 if (__isFocused && __focusId == boxId)
1068 if (boxId == DATETIME_ID_AMPM)
1070 GET_COLOR_CONFIG(EDITTIME::BUTTON_TEXT_HIGHLIGHTED, textColor);
1074 GET_COLOR_CONFIG(EDITTIME::TEXT_HIGHLIGHTED, textColor);
1080 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1082 __textObject.SetForegroundColor(textColor, 0, __textObject.GetTextLength());
1083 __textObject.SetBounds(drawAreaBounds);
1084 __textObject.Draw(*_CanvasImpl::GetInstance(canvas));
1090 _EditTimePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
1092 _DateTimeId displayBoxId = DATETIME_ID_NONE;
1094 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1095 FloatRectangle hoursBounds(0.0f, 0.0f, 0.0f, 0.0f);
1096 FloatRectangle minutesBounds(0.0f, 0.0f, 0.0f, 0.0f);
1098 if (__24hours == false)
1100 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1103 hoursBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1104 minutesBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1106 if (point.y < hoursBounds.y || point.y > hoursBounds.y + hoursBounds.height)
1108 return displayBoxId;
1111 if (hoursBounds.Contains(point) == true)
1113 displayBoxId = DATETIME_ID_HOUR;
1115 else if (minutesBounds.Contains(point) == true)
1117 displayBoxId = DATETIME_ID_MINUTE;
1119 else if (ampmBounds.Contains(point) == true)
1121 displayBoxId = DATETIME_ID_AMPM;
1124 return displayBoxId;
1128 _EditTimePresenter::SetLastSelectedId(_DateTimeId boxId)
1130 __lastSelectedId = boxId;
1135 _EditTimePresenter::GetLastSelectedId(void) const
1137 return __lastSelectedId;
1141 _EditTimePresenter::SetFocusedElement()
1143 if (__isEnterKeyPressed)
1145 __isEnterKeyPressed = false;
1148 if (__focusId == DATETIME_ID_NONE || __focusId == DATETIME_ID_AMPM)
1150 __focusId = DATETIME_ID_HOUR;
1157 _EditTimePresenter::SetFocusState(bool isFocused)
1159 __isFocused = isFocused;
1164 _EditTimePresenter::OnFocusLost(const _Control &source)
1166 if (!__isEnterKeyPressed || __focusId == DATETIME_ID_AMPM)
1168 __focusId = DATETIME_ID_NONE;
1170 __isFocused = false;
1171 __pEditTime->Invalidate();
1176 _EditTimePresenter::OnFocusModeStateChanged(void)
1178 __isFocused = false;
1179 __focusId = DATETIME_ID_NONE;
1180 __pEditTime->Invalidate();
1185 _EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
1191 _KeyCode keyCode = keyInfo.GetKeyCode();
1197 __isEnterKeyPressed = false;
1198 if (__focusId == DATETIME_ID_HOUR)
1200 __focusId = DATETIME_ID_MINUTE;
1202 else if (__focusId == DATETIME_ID_MINUTE)
1204 if (!Is24HourNotationEnabled())
1206 __focusId = DATETIME_ID_AMPM;
1209 else if (__focusId == DATETIME_ID_AMPM)
1214 __pEditTime->Invalidate();
1219 __isEnterKeyPressed = false;
1220 if (__focusId == DATETIME_ID_MINUTE)
1222 __focusId = DATETIME_ID_HOUR;
1224 else if (__focusId == DATETIME_ID_AMPM)
1226 __focusId = DATETIME_ID_MINUTE;
1228 else if (__focusId == DATETIME_ID_HOUR)
1232 __pEditTime->Invalidate();
1245 _EditTimePresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
1251 _KeyCode keyCode = keyInfo.GetKeyCode();
1255 VisualElement *pEditTimeElement = __pEditTime->GetVisualElement();
1256 result r = GetLastResult();
1257 SysTryReturn(NID_UI_CTRL, (pEditTimeElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
1258 pEditTimeElement->RemoveAllAnimations();
1263 int displayValue = -1;
1265 _DateTimeId boxId = DATETIME_ID_HOUR;
1271 __isEnterKeyPressed = true;
1272 if (__focusId == DATETIME_ID_HOUR)
1274 boxId = DATETIME_ID_HOUR;
1275 if (__pEditTime->GetDateTimeBar() != null)
1277 if (!Is24HourNotationEnabled())
1281 minValue = DATETIME_HOUR_MIN + 1;
1282 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1283 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1285 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1287 minValue = DATETIME_HOUR_MIN + 1;
1288 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1289 displayValue = __pEditTime->GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1293 minValue = DATETIME_HOUR_MIN + 1;
1294 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1295 displayValue = __pEditTime->GetHour();
1300 minValue = DATETIME_HOUR_MIN;
1301 maxValue = DATETIME_HOUR_MAX;
1302 displayValue = __pEditTime->GetHour();
1305 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1307 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1311 else if (__focusId == DATETIME_ID_MINUTE)
1313 if (__pEditTime->GetDateTimeBar() != null)
1315 minValue = DATETIME_MINUTE_MIN;
1316 maxValue = DATETIME_MINUTE_MAX;
1317 displayValue = __pEditTime->GetMinute();
1319 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1321 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1324 boxId = DATETIME_ID_MINUTE;
1326 else if (__focusId == DATETIME_ID_AMPM)
1328 SetAmEnabled(!GetAmEnabled());
1329 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1330 boxId = DATETIME_ID_AMPM;
1332 __pEditTime->Invalidate();
1335 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM))
1337 FloatRectangle absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1339 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1340 bounds = GetDisplayAreaBoundsFromHoursStyle(boxId);
1341 bounds.x += absoluteBounds.x;
1343 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1344 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1345 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1346 __pEditTime->GetDateTimeBar()->Open();
1347 UpdateLastSelectedValue(boxId, false);
1361 _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
1363 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1365 if (&source != __pEditTime)
1370 __touchMoveHandled = false;
1372 FloatRectangle hourBounds(0.0f, 0.0f, 0.0f, 0.0f);
1373 FloatRectangle minuteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1374 FloatRectangle ampmBounds(0.0f, 0.0f, 0.0f, 0.0f);
1376 hourBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1377 minuteBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1379 if (__24hours == false)
1381 ampmBounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
1384 FloatPoint point = touchinfo.GetCurrentPosition();
1386 _DateTimeId boxId = GetBoxIdFromPosition(point);
1390 int displayValue = -1;
1392 if (boxId == DATETIME_ID_HOUR)
1394 if (__pEditTime->GetDateTimeBar() != null)
1396 if (__24hours == false)
1400 minValue = DATETIME_HOUR_MIN + 1;
1401 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1402 displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1404 else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
1406 minValue = DATETIME_HOUR_MIN + 1;
1407 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1408 displayValue = GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
1412 minValue = DATETIME_HOUR_MIN + 1;
1413 maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1414 displayValue = GetHour();
1419 minValue = DATETIME_HOUR_MIN;
1420 maxValue = DATETIME_HOUR_MAX;
1421 displayValue = GetHour();
1424 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1426 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1429 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1432 __bounds = hourBounds;
1434 else if (boxId == DATETIME_ID_MINUTE)
1436 if (__pEditTime->GetDateTimeBar() != null)
1438 minValue = DATETIME_MINUTE_MIN;
1439 maxValue = DATETIME_MINUTE_MAX;
1440 displayValue = GetMinute();
1442 if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
1444 __pEditTime->GetDateTimeBar()->RemoveAllItems();
1447 __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
1450 __bounds = minuteBounds;
1452 else if (boxId == DATETIME_ID_AMPM)
1454 __selectedId = boxId;
1455 __bounds = ampmBounds;
1460 __selectedId = DATETIME_ID_NONE;
1464 __selectedId = boxId;
1470 _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
1472 SysTryReturn(NID_UI_CTRL, IsTimePickerEnabled() == true, true, E_SYSTEM, "[E_SYSTEM] A system error has occurred. EditTime instance is disabled.");
1474 if (&source != __pEditTime)
1479 FloatRectangle bounds = __pEditTime->GetBoundsF();
1481 FloatPoint startPoint(0.0f, 0.0f);
1483 float titleHeight = 0;
1484 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, __pEditTime->GetOrientation(), titleHeight);
1486 __bounds = FloatRectangle(0.0f, titleHeight, bounds.width, bounds.height);
1488 FloatPoint point = touchinfo.GetCurrentPosition();
1490 _DateTimeId boxId = GetBoxIdFromPosition(point);
1492 if ((boxId == GetLastSelectedId() && boxId != DATETIME_ID_AMPM) || boxId != __selectedId || boxId == DATETIME_ID_NONE)
1494 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1496 __pEditTime->GetDateTimeBar()->CloseDateTimeBar();
1499 __selectedId = DATETIME_ID_NONE;
1500 SetLastSelectedId(__selectedId);
1506 UpdateLastSelectedValue(__selectedId, true);
1507 if (GetLastSelectedId() == DATETIME_ID_AMPM)
1514 if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
1516 __pEditTime->SetFocused(true);
1518 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
1519 bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
1520 FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
1521 absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
1522 bounds.x += absoluteBounds.x;
1524 __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
1526 if (__pEditTime->GetDateTimeBar()->IsActivated())
1528 __pEditTime->GetDateTimeBar()->Close();
1529 __pEditTime->GetDateTimeBar()->Open();
1533 __pEditTime->GetDateTimeBar()->SetVisibleState(true);
1534 __pEditTime->GetDateTimeBar()->Open();
1538 __selectedId = DATETIME_ID_NONE;
1543 _EditTimePresenter::UpdateLastSelectedValue(_DateTimeId boxId, bool isTouchPressed)
1545 __selectedId = boxId;
1546 SetLastSelectedId(boxId);
1548 __lastSelectedValue = "";
1550 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1552 int hours = GetHour();
1554 if (!Is24HourNotationEnabled())
1558 if (hours == DATETIME_HOUR_MIN)
1560 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1563 __lastSelectedValue.Format(10, L"%02d", hours);
1566 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1569 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1571 __lastSelectedValue.Format(10, L"%02d", GetMinute());
1574 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1577 else if (GetLastSelectedId() == DATETIME_ID_AMPM)
1579 SetAmEnabled(!GetAmEnabled());
1580 __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
1583 __pEditTime->UpdateAccessibilityElement();
1584 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pEditTime);
1586 __selectedId = DATETIME_ID_NONE;
1588 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1590 __pEditTime->GetDateTimeBar()->SetVisibleState(false);
1591 __pEditTime->GetDateTimeBar()->Close();
1595 __selectedId = DATETIME_ID_NONE;
1596 __pEditTime->Invalidate();
1601 _EditTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1603 if (&source != __pEditTime)
1608 __selectedId = DATETIME_ID_NONE;
1614 _EditTimePresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1616 if (&source != __pEditTime)
1621 if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
1630 _EditTimePresenter::OnTouchMoveHandled(const _Control& control)
1632 __touchMoveHandled = true;
1633 __selectedId = DATETIME_ID_NONE;
1639 _EditTimePresenter::OnFontChanged(Font* pFont)
1643 if (__pEditTime->GetDateTimeBar() != null)
1645 __pEditTime->GetDateTimeBar()->SetFont(*pFont);
1652 _EditTimePresenter::OnFontInfoRequested(unsigned long& style, float& size)
1654 style = FONT_STYLE_PLAIN;
1655 size = __timeFontSize;
1661 _EditTimePresenter::Initialize(void)
1663 result r = E_SUCCESS;
1665 float titleTimeMargin = 0;
1666 float timeHeight = 0;
1667 float editTimeHeight = 0;
1669 GET_SHAPE_CONFIG(EDITTIME::TEXT_FONT_SIZE, __pEditTime->GetOrientation(), __titleFontSize);
1670 GET_SHAPE_CONFIG(EDITTIME::TIME_FONT_SIZE, __pEditTime->GetOrientation(), __timeFontSize);
1671 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, __pEditTime->GetOrientation(), titleTimeMargin);
1672 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, __pEditTime->GetOrientation(), timeHeight);
1673 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, __pEditTime->GetOrientation(), editTimeHeight);
1675 if (__pEditTime->GetBoundsF().height > editTimeHeight)
1677 editTimeHeight = __pEditTime->GetBoundsF().height;
1680 if (__title.IsEmpty() == false)
1683 if (!__isEditTimeInitialized)
1685 r = InitializeTitleObject();
1686 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1689 __titleBounds.y = (editTimeHeight - (__titleBounds.height + titleTimeMargin + timeHeight)) / 2.0f;
1690 __titleObject.SetBounds(__titleBounds);
1693 __pFont = __pEditTime->GetFallbackFont();
1694 r = GetLastResult();
1695 SysTryReturn(NID_UI_CTRL, __pFont != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
1697 if (!__isEditTimeInitialized)
1700 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1702 r = InitializeTextObject();
1703 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
1706 __isEditTimeInitialized = true;
1713 _EditTimePresenter::UpdateTimeFormat(void)
1715 if (!__is24hoursSet)
1717 String key(L"http://tizen.org/setting/locale.time.format.24hour");
1718 SettingInfo::GetValue(key , __24hours);
1725 _EditTimePresenter::Animate(void)
1727 SysTryReturnVoidResult(NID_UI_CTRL, !__isAnimating, E_SUCCESS, "Rolling animation is in progress.");
1728 SysAssertf((__pFont != null), "Font instance must not be null.");
1730 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1732 result r = E_SUCCESS;
1733 FloatRectangle rect;
1735 String minuteString;
1737 TextSimple* pOldSimpleText = null;
1738 TextSimple* pNewSimpleText = null;
1739 bool isCustomBitmap = false;
1741 _DateTimeUtils dateTimeUtils;
1742 int hours = GetHour();
1743 if (!Is24HourNotationEnabled())
1747 if (hours == DATETIME_HOUR_MIN)
1749 hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
1752 hourString.Format(10, L"%02d", hours);
1753 minuteString.Format(10, L"%02d", GetMinute());
1755 if (GetLastSelectedId() == DATETIME_ID_HOUR)
1757 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(hourString) == false), E_SUCCESS, "[E_SUCCESS] Hour string matched.");
1759 newValue = hourString;
1760 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
1762 else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
1764 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(minuteString) == false), E_SUCCESS, "[E_SUCCESS] Minute string matched.");
1766 newValue = minuteString;
1767 rect = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
1770 FloatDimension newTextDim;
1771 FloatDimension oldTextDim;
1772 FloatPoint textPoint;
1773 VisualElement* pNewVisualElement = null;
1774 VisualElement* pOldVisualElement = null;
1775 VisualElement* pEditTimeElement = null;
1776 VisualElementPropertyAnimation* pNewBoundsAnimation = null;
1777 VisualElementPropertyAnimation* pOldBoundsAnimation = null;
1778 Canvas *pCanvas = null;
1779 Canvas *pContentCanvas = null;
1780 Color contentBgColor;
1781 Color textNormalColor;
1782 Color textPressedColor;
1783 float contentTextMargin;
1785 GET_COLOR_CONFIG(EDITTIME::CONTENT_BG_PRESSED, contentBgColor);
1786 GET_COLOR_CONFIG(EDITTIME::TEXT_PRESSED, textPressedColor);
1787 GET_SHAPE_CONFIG(EDITDATE::CONTENT_TEXT_MARGIN, __pEditTime->GetOrientation(), contentTextMargin);
1789 __pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
1790 __pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
1792 if (newTextDim.width > oldTextDim.width)
1794 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1798 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1801 SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditTime->GetBounds().width), E_SUCCESS, "Rolling animation cann't be played.");
1803 __isAnimating = true;
1805 __pContentProvider = new (std::nothrow) VisualElement();
1806 SysTryReturnVoidResult(NID_UI_CTRL, (__pContentProvider != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1808 r = __pContentProvider->Construct();
1809 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1811 __pContentProvider->SetShowState(true);
1812 __pContentProvider->SetClipChildrenEnabled(true);
1813 __pContentProvider->SetImplicitAnimationEnabled(false);
1815 pEditTimeElement = __pEditTime->GetVisualElement();
1816 r = GetLastResult();
1817 SysTryCatch(NID_UI_CTRL, (pEditTimeElement != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1819 pNewVisualElement = new (std::nothrow) VisualElement();
1820 SysTryCatch(NID_UI_CTRL, (pNewVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1822 r = pNewVisualElement->Construct();
1825 pNewVisualElement->Destroy();
1826 pNewVisualElement = null;
1828 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1830 pNewVisualElement->SetShowState(true);
1832 pOldVisualElement = new (std::nothrow) VisualElement();
1833 if (pOldVisualElement == null)
1835 pNewVisualElement->Destroy();
1836 pNewVisualElement = null;
1838 SysTryCatch(NID_UI_CTRL, (pOldVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1840 r = pOldVisualElement->Construct();
1843 pNewVisualElement->Destroy();
1844 pOldVisualElement->Destroy();
1845 pNewVisualElement = null;
1846 pOldVisualElement = null;
1848 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1850 pOldVisualElement->SetShowState(true);
1852 __pContentProvider->SetBounds(FloatRectangle((rect.x + contentTextMargin), (rect.y + (contentTextMargin * 2.0f)), (rect.width - (contentTextMargin * 2.0f)), (rect.height - (contentTextMargin * 4.0f))));
1854 pNewVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1855 pOldVisualElement->SetBounds(FloatRectangle(0, 0, __pContentProvider->GetBounds().width, __pContentProvider->GetBounds().height));
1857 pContentCanvas = pEditTimeElement->GetCanvasN(__pContentProvider->GetBounds());
1858 r = GetLastResult();
1859 SysTryCatch(NID_UI_CTRL, (pContentCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1860 pContentCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1861 pContentCanvas->Clear();
1863 pCanvas = pEditTimeElement->GetCanvasN(rect);
1864 r = GetLastResult();
1865 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1866 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1870 r = DrawResourceBitmap(*pCanvas, rect, __pContentBgPressedColorReplacementBitmap);
1871 isCustomBitmap = IS_CUSTOM_BITMAP(EDITTIME::CONTENT_BG_PRESSED);
1873 if (!isCustomBitmap)
1875 result res = DrawResourceBitmap(*pCanvas, rect, __pContentBgEffectPressedBitmap);
1877 if (res != E_SUCCESS)
1879 SysLog(NID_UI_CTRL, "[%s] Propagating.", GetErrorMessage(res));
1888 pContentCanvas->SetBackgroundColor(contentBgColor);
1889 pContentCanvas->Clear();
1892 delete pContentCanvas;
1893 pContentCanvas = null;
1895 pEditTimeElement->AttachChild(*__pContentProvider);
1897 __pContentProvider->AttachChild(*pOldVisualElement);
1898 __pContentProvider->AttachChild(*pNewVisualElement);
1900 pNewBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1901 SysTryCatch(NID_UI_CTRL, (pNewBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1903 pNewBoundsAnimation->SetDuration(300);
1904 pNewBoundsAnimation->SetPropertyName("bounds.position");
1905 pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, oldTextDim.height)));
1906 pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x, 0.0f)));
1907 pNewBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
1909 pOldBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1910 SysTryCatch(NID_UI_CTRL, (pOldBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1912 pOldBoundsAnimation->SetDuration(300);
1913 pOldBoundsAnimation->SetPropertyName("bounds.position");
1914 pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, 0.0f)));
1915 pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x, oldTextDim.height * -1.0f)));
1916 pOldBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
1918 pOldSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__lastSelectedValue.GetPointer())), __lastSelectedValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1919 SysTryCatch(NID_UI_CTRL, (pOldSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1921 pCanvas = pOldVisualElement->GetCanvasN();
1922 r = GetLastResult();
1923 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1925 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1927 pCanvas->SetForegroundColor(textPressedColor);
1929 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1930 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1931 __textObject.RemoveAll();
1932 __textObject.AppendElement(*pOldSimpleText);
1934 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1935 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1936 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1937 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1942 pNewSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(newValue.GetPointer())), newValue.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
1943 SysTryCatch(NID_UI_CTRL, (pNewSimpleText != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1945 pCanvas = pNewVisualElement->GetCanvasN();
1946 r = GetLastResult();
1947 SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1949 pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1951 pCanvas->SetForegroundColor(textPressedColor);
1953 (_FontImpl::GetInstance(*__pFont))->SetSize(__timeFontSize);
1954 (_FontImpl::GetInstance(*__pFont))->SetStyle(FONT_STYLE_PLAIN);
1955 __textObject.RemoveAll();
1956 __textObject.AppendElement(*pNewSimpleText);
1958 __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
1959 __textObject.SetForegroundColor(textPressedColor, 0, __textObject.GetTextLength());
1960 __textObject.SetBounds(FloatRectangle(0, 0, pCanvas->GetBounds().width, pCanvas->GetBounds().height));
1961 __textObject.Draw(*_CanvasImpl::GetInstance(*pCanvas));
1966 pOldVisualElement->SetImplicitAnimationEnabled(false);
1967 pOldVisualElement->AddAnimation(*pOldBoundsAnimation);
1969 pNewVisualElement->SetImplicitAnimationEnabled(false);
1970 pNewVisualElement->AddAnimation(*pNewBoundsAnimation);
1972 delete pOldBoundsAnimation;
1973 delete pNewBoundsAnimation;
1978 __isAnimating = false;
1979 __pContentProvider->Destroy();
1980 __pContentProvider = null;
1982 delete pNewBoundsAnimation;
1983 pNewBoundsAnimation = null;
1985 delete pOldBoundsAnimation;
1986 pOldBoundsAnimation = null;
1988 delete pOldSimpleText;
1989 pOldSimpleText = null;
1991 delete pNewSimpleText;
1992 pNewSimpleText = null;
1994 delete pContentCanvas;
1995 pContentCanvas = null;
2001 _EditTimePresenter::OnVisualElementAnimationFinished (const VisualElementAnimation &animation, const String &keyName, VisualElement &target, bool completedNormally)
2003 result r = E_SUCCESS;
2004 __isAnimating = false;
2006 VisualElement* pEditTimeElement = __pEditTime->GetVisualElement();
2007 r = GetLastResult();
2008 SysTryReturnVoidResult(NID_UI_CTRL, (pEditTimeElement != null), r, "[%s] Propagating.", GetErrorMessage(r));
2010 pEditTimeElement->DetachChild(*__pContentProvider);
2011 __pContentProvider->Destroy();
2012 __pContentProvider = null;
2018 }}} // Tizen::Ui::Controls