comctl32/monthcal: Added support for MCS_SHORTDAYSOFWEEK 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-05-17 21:21:07 +03:00 committed by Alexandre Julliard
parent d701a76ca1
commit 7912acaab9
2 changed files with 16 additions and 4 deletions

View File

@ -1156,6 +1156,18 @@ static void MONTHCAL_PaintLeadTrailMonths(const MONTHCAL_INFO *infoPtr, HDC hdc,
} }
} }
static int get_localized_dayname(const MONTHCAL_INFO *infoPtr, unsigned int day, WCHAR *buff, unsigned int count)
{
LCTYPE lctype;
if (infoPtr->dwStyle & MCS_SHORTDAYSOFWEEK)
lctype = LOCALE_SSHORTESTDAYNAME1 + day;
else
lctype = LOCALE_SABBREVDAYNAME1 + day;
return GetLocaleInfoW(LOCALE_USER_DEFAULT, lctype, buff, count);
}
/* paint a calendar area */ /* paint a calendar area */
static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps, INT calIdx) static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps, INT calIdx)
{ {
@ -1196,7 +1208,7 @@ static void MONTHCAL_PaintCalendar(const MONTHCAL_INFO *infoPtr, HDC hdc, const
i = infoPtr->firstDay; i = infoPtr->firstDay;
for(j = 0; j < 7; j++) { for(j = 0; j < 7; j++) {
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + (i+j+6)%7, buf, countof(buf)); get_localized_dayname(infoPtr, (i + j + 6) % 7, buf, countof(buf));
DrawTextW(hdc, buf, strlenW(buf), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE); DrawTextW(hdc, buf, strlenW(buf), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
OffsetRect(&r, infoPtr->width_increment, 0); OffsetRect(&r, infoPtr->width_increment, 0);
} }
@ -2500,8 +2512,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
size.cx = sz.cx = 0; size.cx = sz.cx = 0;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
{ {
if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, if (get_localized_dayname(infoPtr, i, buff, countof(buff)))
buff, countof(buff)))
{ {
GetTextExtentPoint32W(hdc, buff, lstrlenW(buff), &sz); GetTextExtentPoint32W(hdc, buff, lstrlenW(buff), &sz);
if (sz.cx > size.cx) size.cx = sz.cx; if (sz.cx > size.cx) size.cx = sz.cx;
@ -2703,7 +2714,7 @@ static INT MONTHCAL_StyleChanged(MONTHCAL_INFO *infoPtr, WPARAM wStyleType,
infoPtr->dwStyle = lpss->styleNew; infoPtr->dwStyle = lpss->styleNew;
/* make room for week numbers */ /* make room for week numbers */
if ((lpss->styleNew ^ lpss->styleOld) & MCS_WEEKNUMBERS) if ((lpss->styleNew ^ lpss->styleOld) & (MCS_WEEKNUMBERS | MCS_SHORTDAYSOFWEEK))
MONTHCAL_UpdateSize(infoPtr); MONTHCAL_UpdateSize(infoPtr);
return 0; return 0;

View File

@ -186,6 +186,7 @@
#define MCS_NOTODAY 0x0010 #define MCS_NOTODAY 0x0010
#define MCS_NOTODAYCIRCLE 0x0008 #define MCS_NOTODAYCIRCLE 0x0008
#define MCS_NOTRAILINGDATES 0x0040 #define MCS_NOTRAILINGDATES 0x0040
#define MCS_SHORTDAYSOFWEEK 0x0080
/* Datetime Control */ /* Datetime Control */
#define DTS_SHORTDATEFORMAT 0x0000 #define DTS_SHORTDATEFORMAT 0x0000