Fix UI issues.
authorSungWan Kim <sw0726.kim@samsung.com>
Mon, 8 Apr 2013 11:39:20 +0000 (20:39 +0900)
committerSungWan Kim <sw0726.kim@samsung.com>
Mon, 8 Apr 2013 11:39:20 +0000 (20:39 +0900)
Change-Id: Ibb03b17156415c0303c625ddeb0594a284f958d9
Signed-off-by: SungWan Kim <sw0726.kim@samsung.com>
src/ClMonthPanel.cpp
src/ClSettingForm.cpp

index f32cce5..d83483d 100644 (file)
@@ -371,6 +371,7 @@ class MonthCalendarPanel
 {
 public:
        const DateTime& GetDate(void) const;
+       int GetViewHeight(void) const;
        result Initialize(const Rectangle& bounds, const DateTime& date, const EventListPresentationModel& pm);
        void SetDate(const DateTime& date);
        void SetDateFocusEventListener(IDateFocusEventListener& listener);
@@ -429,6 +430,14 @@ MonthCalendarPanel::GetDate(void) const
        return __date;
 }
 
+int
+MonthCalendarPanel::GetViewHeight(void) const
+{
+       int maxDay;
+       DateTime::GetDaysInMonth(__date.GetYear(), __date.GetMonth(), maxDay);
+       return Y_DAY + ((maxDay + __startDayColumn - 1) / MONTH_CALENDAR_WEEKDAY_COUNT  + 1) * H_DAY;
+}
+
 result
 MonthCalendarPanel::Initialize(const Rectangle& bounds, const DateTime& date, const EventListPresentationModel& pm)
 {
@@ -440,10 +449,7 @@ MonthCalendarPanel::Initialize(const Rectangle& bounds, const DateTime& date, co
                __startDayColumn += MONTH_CALENDAR_WEEKDAY_COUNT;
        }
 
-       int maxDay;
-       DateTime::GetDaysInMonth(__date.GetYear(), __date.GetMonth(), maxDay);
-       int height = Y_DAY + ((maxDay + __startDayColumn - 1) / MONTH_CALENDAR_WEEKDAY_COUNT  + 1) * H_DAY;
-       return Construct(Rectangle(bounds.x, bounds.y, bounds.width, height));
+       return Construct(bounds);
 }
 
 void
@@ -470,15 +476,6 @@ MonthCalendarPanel::SetDate(const DateTime& date)
                        {
                                __startDayColumn += MONTH_CALENDAR_WEEKDAY_COUNT;
                        }
