173fdffdd3710766ccfbb0b1393fc8a491932637
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_EditDatePresenter.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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 /**
19  * @file                FUiCtrl_EditDatePresenter.cpp
20  * @brief               This is the implementation file for the _EditDatePresenter class.
21  */
22
23 #include <vconf.h>
24 #include <FGrp_TextTextObject.h>
25 #include <FGrp_TextTextSimple.h>
26 #include <FGrp_CanvasImpl.h>
27 #include <FGrp_FontImpl.h>
28 #include "FUi_ResourceManager.h"
29 #include "FUiCtrl_EditDatePresenter.h"
30 #include "FUiCtrl_EditDate.h"
31 #include "FUiCtrl_DateTimeModel.h"
32 #include "FUiCtrl_DateTimeUtils.h"
33 #include "FUiControl.h"
34 #include "FUiAnim_VisualElement.h"
35 #include "FUiAnimVisualElementPropertyAnimation.h"
36 #include "FGrpColor.h"
37 #include "FUi_CoordinateSystemUtils.h"
38
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Base;
41 using namespace Tizen::Graphics::_Text;
42 using namespace Tizen::Ui::Animations;
43
44
45 namespace Tizen { namespace Ui { namespace Controls
46 {
47 _EditDatePresenter::_EditDatePresenter(void)
48         : __pEditDateTimeModel(null)
49         , __pEditDate(null)
50         , __dayBounds(FloatRectangle())
51         , __monthBounds(FloatRectangle())
52         , __yearBounds(FloatRectangle())
53         , __dayTouchBounds(FloatRectangle())
54         , __monthTouchBounds(FloatRectangle())
55         , __yearTouchBounds(FloatRectangle())
56         , __titleBounds(FloatRectangle())
57         , __datePickerEnabled(true)
58         , __selectedId(DATETIME_ID_NONE)
59         , __lastSelectedId(DATETIME_ID_NONE)
60         , __touchMoveHandled(false)
61         , __titleObject()
62         , __textObject()
63         , __pFont(null)
64         , __dividerLineWidth(0.0f)
65         , __dividerLineHeight(0.0f)
66         , __titleFontSize(0.0f)
67         , __dateFontSize(0.0f)
68         , __pContentProvider(null)
69         , __isAnimating(false)
70         , __isEditDateInitialized(false)
71         , __elementWidth(0.0f)
72 {
73 }
74
75 _EditDatePresenter::~_EditDatePresenter(void)
76 {
77         __titleObject.RemoveAll();
78         __textObject.RemoveAll();
79
80         delete __pEditDateTimeModel;
81         __pEditDateTimeModel = null;
82 }
83
84 _EditDatePresenter*
85 _EditDatePresenter::CreateInstanceN(const _EditDate& editDate, const String& title)
86 {
87         _EditDatePresenter* pEditDatePresenter = new (std::nothrow) _EditDatePresenter;
88         SysTryReturn(NID_UI_CTRL, pEditDatePresenter, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
89
90         pEditDatePresenter->__pEditDate = const_cast <_EditDate*>(&editDate);
91
92         pEditDatePresenter->__pEditDateTimeModel = new (std::nothrow) _DateTimeModel;
93         SysTryCatch(NID_UI_CTRL, pEditDatePresenter->__pEditDateTimeModel, , E_OUT_OF_MEMORY,
94                         "[E_OUT_OF_MEMORY] Memory allocation failed.");
95         pEditDatePresenter->SetTitle(title);
96
97         return pEditDatePresenter;
98
99 CATCH:
100         delete pEditDatePresenter;
101         return null;
102 }
103
104 void
105 _EditDatePresenter::SetTitle(const String& title)
106 {
107         __title = title;
108 }
109 result
110 _EditDatePresenter::Initialize(void)
111 {
112         result r = E_SUCCESS;
113         float editDateHeight = 0.0f;
114         float editDateWidth = 0.0f;
115         float leftMargin = 0.0f;
116         float titledateMargin = 0.0f;
117         float dateHeight = 0.0f;
118         FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
119
120         GET_SHAPE_CONFIG(EDITDATE::WIDTH, __pEditDate->GetOrientation(), editDateWidth);
121         GET_SHAPE_CONFIG(EDITDATE::HEIGHT, __pEditDate->GetOrientation(), editDateHeight);
122         GET_SHAPE_CONFIG(EDITDATE::DATE_TEXT_LEFT_MARGIN, __pEditDate->GetOrientation(), leftMargin);
123         GET_FIXED_VALUE_CONFIG(EDITDATE::ITEM_DIVIDER_WIDTH, __pEditDate->GetOrientation(), __dividerLineWidth);
124         GET_SHAPE_CONFIG(EDITDATE::ITEM_DIVIDER_HEIGHT, __pEditDate->GetOrientation(), __dividerLineHeight);
125         GET_SHAPE_CONFIG(EDITDATE::TEXT_FONT_SIZE, __pEditDate->GetOrientation(), __titleFontSize);
126         GET_SHAPE_CONFIG(EDITDATE::DATE_FONT_SIZE, __pEditDate->GetOrientation(), __dateFontSize);
127         GET_SHAPE_CONFIG(EDITDATE::TITLE_DATE_MARGIN, __pEditDate->GetOrientation(), titledateMargin);
128         GET_SHAPE_CONFIG(EDITDATE::DATE_HEIGHT, __pEditDate->GetOrientation(), dateHeight);
129         GET_SHAPE_CONFIG(EDITDATE::TITLE_HEIGHT, __pEditDate->GetOrientation(), __titleBounds.height);
130
131         CalculateElementWidth();
132
133         if (__pEditDate->GetBoundsF().height > editDateHeight)
134         {
135                 editDateHeight = __pEditDate->GetBoundsF().height;
136         }
137
138         __pFont = __pEditDate->GetFallbackFont();
139         r = GetLastResult();
140         SysTryReturn(NID_UI_CTRL, __pFont != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
141
142         if (__title.IsEmpty() == false)
143         {
144                 __titleBounds.x = leftMargin;
145                 __titleBounds.y = (editDateHeight - (__titleBounds.height + titledateMargin + dateHeight)) / 2.0f;
146                 __titleBounds.width = editDateWidth;
147
148                 bounds.y = __titleBounds.y + __titleBounds.height + titledateMargin;
149
150                 __dayBounds.height = dateHeight;
151                 __monthBounds.height = dateHeight;
152                 __yearBounds.height = dateHeight;
153
154                 if (!__isEditDateInitialized)
155                 {
156                         r = InitializeTitleObject();
157                         SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
158                 }
159
160                 __titleObject.SetBounds(__titleBounds);
161         }
162         else
163         {
164                 __dayBounds.height = editDateHeight;
165                 __monthBounds.height = editDateHeight;
166                 __yearBounds.height = editDateHeight;
167         }
168
169         __dayBounds.width = __elementWidth;
170         __monthBounds.width = __elementWidth;
171         __yearBounds.width = __elementWidth;
172
173         __dayBounds.x = 0.0f;
174         __monthBounds.x = 0.0f;
175         __yearBounds.x = 0.0f;
176
177         __dayBounds.y = bounds.y;
178         __monthBounds.y = bounds.y;
179         __yearBounds.y = bounds.y;
180
181         if (!__isEditDateInitialized)
182         {
183                 r = InitializeTextObject();
184                 SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
185         }
186
187         __isEditDateInitialized = true;
188
189         CalculateAreaBounds();
190
191         return r;
192 }
193
194 result
195 _EditDatePresenter::InitializeTitleObject(void)
196 {
197         result r = E_SUCCESS;
198
199         Color titleNormalColor;
200
201         GET_COLOR_CONFIG(EDITDATE::TITLE_TEXT_NORMAL, titleNormalColor);
202
203         r = __titleObject.Construct();
204         SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
205
206         TextSimple* pSimpleText = null;
207
208         pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(__title.GetPointer())), __title.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
209         SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
210
211         __titleObject.AppendElement(*pSimpleText);
212
213         __titleObject.SetForegroundColor(titleNormalColor, 0, __titleObject.GetTextLength());
214         __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
215         __titleObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_LEFT | TEXT_OBJECT_ALIGNMENT_MIDDLE);
216         __titleObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
217         __titleObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
218
219         return r;
220 }
221
222 result
223 _EditDatePresenter::InitializeTextObject(void)
224 {
225         result r = E_SUCCESS;
226
227         r = __textObject.Construct();
228         SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
229
230         TextSimple* pSimpleText = null;
231
232         pSimpleText = new (std::nothrow)TextSimple(null, 0, TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
233         SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
234
235         __textObject.AppendElement(*pSimpleText);
236
237         __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
238         __textObject.SetAlignment(TEXT_OBJECT_ALIGNMENT_CENTER | TEXT_OBJECT_ALIGNMENT_MIDDLE);
239         __textObject.SetWrap(TEXT_OBJECT_WRAP_TYPE_NONE);
240         __textObject.SetAction(TEXT_OBJECT_ACTION_TYPE_ABBREV);
241
242         return r;
243 }
244
245 float
246 _EditDatePresenter::GetTextWidth(_DateTimeId boxId) const
247 {
248         result r = E_SUCCESS;
249         FloatDimension dim;
250         TextObject dateObject;
251
252         String monthString;
253         String yearString;
254         String dayString;
255
256         _DateTimeUtils dateTimeUtils;
257         monthString = dateTimeUtils.GetMonthString(GetMonth());
258         yearString.Format(10, L"%04d", GetYear());
259         dayString.Format(10, L"%02d", GetDay());
260
261         r = dateObject.Construct();
262         SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
263
264         TextSimple* pSimpleText = null;
265
266         if (boxId == DATETIME_ID_DAY)
267         {
268                 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(dayString.GetPointer())), dayString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
269         }
270         else if (boxId == DATETIME_ID_MONTH)
271         {
272                 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(monthString.GetPointer())), monthString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
273         }
274         else if (boxId == DATETIME_ID_YEAR)
275         {
276                 pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(yearString.GetPointer())), yearString.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
277         }
278
279         SysTryReturn(NID_UI_CTRL, (pSimpleText != null), dim.width, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
280
281         dateObject.AppendElement(*pSimpleText);
282         dateObject.SetFont(__pFont, 0, dateObject.GetTextLength());
283         dim = dateObject.GetTextExtentF(0, dateObject.GetTextLength());
284
285         dateObject.RemoveAll();
286
287         return dim.width;
288 }
289
290 int
291 _EditDatePresenter::GetLocaleDateFormat(void) const
292 {
293         int localeDateFormat = -1;
294         int error = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &localeDateFormat);
295         if (error == -1)
296         {
297                 localeDateFormat = SETTING_DATE_FORMAT_DD_MM_YYYY;
298         }
299
300         return localeDateFormat;
301 }
302
303 DateTime
304 _EditDatePresenter::GetDate(void) const
305 {
306         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
307
308         DateTime date;
309         date.SetValue(GetYear(), GetMonth(), GetDay(), DATETIME_HOUR_MIN, DATETIME_MINUTE_MIN);
310
311         return date;
312 }
313
314 int
315 _EditDatePresenter::GetDay(void) const
316 {
317         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
318
319         return __pEditDateTimeModel->GetDay();
320 }
321
322 int
323 _EditDatePresenter::GetMonth(void) const
324 {
325         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
326
327         return __pEditDateTimeModel->GetMonth();
328 }
329
330 int
331 _EditDatePresenter::GetYear(void) const
332 {
333         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
334
335         return __pEditDateTimeModel->GetYear();
336 }
337
338 void
339 _EditDatePresenter::SetDate(const DateTime& date)
340 {
341         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
342
343         __pEditDateTimeModel->SetDateTime(date);
344         return;
345 }
346
347 void
348 _EditDatePresenter::SetCurrentDate(void)
349 {
350         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
351
352         __pEditDateTimeModel->SetCurrentDateTime();
353         return;
354 }
355
356 result
357 _EditDatePresenter::SetYear(int year)
358 {
359         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
360
361         return __pEditDateTimeModel->SetYear(year);
362 }
363
364 result
365 _EditDatePresenter::SetMonth(int month)
366 {
367         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
368
369         return __pEditDateTimeModel->SetMonth(month);
370 }
371
372 result
373 _EditDatePresenter::SetDay(int day)
374 {
375         SysAssertf((__pEditDateTimeModel != null), "The _EditDateTimeModel instance is null.");
376
377         return __pEditDateTimeModel->SetDay(day);
378 }
379
380 void
381 _EditDatePresenter::SetDatePickerEnabled(bool enable)
382 {
383         __datePickerEnabled = enable;
384         return;
385 }
386
387 bool
388 _EditDatePresenter::IsDatePickerEnabled(void) const
389 {
390         return __datePickerEnabled;
391 }
392
393 result
394 _EditDatePresenter::SetMinYear(int minYear)
395 {
396         return __pEditDateTimeModel->SetMinYear(minYear);
397 }
398
399 result
400 _EditDatePresenter::SetMaxYear(int maxYear)
401 {
402         return __pEditDateTimeModel->SetMaxYear(maxYear);
403 }
404
405 int
406 _EditDatePresenter::GetMinYear(void) const
407 {
408         int minYear = 0;
409         int maxYear = 0;
410
411         __pEditDateTimeModel->GetYearRange(minYear, maxYear);
412
413         return minYear;
414 }
415
416 int
417 _EditDatePresenter::GetMaxYear(void) const
418 {
419         int minYear = 0;
420         int maxYear = 0;
421
422         __pEditDateTimeModel->GetYearRange(minYear, maxYear);
423
424         return maxYear;
425 }
426
427 result
428 _EditDatePresenter::Draw(void)
429 {
430         result r = E_SUCCESS;
431
432         if (__isAnimating)
433         {
434                 return E_SUCCESS;
435         }
436
437         Canvas* pCanvas = __pEditDate->GetCanvasN();
438         SysAssertf((pCanvas != null), "Failed to get canvas.");
439
440         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
441         pCanvas->Clear();
442
443         if (__title.IsEmpty() == false)
444         {
445                 DrawTitle(*pCanvas);
446         }
447
448         String monthString;
449         String yearString;
450         String dayString;
451
452         _DateTimeUtils dateTimeUtils;
453         monthString = dateTimeUtils.GetMonthString(GetMonth());
454         yearString.Format(10, L"%04d", GetYear());
455         dayString.Format(10, L"%02d", GetDay());
456
457         CalculateAreaBounds();
458
459         r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_DAY), dayString, DATETIME_ID_DAY);
460         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
461         r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_MONTH), monthString, DATETIME_ID_MONTH);
462         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
463         r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_YEAR), yearString, DATETIME_ID_YEAR);
464         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
465
466         r = DrawDividers(*pCanvas);
467         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
468
469         CalculateTouchAreaBounds();
470
471         delete pCanvas;
472
473         return r;
474
475         CATCH:
476         delete pCanvas;
477         return r;
478 }
479
480 result
481 _EditDatePresenter::CalculateAreaBounds(void)
482 {
483         result r = E_SUCCESS;
484
485         if (GetLocaleDateFormat() == DATE_FORMAT_DDMMYYYY)
486         {
487                 __monthBounds.x = __dayBounds.x + __dayBounds.width + __dividerLineWidth;
488                 __yearBounds.x = __monthBounds.x + __monthBounds.width + __dividerLineWidth;
489         }
490         else if (GetLocaleDateFormat() == DATE_FORMAT_MMDDYYYY)
491         {
492                 __dayBounds.x = __monthBounds.x + __monthBounds.width + __dividerLineWidth;
493                 __yearBounds.x = __dayBounds.x + __dayBounds.width + __dividerLineWidth;
494         }
495         else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYMMDD)
496         {
497                 __monthBounds.x = __yearBounds.x + __yearBounds.width + __dividerLineWidth;
498                 __dayBounds.x = __monthBounds.x + __monthBounds.width + __dividerLineWidth;
499         }
500         else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYDDMM)
501         {
502                 __dayBounds.x = __yearBounds.x + __yearBounds.width + __dividerLineWidth;
503                 __monthBounds.x = __dayBounds.x + __dayBounds.width + __dividerLineWidth;
504         }
505
506         return r;
507 }
508
509 void
510 _EditDatePresenter::CalculateTouchAreaBounds(void)
511 {
512         __dayTouchBounds.width = GetTextWidth(DATETIME_ID_DAY);
513         __dayTouchBounds.x = __dayBounds.x + (__elementWidth - __dayTouchBounds.width) / 2.0f;
514         __dayTouchBounds.y = __dayBounds.y;
515         __dayTouchBounds.height = __dayBounds.height;
516
517         __monthTouchBounds.width = GetTextWidth(DATETIME_ID_MONTH);
518         __monthTouchBounds.x = __monthBounds.x + (__elementWidth - __monthTouchBounds.width) / 2.0f;
519         __monthTouchBounds.y = __monthBounds.y;
520         __monthTouchBounds.height = __monthBounds.height;
521
522         __yearTouchBounds.width = GetTextWidth(DATETIME_ID_YEAR);
523         __yearTouchBounds.x = __yearBounds.x + (__elementWidth - __yearTouchBounds.width) / 2.0f;
524         __yearTouchBounds.y = __yearBounds.y;
525         __yearTouchBounds.height = __yearBounds.height;
526
527         return;
528 }
529
530 void
531 _EditDatePresenter::CalculateElementWidth(void)
532 {
533         FloatRectangle bounds;
534         FloatDimension minSize;
535         bounds = __pEditDate->GetBoundsF();
536
537         float elementMinWidth = 0.0f;
538         float width = 0.0f;
539         float minWidth = 0.0f;
540
541         GET_SHAPE_CONFIG(EDITDATE::TEXT_ELEMENT_WIDTH, __pEditDate->GetOrientation(), __elementWidth);
542         GET_SHAPE_CONFIG(EDITDATE::TEXT_ELEMENT_MIN_WIDTH, __pEditDate->GetOrientation(), elementMinWidth);
543         GET_SHAPE_CONFIG(EDITDATE::WIDTH, __pEditDate->GetOrientation(), width);
544         GET_DIMENSION_CONFIG(EDITDATE::MIN_SIZE, __pEditDate->GetOrientation(), minSize);
545
546         if (bounds.width >= width)
547         {
548                 return;
549         }
550
551         if (bounds.width <= minSize.width)
552         {
553                 __elementWidth = elementMinWidth;
554         }
555         else if (bounds.width < width && bounds.width > minSize.width)
556         {
557                 __elementWidth = __elementWidth - ((__elementWidth - elementMinWidth) / (width - minWidth)) * (width - bounds.width);
558         }
559
560         return;
561 }
562
563 result
564 _EditDatePresenter::DrawTitle(Canvas& canvas)
565 {
566         if (!__pEditDate->IsEnabled())
567         {
568                 Color titleDisabledColor;
569                 GET_COLOR_CONFIG(EDITDATE::TITLE_TEXT_DISABLED, titleDisabledColor);
570                 __titleObject.SetForegroundColor(titleDisabledColor, 0, __titleObject.GetTextLength());
571         }
572
573         (_FontImpl::GetInstance(*__pFont))->SetSize(__titleFontSize);
574         __titleObject.SetFont(__pFont, 0, __titleObject.GetTextLength());
575         __titleObject.Draw(*_CanvasImpl::GetInstance(canvas));
576
577         return E_SUCCESS;
578 }
579
580 result
581 _EditDatePresenter::DrawText(Canvas& canvas, const FloatRectangle& bounds, const String& text, _DateTimeId boxId)
582 {
583         Color textColor;
584
585         if (!__pEditDate->IsEnabled())
586         {
587                 GET_COLOR_CONFIG(EDITDATE::TEXT_DISABLED, textColor);
588         }
589         else
590         {
591                 GET_COLOR_CONFIG(EDITDATE::TEXT_NORMAL, textColor);
592         }
593
594         if (boxId == __selectedId && boxId != DATETIME_ID_NONE)
595         {
596                 GET_COLOR_CONFIG(EDITDATE::TEXT_PRESSED, textColor);
597         }
598
599         FloatRectangle drawAreaBounds(0.0f, 0.0f, 0.0f, 0.0f);
600         drawAreaBounds = bounds;
601
602         TextSimple* pSimpleText = null;
603         pSimpleText = new (std::nothrow)TextSimple((const_cast <wchar_t*>(text.GetPointer())), text.GetLength(), TEXT_ELEMENT_SOURCE_TYPE_EXTERNAL);
604         SysTryReturn(NID_UI_CTRL, (pSimpleText != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
605
606         __textObject.RemoveAll();
607
608         (_FontImpl::GetInstance(*__pFont))->SetSize(__dateFontSize);
609
610         __textObject.AppendElement(*pSimpleText);
611
612         __textObject.SetFont(__pFont, 0, __textObject.GetTextLength());
613         __textObject.SetForegroundColor(textColor, 0, __textObject.GetTextLength());
614         __textObject.SetBounds(drawAreaBounds);
615         __textObject.Draw(*_CanvasImpl::GetInstance(canvas));
616
617         return E_SUCCESS;
618 }
619
620 result
621 _EditDatePresenter::DrawDividers(Canvas& canvas)
622 {
623         result r = E_SUCCESS;
624
625         float editDateHeight = 0.0f;
626         float dateHeight = 0.0f;
627
628         GET_SHAPE_CONFIG(EDITDATE::DATE_HEIGHT, __pEditDate->GetOrientation(), dateHeight);
629         GET_SHAPE_CONFIG(EDITDATE::HEIGHT, __pEditDate->GetOrientation(), editDateHeight);
630
631         if (__pEditDate->GetBoundsF().height > editDateHeight)
632         {
633                 editDateHeight = __pEditDate->GetBoundsF().height;
634         }
635
636         Color dividerHalfLeftColor;
637         Color dividerHalfRightColor;
638
639         GET_COLOR_CONFIG(EDITDATE::DIVIDER_LEFT_HALF, dividerHalfLeftColor);
640         GET_COLOR_CONFIG(EDITDATE::DIVIDER_RIGHT_HALF, dividerHalfRightColor);
641
642         FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
643
644         bounds.x = __elementWidth;
645
646         if (__title.IsEmpty() == false)
647         {
648                 bounds.y = __dayBounds.y + ((dateHeight - __dividerLineHeight) / 2.0f);
649         }
650         else
651         {
652                 bounds.y = __dayBounds.y + ((editDateHeight - __dividerLineHeight) / 2.0f);
653         }
654
655         for (int divider = 0; divider < __dividerCount; divider++)
656         {
657                 canvas.SetForegroundColor(dividerHalfLeftColor);
658                 canvas.SetLineWidth(__dividerLineWidth / 2.0f);
659
660                 r = canvas.DrawLine(FloatPoint(bounds.x, bounds.y), FloatPoint(bounds.x, bounds.y + __dividerLineHeight));
661                 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
662
663                 canvas.SetForegroundColor(dividerHalfRightColor);
664                 canvas.SetLineWidth(__dividerLineWidth / 2.0f);
665
666                 r = canvas.DrawLine(FloatPoint(bounds.x + 1.0f, bounds.y), FloatPoint(bounds.x + 1.0f, bounds.y + __dividerLineHeight));
667                 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
668
669                 bounds.x = bounds.x + __elementWidth;
670         }
671
672         return r;
673 }
674 _DateTimeId
675 _EditDatePresenter::GetBoxIdFromPosition(const FloatPoint& point) const
676 {
677         _DateTimeId displayBoxId = DATETIME_ID_NONE;
678
679         if (point.y < __dayTouchBounds.y || point.y > __dayTouchBounds.y + __dayTouchBounds.height)
680         {
681                 return displayBoxId;
682         }
683
684         if (__dayTouchBounds.Contains(point) == true)
685         {
686                 displayBoxId = DATETIME_ID_DAY;
687         }
688         else if (__monthTouchBounds.Contains(point) == true)
689         {
690                 displayBoxId = DATETIME_ID_MONTH;
691         }
692         else if (__yearTouchBounds.Contains(point) == true)
693         {
694                 displayBoxId = DATETIME_ID_YEAR;
695         }
696
697         return displayBoxId;
698 }
699
700 FloatRectangle
701 _EditDatePresenter::GetDateAreaBounds(_DateTimeId id) const
702 {
703         if (id == DATETIME_ID_DAY)
704         {
705                 return __dayBounds;
706         }
707         else if (id == DATETIME_ID_MONTH)
708         {
709                 return __monthBounds;
710         }
711         else if (id == DATETIME_ID_YEAR)
712         {
713                 return __yearBounds;
714         }
715         else
716         {
717                 return FloatRectangle();
718         }
719 }
720
721 FloatRectangle
722 _EditDatePresenter::GetTitleBounds(void) const
723 {
724         return __titleBounds;
725 }
726
727 void
728 _EditDatePresenter::SetLastSelectedId(_DateTimeId boxId)
729 {
730         __lastSelectedId = boxId;
731         return;
732 }
733
734 _DateTimeId
735 _EditDatePresenter::GetLastSelectedId(void) const
736 {
737         return __lastSelectedId;
738 }
739
740 void
741 _EditDatePresenter::OnFontChanged(Font* pFont)
742 {
743         __pFont = pFont;
744
745         if (__pEditDate->GetDateTimeBar() != null)
746         {
747                 __pEditDate->GetDateTimeBar()->SetFont(*pFont);
748         }
749
750         return;
751 }
752
753 void
754 _EditDatePresenter::OnFontInfoRequested(unsigned long& style, float& size)
755 {
756         style = FONT_STYLE_PLAIN;
757         size = __dateFontSize;
758
759         return;
760 }
761
762 bool
763 _EditDatePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
764 {
765         SysTryReturn(NID_UI_CTRL, IsDatePickerEnabled() == true, true, E_SYSTEM,
766                         "[E_SYSTEM] A system error has occurred. EditDate instance is disabled.");
767
768         if (&source != __pEditDate)
769         {
770                 return false;
771         }
772
773         __touchMoveHandled = false;
774
775         FloatPoint point = touchinfo.GetCurrentPosition();
776
777         _DateTimeId boxId = DATETIME_ID_NONE;
778         boxId = GetBoxIdFromPosition(point);
779
780         if (boxId < DATETIME_ID_YEAR || boxId > DATETIME_ID_DAY)
781         {
782                 __selectedId = DATETIME_ID_NONE;
783                 return true;
784         }
785
786         int minValue = -1;
787         int maxValue = -1;
788         int displayValue = -1;
789
790         if (boxId == DATETIME_ID_DAY)
791         {
792                 if (__pEditDate->GetDateTimeBar() != null)
793                 {
794                         _DateTimeUtils dateTimeUtils;
795                         maxValue = dateTimeUtils.CalculateMaxDay(GetYear(), GetMonth());
796                         minValue = DATETIME_DAY_MIN;
797                         displayValue = GetDay();
798                 }
799         }
800         else if (boxId == DATETIME_ID_MONTH)
801         {
802                 minValue = DATETIME_MONTH_MIN;
803                 maxValue = DATETIME_MONTH_MAX;
804                 displayValue = GetMonth();
805         }
806         else if (boxId == DATETIME_ID_YEAR)
807         {
808                 minValue = GetMinYear();
809                 maxValue = GetMaxYear();
810                 displayValue = GetYear();
811         }
812
813         if (__pEditDate->GetDateTimeBar() != null)
814         {
815                 if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
816                 {
817                         __pEditDate->GetDateTimeBar()->RemoveAllItems();
818                 }
819
820                 result r = __pEditDate->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
821                 if (r != E_SUCCESS)
822                 {
823                         __selectedId = DATETIME_ID_NONE;
824                         return true;
825                 }
826         }
827
828         __selectedId = boxId;
829
830         return true;
831 }
832
833 bool
834 _EditDatePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
835 {
836         SysTryReturn(NID_UI_CTRL, IsDatePickerEnabled() == true, true, E_SYSTEM,
837                         "[E_SYSTEM] A system error has occurred. EditDate instance is disabled.");
838
839         if (&source != __pEditDate)
840         {
841                 return false;
842         }
843
844         FloatPoint point = touchinfo.GetCurrentPosition();
845
846         _DateTimeId boxId = DATETIME_ID_NONE;
847         boxId = GetBoxIdFromPosition(point);
848
849         if (boxId == GetLastSelectedId() || boxId != __selectedId || boxId == DATETIME_ID_NONE)
850         {
851                 if (__pEditDate->GetDateTimeBar() != null && __pEditDate->GetDateTimeBar()->IsActivated())
852                 {
853                         __pEditDate->GetDateTimeBar()->SetVisibleState(false);
854                         __pEditDate->GetDateTimeBar()->Close();
855                 }
856
857                 __selectedId = DATETIME_ID_NONE;
858                 SetLastSelectedId(__selectedId);
859
860                 Draw();
861
862                 return true;
863         }
864
865         SetLastSelectedId(__selectedId);
866
867         __lastSelectedValue = "";
868         _DateTimeUtils dateTimeUtils;
869         if (GetLastSelectedId() == DATETIME_ID_YEAR)
870         {
871                 __lastSelectedValue.Format(10, L"%04d", GetYear());
872                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
873         }
874         else if (GetLastSelectedId() == DATETIME_ID_MONTH)
875         {
876                 __lastSelectedValue = dateTimeUtils.GetMonthString(GetMonth());
877                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
878         }
879         else if (GetLastSelectedId() == DATETIME_ID_DAY)
880         {
881                 __lastSelectedValue.Format(10, L"%02d", GetDay());
882                 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
883         }
884
885         Draw();
886
887         if ((__pEditDate->GetDateTimeBar() != null) && (GetLastSelectedId() != DATETIME_ID_NONE))
888         {
889                 FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
890                 bounds = GetDateAreaBounds(GetLastSelectedId());
891                 FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
892                 absoluteBounds = __pEditDate->GetAbsoluteBoundsF();
893                 bounds.x += absoluteBounds.x;
894
895                 __pEditDate->GetDateTimeBar()->CalculateArrowBounds(bounds);
896
897                 if (__pEditDate->GetDateTimeBar()->IsActivated())
898                 {
899                         __pEditDate->GetDateTimeBar()->RefreshItems();
900                 }
901                 else
902                 {
903                         __pEditDate->GetDateTimeBar()->SetVisibleState(true);
904                         __pEditDate->GetDateTimeBar()->Open();
905                 }
906         }
907
908         __selectedId = DATETIME_ID_NONE;
909         return true;
910 }
911
912 bool
913 _EditDatePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
914 {
915         if (&source != __pEditDate)
916         {
917                 return false;
918         }
919
920         __selectedId = DATETIME_ID_NONE;
921
922         return true;
923 }
924
925 bool
926 _EditDatePresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
927 {
928         if (&source != __pEditDate)
929         {
930                 return false;
931         }
932
933         if (__pEditDate->GetDateTimeBar() != null && __pEditDate->GetDateTimeBar()->IsActivated())
934         {
935                 return true;
936         }
937
938         return false;
939 }
940
941 void
942 _EditDatePresenter::OnTouchMoveHandled(const _Control& control)
943 {
944         __touchMoveHandled = true;
945         __selectedId = DATETIME_ID_NONE;
946
947         return;
948 }
949
950 void
951 _EditDatePresenter::Animate(void)
952 {
953         SysAssertf((__pFont != null), "Font instance must not be null.");
954
955         (_FontImpl::GetInstance(*__pFont))->SetSize(__dateFontSize);
956
957         result r = E_SUCCESS;
958         FloatRectangle rect;
959         String monthString;
960         String yearString;
961         String dayString;
962         String newValue;
963
964         _DateTimeUtils dateTimeUtils;
965         monthString = dateTimeUtils.GetMonthString(GetMonth());
966         yearString.Format(10, L"%04d", GetYear());
967         dayString.Format(10, L"%02d", GetDay());
968
969         if (GetLastSelectedId() == DATETIME_ID_DAY)
970         {
971                 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(dayString) == false), E_SUCCESS, "Day string matched.");
972
973                 newValue = dayString;
974                 rect = GetDateAreaBounds(DATETIME_ID_DAY);
975         }
976         else if (GetLastSelectedId() == DATETIME_ID_MONTH)
977         {
978                 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(monthString) == false), E_SUCCESS, "Month string matched.");
979
980                 newValue = monthString;
981                 rect = GetDateAreaBounds(DATETIME_ID_MONTH);
982         }
983         else if (GetLastSelectedId() == DATETIME_ID_YEAR)
984         {
985                 SysTryReturnVoidResult(NID_UI_CTRL, (__lastSelectedValue.Equals(yearString) == false), E_SUCCESS, "Year string matched.");
986
987                 newValue = yearString;
988                 rect = GetDateAreaBounds(DATETIME_ID_YEAR);
989         }
990
991         FloatDimension newTextDim;
992         FloatDimension oldTextDim;
993         FloatPoint textPoint;
994         VisualElement* pNewVisualElement = null;
995         VisualElement* pOldVisualElement = null;
996         VisualElement* pEditDateElement = null;
997         VisualElementPropertyAnimation* pNewBoundsAnimation = null;
998         VisualElementPropertyAnimation* pOldBoundsAnimation = null;
999         Canvas *pCanvas = null;
1000
1001         __pFont->GetTextExtent(newValue, newValue.GetLength(), newTextDim);
1002         __pFont->GetTextExtent(__lastSelectedValue, __lastSelectedValue.GetLength(), oldTextDim);
1003
1004         if (newTextDim.width > oldTextDim.width)
1005         {
1006                 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1007         }
1008         else
1009         {
1010                 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1011         }
1012
1013         SysTryReturnVoidResult(NID_UI_CTRL, (rect.x + textPoint.x < __pEditDate->GetBoundsF().width), E_SUCCESS, "Rolling animation cann't be played.");
1014
1015         __isAnimating = true;
1016
1017         __pContentProvider = new (std::nothrow) VisualElement();
1018         SysTryReturnVoidResult(NID_UI_CTRL, (__pContentProvider != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1019
1020         r = __pContentProvider->Construct();
1021         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1022
1023         __pContentProvider->SetShowState(true);
1024         __pContentProvider->SetClipChildrenEnabled(true);
1025         __pContentProvider->SetImplicitAnimationEnabled(false);
1026
1027         pEditDateElement = __pEditDate->GetVisualElement();
1028         r = GetLastResult();
1029         SysTryCatch(NID_UI_CTRL, (pEditDateElement != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1030
1031         pNewVisualElement = new (std::nothrow) VisualElement();
1032         SysTryCatch(NID_UI_CTRL, (pNewVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1033
1034         r = pNewVisualElement->Construct();
1035         if (r != E_SUCCESS)
1036         {
1037                 pNewVisualElement->Destroy();
1038         }
1039         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1040
1041         pOldVisualElement = new (std::nothrow) VisualElement();
1042         if (pOldVisualElement == null)
1043         {
1044                 pNewVisualElement->Destroy();
1045         }
1046         SysTryCatch(NID_UI_CTRL, (pOldVisualElement != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1047
1048         r = pOldVisualElement->Construct();
1049         if (r != E_SUCCESS)
1050         {
1051                 pNewVisualElement->Destroy();
1052                 pOldVisualElement->Destroy();
1053         }
1054         SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
1055
1056         pNewVisualElement->SetShowState(true);
1057         pOldVisualElement->SetShowState(true);
1058
1059         if (newTextDim.width > oldTextDim.width)
1060         {
1061                 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1062                 textPoint.y = (rect.height - newTextDim.height) / 2.0f;
1063                 __pContentProvider->SetBounds(FloatRectangle((rect.x + textPoint.x) * 1.0f, (rect.y + textPoint.y) * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
1064                 pNewVisualElement->SetBounds(FloatRectangle(0.0f, newTextDim.height * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
1065
1066                 rect.x = static_cast<int>(__pContentProvider->GetBounds().x);
1067                 rect.y = static_cast<int>(__pContentProvider->GetBounds().y);
1068                 rect.width = static_cast<int>(__pContentProvider->GetBounds().width);
1069                 rect.height = static_cast<int>(__pContentProvider->GetBounds().height);
1070
1071                 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1072                 textPoint.y = (rect.height - oldTextDim.height) / 2.0f;
1073
1074                 pOldVisualElement->SetBounds(FloatRectangle(textPoint.x * 1.0f, 0.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
1075         }
1076         else
1077         {
1078                 textPoint.x = (rect.width - oldTextDim.width) / 2.0f;
1079                 textPoint.y = (rect.height - oldTextDim.height) / 2.0f;
1080                 __pContentProvider->SetBounds(FloatRectangle((rect.x + textPoint.x) * 1.0f, (rect.y + textPoint.y) * 1.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
1081                 pOldVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, oldTextDim.width * 1.0f, oldTextDim.height * 1.0f));
1082
1083                 rect.x = static_cast<int>(__pContentProvider->GetBounds().x);
1084                 rect.y = static_cast<int>(__pContentProvider->GetBounds().y);
1085                 rect.width = static_cast<int>(__pContentProvider->GetBounds().width);
1086                 rect.height = static_cast<int>(__pContentProvider->GetBounds().height);
1087
1088                 textPoint.x = (rect.width - newTextDim.width) / 2.0f;
1089                 textPoint.y = (rect.height - newTextDim.height) / 2.0f;
1090
1091                 pNewVisualElement->SetBounds(FloatRectangle(textPoint.x * 1.0f, newTextDim.height * 1.0f, newTextDim.width * 1.0f, newTextDim.height * 1.0f));
1092         }
1093
1094
1095         pCanvas = pEditDateElement->GetCanvasN(rect);
1096         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1097         pCanvas->Clear();
1098         delete pCanvas;
1099
1100         pEditDateElement->AttachChild(*__pContentProvider);
1101
1102         __pContentProvider->AttachChild(*pOldVisualElement);
1103         __pContentProvider->AttachChild(*pNewVisualElement);
1104
1105         pNewBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1106         SysTryCatch(NID_UI_CTRL, (pNewBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1107
1108         pNewBoundsAnimation->SetDuration(300);
1109         pNewBoundsAnimation->SetPropertyName("bounds.position");
1110         pNewBoundsAnimation->SetStartValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, newTextDim.height * 1.0f)));
1111         pNewBoundsAnimation->SetEndValue(Variant(FloatPoint(pNewVisualElement->GetBounds().x * 1.0f, 0.0f)));
1112         pNewBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
1113
1114         pOldBoundsAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1115         SysTryCatch(NID_UI_CTRL, (pOldBoundsAnimation != null), , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1116
1117         pOldBoundsAnimation->SetDuration(300);
1118         pOldBoundsAnimation->SetPropertyName("bounds.position");
1119         pOldBoundsAnimation->SetStartValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x * 1.0f, 0.0f)));
1120         pOldBoundsAnimation->SetEndValue(Variant(FloatPoint(pOldVisualElement->GetBounds().x * 1.0f, oldTextDim.height * -1.0f)));
1121         pOldBoundsAnimation->SetVisualElementAnimationStatusEventListener(this);
1122
1123         pCanvas = pOldVisualElement->GetCanvasN();
1124         r = GetLastResult();
1125         SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1126
1127         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1128         pCanvas->Clear();
1129         pCanvas->SetFont(*__pFont);
1130         pCanvas->DrawText(FloatPoint(0.0f, 0.0f), __lastSelectedValue);
1131
1132         delete pCanvas;
1133         pCanvas = null;
1134
1135         pCanvas = pNewVisualElement->GetCanvasN();
1136         r = GetLastResult();
1137         SysTryCatch(NID_UI_CTRL, (pCanvas != null), , r, "[%s] Propagating.", GetErrorMessage(r));
1138
1139         pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
1140         pCanvas->Clear();
1141         pCanvas->SetFont(*__pFont);
1142         pCanvas->DrawText(FloatPoint(0.0f, 0.0f), newValue);
1143
1144         delete pCanvas;
1145         pCanvas = null;
1146
1147         pOldVisualElement->SetImplicitAnimationEnabled(false);
1148         pOldVisualElement->AddAnimation(*pOldBoundsAnimation);
1149
1150         pNewVisualElement->SetImplicitAnimationEnabled(false);
1151         pNewVisualElement->AddAnimation(*pNewBoundsAnimation);
1152
1153         delete pOldBoundsAnimation;
1154         delete pNewBoundsAnimation;
1155
1156         return;
1157
1158         CATCH:
1159         __isAnimating = false;
1160         __pContentProvider->Destroy();
1161
1162         delete pNewBoundsAnimation;
1163         pNewBoundsAnimation = null;
1164
1165         delete pOldBoundsAnimation;
1166         pOldBoundsAnimation = null;
1167
1168         delete pCanvas;
1169         pCanvas = null;
1170
1171         return;
1172 }
1173
1174 void
1175 _EditDatePresenter::OnVisualElementAnimationFinished (const VisualElementAnimation &animation, const String &keyName, VisualElement &target, bool completedNormally)
1176 {
1177         result r = E_SUCCESS;
1178         __isAnimating = false;
1179
1180         VisualElement* pEditDateElement = __pEditDate->GetVisualElement();
1181         r = GetLastResult();
1182         SysTryReturnVoidResult(NID_UI_CTRL, (pEditDateElement != null), r, "[%s] Propagating.", GetErrorMessage(r));
1183
1184         pEditDateElement->DetachChild(*__pContentProvider);
1185         __pContentProvider->Destroy();
1186
1187         Draw();
1188         return;
1189 }
1190
1191 }}} // Tizen::Ui::Controls