comctl32/monthcal: Implement MCS_NOSELCHANGEONNAV style.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-07-26 00:13:45 +03:00 committed by Alexandre Julliard
parent d73d6b2093
commit 5d0a02db69
2 changed files with 13 additions and 6 deletions

View File

@ -1969,7 +1969,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr)
} }
/* no valid range check performed */ /* no valid range check performed */
static void MONTHCAL_Scroll(MONTHCAL_INFO *infoPtr, INT delta) static void MONTHCAL_Scroll(MONTHCAL_INFO *infoPtr, INT delta, BOOL keep_selection)
{ {
INT i, selIdx = -1; INT i, selIdx = -1;
@ -1982,8 +1982,11 @@ static void MONTHCAL_Scroll(MONTHCAL_INFO *infoPtr, INT delta)
MONTHCAL_GetMonth(&infoPtr->calendars[i].month, delta); MONTHCAL_GetMonth(&infoPtr->calendars[i].month, delta);
} }
if (keep_selection)
return;
/* selection is always shifted to first calendar */ /* selection is always shifted to first calendar */
if(infoPtr->dwStyle & MCS_MULTISELECT) if (infoPtr->dwStyle & MCS_MULTISELECT)
{ {
SYSTEMTIME range[2]; SYSTEMTIME range[2];
@ -2004,6 +2007,7 @@ static void MONTHCAL_Scroll(MONTHCAL_INFO *infoPtr, INT delta)
static void MONTHCAL_GoToMonth(MONTHCAL_INFO *infoPtr, enum nav_direction direction) static void MONTHCAL_GoToMonth(MONTHCAL_INFO *infoPtr, enum nav_direction direction)
{ {
INT delta = infoPtr->delta ? infoPtr->delta : MONTHCAL_GetCalCount(infoPtr); INT delta = infoPtr->delta ? infoPtr->delta : MONTHCAL_GetCalCount(infoPtr);
BOOL keep_selection;
SYSTEMTIME st; SYSTEMTIME st;
TRACE("%s\n", direction == DIRECTION_BACKWARD ? "back" : "fwd"); TRACE("%s\n", direction == DIRECTION_BACKWARD ? "back" : "fwd");
@ -2022,9 +2026,11 @@ static void MONTHCAL_GoToMonth(MONTHCAL_INFO *infoPtr, enum nav_direction direct
if(!MONTHCAL_IsDateInValidRange(infoPtr, &st, FALSE)) return; if(!MONTHCAL_IsDateInValidRange(infoPtr, &st, FALSE)) return;
MONTHCAL_Scroll(infoPtr, direction == DIRECTION_BACKWARD ? -delta : delta); keep_selection = infoPtr->dwStyle & MCS_NOSELCHANGEONNAV;
MONTHCAL_Scroll(infoPtr, direction == DIRECTION_BACKWARD ? -delta : delta, keep_selection);
MONTHCAL_NotifyDayState(infoPtr); MONTHCAL_NotifyDayState(infoPtr);
MONTHCAL_NotifySelectionChange(infoPtr); if (!keep_selection)
MONTHCAL_NotifySelectionChange(infoPtr);
} }
static LRESULT static LRESULT
@ -2212,7 +2218,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
if (MONTHCAL_IsDateInValidRange(infoPtr, &st, FALSE)) if (MONTHCAL_IsDateInValidRange(infoPtr, &st, FALSE))
{ {
MONTHCAL_Scroll(infoPtr, delta); MONTHCAL_Scroll(infoPtr, delta, FALSE);
MONTHCAL_NotifyDayState(infoPtr); MONTHCAL_NotifyDayState(infoPtr);
MONTHCAL_NotifySelectionChange(infoPtr); MONTHCAL_NotifySelectionChange(infoPtr);
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
@ -2851,7 +2857,7 @@ MONTHCAL_Notify(MONTHCAL_INFO *infoPtr, NMHDR *hdr)
if (hdr->hwndFrom == infoPtr->hWndYearUpDown && nmud->iDelta) if (hdr->hwndFrom == infoPtr->hWndYearUpDown && nmud->iDelta)
{ {
/* year value limits are set up explicitly after updown creation */ /* year value limits are set up explicitly after updown creation */
MONTHCAL_Scroll(infoPtr, 12 * nmud->iDelta); MONTHCAL_Scroll(infoPtr, 12 * nmud->iDelta, FALSE);
MONTHCAL_NotifyDayState(infoPtr); MONTHCAL_NotifyDayState(infoPtr);
MONTHCAL_NotifySelectionChange(infoPtr); MONTHCAL_NotifySelectionChange(infoPtr);
} }

View File

@ -187,6 +187,7 @@
#define MCS_NOTODAYCIRCLE 0x0008 #define MCS_NOTODAYCIRCLE 0x0008
#define MCS_NOTRAILINGDATES 0x0040 #define MCS_NOTRAILINGDATES 0x0040
#define MCS_SHORTDAYSOFWEEK 0x0080 #define MCS_SHORTDAYSOFWEEK 0x0080
#define MCS_NOSELCHANGEONNAV 0x0100
/* Datetime Control */ /* Datetime Control */
#define DTS_SHORTDATEFORMAT 0x0000 #define DTS_SHORTDATEFORMAT 0x0000