From cbdc99cdbaec40b7639c0948c3e21d6e07d846e0 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 15 Oct 2009 20:16:27 +0400 Subject: [PATCH] comctl32/monthcal: Get/set unicode format flag using MCM_[GET|SET]UNICODEFORMAT. --- dlls/comctl32/monthcal.c | 23 +++++++++++++++++++++++ dlls/comctl32/tests/monthcal.c | 2 -- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index ee7dc4ea62c..1c06d2309df 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -100,6 +100,8 @@ typedef struct stored in SYSTEMTIME format */ BOOL firstDaySet; /* first week day differs from locale defined */ + BOOL isUnicode; /* value set with MCM_SETUNICODE format */ + int monthRange; MONTHDAYSTATE *monthdayState; SYSTEMTIME todaysDate; @@ -2412,6 +2414,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) infoPtr->minSel = infoPtr->todaysDate; infoPtr->maxSel = infoPtr->todaysDate; infoPtr->curSel = infoPtr->todaysDate; + infoPtr->isUnicode = TRUE; /* call MONTHCAL_UpdateSize to set all of the dimensions */ /* of the control */ @@ -2465,6 +2468,20 @@ MONTHCAL_Notify(MONTHCAL_INFO *infoPtr, NMHDR *hdr) return 0; } +static inline BOOL +MONTHCAL_SetUnicodeFormat(MONTHCAL_INFO *infoPtr, BOOL isUnicode) +{ + BOOL prev = infoPtr->isUnicode; + infoPtr->isUnicode = isUnicode; + return prev; +} + +static inline BOOL +MONTHCAL_GetUnicodeFormat(const MONTHCAL_INFO *infoPtr) +{ + return infoPtr->isUnicode; +} + static LRESULT WINAPI MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -2540,6 +2557,12 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case MCM_GETMAXTODAYWIDTH: return MONTHCAL_GetMaxTodayWidth(infoPtr); + case MCM_SETUNICODEFORMAT: + return MONTHCAL_SetUnicodeFormat(infoPtr, (BOOL)wParam); + + case MCM_GETUNICODEFORMAT: + return MONTHCAL_GetUnicodeFormat(infoPtr); + case WM_GETDLGCODE: return DLGC_WANTARROWS | DLGC_WANTCHARS; diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 2e84af53278..f59614cb812 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -901,14 +901,12 @@ static void test_monthcal_unicode(void) /* current setting is 1, so, should return 1 */ res = SendMessage(hwnd, MCM_GETUNICODEFORMAT, 0, 0); - todo_wine ok(1 == res || broken(0 == res), /* comctl32 <= 4.70 */ "Expected 1, got %d\n", res); /* setting to 0, should return previous settings */ res = SendMessage(hwnd, MCM_SETUNICODEFORMAT, 0, 0); - todo_wine ok(1 == res || broken(0 == res), /* comctl32 <= 4.70 */ "Expected 1, got %d\n", res);