DateTimePicker changes according to new UI spec.
authorsr.shashank <sr.shashank@samsung.com>
Fri, 22 Mar 2013 09:48:44 +0000 (15:18 +0530)
committersr.shashank <sr.shashank@samsung.com>
Fri, 22 Mar 2013 12:33:30 +0000 (18:03 +0530)
Change-Id: I2a3064f0832b6a3b7612e297e6e1fc85321aaaea
Signed-off-by: sr.shashank <sr.shashank@samsung.com>
src/ui/controls/FUiCtrl_DateTimePresenter.cpp
src/ui/inc/FUiCtrl_DateTimePresenter.h
src/ui/resource/FUi_ResourceDateTimePickerConfig.cpp

index 2f74c3e..c466a2f 100644 (file)
@@ -74,6 +74,8 @@ _DateTimePresenter::_DateTimePresenter(int pickerStyle, const String& title)
        , __pPmBoxPressedEffectBitmap(null)
        , __pPmBoxDisabledEffectBitmap(null)
        , __pColonBitmap(null)
+       , __pBgNormalBitmap(null)
+       , __pBgEffectBitmap(null)
        , __pFont(null)
        , __pPmBox(null)
 {
@@ -106,6 +108,12 @@ _DateTimePresenter::Dispose(void)
        delete __pColonBitmap;
        __pColonBitmap = null;
 
+       delete __pBgNormalBitmap;
+       __pBgNormalBitmap = null;
+
+       delete __pBgEffectBitmap;
+       __pBgEffectBitmap = null;
+
        for (int i = 0; i < DATETIME_ID_MAX; i++)
        {
                delete __pDisplayBox[i];
@@ -418,8 +426,7 @@ _DateTimePresenter::Draw(void)
        __pView->SetBackgroundColor(backgroundColor);
 
        // Draw DisplayBox Background
-       pCanvas->SetBackgroundColor(backgroundColor);
-       pCanvas->Clear();
+       DrawBackground(*pCanvas);
 
        DrawDividers(*pCanvas);
 
@@ -875,22 +882,22 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
 
        int indexBox = 0;
        int boxCount = 0;
-       float dateElementWidth = 0;
-
-       float dateTimeDisplayBoxHeight = 0;
-       float amPmDisplayBoxHeight = 0;
-
-       float dateTimeElementY = 0;
-       float amPmElementY = 0;
-       float dividerMargin = 0;
-       float dateTimeMargin = 0;
-       float leftMargin = 0;
-       float timeOutputMargin = 0;
-       float timeElementWidth = 0;
-       float colonWidth = 0;
-       float colonMargin = 0;
-       float amPmWidth = 0;
-       float amPmMargin = 0;
+       float dpDateElementWidth = 0.0f;
+       float dtpDateElementWidth = 0.0f;
+
+       float dateTimeDisplayBoxHeight = 0.0f;
+       float amPmDisplayBoxHeight = 0.0f;
+
+       float dateTimeElementY = 0.0f;
+       float amPmElementY = 0.0f;
+       float dividerMargin = 0.0f;
+       float dateTimeMargin = 0.0f;
+       float timeOutputMargin = 0.0f;
+       float timeElementWidth = 0.0f;
+       float colonWidth = 0.0f;
+       float colonMargin = 0.0f;
+       float amPmWidth = 0.0f;
+       float amPmMargin = 0.0f;
 
        for (indexBox = 0; indexBox < DATETIME_ID_MAX; indexBox++)
        {
@@ -901,13 +908,13 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
        __pView->SetDisplayVisualElementBounds(outputAreaBounds);
 
        GET_FIXED_VALUE_CONFIG(DATETIMEPICKER::DIVIDER_WIDTH, orientation, dividerMargin);
-       GET_SHAPE_CONFIG(DATETIMEPICKER::DATE_ELEMENT_WIDTH, orientation, dateElementWidth);
+       GET_SHAPE_CONFIG(DATETIMEPICKER::DP_DATE_ELEMENT_WIDTH, orientation, dpDateElementWidth);
+       GET_SHAPE_CONFIG(DATETIMEPICKER::DTP_DATE_ELEMENT_WIDTH, orientation, dtpDateElementWidth);
 
        GET_SHAPE_CONFIG(DATETIMEPICKER::DATETIME_DISPLAY_BOX_HEIGHT, orientation, dateTimeDisplayBoxHeight);
        GET_SHAPE_CONFIG(DATETIMEPICKER::AMPM_DISPLAY_BOX_HEIGHT, orientation, amPmDisplayBoxHeight);
 
        GET_SHAPE_CONFIG(DATETIMEPICKER::DATE_TIME_MARGIN, orientation, dateTimeMargin);
-       GET_SHAPE_CONFIG(DATETIMEPICKER::LEFT_MARGIN, orientation, leftMargin);
        GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_OUTPUT_MARGIN, orientation, timeOutputMargin);
        GET_SHAPE_CONFIG(DATETIMEPICKER::TIME_ELEMENT_WIDTH, orientation, timeElementWidth);
        GET_SHAPE_CONFIG(DATETIMEPICKER::COLON_WIDTH, orientation, colonWidth);
@@ -918,7 +925,14 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
        dateTimeElementY = (outputAreaBounds.height - dateTimeDisplayBoxHeight) / 2.0f;
        amPmElementY = (outputAreaBounds.height - amPmDisplayBoxHeight) / 2.0f;
 
-       dateBounds.width = monthBounds.width = yearBounds.width = dateElementWidth;
+       if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATE)
+       {
+               dateBounds.width = monthBounds.width = yearBounds.width = dpDateElementWidth;
+       }
+       else
+       {
+               dateBounds.width = monthBounds.width = yearBounds.width = dtpDateElementWidth;
+       }
        hourBounds.width = minuteBounds.width = timeElementWidth;
        amPmBounds.width = amPmWidth;
 
@@ -934,7 +948,6 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
                {
                case DATE_FORMAT_DDMMYYYY:
                        {
-                               dateBounds.x = leftMargin;
                                monthBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
                                yearBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
                                hourBounds.x = yearBounds.x + yearBounds.width + dateTimeMargin;
@@ -960,7 +973,6 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
                        break;
                case DATE_FORMAT_MMDDYYYY:
                        {
-                               monthBounds.x = leftMargin;
                                dateBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
                                yearBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
                                hourBounds.x = yearBounds.x + yearBounds.width + dateTimeMargin;
@@ -986,7 +998,6 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
                        break;
                case DATE_FORMAT_YYYYMMDD:
                        {
-                               yearBounds.x = leftMargin;
                                monthBounds.x = yearBounds.x + yearBounds.width + dividerMargin;
                                dateBounds.x = monthBounds.x + monthBounds.width + dividerMargin;
                                hourBounds.x = dateBounds.x + dateBounds.width + dateTimeMargin;
@@ -1012,7 +1023,6 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
                        break;
                case DATE_FORMAT_YYYYDDMM:
                        {
-                               yearBounds.x = leftMargin;
                                dateBounds.x = yearBounds.x + yearBounds.width + dividerMargin;
                                monthBounds.x = dateBounds.x + dateBounds.width + dividerMargin;
                                hourBounds.x = monthBounds.x + monthBounds.width + dateTimeMargin;
@@ -1048,7 +1058,7 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
                }
                else
                {
-                       hourBounds.x = dateTimeMargin + leftMargin + timeOutputMargin;
+                       hourBounds.x = dateTimeMargin + timeOutputMargin;
                        minuteBounds.x = hourBounds.x + hourBounds.width + colonWidth + 2 * colonMargin;
                        amPmBounds.x = minuteBounds.x + minuteBounds.width + amPmMargin;
                }
@@ -1103,9 +1113,10 @@ CATCH:
 void
 _DateTimePresenter::LoadResource(void)
 {
-       Color colonColor;
+       Color color;
        result r = E_SUCCESS;
        Bitmap* pColonBitmap = null;
+       Bitmap* pBgBitmap = null;
 
        r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pPmBoxNormalBitmap);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1122,13 +1133,26 @@ _DateTimePresenter::LoadResource(void)
        r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::COLON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pColonBitmap);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, colonColor);
+       GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, color);
 
-       __pColonBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pColonBitmap, Color::GetColor(COLOR_ID_WHITE), colonColor);
+       __pColonBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pColonBitmap, Color::GetColor(COLOR_ID_WHITE), color);
        r = GetLastResult();
        SysTryCatch(NID_UI_CTRL, (__pColonBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
 
+       r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pBgBitmap);
+       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       GET_COLOR_CONFIG(DATETIMEPICKER::DISPLAY_BG_NORMAL, color);
+
+       __pBgNormalBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pBgBitmap, Color::GetColor(COLOR_ID_MAGENTA), color);
+       r = GetLastResult();
+       SysTryCatch(NID_UI_CTRL, (__pBgNormalBitmap != null), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pBgEffectBitmap);
+       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
        delete pColonBitmap;