-
-                       int maxDay;
-                       DateTime::GetDaysInMonth(date.GetYear(), date.GetMonth(), maxDay);
-                       int maxRow = (maxDay + __startDayColumn - 1) / MONTH_CALENDAR_WEEKDAY_COUNT  + 1;
-                       int height = __pDayCalendars[maxRow - 1][0]->GetY() + H_DAY;
-                       if (GetHeight() != height)
-                       {
-                               SetSize(GetWidth(), height);
-                       }
                }
                else
                {
@@ -513,10 +510,7 @@ MonthCalendarPanel::SetFocusEnabled(bool enable)
 void
 MonthCalendarPanel::UpdateEvent(void)
 {
-       int maxDay;
-       DateTime::GetDaysInMonth(__date.GetYear(), __date.GetMonth(), maxDay);
-       int maxRow = (maxDay + __startDayColumn - 1) / MONTH_CALENDAR_WEEKDAY_COUNT  + 1;
-       for (int row = 0; row < maxRow; ++row)
+       for (int row = 0; row < MONTH_CALENDAR_ROW_COUNT; ++row)
        {
                for (int col = 0; col < MONTH_CALENDAR_WEEKDAY_COUNT; ++col)
                {
@@ -559,19 +553,9 @@ MonthCalendarPanel::OnClearBackground(void)
        DateTime date = __pDayCalendars[0][__startDayColumn]->GetDate();
        if (date.GetYear() != __date.GetYear() || date.GetMonth() != __date.GetMonth() || date.GetDay() != 1)
        {
-               int maxDay;
-               DateTime::GetDaysInMonth(__date.GetYear(), __date.GetMonth(), maxDay);
-               int maxRow = (maxDay + __startDayColumn - 1) / MONTH_CALENDAR_WEEKDAY_COUNT  + 1;
-               int height = __pDayCalendars[maxRow - 1][0]->GetY() + H_DAY;
-               if (GetHeight() != height)
-               {
-                       SetSize(GetWidth(), height);
-                       Invalidate(false);
-               }
-
                date = __date;
                date.AddDays(1 - __startDayColumn - date.GetDay());
-               for (int row = 0; row < maxRow; ++row)
+               for (int row = 0; row < MONTH_CALENDAR_ROW_COUNT; ++row)
                {
                        for (int col = 0; col < MONTH_CALENDAR_WEEKDAY_COUNT; ++col)
                        {
@@ -589,17 +573,6 @@ MonthCalendarPanel::OnClearBackground(void)
 result
 MonthCalendarPanel::OnInitializing(void)
 {
-       // Set background
-//     Bitmap* pBitmapBackground = ResourceManager::GetBitmapN(IDB_MONTH_VIEW_CALENDAR_BG);
-//     if (pBitmapBackground != null)
-//     {
-//             Label* pLabel = new (std::nothrow) Label();
-//             pLabel->Construct(Rectangle(0, 0, GetWidth(), GetHeight()), L"");
-//             pLabel->SetBackgroundBitmap(*pBitmapBackground);
-//             AddControl(*pLabel);
-//             delete pBitmapBackground;
-//     }
-
        // Create week label
        for (int week = 0; week < MONTH_CALENDAR_WEEKDAY_COUNT; ++week)
        {
@@ -662,6 +635,7 @@ MonthCalendarPanel::OnDateFocused(const DateTime& focusedDate)
        }
 }
 
+
 MonthPanel::MonthPanel(void)
        : __pPm(null)
        , __selectedIndex(0)
@@ -711,6 +685,7 @@ MonthPanel::OnInitializing(void)
        __pPanningAnimationManager->AddView(*pPanel, VIEW_SCROLL_EFFECT_CURRENT);
        pPanel->SetDateFocusEventListener(*this);
        pPanel->SetFocusEnabled(true);
+       pPanel->SetSize(pPanel->GetWidth(), pPanel->GetViewHeight());
        __pPanelMonthCalendar[VIEW_SCROLL_EFFECT_CURRENT] = pPanel;
 
        __pContextItem = new (std::nothrow) ListContextItem();
@@ -1149,10 +1124,12 @@ MonthPanel::OnPanningAnimationEnded(ViewScrollEffect direction)
 void
 MonthPanel::DrawCalendar(void)
 {
-       DateTime current = static_cast<MonthCalendarPanel*>(__pPanelMonthCalendar[VIEW_SCROLL_EFFECT_CURRENT])->GetDate();
-       static_cast<MonthCalendarPanel*>(__pPanelMonthCalendar[VIEW_SCROLL_EFFECT_CURRENT])->SetDate(__pPm->GetCurrentDate());
+       MonthCalendarPanel* pCurrent = static_cast<MonthCalendarPanel*>(__pPanelMonthCalendar[VIEW_SCROLL_EFFECT_CURRENT]);
+       DateTime current = pCurrent->GetDate();
+       pCurrent->SetDate(__pPm->GetCurrentDate());
+       pCurrent->SetSize(pCurrent->GetWidth(), pCurrent->GetViewHeight());
 
-       int height = GetHeight() - Y_CALENDAR - __pPanelMonthCalendar[VIEW_SCROLL_EFFECT_CURRENT]->GetHeight();
+       int height = GetHeight() - Y_CALENDAR - pCurrent->GetHeight();
        if (__pListViewEvent->GetHeight() != height)
        {
                __pListViewEvent->SetBounds(0, GetHeight() - height, GetWidth(), height);
@@ -1173,6 +1150,7 @@ MonthPanel::DrawCalendar(void)
                        nextDate.SetValue(minDate.GetYear(), minDate.GetMonth(), nextDate.GetDay(), nextDate.GetHour(), nextDate.GetMinute());
                }
                pNextPanel->SetDate(nextDate);
+               pNextPanel->SetSize(pNextPanel->GetWidth(), pCurrent->GetHeight());
        }
 
        MonthCalendarPanel* pPrevPanel = static_cast<MonthCalendarPanel*>(__pPanelMonthCalendar[VIEW_SCROLL_EFFECT_PREVIEW]);
@@ -1186,6 +1164,7 @@ MonthPanel::DrawCalendar(void)
                        prevDate.SetValue(maxDate.GetYear(), maxDate.GetMonth(), prevDate.GetDay(), prevDate.GetHour(), prevDate.GetMinute());
                }
                pPrevPanel->SetDate(prevDate);
+               pPrevPanel->SetSize(pPrevPanel->GetWidth(), pCurrent->GetHeight());
        }
 }
 
index 779f6ed..de6e037 100644 (file)
@@ -253,7 +253,6 @@ SettingForm::UpdateItem(int sectionIndex, int itemIndex, TableViewItem* pItem)
                {
                case FIRST_DAY_OF_WEEK_ITEM_EXPANDER:
                        __pLabelFirstDayOfWeek->SetText((__isFirstDayOfWeekSunday == true) ? ResourceManager::GetWeekString(0) : ResourceManager::GetWeekString(1));
-                       __pLabelFirstDayOfWeek->Invalidate(false);
 
                        if (__isFirstDayOfWeekSelectionItemExpanded == true)
                        {
@@ -273,7 +272,8 @@ SettingForm::UpdateItem(int sectionIndex, int itemIndex, TableViewItem* pItem)
                                        delete pButtonIcon;
                                }
                        }
-                       __pLabelFirstDayOfWeekExpandIcon->Invalidate(false);
+
+                       pItem->Invalidate(true);
                        break;
                }
                break;