2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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_EditTime.cpp
20 * @brief This is the implementation file for the _EditTime class.
23 #include <FSysSettingInfo.h>
24 #include "FUi_CoordinateSystemUtils.h"
25 #include "FUi_AccessibilityContainer.h"
26 #include "FUi_AccessibilityElement.h"
27 #include "FUi_ResourceManager.h"
28 #include "FUiAnim_VisualElement.h"
29 #include "FUiCtrl_EditTime.h"
30 #include "FUiCtrl_EditTimePresenter.h"
31 #include "FUiCtrl_Form.h"
32 #include "FUiCtrl_Frame.h"
33 #include "FUiCtrl_DateTimeUtils.h"
34 #include "FUiCtrl_DateTimeDefine.h"
36 using namespace Tizen::Graphics;
37 using namespace Tizen::Base::Runtime;
38 using namespace Tizen::Base;
39 using namespace Tizen::System;
41 namespace Tizen { namespace Ui { namespace Controls
44 IMPLEMENT_PROPERTY(_EditTime);
46 _EditTime::_EditTime(void)
47 : __pEditTimePresenter(null)
48 , __pTimeChangeEvent(null)
49 , __pDateTimeBar(null)
50 , __absoluteBounds(FloatRectangle())
52 , __pAccessibilityEditTimeElement(null)
53 , __pAccessibilityHourElement(null)
54 , __pAccessibilityMinuteElement(null)
55 , __pAccessibilityAmPmElement(null)
59 _EditTime::~_EditTime(void)
61 SettingInfo::RemoveSettingEventListener(*this);
63 delete __pDateTimeBar;
64 __pDateTimeBar = null;
66 delete __pEditTimePresenter;
67 __pEditTimePresenter = null;
69 if (__pTimeChangeEvent != null)
71 delete __pTimeChangeEvent;
72 __pTimeChangeEvent = null;
75 if (__pAccessibilityEditTimeElement)
77 __pAccessibilityEditTimeElement->Activate(false);
78 __pAccessibilityEditTimeElement = null;
80 if (__pAccessibilityHourElement)
82 __pAccessibilityHourElement->Activate(false);
83 __pAccessibilityHourElement = null;
85 if (__pAccessibilityMinuteElement)
87 __pAccessibilityMinuteElement->Activate(false);
88 __pAccessibilityMinuteElement = null;
90 if (__pAccessibilityAmPmElement)
92 __pAccessibilityAmPmElement->Activate(false);
93 __pAccessibilityAmPmElement = null;
98 _EditTime::CreateEditTimeN(const String& title)
100 result r = E_SUCCESS;
102 _AccessibilityContainer* pContainer = null;
104 _EditTime* pEditTime = new (std::nothrow) _EditTime;
105 SysTryReturn(NID_UI_CTRL, pEditTime, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
107 pEditTime->GetVisualElement()->SetSurfaceOpaque(false);
109 pEditTime->__pEditTimePresenter = _EditTimePresenter::CreateInstanceN(*pEditTime, title);
111 SysTryCatch(NID_UI_CTRL, pEditTime->__pEditTimePresenter, , r, "[%s] Propagating.", GetErrorMessage(r));
113 r = pEditTime->CreateDateTimeBar();
114 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
116 pEditTime->__pEditTimePresenter->Initialize();
118 SysTryCatch(NID_UI_CTRL, pEditTime->__pEditTimePresenter, , r, "[%s] Propagating.", GetErrorMessage(r));
120 pEditTime->__pEditTimePresenter->SetCurrentTime();
122 if (title.IsEmpty() != true)
124 pEditTime->__title = title;
127 pContainer = pEditTime->GetAccessibilityContainer();
130 pContainer->Activate(true);
131 pEditTime->CreateAccessibilityElement();
134 pEditTime->AcquireHandle();
144 _EditTime::CreateDateTimeBar(void)
146 result r = E_SUCCESS;
148 __pDateTimeBar = _DateTimeBar::CreateDateTimeBarN(*this);
150 SysTryReturn(NID_UI_CTRL, (__pDateTimeBar != null), r, r, "[%s] Propagating.", GetErrorMessage(r));
152 r = __pDateTimeBar->AddActionEventListener(*this);
153 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
155 r = __pDateTimeBar->AddDateTimeChangeEventListener(*this);
156 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
158 r = SettingInfo::AddSettingEventListener(*this);
159 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
164 delete __pDateTimeBar;
169 _EditTime::AddTimeChangeEventListener(const _IDateTimeChangeEventListener& listener)
171 if (__pTimeChangeEvent == null)
173 __pTimeChangeEvent = new (std::nothrow) _DateTimeChangeEvent(*this);
174 SysTryReturn(NID_UI_CTRL, (__pTimeChangeEvent != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
175 "[E_OUT_OF_MEMORY] Memory allocation failed.");
178 result r = __pTimeChangeEvent->AddListener(listener);
179 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
185 _EditTime::RemoveTimeChangeEventListener(const _IDateTimeChangeEventListener& listener)
187 result r = E_OBJ_NOT_FOUND;
189 if (__pTimeChangeEvent)
191 r = __pTimeChangeEvent->RemoveListener(listener);
194 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
200 _EditTime::SetTime(const DateTime& time)
202 SetProperty("time", Variant(time));
207 _EditTime::SetPropertyTime(const Variant& time)
209 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), E_SYSTEM, E_SYSTEM,
210 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
212 __pEditTimePresenter->SetTime(time.ToDateTime());
214 UpdateAccessibilityElement();
219 _EditTime::GetTime(void) const
221 Variant time = GetProperty("time");
223 return time.ToDateTime();
227 _EditTime::GetPropertyTime(void) const
231 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), Variant(), E_SYSTEM,
232 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
234 time = __pEditTimePresenter->GetTime();
236 return Variant(time);
240 _EditTime::SetHour(int hour)
242 result r = E_SUCCESS;
244 SetProperty("hour", Variant(hour));
252 _EditTime::SetPropertyHour(const Variant& hour)
254 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), E_SYSTEM, E_SYSTEM,
255 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
257 result r = E_SUCCESS;
259 r = __pEditTimePresenter->SetHour(hour.ToInt());
260 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
262 UpdateAccessibilityElement();
268 _EditTime::GetHour(void) const
270 Variant hour = GetProperty("hour");
276 _EditTime::GetPropertyHour(void) const
280 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), Variant(), E_SYSTEM,
281 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
283 hour = __pEditTimePresenter->GetHour();
285 return Variant(hour);
289 _EditTime::SetMinute(int minute)
291 result r = E_SUCCESS;
293 SetProperty("minute", Variant(minute));
301 _EditTime::SetPropertyMinute(const Variant& minute)
303 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), E_SYSTEM, E_SYSTEM,
304 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
306 result r = E_SUCCESS;
308 r = __pEditTimePresenter->SetMinute(minute.ToInt());
309 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
311 UpdateAccessibilityElement();
317 _EditTime::GetMinute(void) const
319 Variant minute = GetProperty("minute");
321 return minute.ToInt();
325 _EditTime::GetPropertyMinute(void) const
329 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), Variant(), E_SYSTEM,
330 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
332 minute = __pEditTimePresenter->GetMinute();
334 return Variant(minute);
338 _EditTime::SetCurrentTime(void)
340 SysTryReturnVoidResult(NID_UI_CTRL, (__pEditTimePresenter != null), E_SYSTEM,
341 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
343 __pEditTimePresenter->SetCurrentTime();
345 UpdateAccessibilityElement();
351 _EditTime::SetTimePickerEnabled(bool enable)
353 SetProperty("timePickerEnabled", Variant(enable));
358 _EditTime::SetPropertyTimePickerEnabled(const Variant& enable)
360 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), E_SYSTEM, E_SYSTEM,
361 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
363 __pEditTimePresenter->SetTimePickerEnabled(enable.ToBool());
369 _EditTime::IsTimePickerEnabled(void) const
371 Variant enable = GetProperty("timePickerEnabled");
373 return enable.ToBool();
377 _EditTime::GetPropertyTimePickerEnabled(void) const
381 SysTryReturn(NID_UI_CTRL, (__pEditTimePresenter != null), Variant(), E_SYSTEM,
382 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
384 enable = __pEditTimePresenter->IsTimePickerEnabled();
386 return Variant(enable);
390 _EditTime::Set24HourNotationEnabled(bool enable)
392 SysTryReturnVoidResult(NID_UI_CTRL, (__pEditTimePresenter != null), E_SYSTEM,
393 "[E_SYSTEM] A system error has occurred. The _EditDatePresenter instance is null.");
395 __pEditTimePresenter->Set24HourNotationEnabled(enable);
400 _EditTime::Is24HourNotationEnabled(void) const
402 SysAssertf((__pEditTimePresenter != null), "The _EditDatePresenter instance is null.");
404 return __pEditTimePresenter->Is24HourNotationEnabled();
408 _EditTime::CalculateDateTimeBarPosition(void)
410 result r = E_SUCCESS;
412 float dateTimeBarHeight = 0.0f;
413 float arrowHeight = 0.0f;
414 float timeHeight = 0.0f;
415 float timeBarMargin = 0.0f;
416 float textHeight = 0.0f;
417 float titleTimeMargin = 0.0f;
418 float bottomPosition = 0.0f;
421 FloatRectangle absoluteBounds;
422 FloatRectangle frameBounds;
423 FloatRectangle parentWindowBounds;
424 FloatRectangle titleBounds;
426 _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame());
427 SysTryReturn(NID_UI_CTRL, (pFrame != null), E_SYSTEM, E_SYSTEM,
428 "[E_SYSTEM] A system error has occurred. Failed to get frame instance.");
430 frameBounds = pFrame->GetAbsoluteBoundsF();
431 absoluteBounds = GetAbsoluteBoundsF();
432 parentWindowBounds = GetParentWindowBounds();
433 titleBounds = __pEditTimePresenter->GetTitleBounds();
435 GET_SHAPE_CONFIG(DATETIMEBAR::ITEM_HEIGHT, GetOrientation(), dateTimeBarHeight);
436 GET_SHAPE_CONFIG(DATETIMEBAR::ARROW_HEIGHT, GetOrientation(), arrowHeight);
437 GET_SHAPE_CONFIG(EDITTIME::TIME_HEIGHT, GetOrientation(), timeHeight);
438 GET_SHAPE_CONFIG(EDITTIME::TIME_BAR_MARGIN, GetOrientation(), timeBarMargin);
439 GET_SHAPE_CONFIG(EDITTIME::TITLE_HEIGHT, GetOrientation(), textHeight);
440 GET_SHAPE_CONFIG(EDITTIME::TITLE_TIME_MARGIN, GetOrientation(), titleTimeMargin);
442 if (!__title.IsEmpty()) //with title
444 timeY = titleBounds.y + textHeight + titleTimeMargin ;
448 timeY = (absoluteBounds.height - timeHeight) / 2.0f ;
451 bottomPosition = absoluteBounds.y + timeY + timeHeight + timeBarMargin + arrowHeight + dateTimeBarHeight;
453 GetDateTimeBar()->SetParentWindowBounds(parentWindowBounds);
455 if (bottomPosition > frameBounds.y + parentWindowBounds.y + parentWindowBounds.height) //ALIGN_UP
457 r = GetDateTimeBar()->SetPositionAndAlignment(FloatPoint(parentWindowBounds.x, absoluteBounds.y + timeY - timeBarMargin - arrowHeight), DATETIME_BAR_ALIGN_UP);
458 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
462 r = GetDateTimeBar()->SetPositionAndAlignment(FloatPoint(parentWindowBounds.x, absoluteBounds.y + timeY + timeHeight + timeBarMargin + arrowHeight), DATETIME_BAR_ALIGN_DOWN);
463 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
466 __absoluteBounds = absoluteBounds;
472 _EditTime::OnDraw(void)
474 if (GetDateTimeBar() != null && GetDateTimeBar()->IsActivated())
476 CalculateDateTimeBarPosition();
479 __pEditTimePresenter->Draw();
481 UpdateAccessibilityElement();
486 _EditTime::CreateAccessibilityElement(void)
488 _AccessibilityContainer* pContainer = GetAccessibilityContainer();
489 FloatRectangle hourBounds = __pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
490 FloatRectangle minuteBounds = __pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
491 FloatRectangle ampmBounds = __pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
493 pContainer->AddListener(*this);
494 if (__pAccessibilityEditTimeElement == null)
496 __pAccessibilityEditTimeElement = new _AccessibilityElement(true);
497 __pAccessibilityEditTimeElement->SetBounds(GetClientBounds());
498 __pAccessibilityEditTimeElement->SetTrait(ACCESSIBILITY_TRAITS_NONE);
499 __pAccessibilityEditTimeElement->SetName(L"EditTimeText");
500 pContainer->AddElement(*__pAccessibilityEditTimeElement);
503 if (__pAccessibilityHourElement == null && __pAccessibilityMinuteElement == null)
505 String hintText(L"Double tap to edit");
507 __pAccessibilityHourElement = new _AccessibilityElement(true);
508 __pAccessibilityHourElement->SetBounds(hourBounds);
509 __pAccessibilityHourElement->SetTrait(ACCESSIBILITY_TRAITS_HOUR);
510 __pAccessibilityHourElement->SetHint(hintText);
511 pContainer->AddElement(*__pAccessibilityHourElement);
513 __pAccessibilityMinuteElement = new _AccessibilityElement(true);
514 __pAccessibilityMinuteElement->SetBounds(minuteBounds);
515 __pAccessibilityMinuteElement->SetTrait(ACCESSIBILITY_TRAITS_MINUTE);
516 __pAccessibilityMinuteElement->SetHint(hintText);
517 pContainer->AddElement(*__pAccessibilityMinuteElement);
519 if (Is24HourNotationEnabled() == false)
521 __pAccessibilityAmPmElement = new _AccessibilityElement(true);
522 __pAccessibilityAmPmElement->SetBounds(ampmBounds);
523 __pAccessibilityAmPmElement->SetTrait(ACCESSIBILITY_TRAITS_BUTTON);
524 pContainer->AddElement(*__pAccessibilityAmPmElement);
530 _EditTime::OnBoundsChanged(void)
532 __pEditTimePresenter->Initialize();
534 if (__pAccessibilityEditTimeElement)
536 __pAccessibilityEditTimeElement->SetBounds(__pEditTimePresenter->GetTitleBounds());
538 if (__pAccessibilityHourElement)
540 __pAccessibilityHourElement->SetBounds(__pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR));
542 if (__pAccessibilityMinuteElement)
544 __pAccessibilityMinuteElement->SetBounds(__pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE));
546 if (__pAccessibilityAmPmElement)
548 __pAccessibilityAmPmElement->SetBounds(__pEditTimePresenter->GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM));
555 _EditTime::OnChangeLayout(_ControlOrientation orientation)
559 GET_SHAPE_CONFIG(EDITTIME::WIDTH, GetOrientation(), dim.width);
560 GET_SHAPE_CONFIG(EDITTIME::HEIGHT, GetOrientation(), dim.height);
564 __pEditTimePresenter->Initialize();
565 __pEditTimePresenter->SetLastSelectedId(DATETIME_ID_NONE);
567 if (GetDateTimeBar() != null)
569 CalculateDateTimeBarPosition();
570 GetDateTimeBar()->SetVisibleState(false);
571 GetDateTimeBar()->Close();
578 _EditTime::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
580 FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
584 if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
586 CalculateDateTimeBarPosition();
589 return __pEditTimePresenter->OnTouchPressed(source, touchinfo);
593 _EditTime::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
595 return __pEditTimePresenter->OnTouchReleased(source, touchinfo);
599 _EditTime::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
601 return __pEditTimePresenter->OnTouchCanceled(source, touchinfo);
605 _EditTime::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
607 return __pEditTimePresenter->OnTouchMoved(source, touchinfo);
611 _EditTime::OnTouchMoveHandled(const _Control& control)
613 __pEditTimePresenter->OnTouchMoveHandled(control);
618 _EditTime::FireTimeChangeEvent(_DateTimeChangeStatus status)
620 SysTryReturn(NID_UI_CTRL, (__pTimeChangeEvent != null), E_SYSTEM, E_SYSTEM,
621 "[E_SYSTEM] A system error has occurred. The _DateTimeChangeEvent instance is null.");
623 _DateTimeChangeEventArg* pDateTimeEventArg = new (std::nothrow) _DateTimeChangeEventArg(status);
624 SysTryReturn(NID_UI_CTRL, pDateTimeEventArg, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
625 "[E_OUT_OF_MEMORY] Memory allocation failed.");
627 pDateTimeEventArg->SetTime(GetHour(), GetMinute());
629 __pTimeChangeEvent->Fire(*pDateTimeEventArg);
635 _EditTime::OnDateTimeChanged(const _Control& source, int year, int month, int day, int hour, int minute)
637 __pEditTimePresenter->Animate();
638 __pEditTimePresenter->SetLastSelectedId(DATETIME_ID_NONE);
640 FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
645 _EditTime::OnDateTimeChangeCanceled(const _Control& source)
647 __pEditTimePresenter->SetLastSelectedId(DATETIME_ID_NONE);
649 FireTimeChangeEvent(TIME_INTERNAL_CHANGE_CANCELED);
654 _EditTime::OnActionPerformed(const Ui::_Control& source, int actionId)
656 _DateTimeId boxId = __pEditTimePresenter->GetLastSelectedId();
658 if (boxId == DATETIME_ID_HOUR)
660 bool amEnable = true;
661 amEnable = __pEditTimePresenter->GetAmEnabled();
665 if (amEnable == false && Is24HourNotationEnabled() == false)
667 if (hour < DATETIME_HOUR_MAX_FOR_24NOTATION)
669 hour += DATETIME_HOUR_MAX_FOR_24NOTATION;
672 else if (amEnable == true && Is24HourNotationEnabled() == false)
674 if (hour == DATETIME_HOUR_MAX_FOR_24NOTATION)
676 hour = DATETIME_HOUR_MIN;
681 else if (boxId == DATETIME_ID_MINUTE)
691 _EditTime::GetDateTimeBar(void) const
693 return __pDateTimeBar;
697 _EditTime::OnFontChanged(Font* pFont)
699 __pEditTimePresenter->OnFontChanged(pFont);
705 _EditTime::OnFontInfoRequested(unsigned long& style, float& size)
707 __pEditTimePresenter->OnFontInfoRequested(style, size);
713 _EditTime::OnSettingChanged(String& key)
715 if (key.Equals(L"http://tizen.org/setting/locale.time.format.24hour", false))
717 __pEditTimePresenter->UpdateTimeFormat();
725 _EditTime::GetParentWindowBounds(void) const
728 _Window* pwindow = null;
729 _Control* pControlCore = GetParent();
731 FloatDimension dateTimeBarSize(0.0f, 0.0f);
733 GET_DIMENSION_CONFIG(DATETIMEBAR::DEFAULT_SIZE, GetOrientation(), dateTimeBarSize);
735 FloatRectangle parentWindowBounds(0.0f, 0.0f, dateTimeBarSize.width, dateTimeBarSize.height);
739 if (pControlCore == null)
741 SysLog(NID_UI_CTRL,"[E_SYSTEM] Parent window not found.");
743 return parentWindowBounds;
746 // If the parent is a Frame, then return the Form's bounds.
747 pForm = dynamic_cast<_Form*>(pControlCore);
750 parentWindowBounds = pForm->GetBoundsF();
754 pwindow = dynamic_cast<_Window*>(pControlCore);
758 parentWindowBounds = pwindow->GetBoundsF();
762 pControlCore = pControlCore->GetParent();
765 return parentWindowBounds;
769 _EditTime::UpdateAccessibilityElement(void)
773 if (likely(!(_AccessibilityManager::IsActivated())))
778 if (__pAccessibilityEditTimeElement == null && __pAccessibilityHourElement == null
779 && __pAccessibilityMinuteElement == null && __pAccessibilityAmPmElement == null)
784 if (__title.IsEmpty() == false)
786 string.Append(__title);
787 string.Append(L", ");
791 int hour = GetHour();
792 int maxHour = DATETIME_HOUR_MAX_FOR_24NOTATION;
794 if (Is24HourNotationEnabled() == false && (hour > maxHour))
796 hourString.Format(10, L"%02d", hour - DATETIME_HOUR_MAX_FOR_24NOTATION);
800 hourString.Format(10, L"%02d", hour);
803 string.Append(hourString.GetPointer());
805 string.Append(GetMinute());
808 if (Is24HourNotationEnabled() == false)
810 String hintAmPmText(L"Double tap to change to ");
814 _DateTimeUtils dateTimeUtils;
815 dateTimeUtils.GetAmPm(amString, AM_TYPE);
816 dateTimeUtils.GetAmPm(pmString, PM_TYPE);
818 if (__pEditTimePresenter->GetAmEnabled() == true)
820 __pAccessibilityAmPmElement->SetLabel(amString);
821 hintAmPmText.Append(pmString.GetPointer());
822 string.Append(amString.GetPointer());
826 __pAccessibilityAmPmElement->SetLabel(pmString);
827 hintAmPmText.Append(amString.GetPointer());
828 string.Append(pmString.GetPointer());
831 __pAccessibilityAmPmElement->SetHint(hintAmPmText);
834 __pAccessibilityEditTimeElement->SetLabel(string);
836 __pAccessibilityHourElement->SetLabel(hourString);
839 string.Format(10, L"%02d", GetMinute());
840 __pAccessibilityMinuteElement->SetLabel(string);
846 _EditTime::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
852 _EditTime::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element)
858 _EditTime::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
864 _EditTime::OnAccessibilityReadedElement(const _AccessibilityContainer& control, const _AccessibilityElement& element)
871 _EditTime::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element)
877 _EditTime::OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element)
883 _EditTime::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element)
889 labelText = element.GetLabel();
891 _DateTimeUtils dateTimeUtils;
892 dateTimeUtils.GetAmPm(amString, AM_TYPE);
893 dateTimeUtils.GetAmPm(pmString, PM_TYPE);
895 if (labelText == amString || labelText == pmString)
897 labelText.Append(L" Selected");
898 _AccessibilityManager::GetInstance()->ReadContent(labelText);
905 _EditTime::OnAccessibilityValueIncreased(const _AccessibilityContainer&, const _AccessibilityElement&)
911 _EditTime::OnAccessibilityValueDecreased(const _AccessibilityContainer&, const _AccessibilityElement&)