Mercurial > dwindows
comparison os2/dw.c @ 1591:c5e210e04dce
Attempt at localizing the calendar widget on OS/2.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 14 Feb 2012 00:31:18 +0000 |
parents | d6988022c5cf |
children | 1795bd78207d |
comparison
equal
deleted
inserted
replaced
1590:9eef6f82ee50 | 1591:c5e210e04dce |
---|---|
1707 rclPaint.yBottom = (cellheight * (6-row)) + CALENDAR_BORDER; | 1707 rclPaint.yBottom = (cellheight * (6-row)) + CALENDAR_BORDER; |
1708 rclPaint.yTop = rclPaint.yBottom + cellheight; | 1708 rclPaint.yTop = rclPaint.yBottom + cellheight; |
1709 return rclPaint; | 1709 return rclPaint; |
1710 } | 1710 } |
1711 | 1711 |
1712 /* These will be filled in during dw_init() */ | |
1713 static char months[12][20]; | |
1714 static char daysofweek[7][20]; | |
1715 | |
1712 /* This procedure handles drawing of a status border */ | 1716 /* This procedure handles drawing of a status border */ |
1713 MRESULT EXPENTRY _calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 1717 MRESULT EXPENTRY _calendarproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2) |
1714 { | 1718 { |
1715 /* How many days are in each month usually (not including leap years) */ | 1719 /* How many days are in each month usually (not including leap years) */ |
1716 static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | 1720 static int days[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; |
1717 static char *months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; | |
1718 static char *daysofweek[] = { "Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday" }; | |
1719 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); | 1721 WindowData *blah = (WindowData *)WinQueryWindowPtr(hWnd, QWP_USER); |
1720 PFNWP oldproc = 0; | 1722 PFNWP oldproc = 0; |
1721 | 1723 |
1722 if(blah) | 1724 if(blah) |
1723 { | 1725 { |
3960 */ | 3962 */ |
3961 int API dw_init(int newthread, int argc, char *argv[]) | 3963 int API dw_init(int newthread, int argc, char *argv[]) |
3962 { | 3964 { |
3963 APIRET rc; | 3965 APIRET rc; |
3964 char objnamebuf[300] = ""; | 3966 char objnamebuf[300] = ""; |
3967 int x; | |
3968 struct tm thistm = { 0 }; | |
3965 | 3969 |
3966 /* Setup the private data directory */ | 3970 /* Setup the private data directory */ |
3967 if(argc > 0 && argv[0]) | 3971 if(argc > 0 && argv[0]) |
3968 { | 3972 { |
3969 char *pos = strrchr(argv[0], '\\'); | 3973 char *pos = strrchr(argv[0], '\\'); |
3987 | 3991 |
3988 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | 3992 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); |
3989 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32); | 3993 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32); |
3990 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32); | 3994 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32); |
3991 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32); | 3995 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32); |
3996 | |
3997 /* Fill in the the calendar fields */ | |
3998 for(x=0;x<7;x++) | |
3999 { | |
4000 thistm.tm_wday = x; | |
4001 strftime(daysofweek[x], 19, "%A", &thistm); | |
4002 } | |
4003 for(x=0;x<12;x++) | |
4004 { | |
4005 thistm.tm_mon = x; | |
4006 strftime(months[x], 19, "%B", &thistm); | |
4007 } | |
3992 | 4008 |
3993 /* Get the OS/2 version. */ | 4009 /* Get the OS/2 version. */ |
3994 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); | 4010 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); |
3995 | 4011 |
3996 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); | 4012 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |