Module: wine Branch: master Commit: 23d8d35e9e44dd1e3d330a8d9c034a9bc1890118 URL: http://source.winehq.org/git/wine.git/?a=commit;h=23d8d35e9e44dd1e3d330a8d9c...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Aug 8 12:14:32 2010 +0400
comctl32/monthcal: Make month popup menu respect multiple calendars.
---
dlls/comctl32/monthcal.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 7ca5633..8425f67 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -2046,11 +2046,23 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) i = TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL);
- if ((i > 0) && (i < 13) && infoPtr->minSel.wMonth != i) + if ((i > 0) && (i < 13) && infoPtr->calendars[ht.iOffset].month.wMonth != i) { - infoPtr->minSel.wMonth = i; - MONTHCAL_IsDateInValidRange(infoPtr, &infoPtr->minSel, TRUE); - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); + INT delta = i - infoPtr->calendars[ht.iOffset].month.wMonth; + SYSTEMTIME st; + + /* check if change allowed by range set */ + st = delta < 0 ? infoPtr->calendars[0].month : + infoPtr->calendars[infoPtr->cal_num-1].month; + MONTHCAL_GetMonth(&st, delta); + + if (MONTHCAL_IsDateInValidRange(infoPtr, &st, FALSE)) + { + MONTHCAL_Scroll(infoPtr, delta); + MONTHCAL_NotifyDayState(infoPtr); + MONTHCAL_NotifySelectionChange(infoPtr); + InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); + } } return 0; }