Nikolay Sivov : comctl32/monthcal: Store full date info for selection at creation time.

Alexandre Julliard julliard at winehq.org
Mon Sep 28 11:54:37 CDT 2009


Module: wine
Branch: master
Commit: d66dcb4ff8f1332c102d97178d36ada54db52576
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d66dcb4ff8f1332c102d97178d36ada54db52576

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Sat Sep 26 01:20:33 2009 +0400

comctl32/monthcal: Store full date info for selection at creation time.

---

 dlls/comctl32/monthcal.c       |   32 +++++++++++++++-----------------
 dlls/comctl32/tests/monthcal.c |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 17 deletions(-)

diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index b23a990..0d4c96b 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -1872,25 +1872,23 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
   infoPtr->firstDayHighWord = FALSE;
   MONTHCAL_SetFirstDayOfWeek(infoPtr, -1);
   infoPtr->currentMonth = infoPtr->todaysDate.wMonth;
-  infoPtr->currentYear = infoPtr->todaysDate.wYear;
+  infoPtr->currentYear  = infoPtr->todaysDate.wYear;
   infoPtr->minDate = infoPtr->todaysDate;
   infoPtr->maxDate = infoPtr->todaysDate;
-  infoPtr->maxDate.wYear=2050;
-  infoPtr->minDate.wYear=1950;
-  infoPtr->maxSelCount  = 7;
-  infoPtr->monthRange = 3;
-  infoPtr->monthdayState = Alloc
-                         (infoPtr->monthRange * sizeof(MONTHDAYSTATE));
-  infoPtr->titlebk     = comctl32_color.clrActiveCaption;
-  infoPtr->titletxt    = comctl32_color.clrWindow;
-  infoPtr->monthbk     = comctl32_color.clrWindow;
-  infoPtr->trailingtxt = comctl32_color.clrGrayText;
-  infoPtr->bk          = comctl32_color.clrWindow;
-  infoPtr->txt	       = comctl32_color.clrWindowText;
-
-  /* set the current day for highlighing */
-  infoPtr->minSel.wDay = infoPtr->todaysDate.wDay;
-  infoPtr->maxSel.wDay = infoPtr->todaysDate.wDay;
+  infoPtr->maxDate.wYear = 2050;
+  infoPtr->minDate.wYear = 1950;
+  infoPtr->maxSelCount   = 7;
+  infoPtr->monthRange    = 3;
+  infoPtr->monthdayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE));
+  infoPtr->titlebk       = comctl32_color.clrActiveCaption;
+  infoPtr->titletxt      = comctl32_color.clrWindow;
+  infoPtr->monthbk       = comctl32_color.clrWindow;
+  infoPtr->trailingtxt   = comctl32_color.clrGrayText;
+  infoPtr->bk            = comctl32_color.clrWindow;
+  infoPtr->txt	         = comctl32_color.clrWindowText;
+
+  infoPtr->minSel = infoPtr->todaysDate;
+  infoPtr->maxSel = infoPtr->todaysDate;
 
   /* call MONTHCAL_UpdateSize to set all of the dimensions */
   /* of the control */
diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c
index 32b4d14..8cd3494 100644
--- a/dlls/comctl32/tests/monthcal.c
+++ b/dlls/comctl32/tests/monthcal.c
@@ -1237,6 +1237,41 @@ static void test_monthcal_destroy(void)
     ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_multi_sel_style_seq, "Destroy monthcal (multi sel style)", FALSE);
 }
 
+static void test_monthcal_getselrange(void)
+{
+    HWND hwnd;
+    SYSTEMTIME st, range[2];
+    BOOL ret;
+
+    hwnd = create_monthcal_control(MCS_MULTISELECT);
+
+    /* just after creation selection should start and end today */
+    ret = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st);
+    expect(TRUE, ret);
+
+    ret = SendMessage(hwnd, MCM_GETSELRANGE, 0, (LPARAM)range);
+    expect(TRUE, ret);
+    expect(st.wYear,      range[0].wYear);
+    expect(st.wMonth,     range[0].wMonth);
+    expect(st.wDay,       range[0].wDay);
+    expect(st.wDayOfWeek, range[0].wDayOfWeek);
+    expect(st.wHour,      range[0].wHour);
+    expect(st.wMinute,    range[0].wMinute);
+    expect(st.wSecond,    range[0].wSecond);
+    expect(st.wMilliseconds, range[0].wMilliseconds);
+
+    expect(st.wYear,      range[1].wYear);
+    expect(st.wMonth,     range[1].wMonth);
+    expect(st.wDay,       range[1].wDay);
+    expect(st.wDayOfWeek, range[1].wDayOfWeek);
+    expect(st.wHour,      range[1].wHour);
+    expect(st.wMinute,    range[1].wMinute);
+    expect(st.wSecond,    range[1].wSecond);
+    expect(st.wMilliseconds, range[1].wMilliseconds);
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(monthcal)
 {
     HMODULE hComctl32;
@@ -1273,6 +1308,7 @@ START_TEST(monthcal)
     test_monthcal_todaylink();
     test_monthcal_size();
     test_monthcal_maxselday();
+    test_monthcal_getselrange();
 
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
     DestroyWindow(parent_wnd);




More information about the wine-cvs mailing list