Mercurial > dwindows
comparison os2/dw.c @ 1534:ad8181f70f31
Add a separate class for the calendar control on OS/2.
Add code to automatically size the calendar control.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 09 Jan 2012 16:04:00 +0000 |
parents | 783a464afab2 |
children | a4ecef1980db |
comparison
equal
deleted
inserted
replaced
1533:7bc189ef0cd0 | 1534:ad8181f70f31 |
---|---|
65 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; | 65 BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; |
66 | 66 |
67 char ClassName[] = "dynamicwindows"; | 67 char ClassName[] = "dynamicwindows"; |
68 char SplitbarClassName[] = "dwsplitbar"; | 68 char SplitbarClassName[] = "dwsplitbar"; |
69 char ScrollClassName[] = "dwscroll"; | 69 char ScrollClassName[] = "dwscroll"; |
70 char CalendarClassName[] = "dwcalendar"; | |
70 char *DefaultFont = "9.WarpSans"; | 71 char *DefaultFont = "9.WarpSans"; |
71 | 72 |
72 HAB dwhab = 0; | 73 HAB dwhab = 0; |
73 HMQ dwhmq = 0; | 74 HMQ dwhmq = 0; |
74 DWTID _dwtid = 0; | 75 DWTID _dwtid = 0; |
3986 } | 3987 } |
3987 | 3988 |
3988 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); | 3989 rc = WinRegisterClass(dwhab, (PSZ)ClassName, _wndproc, CS_SIZEREDRAW | CS_CLIPCHILDREN, 32); |
3989 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32); | 3990 rc = WinRegisterClass(dwhab, (PSZ)SplitbarClassName, _splitwndproc, 0L, 32); |
3990 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32); | 3991 rc = WinRegisterClass(dwhab, (PSZ)ScrollClassName, _scrollwndproc, 0L, 32); |
3992 rc = WinRegisterClass(dwhab, (PSZ)CalendarClassName, _calendarproc, 0L, 32); | |
3991 | 3993 |
3992 /* Get the OS/2 version. */ | 3994 /* Get the OS/2 version. */ |
3993 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); | 3995 DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_MS_COUNT,(void *)aulBuffer, 4*sizeof(ULONG)); |
3994 | 3996 |
3995 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); | 3997 desktop = WinQueryDesktopWindow(dwhab, NULLHANDLE); |
4661 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); | 4663 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); |
4662 thiswidth = 150; | 4664 thiswidth = 150; |
4663 extraheight = 4; | 4665 extraheight = 4; |
4664 if(thisheight < 18) | 4666 if(thisheight < 18) |
4665 thisheight = 18; | 4667 thisheight = 18; |
4668 } | |
4669 /* Calendar */ | |
4670 else if(strncmp(tmpbuf, CalendarClassName, strlen(CalendarClassName)+1)==0) | |
4671 { | |
4672 thiswidth = 200; | |
4673 thisheight = 150; | |
4666 } | 4674 } |
4667 /* Bitmap/Static */ | 4675 /* Bitmap/Static */ |
4668 else if(strncmp(tmpbuf, "#5", 3)==0) | 4676 else if(strncmp(tmpbuf, "#5", 3)==0) |
4669 { | 4677 { |
4670 HBITMAP hbm = (HBITMAP)WinSendMsg(handle, SM_QUERYHANDLE, MPVOID, MPVOID); | 4678 HBITMAP hbm = (HBITMAP)WinSendMsg(handle, SM_QUERYHANDLE, MPVOID, MPVOID); |
12064 HWND API dw_calendar_new(ULONG id) | 12072 HWND API dw_calendar_new(ULONG id) |
12065 { | 12073 { |
12066 WindowData *blah = calloc(sizeof(WindowData), 1); | 12074 WindowData *blah = calloc(sizeof(WindowData), 1); |
12067 DATETIME dt; | 12075 DATETIME dt; |
12068 HWND tmp = WinCreateWindow(HWND_OBJECT, | 12076 HWND tmp = WinCreateWindow(HWND_OBJECT, |
12069 WC_STATIC, | 12077 CalendarClassName, |
12070 NULL, | 12078 NULL, |
12071 WS_VISIBLE | SS_TEXT, | 12079 WS_VISIBLE, |
12072 0,0,2000,1000, | 12080 0,0,2000,1000, |
12073 NULLHANDLE, | 12081 NULLHANDLE, |
12074 HWND_TOP, | 12082 HWND_TOP, |
12075 id, | 12083 id, |
12076 NULL, | 12084 NULL, |
12077 NULL); | 12085 NULL); |
12078 blah->oldproc = WinSubclassWindow(tmp, _calendarproc); | |
12079 WinSetWindowPtr(tmp, QWP_USER, blah); | 12086 WinSetWindowPtr(tmp, QWP_USER, blah); |
12080 dw_window_set_font(tmp, DefaultFont); | 12087 dw_window_set_font(tmp, DefaultFont); |
12081 if(!DosGetDateTime(&dt)) | 12088 if(!DosGetDateTime(&dt)) |
12082 dw_calendar_set_date(tmp, dt.year, dt.month, dt.day); | 12089 dw_calendar_set_date(tmp, dt.year, dt.month, dt.day); |
12083 return tmp; | 12090 return tmp; |