Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_DateTimePresenter.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUiCtrl_DateTimePresenter.cpp
19  * @brief               This is the implementation file for the _DateTimePresenter class.
20  */
21
22 #include <vconf.h>
23 #include <FBaseErrorDefine.h>
24 #include <FBaseSysLog.h>
25 #include <FGrp_TextTextObject.h>
26 #include <FGrp_CanvasImpl.h>
27 #include <FGrp_BitmapImpl.h>
28 #include "FUi_ResourceManager.h"
29 #include "FUiAnim_VisualElement.h"
30 #include "FUiCtrl_DateTimePresenter.h"
31 #include "FUiCtrl_InputPad.h"
32 #include "FUiCtrl_DateTimeDefine.h"
33 #include "FUiCtrl_DateTimeModel.h"
34 #include "FUiCtrl_DateTimeDisplayBox.h"
35 #include "FUiCtrl_DateTimePicker.h"
36 #include "FUiCtrl_DateTimeUtils.h"
37 #include "FUi_AccessibilityManager.h"
38
39 using namespace Tizen::Ui;
40 using namespace Tizen::Base;
41 using namespace Tizen::Graphics;
42 using namespace Tizen::Graphics::_Text;
43 using namespace Tizen::Ui::Animations;
44
45 namespace Tizen { namespace Ui { namespace Controls
46 {
47 const int DATETIME_DISPLAY_STRING_MAX_LENGTH = 10;
48
49 _DateTimePresenter::_DateTimePresenter(int pickerStyle, const String& title)
50         : __pView(null)
51         , __pModel(null)
52         , __selectedBoxIndex(-1)
53         , __focusedBoxIndex(0)
54         , __pInputPad(null)
55         , __inputPadType(INPUTPAD_STYLE_NORMAL)
56         , __pickerStyle(pickerStyle)
57         , __inputPadEnabled(true)
58         , __outputBoxMaxCount(0)
59         , __year(0)
60         , __month(0)
61         , __day(0)
62         , __hour(0)
63         , __minute(0)
64         , __is24HourNotation(false)
65         , __isPm(false)
66         , __isPmButtonPressed(false)
67         , __isFocusBoxChanged(false)
68         , __inputComposing(DATETIME_INPUT_END)
69         , __changeFocusCounter(DATE_TIME_CHANGE_FOCUS_COUNTER_MIN)
70         , __pPmBoxNormalBitmap(null)
71         , __pPmBoxEffectBitmap(null)
72         , __pPmBoxPressedEffectBitmap(null)
73         , __pPmBoxDisabledEffectBitmap(null)
74         , __pColonBitmap(null)
75         , __pFont(null)
76         , __pPmBox(null)
77 {
78         for (int i = 0; i < DATETIME_ID_MAX; i++)
79         {
80                 __pDisplayBox[i] = null;
81         }
82 }
83
84 _DateTimePresenter::~_DateTimePresenter(void)
85 {
86         Dispose();
87 }
88
89 void
90 _DateTimePresenter::Dispose(void)
91 {
92         delete __pPmBoxNormalBitmap;
93         __pPmBoxNormalBitmap = null;
94
95         delete __pPmBoxEffectBitmap;
96         __pPmBoxEffectBitmap = null;
97
98         delete __pPmBoxPressedEffectBitmap;
99         __pPmBoxPressedEffectBitmap = null;
100
101         delete __pPmBoxDisabledEffectBitmap;
102         __pPmBoxDisabledEffectBitmap = null;
103
104         delete __pColonBitmap;
105         __pColonBitmap = null;
106
107         for (int i = 0; i < DATETIME_ID_MAX; i++)
108         {
109                 delete __pDisplayBox[i];
110                 __pDisplayBox[i] = null;
111         }
112
113         delete __pPmBox;
114         __pPmBox = null;
115
116         if ((__inputPadEnabled == true) && (__pInputPad != null))
117         {
118                 __pView->DetachChild(*__pInputPad);
119                 delete __pInputPad;
120                 __pInputPad = null;
121         }
122
123         delete __pModel;
124         __pModel = null;
125 }
126
127 result
128 _DateTimePresenter::Construct(_DateTimePicker& view)
129 {
130         result r = E_SUCCESS;
131
132         __pView = &view;
133         _ControlOrientation orientation = __pView->GetOrientation();
134
135         __pFont = __pView->GetDateTimeFont();
136         SysTryReturnResult(NID_UI_CTRL, (__pFont != null), E_SYSTEM, "A system error has occurred. Failed to get the font.");
137
138         LoadResource();
139         UpdateDateTimeOutputConfig();
140
141         Rectangle inputPadBounds(0, 0, 0, 0);
142         Rectangle pickerBounds(0, 0, 0, 0);
143
144         pickerBounds = __pView->GetBounds();
145
146         GET_SHAPE_CONFIG(DATETIMEPICKER::INPUTPAD_HEIGHT, orientation, inputPadBounds.height);
147
148         inputPadBounds.x = 0;
149         inputPadBounds.width = pickerBounds.width;
150         inputPadBounds.y = pickerBounds.height - inputPadBounds.height;
151
152         __pModel = new (std::nothrow) _DateTimeModel;
153         SysTryReturnResult(NID_UI_CTRL, (__pModel != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
154
155         // Load display data for sync with model data
156         LoadPickerData();
157
158         if (__inputPadEnabled == true)
159         {
160                 __pInputPad = new (std::nothrow) _InputPad;
161                 SysTryCatch(NID_UI_CTRL, (__pInputPad != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
162
163                 r = __pInputPad->Construct(inputPadBounds);
164                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , E_SYSTEM,
165                                         "[E_SYSTEM] A system error has occurred. Failed to construct the instance of Inputpad.");
166
167                 r = __pView->AttachChild(*__pInputPad);
168                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
169
170                 r = __pInputPad->SetInputPadEventListener(*this);
171                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , E_SYSTEM,
172                                         "[E_SYSTEM] A system error has occurred. Failed to set InputPadEventListener to the Inputpad.");
173
174                 __pInputPad->SetInputPadStyle(INPUTPAD_STYLE_NORMAL);
175                 r = GetLastResult();
176                 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , E_SYSTEM,
177                                         "[E_SYSTEM] A system error has occurred. Failed to set InputPadStyle to the Inputpad.");
178
179                 __pInputPad->SetFont(__pFont);
180
181                 _DateTimeDisplayBox* pDisplayBox = __pDisplayBox[__focusedBoxIndex];
182                 SysTryCatch(NID_UI_CTRL, (pDisplayBox != null), , E_SYSTEM,
183                                         "[E_SYSTEM] A system error has occurred. Failed to get Display box.");
184
185                 SetFocusBoxId(pDisplayBox->GetDisplayBoxId());
186         }
187
188         return r;
189
190 CATCH:
191         Dispose();
192
193         return r;
194 }
195
196 result
197 _DateTimePresenter::SetYear(int year)
198 {
199         result r = E_SUCCESS;
200         int minYear = 0;
201         int maxYear = 0;
202
203         GetYearRange(minYear, maxYear);
204
205         if (year < minYear)
206         {
207                 year = minYear;
208         }
209         else if (year > maxYear)
210         {
211                 year = maxYear;
212         }
213
214         r = __pModel->SetYear(year);
215
216         if (r == E_SUCCESS)
217         {
218                 UpdateDisplayData(DATETIME_ID_YEAR);
219         }
220
221         return r;
222 }
223
224 result
225 _DateTimePresenter::SetMonth(int month)
226 {
227         result r = __pModel->SetMonth(month);
228
229         if (r == E_SUCCESS)
230         {
231                 UpdateDisplayData(DATETIME_ID_MONTH);
232         }
233
234         return r;
235 }
236
237 result
238 _DateTimePresenter::SetDay(int day)
239 {
240         result r = __pModel->SetDay(day);
241
242         if (r == E_SUCCESS)
243         {
244                 UpdateDisplayData(DATETIME_ID_DAY);
245         }
246
247         return r;
248 }
249
250 result
251 _DateTimePresenter::SetHour(int hour)
252 {
253         result r = __pModel->SetHour(hour);
254
255         if (r == E_SUCCESS)
256         {
257                 UpdateDisplayData(DATETIME_ID_HOUR);
258         }
259
260         return r;
261 }
262
263 result
264 _DateTimePresenter::SetMinute(int minute)
265 {
266         result r = __pModel->SetMinute(minute);
267
268         if (r == E_SUCCESS)
269         {
270                 UpdateDisplayData(DATETIME_ID_MINUTE);
271         }
272
273         return r;
274 }
275
276 result
277 _DateTimePresenter::SetYearRange(int minYear, int maxYear)
278 {
279         __pModel->SetMinYear(minYear);
280         __pModel->SetMaxYear(maxYear);
281
282         return E_SUCCESS;
283 }
284
285 int
286 _DateTimePresenter::GetYear(void) const
287 {
288         return __pModel->GetYear();
289 }
290
291 int
292 _DateTimePresenter::GetMonth(void) const
293 {
294         return __pModel->GetMonth();
295 }
296
297 int
298 _DateTimePresenter::GetDay(void) const
299 {
300         return __pModel->GetDay();
301 }
302
303 int
304 _DateTimePresenter::GetHour(void) const
305 {
306         return __pModel->GetHour();
307 }
308
309 int
310 _DateTimePresenter::GetMinute(void) const
311 {
312         return __pModel->GetMinute();
313 }
314
315 result
316 _DateTimePresenter::GetYearRange(int& minYear, int& maxYear) const
317 {
318         return __pModel->GetYearRange(minYear, maxYear);
319 }
320
321 void
322 _DateTimePresenter::Set24HourNotationEnabled(bool enable)
323 {
324         __is24HourNotation = enable;
325
326         UpdateDateTimeOutputConfig();
327 }
328
329 bool
330 _DateTimePresenter::Is24HourNotationEnabled(void) const
331 {
332         return __is24HourNotation;
333 }
334
335 void
336 _DateTimePresenter::SetCurrentDateTime(void)
337 {
338         __pModel->SetCurrentDateTime();
339
340         UpdateDisplayData(DATETIME_ID_YEAR);
341         UpdateDisplayData(DATETIME_ID_MONTH);
342         UpdateDisplayData(DATETIME_ID_DAY);
343         UpdateDisplayData(DATETIME_ID_HOUR);
344         UpdateDisplayData(DATETIME_ID_MINUTE);
345 }
346
347 void
348 _DateTimePresenter::SetDateTime(const DateTime& dateTime)
349 {
350         __pModel->SetDateTime(dateTime);
351
352         UpdateDisplayData(DATETIME_ID_YEAR);
353         UpdateDisplayData(DATETIME_ID_MONTH);
354         UpdateDisplayData(DATETIME_ID_DAY);
355         UpdateDisplayData(DATETIME_ID_HOUR);
356         UpdateDisplayData(DATETIME_ID_MINUTE);
357 }
358
359 DateTime
360 _DateTimePresenter::GetDateTime(void) const
361 {
362         return __pModel->GetDateTime();
363 }
364
365 void
366 _DateTimePresenter::SetFocusBoxId(int boxId)
367 {
368         for (int i = 0; i < __outputBoxMaxCount; i++)
369         {
370                 int displayBoxId = __pDisplayBox[i]->GetDisplayBoxId();
371
372                 if (boxId == displayBoxId)
373                 {
374                         SetFocusBox(i);
375                         ChangeInputPadStyle(boxId);
376                         return;
377                 }
378         }
379 }
380
381 const _DateTimeDisplayBox*
382 _DateTimePresenter::GetDisplayBox(int index) const
383 {
384         return __pDisplayBox[index];
385 }
386
387 const _DateTimeDisplayBox*
388 _DateTimePresenter::GetAmPmBox(void) const
389 {
390         return __pPmBox;
391 }
392
393 bool
394 _DateTimePresenter::Draw(void)
395 {
396         result r = E_SUCCESS;
397
398         _VisualElement* pVisualElement = null;
399         Canvas* pCanvas = null;
400         Color backgroundColor;
401
402         pVisualElement = __pView->GetDisplayVisualElement();
403         r = GetLastResult();
404         SysTryReturn(NID_UI_CTRL, (pVisualElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
405
406         pCanvas = pVisualElement->GetCanvasN();
407         r = GetLastResult();
408         SysTryReturn(NID_UI_CTRL, (pCanvas != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
409
410         // Draw Background
411         GET_COLOR_CONFIG(DATETIMEPICKER::BG_NORMAL, backgroundColor);
412         __pView->SetBackgroundColor(backgroundColor);
413
414         // Draw DisplayBox Background
415         pCanvas->SetBackgroundColor(backgroundColor);
416         pCanvas->Clear();
417
418         DrawDividers(*pCanvas);
419
420         for (int i = 0; i < __outputBoxMaxCount; i++)
421         {
422                 DrawDateTimeDisplayBox(*pCanvas, i);
423         }
424
425         if ((__pickerStyle & DATETIME_OUTPUT_STYLE_DATE) && (__pickerStyle & DATETIME_OUTPUT_STYLE_TIME))
426         {
427                 DrawColon(*pCanvas);
428                 DrawPm(*pCanvas);
429         }
430         else if (__pickerStyle & DATETIME_OUTPUT_STYLE_TIME)
431         {
432                 DrawColon(*pCanvas);
433                 DrawPm(*pCanvas);
434         }
435
436         if (likely(_AccessibilityManager::IsActivated()))
437         {
438                 SetAccessibilityElementText();
439         }
440
441         delete pCanvas;
442
443         return true;
444 }
445
446 result
447 _DateTimePresenter::SetFont(Font* pFont)
448 {
449         result r = E_SUCCESS;
450         int fontSize = 0;
451
452         if (__pView == null)
453         {
454                 return E_SUCCESS;
455         }
456
457         GET_SHAPE_CONFIG(DATETIMEPICKER::FONT_SIZE, __pView->GetOrientation(), fontSize);
458
459         r = _FontImpl::GetInstance(*pFont)->SetStyle(FONT_STYLE_PLAIN);
460         SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
461
462         r = _FontImpl::GetInstance(*pFont)->SetSize(fontSize);
463         SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Propagating.");
464
465         for (int i = 0; i < DATETIME_ID_MAX; i++)
466         {
467                 if (__pDisplayBox[i] != null)
468                 {
469                         __pDisplayBox[i]->SetFont(pFont);
470                 }
471         }
472
473         if (__pPmBox != null)
474         {
475                 __pPmBox->SetFont(pFont);
476         }
477
478         if (__pInputPad != null)
479         {
480                 __pInputPad->SetFont(pFont);
481         }
482
483         return E_SUCCESS;
484 }
485
486 void
487 _DateTimePresenter::OnChangeLayout(_ControlOrientation orientation)
488 {
489         result r = E_SUCCESS;
490         Rectangle inputPadBounds(0, 0, 0, 0);
491         Rectangle pickerBounds(0, 0, 0, 0);
492
493         pickerBounds = __pView->GetBounds();
494
495         UpdateDateTimeOutputConfig();
496
497         inputPadBounds.x = 0;
498
499         GET_SHAPE_CONFIG(DATETIMEPICKER::INPUTPAD_HEIGHT, orientation, inputPadBounds.height);
500
501         inputPadBounds.width = pickerBounds.width;
502         inputPadBounds.y = pickerBounds.height - inputPadBounds.height;
503
504         if (__pInputPad != null)
505         {
506                 r = __pInputPad->SetBounds(inputPadBounds);
507                 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
508         }
509 }
510
511 bool
512 _DateTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
513 {
514         if (__pView != &source)
515         {
516                 return false;
517         }
518
519         int touchedAreaId = CalculateTouchArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
520
521         if (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM)
522         {
523                 __isPmButtonPressed = true;
524                 __pView->Draw();
525                 return true;
526         }
527
528         __selectedBoxIndex = CalculateTouchOutputArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
529
530         if (__selectedBoxIndex != -1 && __selectedBoxIndex != __focusedBoxIndex)
531         {
532                 result r = E_SUCCESS;
533                 _VisualElement* pVisualElement = null;
534                 Canvas* pCanvas = null;
535
536                 pVisualElement = __pView->GetDisplayVisualElement();
537                 r = GetLastResult();
538                 SysTryReturn(NID_UI_CTRL, (pVisualElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
539
540                 pCanvas = pVisualElement->GetCanvasN();
541                 r = GetLastResult();
542                 SysTryReturn(NID_UI_CTRL, (pCanvas != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
543
544                 DrawDateTimeDisplayBox(*pCanvas, __selectedBoxIndex);
545
546                 delete pCanvas;
547
548                 __pView->Draw();
549
550                 return true;
551         }
552
553         return true;
554 }
555
556 bool
557 _DateTimePresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
558 {
559         if (__pView != &source)
560         {
561                 return false;
562         }
563
564         return true;
565 }
566
567 bool
568 _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
569 {
570         result r = E_SUCCESS;
571
572         if (__pView != &source)
573         {
574                 return false;
575         }
576
577         int touchedAreaId = CalculateTouchArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
578
579         if (__isPmButtonPressed == true)
580         {
581                 if (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM)
582                 {
583                         __isPm = (!__isPm);
584                 }
585
586                 __inputComposing = DATETIME_INPUT_END;
587                 __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
588                 __isPmButtonPressed = false;
589                 __pView->Draw();
590
591                 return true;
592         }
593
594         if ((touchedAreaId == DATETIME_AREA_NONE) || (touchedAreaId == DATETIME_AREA_INPUT) ||
595                 (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM))
596         {
597                 __selectedBoxIndex = -1;
598                 __isPmButtonPressed = false;
599                 __pView->Draw();
600
601                 return true;
602         }
603
604         int newOutputFocusedIndex = -1;
605
606         if (touchedAreaId == DATETIME_AREA_OUTPUT)
607         {
608                 newOutputFocusedIndex = CalculateTouchOutputArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
609                 if ((newOutputFocusedIndex == (-1)) || (newOutputFocusedIndex == __focusedBoxIndex))
610                 {
611                         __selectedBoxIndex = -1;
612                         __pView->Draw();
613
614                         return true;
615                 }
616
617                 if (newOutputFocusedIndex == __selectedBoxIndex)
618                 {
619                         for (int i = 0; i < __outputBoxMaxCount; i++)
620                         {
621                                 AdjustDisplayValue(i);
622                         }
623
624                         SetFocusBox(newOutputFocusedIndex);
625                 }
626
627                 _VisualElement* pVisualElement = null;
628                 Canvas* pCanvas = null;
629
630                 pVisualElement = __pView->GetDisplayVisualElement();
631                 r = GetLastResult();
632                 SysTryReturn(NID_UI_CTRL, (pVisualElement != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
633
634                 pCanvas = pVisualElement->GetCanvasN();
635                 r = GetLastResult();
636                 SysTryReturn(NID_UI_CTRL, (pCanvas != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
637
638                 DrawDateTimeDisplayBox(*pCanvas, __focusedBoxIndex);
639
640                 delete pCanvas;
641
642                 __selectedBoxIndex = -1;
643                 __inputComposing = DATETIME_INPUT_END;
644                 __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
645
646                 int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
647                 ChangeInputPadStyle(boxId);
648
649                 __pView->Draw();
650
651                 return true;
652         }
653
654         return true;
655 }
656
657 bool
658 _DateTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
659 {
660         if (__pView != &source)
661         {
662                 return false;
663         }
664
665         __selectedBoxIndex = -1;
666         __isPmButtonPressed = false;
667         __inputComposing = DATETIME_INPUT_END;
668         __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
669
670         __pView->Draw();
671
672         return true;
673 }
674
675 void
676 _DateTimePresenter::OnInputPadValueChanged(const _Control& source, int inputPadReturnValue)
677 {
678         if ((__inputPadEnabled == false) || (inputPadReturnValue == -1))
679         {
680                 return;
681         }
682
683         int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
684         int currentNumber = GetNumberInBox(boxId);
685         int newNumber = 0;
686
687         if (boxId == DATETIME_ID_YEAR)
688         {
689                 __changeFocusCounter++;
690
691                 if (__isFocusBoxChanged == true)
692                 {
693                         newNumber = inputPadReturnValue;
694                         __isFocusBoxChanged = false;
695                 }
696                 else
697                 {
698                         newNumber = SetFourDigit(currentNumber, inputPadReturnValue);
699                 }
700
701                 __inputComposing = DATETIME_INPUT_BEGIN;
702                 SetNumberInBox(boxId, newNumber);
703
704                 int min = 0;
705                 int max = 0;
706
707                 GetYearRange(min, max);
708
709                 if ((newNumber >= max) || (newNumber > DATETIME_THREE_DIGIT_MAX) || __changeFocusCounter == DATE_TIME_CHANGE_FOCUS_COUNTER_MAX)
710                 {
711                         ChangeFocusBox();
712                 }
713         }
714         else if (boxId == DATETIME_ID_MONTH)
715         {
716                 newNumber = inputPadReturnValue;
717                 __inputComposing = DATETIME_INPUT_BEGIN;
718
719                 SetNumberInBox(boxId, newNumber);
720                 ChangeFocusBox();
721         }
722         else
723         {
724                 __changeFocusCounter++;
725
726                 if (__isFocusBoxChanged == true)
727                 {
728                         newNumber = inputPadReturnValue;
729                         __isFocusBoxChanged = false;
730                 }
731                 else
732                 {
733                         newNumber = SetTwoDigit(currentNumber, inputPadReturnValue);
734                 }
735
736                 __inputComposing = DATETIME_INPUT_BEGIN;
737
738                 SetNumberInBox(boxId, newNumber);
739
740                 if (newNumber > DATETIME_ONE_DIGIT_MAX || __changeFocusCounter == DATE_TIME_CHANGE_FOCUS_COUNTER_MAX / 2)
741                 {
742                         ChangeFocusBox();
743                 }
744         }
745
746         __pView->Draw();
747 }
748
749 void
750 _DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
751 {
752         result r = E_SUCCESS;
753
754         if (__pView == null)
755         {
756                 return;
757         }
758
759         if (actionId != DATETIME_EVENT_ID_SAVE && actionId != DATETIME_EVENT_ID_CANCEL )
760         {
761                 return;
762         }
763
764         DateTime dateTime;
765
766         __inputComposing = DATETIME_INPUT_END;
767         __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
768         __focusedBoxIndex = 0;
769
770         int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
771
772         SetFocusBoxId(boxId);
773         __pView->Close();
774
775         if (actionId == DATETIME_EVENT_ID_SAVE)
776         {
777                 for (int i = 0; i < __outputBoxMaxCount; i++)
778                 {
779                         AdjustDisplayValue(i);
780                 }
781
782                 SavePickerData();
783
784                 switch (__pickerStyle)
785                 {
786                 case DATETIME_OUTPUT_STYLE_DATE:
787                         r = dateTime.SetValue(GetYear(), GetMonth(), GetDay(), dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond());
788                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
789
790                         r = __pView->FireDateTimeChangeEvent(DATE_INTERNAL_CHANGE_SAVED, dateTime);
791                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to fire the event for DateTime change saved.");
792                         break;
793
794                 case DATETIME_OUTPUT_STYLE_TIME:
795                         r = dateTime.SetValue(dateTime.GetYear(), dateTime.GetMonth(), dateTime.GetDay(), GetHour(), GetMinute(), dateTime.GetSecond());
796                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
797
798                         r = __pView->FireDateTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED, dateTime);
799                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to fire the event for DateTime change saved.");
800                         break;
801
802                 case DATETIME_OUTPUT_STYLE_DATETIME:
803                         r = dateTime.SetValue(GetYear(), GetMonth(), GetDay(), GetHour(), GetMinute(), dateTime.GetSecond());
804                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
805
806                         r = __pView->FireDateTimeChangeEvent(DATETIME_INTERNAL_CHANGE_SAVED, dateTime);
807                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to fire the event for DateTime change saved.");
808                         break;
809
810                 default:
811                         break;
812                 }
813         }
814         else if (actionId == DATETIME_EVENT_ID_CANCEL)
815         {
816                 LoadPickerData();
817
818                 switch (__pickerStyle)
819                 {
820                 case DATETIME_OUTPUT_STYLE_DATE:
821                         r = dateTime.SetValue(GetYear(), GetMonth(), GetDay(), dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond());
822                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
823
824                         r = __pView->FireDateTimeChangeEvent(DATE_INTERNAL_CHANGE_CANCELED, dateTime);
825                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to fire the event for DateTime change canceled.");
826                         break;
827
828                 case DATETIME_OUTPUT_STYLE_TIME:
829                         r = dateTime.SetValue(dateTime.GetYear(), dateTime.GetMonth(), dateTime.GetDay(), GetHour(), GetMinute(), dateTime.GetSecond());
830                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
831
832                         r = __pView->FireDateTimeChangeEvent(TIME_INTERNAL_CHANGE_CANCELED, dateTime);
833                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to fire the event for DateTime change canceled.");
834                         break;
835
836                 case DATETIME_OUTPUT_STYLE_DATETIME:
837                         r = dateTime.SetValue(GetYear(), GetMonth(), GetDay(), GetHour(), GetMinute(), dateTime.GetSecond());
838                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
839
840                         r = __pView->FireDateTimeChangeEvent(DATETIME_INTERNAL_CHANGE_CANCELED, dateTime);
841                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to fire the event for DateTime change canceled.");
842                         break;
843
844                 default:
845                         break;
846                 }
847         }
848 }
849
850 void
851 _DateTimePresenter::UpdateDateTimeOutputConfig(void)
852 {
853         _ControlOrientation orientation = __pView->GetOrientation();
854         _DateTimeDisplayBox* pPmBox = null;
855         _DateTimeDisplayBox* pDisplayBox[DATETIME_ID_MAX];
856
857         Rectangle outputAreaBounds(0, 0, 0, 0);
858         Rectangle dateBounds(0, 0, 0, 0);
859         Rectangle monthBounds(0, 0, 0, 0);
860         Rectangle yearBounds(0, 0, 0, 0);
861         Rectangle hourBounds(0, 0, 0, 0);
862         Rectangle minuteBounds(0, 0, 0, 0);
863         Rectangle amPmBounds(0, 0, 0, 0);
864
865         int indexBox = 0;
866         int boxCount = 0;
867         int dateElementWidth = 0;
868         int displayBoxHeight = 0;
869         int dateTimeElementY = 0;
870         int dividerMargin = 0;
871         int dateTimeMargin = 0;
872         int leftMargin = 0;
873         int timeOutputMargin = 0;
874         int timeElementWidth = 0;
875         int colonWidth = 0;
876         int colonMargin = 0;
877         int amPmWidth = 0;
878         int amPmMargin = 0;
879
880         for (indexBox = 0; indexBox < DATETIME_ID_MAX; indexBox++)
881         {
882                 pDisplayBox[indexBox] = null;
883         }
884
885         outputAreaBounds = GetOutputArea();
886         __pView->SetDisplayVisualElementBounds(outputAreaBounds);
887
888         GET_FIXED_VALUE_CONFIG(DATETIMEPICKER::DIVIDER_WIDTH, orientation, dividerMargin);
889         GET_SHAPE_CONFIG(DATETIMEPICKER::DATE_ELEMENT_WIDTH, orientation, dateElementWidth);
890         GET_SHAPE_CONFIG(DATETIMEPICKER::DISPLAY_BOX_HEIGHT, orientation, displayBoxHeight);
891         GET_SHAPE_CONFIG(DATETIMEPICKER::DATE_TIME_MARGIN, orientation, dateTimeMargin);
892         GET_SHAPE_CONFIG(DATETIMEPICKER::LEFT_MARGIN, orientation, leftMargin);
893         GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_OUTPUT_MARGIN, orientation, timeOutputMargin);
894         GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_ELEMENT_WIDTH, orientation, timeElementWidth);
895         GET_SHAPE_CONFIG(DATETIMEPICKER::COLON_WIDTH, orientation, colonWidth);
896         GET_SHAPE_CONFIG(DATETIMEPICKER::COLON_MARGIN, orientation, colonMargin);
897         GET_SHAPE_CONFIG(DATETIMEPICKER::AMPM_WIDTH, orientation, amPmWidth);
898         GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_AMPM_MARGIN, orientation, amPmMargin);
899
900         dateTimeElementY = (outputAreaBounds.height - displayBoxHeight) / 2;
901
902         dateBounds.width = monthBounds.width = yearBounds.width = dateElementWidth;
903         hourBounds.width = minuteBounds.width = timeElementWidth;
904         amPmBounds.width = amPmWidth;
905
906         dateBounds.height = monthBounds.height = yearBounds.height = hourBounds.height = minuteBounds.height = amPmBounds.height = displayBoxHeight;
907         dateBounds.y = monthBounds.y = yearBounds.y = hourBounds.y = minuteBounds.y = amPmBounds.y = dateTimeElementY;
908
909         if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATE || __pickerStyle == DATETIME_OUTPUT_STYLE_DATETIME)
910         {
911                 switch (GetLocaleDateFormat())
912                 {
913                 case DATE_FORMAT_DDMMYYYY:
914                         {
915                                 dateBounds.x = leftMargin;
916                                 monthBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
917                                 yearBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
918                                 hourBounds.x = yearBounds.x + yearBounds.width + dateTimeMargin;
919
920                                 // Date
921                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(dateBounds, DATETIME_ID_DAY);
922                                 SysTryReturnVoidResult(NID_UI_CTRL, (pDisplayBox[boxCount] != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
923
924                                 boxCount++;
925
926                                 // Month
927                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(monthBounds, DATETIME_ID_MONTH);
928                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
929
930                                 boxCount++;
931
932                                 // Year
933                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(yearBounds, DATETIME_ID_YEAR);
934                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
935
936                                 boxCount++;
937                         }
938                         break;
939                 case DATE_FORMAT_MMDDYYYY:
940                         {
941                                 monthBounds.x = leftMargin;
942                                 dateBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
943                                 yearBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
944                                 hourBounds.x = yearBounds.x + yearBounds.width + dateTimeMargin;
945
946                                 // Month
947                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(monthBounds, DATETIME_ID_MONTH);
948                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
949
950                                 boxCount++;
951
952                                 // Date
953                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(dateBounds, DATETIME_ID_DAY);
954                                 SysTryReturnVoidResult(NID_UI_CTRL, (pDisplayBox[boxCount] != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
955
956                                 boxCount++;
957
958                                 // Year
959                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(yearBounds, DATETIME_ID_YEAR);
960                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
961
962                                 boxCount++;
963                         }
964                         break;
965                 case DATE_FORMAT_YYYYMMDD:
966                         {
967                                 yearBounds.x = leftMargin;
968                                 monthBounds.x = yearBounds.x + yearBounds.width + dividerMargin;
969                                 dateBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
970                                 hourBounds.x = dateBounds.x + dateBounds.width + dateTimeMargin;
971
972                                 // Year
973                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(yearBounds, DATETIME_ID_YEAR);
974                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
975
976                                 boxCount++;
977
978                                 // Month
979                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(monthBounds, DATETIME_ID_MONTH);
980                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
981
982                                 boxCount++;
983
984                                 // Date
985                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(dateBounds, DATETIME_ID_DAY);
986                                 SysTryReturnVoidResult(NID_UI_CTRL, (pDisplayBox[boxCount] != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
987
988                                 boxCount++;
989                         }
990                         break;
991                 case DATE_FORMAT_YYYYDDMM:
992                         {
993                                 yearBounds.x = leftMargin;
994                                 dateBounds.x = yearBounds.x + yearBounds.width + dividerMargin;
995                                 monthBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
996                                 hourBounds.x = monthBounds.x + monthBounds.width + dateTimeMargin;
997
998                                 // Year
999                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(yearBounds, DATETIME_ID_YEAR);
1000                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1001
1002                                 boxCount++;
1003
1004                                 // Date
1005                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(dateBounds, DATETIME_ID_DAY);
1006                                 SysTryReturnVoidResult(NID_UI_CTRL, (pDisplayBox[boxCount] != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1007
1008                                 boxCount++;
1009
1010                                 // Month
1011                                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(monthBounds, DATETIME_ID_MONTH);
1012                                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1013
1014                                 boxCount++;
1015                         }
1016                         break;
1017                 }
1018         }
1019
1020         if (__pickerStyle == DATETIME_OUTPUT_STYLE_TIME || __pickerStyle == DATETIME_OUTPUT_STYLE_DATETIME)
1021         {
1022                 if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATETIME)
1023                 {
1024                         minuteBounds.x = hourBounds.x + hourBounds.width + colonWidth;
1025                         amPmBounds.x = minuteBounds.x + minuteBounds.width + amPmMargin;
1026                 }
1027                 else
1028                 {
1029                         hourBounds.x = dateTimeMargin + leftMargin + timeOutputMargin;
1030                         minuteBounds.x = hourBounds.x + hourBounds.width + colonWidth + 2 * colonMargin;
1031                         amPmBounds.x = minuteBounds.x + minuteBounds.width + amPmMargin;
1032                 }
1033
1034                 // Hour
1035                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(hourBounds, DATETIME_ID_HOUR);
1036                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1037
1038                 boxCount++;
1039
1040                 // Minute
1041                 pDisplayBox[boxCount] = new (std::nothrow) _DateTimeDisplayBox(minuteBounds, DATETIME_ID_MINUTE);
1042                 SysTryCatch(NID_UI_CTRL, (pDisplayBox[boxCount] != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1043
1044                 boxCount++;
1045
1046                 // AmPm Button
1047                 if (__is24HourNotation == false)
1048                 {
1049                         pPmBox = new (std::nothrow) _DateTimeDisplayBox(amPmBounds, DATETIME_ID_AMPM);
1050                         SysTryCatch(NID_UI_CTRL, (pPmBox != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1051
1052                         pPmBox->SetBackgroundBitmap(__pPmBoxNormalBitmap, __pPmBoxEffectBitmap, __pPmBoxPressedEffectBitmap, __pPmBoxDisabledEffectBitmap);
1053
1054                         delete __pPmBox;
1055                         __pPmBox = pPmBox;
1056                 }
1057         }
1058
1059         __outputBoxMaxCount = boxCount;
1060
1061         for (indexBox = 0; indexBox < DATETIME_ID_MAX; indexBox++)
1062         {
1063                 delete __pDisplayBox[indexBox];
1064                 __pDisplayBox[indexBox] = pDisplayBox[indexBox];
1065         }
1066
1067         SetFont(__pFont);
1068
1069         return;
1070
1071 CATCH:
1072         for (int i = 0; i < DATETIME_ID_MAX; i++)
1073         {
1074                 delete pDisplayBox[i];
1075                 pDisplayBox[i] = null;
1076         }
1077
1078         return;
1079 }
1080
1081 void
1082 _DateTimePresenter::LoadResource(void)
1083 {
1084         Color colonColor;
1085         result r = E_SUCCESS;
1086         Bitmap* pColonBitmap = null;
1087
1088         r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pPmBoxNormalBitmap);
1089         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1090
1091         r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pPmBoxEffectBitmap);
1092         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1093
1094         r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_PRESSED_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pPmBoxPressedEffectBitmap);
1095         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1096
1097         r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_DISABLED_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pPmBoxDisabledEffectBitmap);
1098         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1099
1100         r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pColonBitmap);
1101         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1102
1103         GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, colonColor);
1104
1105         __pColonBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pColonBitmap, Color::GetColor(COLOR_ID_WHITE), colonColor);
1106         r = GetLastResult();
1107         SysTryCatch(NID_UI_CTRL, (__pColonBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1108
1109         delete pColonBitmap;
1110
1111         return;
1112
1113 CATCH:
1114         delete __pPmBoxNormalBitmap;
1115         __pPmBoxNormalBitmap = null;
1116
1117         delete __pPmBoxEffectBitmap;
1118         __pPmBoxEffectBitmap = null;
1119
1120         delete __pPmBoxPressedEffectBitmap;
1121         __pPmBoxPressedEffectBitmap = null;
1122
1123         delete __pPmBoxDisabledEffectBitmap;
1124         __pPmBoxDisabledEffectBitmap = null;
1125
1126         delete __pColonBitmap;
1127         __pColonBitmap = null;
1128
1129         delete pColonBitmap;
1130
1131         return;
1132 }
1133
1134 void
1135 _DateTimePresenter::DrawColon(Canvas& canvas)
1136 {
1137         result r = E_SUCCESS;
1138         _ControlOrientation orientation = __pView->GetOrientation();
1139
1140         Rectangle hourBounds(0, 0, 0, 0);
1141         Rectangle colonBounds(0, 0, 0, 0);
1142
1143         int colonWidth = 0;
1144         int colonMargin = 0;
1145
1146         GET_SHAPE_CONFIG(DATETIMEPICKER::COLON_WIDTH, orientation, colonWidth);
1147         GET_SHAPE_CONFIG(DATETIMEPICKER::COLON_MARGIN, orientation, colonMargin);
1148
1149         for (int i = 0; i < __outputBoxMaxCount; i++)
1150         {
1151                 if (__pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_HOUR)
1152                 {
1153                         hourBounds = __pDisplayBox[i]->GetDisplayBoxBounds();
1154                 }
1155         }
1156
1157         colonBounds.x = hourBounds.x + hourBounds.width;
1158         colonBounds.y = hourBounds.y;
1159         colonBounds.width = colonWidth;
1160         colonBounds.height = hourBounds.height;
1161
1162         if (__pickerStyle == DATETIME_OUTPUT_STYLE_TIME)
1163         {
1164                 colonBounds.x += colonMargin;
1165         }
1166
1167         if (__pColonBitmap != null)
1168         {
1169                 r = canvas.DrawBitmap(colonBounds, *__pColonBitmap);
1170                 SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1171         }
1172 }
1173
1174 void
1175 _DateTimePresenter::DrawDateTimeDisplayBox(Canvas& canvas, int index)
1176 {
1177         result r = E_SUCCESS;
1178         String text;
1179         int number = 0;
1180         int boxId = __pDisplayBox[index]->GetDisplayBoxId();
1181         number = GetNumberInBox(boxId);
1182         DateTimePickerStatus status = DATETIME_STATUS_NORMAL;
1183
1184         if (__pView->IsEnabled() == false)
1185         {
1186                 status = DATETIME_STATUS_DISABLED;
1187         }
1188         else if (index == __selectedBoxIndex)
1189         {
1190                 status = DATETIME_STATUS_SELECTED;
1191         }
1192         else if (index == __focusedBoxIndex)
1193         {
1194                 status = DATETIME_STATUS_FOCUSED;
1195         }
1196
1197         if (boxId == DATETIME_ID_YEAR)
1198         {
1199                 if ((__inputComposing == DATETIME_INPUT_BEGIN) && (status == DATETIME_STATUS_FOCUSED))
1200                 {
1201                         String length = L"%0d";
1202
1203                         r = length.Insert(__changeFocusCounter,2);
1204                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1205
1206                         r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, length.GetPointer(), number);
1207                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1208                 }
1209                 else
1210                 {
1211                         r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, L"%04d", number);
1212                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1213                 }
1214         }
1215         else if (boxId == DATETIME_ID_MONTH)
1216         {
1217                 if (__pInputPad != null)
1218                 {
1219                         text.Clear();
1220                         _DateTimeUtils dateTimeUtils;
1221                         text = dateTimeUtils.GetMonthString(number);
1222                 }
1223                 else
1224                 {
1225                         r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, L"%02d", number);
1226                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1227                 }
1228         }
1229         else
1230         {
1231                 if ((__inputComposing == DATETIME_INPUT_BEGIN) && (status == DATETIME_STATUS_FOCUSED))
1232                 {
1233                         r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, L"%d", number);
1234                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1235                 }
1236                 else
1237                 {
1238                         r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, L"%02d", number);
1239                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1240                 }
1241         }
1242
1243         __pDisplayBox[index]->SetText(text);
1244         __pDisplayBox[index]->DrawDisplayBox(canvas, status);
1245
1246         return;
1247 }
1248
1249 void
1250 _DateTimePresenter::DrawPm(Canvas& canvas)
1251 {
1252         String text;
1253
1254         if ((__is24HourNotation == true) || (__pPmBox == null))
1255         {
1256                 return;
1257         }
1258
1259         if (__isPm == false)
1260         {
1261                 GET_STRING_CONFIG(IDS_COM_BODY_AM, text);
1262         }
1263         else
1264         {
1265                 GET_STRING_CONFIG(IDS_COM_POP_PM, text);
1266         }
1267
1268         __pPmBox->SetText(text);
1269
1270         if (__pView->IsEnabled() == false)
1271         {
1272                 __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_DISABLED);
1273         }
1274         else if (__isPmButtonPressed == true)
1275         {
1276                 __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_SELECTED);
1277         }
1278         else
1279         {
1280                 __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_NORMAL);
1281         }
1282 }
1283
1284 void
1285 _DateTimePresenter::DrawDividers(Canvas& canvas)
1286 {
1287         result r = E_SUCCESS;
1288         int dividerWidth = 0;
1289         int dividerHeight = 0;
1290         Point lineStart(0,0);
1291         Point lineEnd(0,0);
1292         Color colorHalfLeft;
1293         Color colorHalfRight;
1294
1295         _ControlOrientation orientation = __pView->GetOrientation();
1296
1297         GET_FIXED_VALUE_CONFIG(DATETIMEPICKER::DIVIDER_WIDTH, orientation, dividerWidth);
1298         GET_SHAPE_CONFIG(DATETIMEPICKER::DIVIDER_HEIGHT, orientation, dividerHeight);
1299
1300         GET_COLOR_CONFIG(DATETIMEPICKER::DIVIDER_LEFT_HALF, colorHalfLeft);
1301         GET_COLOR_CONFIG(DATETIMEPICKER::DIVIDER_RIGHT_HALF, colorHalfRight);
1302
1303         lineStart.y = (GetOutputArea().height - dividerHeight) / 2;
1304         lineEnd.y = lineStart.y + dividerHeight;
1305
1306         canvas.SetLineWidth(dividerWidth/2);
1307
1308         for (int i = 0; i < __outputBoxMaxCount; i++)
1309         {
1310                 bool isDrawDivider = false;
1311
1312                 if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATETIME)
1313                 {
1314                         if (__pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_DAY ||
1315                                 __pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_MONTH ||
1316                                 __pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_YEAR)
1317                         {
1318                                 isDrawDivider = true;
1319                         }
1320                 }
1321                 else if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATE)
1322                 {
1323                         if (GetLocaleDateFormat() == DATE_FORMAT_YYYYMMDD)
1324                         {
1325                                 if (__pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_YEAR ||
1326                                         __pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_MONTH)
1327                                 {
1328                                         isDrawDivider = true;
1329                                 }
1330                         }
1331                         else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYDDMM)
1332                         {
1333                                 if (__pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_YEAR ||
1334                                         __pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_DAY)
1335                                 {
1336                                         isDrawDivider = true;
1337                                 }
1338                         }
1339                         else
1340                         {
1341                                 if (__pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_MONTH ||
1342                                         __pDisplayBox[i]->GetDisplayBoxId() == DATETIME_ID_DAY)
1343                                 {
1344                                         isDrawDivider = true;
1345                                 }
1346                         }
1347                 }
1348
1349                 if (isDrawDivider)
1350                 {
1351                         lineStart.x = __pDisplayBox[i]->GetDisplayBoxBounds().x + __pDisplayBox[i]->GetDisplayBoxBounds().width;
1352                         lineEnd.x = lineStart.x;
1353
1354                         canvas.SetForegroundColor(colorHalfLeft);
1355                         r = canvas.DrawLine(lineStart, lineEnd);
1356                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1357
1358                         lineStart.x += dividerWidth/2;
1359                         lineEnd.x = lineStart.x;
1360
1361                         canvas.SetForegroundColor(colorHalfRight);
1362                         r = canvas.DrawLine(lineStart, lineEnd);
1363                         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1364                 }
1365         }
1366
1367         return;
1368 }
1369
1370 Rectangle
1371 _DateTimePresenter::GetOutputArea(void)
1372 {
1373         _ControlOrientation orientation = __pView->GetOrientation();
1374
1375         Rectangle outputArea(0, 0, 0, 0);
1376         Rectangle headerBounds = __pView->GetHeaderBounds();
1377         int margin = 0;
1378
1379         GET_SHAPE_CONFIG(DATETIMEPICKER::TOP_MARGIN, orientation, margin);
1380
1381         outputArea.y = headerBounds.y + headerBounds.height + margin;
1382         outputArea.width = __pView->GetBounds().width;
1383
1384         GET_SHAPE_CONFIG(DATETIMEPICKER::OUTPUT_AREA_HEIGHT, orientation, outputArea.height);
1385
1386         return outputArea;
1387 }
1388
1389 void
1390 _DateTimePresenter::ChangeInputPadStyle(int boxId)
1391 {
1392         if (__inputPadEnabled == false)
1393         {
1394                 return;
1395         }
1396
1397         SysTryReturnVoidResult(NID_UI_CTRL, __pInputPad != null, E_SYSTEM,
1398                                                    "[E_SYSTEM] A system error has occurred. The instance of Inputpad is null.");
1399
1400         _InputPadStyle inputPadType = INPUTPAD_STYLE_NORMAL;
1401         switch (boxId)
1402         {
1403         case DATETIME_ID_MONTH:
1404                 inputPadType = INPUTPAD_STYLE_ALPHA;
1405                 break;
1406
1407         case DATETIME_ID_YEAR:
1408         // fall through intentional
1409         case DATETIME_ID_DAY:
1410         // fall through intentional
1411         case DATETIME_ID_HOUR:
1412         // fall through intentional
1413         case DATETIME_ID_MINUTE:
1414         // fall through intentional
1415         default:
1416                 inputPadType = INPUTPAD_STYLE_NORMAL;
1417                 break;
1418         }
1419
1420         if (__inputPadType == inputPadType)
1421         {
1422                 return;
1423         }
1424         __inputPadType = inputPadType;
1425
1426         __pInputPad->SetInputPadStyle(inputPadType);
1427         result r = GetLastResult();
1428         SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
1429 }
1430
1431 int
1432 _DateTimePresenter::CalculateTouchArea(int posX, int posY)
1433 {
1434         _ControlOrientation orientation = __pView->GetOrientation();
1435         Rectangle outputArea = GetOutputArea();
1436
1437         int margin = 0;
1438
1439         GET_SHAPE_CONFIG(DATETIMEPICKER::TOP_MARGIN, orientation, margin);
1440
1441         if ((posX < outputArea.x) || (posY < outputArea.y))
1442         {
1443                 return DATETIME_AREA_NONE;
1444         }
1445
1446         int touched = DATETIME_AREA_NONE;
1447
1448         if (posY < outputArea.y + outputArea.height)
1449         {
1450                 int boxHeight = 0;
1451                 GET_SHAPE_CONFIG(DATETIMEPICKER::DISPLAY_BOX_HEIGHT, orientation, boxHeight);
1452
1453                 int boxPosY = outputArea.y + ((outputArea.height - boxHeight) / 2);
1454
1455                 if ((posY >= boxPosY) && (posY <= boxPosY + boxHeight))
1456                 {
1457                         // output area
1458                         touched = DATETIME_AREA_OUTPUT;
1459
1460                         if (__pPmBox != null)
1461                         {
1462                                 Rectangle boxBounds = __pPmBox->GetDisplayBoxBounds();
1463
1464                                 boxBounds.y = outputArea.y + ((outputArea.height - boxBounds.height) / 2);
1465
1466                                 if ((posX >= boxBounds.x) && (posX < boxBounds.x + boxBounds.width)
1467                                         && (posY >= boxBounds.y) && (posY < boxBounds.y + boxBounds.height))
1468                                 {
1469                                         touched = DATETIME_AREA_OUTPUT_AMPM;
1470                                 }
1471                         }
1472                 }
1473         }
1474         else
1475         {
1476                 touched = DATETIME_AREA_INPUT;
1477         }
1478
1479         return touched;
1480 }
1481
1482 int
1483 _DateTimePresenter::CalculateTouchOutputArea(int posX, int posY)
1484 {
1485         Rectangle outputArea = GetOutputArea();
1486
1487         for (int i = 0; i < __outputBoxMaxCount; i++)
1488         {
1489                 Rectangle boxBounds = __pDisplayBox[i]->GetDisplayBoxBounds();
1490
1491                 boxBounds.y = outputArea.y + ((outputArea.height - boxBounds.height) / 2);
1492
1493                 if ((posX >= boxBounds.x) && (posX < boxBounds.x + boxBounds.width)
1494                         && (posY >= boxBounds.y) && (posY < boxBounds.y + boxBounds.height))
1495                 {
1496                         return i;
1497                 }
1498         }
1499
1500         return -1;
1501 }
1502
1503 int
1504 _DateTimePresenter::CalculateTwoDigit(int originalNumber, int number)
1505 {
1506         int twoDigit = (originalNumber * 10) + number;
1507
1508         if (twoDigit == 0)
1509         {
1510                 return twoDigit;
1511         }
1512
1513         if ((twoDigit > 0) && (twoDigit > DATETIME_TWO_DIGIT_MAX))
1514         {
1515                 twoDigit = twoDigit % (DATETIME_TWO_DIGIT_MAX + 1);
1516         }
1517
1518         return twoDigit;
1519 }
1520
1521 int
1522 _DateTimePresenter::CalculateFourDigit(int originalNumber, int number)
1523 {
1524         int fourDigit = (originalNumber * 10) + number;
1525
1526         if (fourDigit == 0)
1527         {
1528                 return fourDigit;
1529         }
1530
1531         if ((fourDigit > 0) && (fourDigit > DATETIME_FOUR_DIGIT_MAX))
1532         {
1533                 fourDigit = fourDigit % (DATETIME_FOUR_DIGIT_MAX + 1);
1534         }
1535         return fourDigit;
1536 }
1537
1538 int
1539 _DateTimePresenter::SetTwoDigit(int originalNumber, int number)
1540 {
1541         int twoDigit = 0;
1542
1543         if ((originalNumber <= DATETIME_ONE_DIGIT_MAX) && (__inputComposing == DATETIME_INPUT_BEGIN))
1544         {
1545                 twoDigit = (originalNumber * 10) + number;
1546         }
1547         else
1548         {
1549                 twoDigit = number;
1550         }
1551         return twoDigit;
1552 }
1553
1554 int
1555 _DateTimePresenter::SetFourDigit(int originalNumber, int number)
1556 {
1557         int fourDigit = 0;
1558         int minYear = 0;
1559         int maxYear = 0;
1560
1561         GetYearRange(minYear, maxYear);
1562         if ((originalNumber <= DATETIME_THREE_DIGIT_MAX) && (__inputComposing == DATETIME_INPUT_BEGIN))
1563         {
1564                 fourDigit = (originalNumber * 10) + number;
1565                 if (fourDigit > maxYear)
1566                 {
1567                         fourDigit = maxYear;
1568                 }
1569         }
1570         else
1571         {
1572                 fourDigit = number;
1573         }
1574
1575         return fourDigit;
1576 }
1577
1578 void
1579 _DateTimePresenter::SetNumberInBox(int boxId, int number)
1580 {
1581         switch (boxId)
1582         {
1583         case DATETIME_ID_YEAR:
1584                 __year = number;
1585                 break;
1586
1587         case DATETIME_ID_MONTH:
1588                 __month = number;
1589                 break;
1590
1591         case DATETIME_ID_DAY:
1592                 __day = number;
1593                 break;
1594
1595         case DATETIME_ID_HOUR:
1596                 __hour = number;
1597                 break;
1598
1599         case DATETIME_ID_MINUTE:
1600                 __minute = number;
1601                 break;
1602
1603         default:
1604                 break;
1605         }
1606 }
1607
1608 int
1609 _DateTimePresenter::GetNumberInBox(int boxId) const
1610 {
1611         int number = 0;
1612
1613         switch (boxId)
1614         {
1615         case DATETIME_ID_YEAR:
1616                 number = __year;
1617                 break;
1618
1619         case DATETIME_ID_MONTH:
1620                 number = __month;
1621                 break;
1622
1623         case DATETIME_ID_DAY:
1624                 number = __day;
1625                 break;
1626
1627         case DATETIME_ID_HOUR:
1628                 number = __hour;
1629                 break;
1630
1631         case DATETIME_ID_MINUTE:
1632                 number = __minute;
1633                 break;
1634
1635         default:
1636                 break;
1637         }
1638
1639         return number;
1640 }
1641
1642 void
1643 _DateTimePresenter::SetFocusBox(int index)
1644 {
1645         __focusedBoxIndex = index;
1646         __isFocusBoxChanged = true;
1647 }
1648
1649 void
1650 _DateTimePresenter::LoadPickerData(void)
1651 {
1652         __year = GetYear();
1653         __month = GetMonth();
1654         __day = GetDay();
1655         __hour = GetHour();
1656
1657         if (__is24HourNotation == false)
1658         {
1659                 int max = DATETIME_HOUR_MAX_FOR_24NOTATION;
1660
1661                 if (__hour == DATETIME_HOUR_MIN)
1662                 {
1663                         __hour = __hour + max;
1664                         __isPm = false;
1665                 }
1666                 else if (__hour < max && __hour != DATETIME_HOUR_MIN)
1667                 {
1668                         __isPm = false;
1669                 }
1670                 else if (__hour == max)
1671                 {
1672                         __isPm = true;
1673                 }
1674                 else if (__hour > max && __hour <= DATETIME_HOUR_MAX)
1675                 {
1676                         __hour = __hour - max;
1677                         __isPm = true;
1678                 }
1679                 else if (__hour == DATETIME_HOUR_MAX + 1)
1680                 {
1681                         __hour = max;
1682                         __isPm = false;
1683                 }
1684         }
1685         __minute = GetMinute();
1686 }
1687
1688 void
1689 _DateTimePresenter::SavePickerData(void)
1690 {
1691         SetYear(__year);
1692         SetMonth(__month);
1693         SetDay(__day);
1694
1695         if (__is24HourNotation == false)
1696         {
1697                 int maxHour = DATETIME_HOUR_MAX_FOR_24NOTATION;
1698
1699                 if (__isPm == true)
1700                 {
1701                         if (__hour < maxHour)
1702                         {
1703                                 SetHour(__hour + maxHour);
1704                         }
1705                         else
1706                         {
1707                                 SetHour(__hour);
1708                         }
1709                 }
1710                 else
1711                 {
1712                         if (__hour < maxHour)
1713                         {
1714                                 SetHour(__hour);
1715                         }
1716                         else
1717                         {
1718                                 SetHour(__hour - maxHour);
1719                         }
1720                 }
1721         }
1722         else
1723         {
1724                 SetHour(__hour);
1725         }
1726
1727         SetMinute(__minute);
1728 }
1729
1730 void
1731 _DateTimePresenter::UpdateDisplayData(int boxId)
1732 {
1733         switch (boxId)
1734         {
1735         case DATETIME_ID_YEAR:
1736                 __year = GetYear();
1737                 break;
1738
1739         case DATETIME_ID_MONTH:
1740                 __month = GetMonth();
1741                 break;
1742
1743         case DATETIME_ID_DAY:
1744                 __day = GetDay();
1745                 break;
1746
1747         case DATETIME_ID_HOUR:
1748                 __hour = GetHour();
1749
1750                 if (__is24HourNotation == false)
1751                 {
1752                         int maxHour = DATETIME_HOUR_MAX_FOR_24NOTATION;
1753
1754                         if (__hour == DATETIME_HOUR_MIN)
1755                         {
1756                                 __hour = maxHour;
1757                                 __isPm = false;
1758                         }
1759                         else if (__hour < maxHour && __hour != DATETIME_HOUR_MIN)
1760                         {
1761                                 __isPm = false;
1762                         }
1763                         else if (__hour == maxHour)
1764                         {
1765                                 __isPm = true;
1766                         }
1767                         else if (__hour > maxHour && __hour <= DATETIME_HOUR_MAX)
1768                         {
1769                                 __hour = __hour - maxHour;
1770                                 __isPm = true;
1771                         }
1772                         else if (__hour == DATETIME_HOUR_MAX + 1)
1773                         {
1774                                 __hour = __hour - maxHour;
1775                                 __isPm = false;
1776                         }
1777                 }
1778                 break;
1779
1780         case DATETIME_ID_MINUTE:
1781                 __minute = GetMinute();
1782                 break;
1783
1784         default:
1785                 break;
1786         }
1787 }
1788
1789 void
1790 _DateTimePresenter::AdjustValue(int& value, int minValue, int maxValue)
1791 {
1792         if (value < minValue)
1793         {
1794                 value = minValue;
1795         }
1796         else if (maxValue < value)
1797         {
1798                 value = maxValue;
1799         }
1800 }
1801
1802 void
1803 _DateTimePresenter::AdjustDisplayValue(int index)
1804 {
1805         int boxId = __pDisplayBox[index]->GetDisplayBoxId();
1806         _DateTimeUtils dateTimeUtils;
1807         int minValue = 0;
1808         int maxValue = 0;
1809
1810         switch (boxId)
1811         {
1812         case DATETIME_ID_YEAR:
1813                 minValue = 0;
1814                 maxValue = 0;
1815                 GetYearRange(minValue, maxValue);
1816                 AdjustValue(__year, minValue, maxValue);
1817                 break;
1818
1819         case DATETIME_ID_MONTH:
1820                 minValue = DATETIME_MONTH_MIN;
1821                 maxValue = DATETIME_MONTH_MAX;
1822                 AdjustValue(__month, minValue, maxValue);
1823                 break;
1824
1825         case DATETIME_ID_DAY:
1826                 minValue = 1;
1827                 maxValue = dateTimeUtils.CalculateMaxDay(__year, __month);
1828                 AdjustValue(__day, minValue, maxValue);
1829                 break;
1830
1831         case DATETIME_ID_HOUR:
1832                 minValue = DATETIME_HOUR_MIN;
1833                 maxValue = DATETIME_HOUR_MAX;
1834                 if (__is24HourNotation == false)
1835                 {
1836                         maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1837
1838                         if(__hour == DATETIME_HOUR_MIN)
1839                         {
1840                                 minValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
1841                         }
1842                 }
1843                 AdjustValue(__hour, minValue, maxValue);
1844                 break;
1845
1846         case DATETIME_ID_MINUTE:
1847                 minValue = DATETIME_MINUTE_MIN;
1848                 maxValue = DATETIME_MINUTE_MAX;
1849                 AdjustValue(__minute, minValue, maxValue);
1850                 break;
1851
1852         default:
1853                 break;
1854         }
1855 }
1856
1857 void
1858 _DateTimePresenter::ChangeFocusBox(void)
1859 {
1860         if (__focusedBoxIndex < (__outputBoxMaxCount - 1))
1861         {
1862                 __focusedBoxIndex++;
1863                 int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
1864                 ChangeInputPadStyle(boxId);
1865                 __isFocusBoxChanged = true;
1866         }
1867
1868         for (int i = 0; i < __outputBoxMaxCount; i++)
1869         {
1870                 AdjustDisplayValue(i);
1871         }
1872
1873         __inputComposing = DATETIME_INPUT_END;
1874         __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
1875 }
1876
1877 int
1878 _DateTimePresenter::GetLocaleDateFormat(void) const
1879 {
1880         int localeDateFormat = -1;
1881         int error = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &localeDateFormat);
1882         if (error == -1)
1883         {
1884                 localeDateFormat = SETTING_DATE_FORMAT_DD_MM_YYYY;
1885         }
1886
1887         return localeDateFormat;
1888 }
1889
1890 void
1891 _DateTimePresenter::SetAccessibilityElementText(void)
1892 {
1893         for (int index = 0; index < __outputBoxMaxCount; ++index)
1894         {
1895                 if (__pDisplayBox[index]->GetDisplayBoxId() == DATETIME_ID_MONTH)
1896                 {
1897                         int number = GetNumberInBox(__pDisplayBox[index]->GetDisplayBoxId());
1898                         __pView->SetAccessibilityElementText(index, __pInputPad->GetAccessebilityElementMonthName(number-1), false);
1899                 }
1900                 else
1901                 {
1902                         __pView->SetAccessibilityElementText(index, __pDisplayBox[index]->GetText(), false);
1903                 }
1904         }
1905
1906         if (__pPmBox)
1907         {
1908                 __pView->SetAccessibilityElementText(__outputBoxMaxCount, __pPmBox->GetText(), true);
1909         }
1910 }
1911
1912 }}} // Tizen::Ui::Controls