+       delete pBgBitmap;
 
        return;
 
@@ -1145,10 +1169,18 @@ CATCH:
        delete __pPmBoxDisabledEffectBitmap;
        __pPmBoxDisabledEffectBitmap = null;
 
+       delete pColonBitmap;
+
        delete __pColonBitmap;
        __pColonBitmap = null;
 
-       delete pColonBitmap;
+       delete pBgBitmap;
+
+       delete __pBgNormalBitmap;
+       __pBgNormalBitmap = null;
+
+       delete __pBgEffectBitmap;
+       __pBgEffectBitmap = null;
 
        return;
 }
@@ -1304,6 +1336,43 @@ _DateTimePresenter::DrawPm(Canvas& canvas)
 }
 
 void
+_DateTimePresenter::DrawBackground(Canvas& canvas)
+{
+       result r = E_SUCCESS;
+       FloatRectangle bounds = canvas.GetBoundsF();
+
+       if (__pBgEffectBitmap)
+       {
+               if (__pBgEffectBitmap->IsNinePatchedBitmap() == true)
+               {
+                       canvas.DrawNinePatchedBitmap(bounds, *__pBgEffectBitmap);
+                       SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+               else
+               {
+                       canvas.DrawBitmap(bounds, *__pBgEffectBitmap);
+                       SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+       }
+
+       if (__pBgNormalBitmap)
+       {
+               if (__pBgNormalBitmap->IsNinePatchedBitmap() == true)
+               {
+                       canvas.DrawNinePatchedBitmap(bounds, *__pBgNormalBitmap);
+                       SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+               else
+               {
+                       canvas.DrawBitmap(bounds, *__pBgNormalBitmap);
+                       SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
+               }
+       }
+
+       return;
+}
+
+void
 _DateTimePresenter::DrawDividers(Canvas& canvas)
 {
        result r = E_SUCCESS;
@@ -1396,12 +1465,14 @@ _DateTimePresenter::GetOutputArea(void)
 
        FloatRectangle outputArea(0.0f, 0.0f, 0.0f, 0.0f);
        FloatRectangle headerBounds = __pView->GetHeaderBounds();
-       float margin = 0;
+       float xMargin = 0.0f;
+       float yMargin = 0.0f;
 
-       GET_SHAPE_CONFIG(DATETIMEPICKER::TOP_MARGIN, orientation, margin);
+       GET_SHAPE_CONFIG(DATETIMEPICKER::LEFT_MARGIN, orientation, outputArea.x);
+       GET_SHAPE_CONFIG(DATETIMEPICKER::TOP_MARGIN, orientation, outputArea.y);
 
-       outputArea.y = headerBounds.y + headerBounds.height + margin;
-       outputArea.width = __pView->GetBounds().width;
+       outputArea.y += headerBounds.y + headerBounds.height;
+       outputArea.width = __pView->GetBounds().width - 2 * outputArea.x;
 
        GET_SHAPE_CONFIG(DATETIMEPICKER::OUTPUT_AREA_HEIGHT, orientation, outputArea.height);
 
index 475f16e..75e98a5 100644 (file)
@@ -116,6 +116,8 @@ private:
 
        void DrawPm(Tizen::Graphics::Canvas& canvas);
 
+       void DrawBackground(Tizen::Graphics::Canvas& canvas);
+
        void DrawDividers(Tizen::Graphics::Canvas& canvas);
 
        void ChangeInputPadStyle(int boxId);
@@ -209,6 +211,8 @@ private:
        Tizen::Graphics::Bitmap* __pPmBoxPressedEffectBitmap;
        Tizen::Graphics::Bitmap* __pPmBoxDisabledEffectBitmap;
        Tizen::Graphics::Bitmap* __pColonBitmap;
+       Tizen::Graphics::Bitmap* __pBgNormalBitmap;
+       Tizen::Graphics::Bitmap* __pBgEffectBitmap;
 
        Tizen::Graphics::Font* __pFont;
 
index 8097e45..1969174 100644 (file)
@@ -25,6 +25,7 @@
 START_UI_CONFIG(DATETIMEPICKER);
 {
        ADD_COLOR_CONFIG(BG_NORMAL, $B011);
+       ADD_COLOR_CONFIG(DISPLAY_BG_NORMAL, $B0217);
 
        ADD_COLOR_CONFIG(AMPM_BG_NORMAL, $W011);
        ADD_COLOR_CONFIG(AMPM_BG_PRESSED, $B042);
@@ -50,8 +51,9 @@ START_UI_CONFIG(DATETIMEPICKER);
        ADD_IMAGE_CONFIG(AMPM_BG_EFFECT, #00_button_01_ef.#.png);
        ADD_IMAGE_CONFIG(AMPM_BG_PRESSED_EFFECT, #00_button_01_ef_press.#.png);
        ADD_IMAGE_CONFIG(AMPM_BG_DISABLED_EFFECT, #00_button_01_ef_dim.#.png);
-
        ADD_IMAGE_CONFIG(COLON_BG_NORMAL, #00_date_picker_dot.png);
+       ADD_IMAGE_CONFIG(BG_NORMAL, #00_list_group_bg.#.png);
+       ADD_IMAGE_CONFIG(BG_EFFECT, #00_list_group_bg_ef.#.png);
 
        START_UI_CONFIG_MODE(720x1280);
        {
@@ -65,7 +67,8 @@ START_UI_CONFIG(DATETIMEPICKER);
                ADD_SHAPE_CONFIG(TOP_MARGIN, 32);
                ADD_SHAPE_CONFIG(LEFT_MARGIN, 16);
 
-               ADD_SHAPE_CONFIG(DATE_ELEMENT_WIDTH, 130);
+               ADD_SHAPE_CONFIG(DTP_DATE_ELEMENT_WIDTH, 130);
+               ADD_SHAPE_CONFIG(DP_DATE_ELEMENT_WIDTH, 228);
                ADD_SHAPE_CONFIG(TIME_ELEMENT_WIDTH, 48);
 
                ADD_SHAPE_CONFIG(AMPM_WIDTH, 106);