1 | /* $Id: datetime.cpp,v 1.3 2000-05-22 17:25:07 cbratschi Exp $ */
|
---|
2 | /*
|
---|
3 | * Date and time picker control
|
---|
4 | *
|
---|
5 | * Copyright 1998, 1999 Eric Kohl
|
---|
6 | * Copyright 1999 Alex Priem <alexp@sci.kun.nl>
|
---|
7 | * Copyright 1999 Achim Hasenmueller
|
---|
8 | * Copyright 1999 Christoph Bratschi
|
---|
9 | *
|
---|
10 | *
|
---|
11 | * TODO:
|
---|
12 | * - All messages.
|
---|
13 | * - All notifications.
|
---|
14 | *
|
---|
15 | */
|
---|
16 |
|
---|
17 | /* WINE 20000513 level */
|
---|
18 |
|
---|
19 | #include "winbase.h"
|
---|
20 | #include "commctrl.h"
|
---|
21 | #include "ccbase.h"
|
---|
22 | #include "datetime.h"
|
---|
23 | #include "monthcal.h"
|
---|
24 | #include <string.h>
|
---|
25 | #include <stdio.h>
|
---|
26 |
|
---|
27 |
|
---|
28 | #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO*)getInfoPtr(hwnd))
|
---|
29 |
|
---|
30 | static const char *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
|
---|
31 | "Thursday", "Friday", "Saturday", NULL};
|
---|
32 |
|
---|
33 | static const char *monthtxt[] = {"January", "February", "March", "April", "May",
|
---|
34 | "June", "July", "August", "September", "October",
|
---|
35 | "November", "December"};
|
---|
36 |
|
---|
37 | static LRESULT
|
---|
38 | DATETIME_GetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam )
|
---|
39 | {
|
---|
40 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
41 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
---|
42 | SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *) lParam;
|
---|
43 |
|
---|
44 | if (!lParam) return GDT_NONE;
|
---|
45 |
|
---|
46 | if ((dwStyle & DTS_SHOWNONE) &&
|
---|
47 | (SendMessageA (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0)))
|
---|
48 | return GDT_NONE;
|
---|
49 |
|
---|
50 | MONTHCAL_CopyTime (&infoPtr->date, lprgSysTimeArray);
|
---|
51 |
|
---|
52 | return GDT_VALID;
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | static LRESULT
|
---|
57 | DATETIME_SetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam )
|
---|
58 | {
|
---|
59 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
60 | SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *) lParam;
|
---|
61 |
|
---|
62 | if (!lParam) return 0;
|
---|
63 |
|
---|
64 | if (lParam==GDT_VALID)
|
---|
65 | MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
|
---|
66 | if (lParam==GDT_NONE) {
|
---|
67 | infoPtr->dateValid=FALSE;
|
---|
68 | SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 0, 0);
|
---|
69 | }
|
---|
70 | return 1;
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 | static LRESULT
|
---|
75 | DATETIME_GetMonthCalColor (HWND hwnd, WPARAM wParam)
|
---|
76 | {
|
---|
77 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
78 |
|
---|
79 | return SendMessageA (infoPtr->hMonthCal, MCM_GETCOLOR, wParam, 0);
|
---|
80 | }
|
---|
81 |
|
---|
82 | static LRESULT
|
---|
83 | DATETIME_SetMonthCalColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
84 | {
|
---|
85 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
86 |
|
---|
87 | return SendMessageA (infoPtr->hMonthCal, MCM_SETCOLOR, wParam, lParam);
|
---|
88 | }
|
---|
89 |
|
---|
90 |
|
---|
91 | /* FIXME: need to get way to force font into monthcal structure */
|
---|
92 |
|
---|
93 | static LRESULT
|
---|
94 | DATETIME_GetMonthCal (HWND hwnd)
|
---|
95 | {
|
---|
96 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
97 |
|
---|
98 | return infoPtr->hMonthCal;
|
---|
99 | }
|
---|
100 |
|
---|
101 |
|
---|
102 |
|
---|
103 | /* FIXME: need to get way to force font into monthcal structure */
|
---|
104 |
|
---|
105 | static LRESULT
|
---|
106 | DATETIME_GetMonthCalFont (HWND hwnd)
|
---|
107 | {
|
---|
108 |
|
---|
109 | return 0;
|
---|
110 | }
|
---|
111 |
|
---|
112 | static LRESULT
|
---|
113 | DATETIME_SetMonthCalFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
114 | {
|
---|
115 |
|
---|
116 | return 0;
|
---|
117 | }
|
---|
118 |
|
---|
119 |
|
---|
120 | static void DATETIME_Refresh (HWND hwnd, HDC hdc)
|
---|
121 |
|
---|
122 | {
|
---|
123 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
124 | RECT *daytxt = &infoPtr->daytxt;
|
---|
125 | RECT *daynumtxt= &infoPtr->daynumtxt;
|
---|
126 | RECT *rmonthtxt= &infoPtr->rmonthtxt;
|
---|
127 | RECT *yeartxt = &infoPtr->yeartxt;
|
---|
128 | RECT *calbutton= &infoPtr->calbutton;
|
---|
129 | RECT *checkbox = &infoPtr->checkbox;
|
---|
130 | RECT *rect = &infoPtr->rect;
|
---|
131 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
---|
132 | SYSTEMTIME date = infoPtr->date;
|
---|
133 | SIZE size;
|
---|
134 | BOOL prssed=FALSE;
|
---|
135 | COLORREF oldBk = 0;
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 | if (infoPtr->dateValid) {
|
---|
140 | char txt[80];
|
---|
141 | HFONT oldFont;
|
---|
142 | oldFont = SelectObject (hdc, infoPtr->hFont);
|
---|
143 |
|
---|
144 | GetClientRect (hwnd, rect);
|
---|
145 |
|
---|
146 | sprintf (txt,"%s,",days[date.wDayOfWeek]);
|
---|
147 | GetTextExtentPoint32A (hdc, txt, strlen (txt), &size);
|
---|
148 | rect->bottom=size.cy+2;
|
---|
149 |
|
---|
150 | checkbox->left = 0;
|
---|
151 | checkbox->right = 0;
|
---|
152 | checkbox->top = rect->top;
|
---|
153 | checkbox->bottom= rect->bottom;
|
---|
154 | if (dwStyle & DTS_SHOWNONE) { /* FIXME: draw checkbox */
|
---|
155 | checkbox->right=18;
|
---|
156 | }
|
---|
157 |
|
---|
158 |
|
---|
159 | if (infoPtr->select==(DTHT_DAY|DTHT_GOTFOCUS))
|
---|
160 | oldBk=SetBkColor (hdc, COLOR_GRAYTEXT);
|
---|
161 | daytxt->left = checkbox->right;
|
---|
162 | daytxt->right = checkbox->right+size.cx;
|
---|
163 | daytxt->top = rect->top;
|
---|
164 | daytxt->bottom= rect->bottom;
|
---|
165 | DrawTextA ( hdc, txt, strlen(txt), daytxt,
|
---|
166 | DT_LEFT | DT_VCENTER | DT_SINGLELINE );
|
---|
167 | if (infoPtr->select==(DTHT_DAY|DTHT_GOTFOCUS))
|
---|
168 | SetBkColor (hdc, oldBk);
|
---|
169 |
|
---|
170 | if (infoPtr->select==(DTHT_MONTH|DTHT_GOTFOCUS))
|
---|
171 | oldBk=SetBkColor (hdc, COLOR_GRAYTEXT);
|
---|
172 | strcpy (txt, monthtxt[date.wMonth]);
|
---|
173 | GetTextExtentPoint32A (hdc, "September", 9, &size);
|
---|
174 | rmonthtxt->left = daytxt->right;
|
---|
175 | rmonthtxt->right = daytxt->right+size.cx;
|
---|
176 | rmonthtxt->top = rect->top;
|
---|
177 | rmonthtxt->bottom= rect->bottom;
|
---|
178 | DrawTextA ( hdc, txt, strlen(txt), rmonthtxt,
|
---|
179 | DT_CENTER | DT_VCENTER | DT_SINGLELINE );
|
---|
180 | if (infoPtr->select==(DTHT_MONTH|DTHT_GOTFOCUS))
|
---|
181 | SetBkColor (hdc, oldBk);
|
---|
182 |
|
---|
183 | if (infoPtr->select==(DTHT_DAYNUM|DTHT_GOTFOCUS))
|
---|
184 | oldBk=SetBkColor (hdc, COLOR_GRAYTEXT);
|
---|
185 | sprintf (txt,"%d,",date.wDay);
|
---|
186 | GetTextExtentPoint32A (hdc, "31,", 3, &size);
|
---|
187 | daynumtxt->left = rmonthtxt->right;
|
---|
188 | daynumtxt->right = rmonthtxt->right+size.cx;
|
---|
189 | daynumtxt->top = rect->top;
|
---|
190 | daynumtxt->bottom= rect->bottom;
|
---|
191 | DrawTextA ( hdc, txt, strlen(txt), daynumtxt,
|
---|
192 | DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
|
---|
193 | if (infoPtr->select==(DTHT_DAYNUM|DTHT_GOTFOCUS))
|
---|
194 | SetBkColor (hdc, oldBk);
|
---|
195 |
|
---|
196 | if (infoPtr->select==(DTHT_YEAR|DTHT_GOTFOCUS))
|
---|
197 | oldBk=SetBkColor (hdc, COLOR_GRAYTEXT);
|
---|
198 | sprintf (txt,"%d",date.wYear);
|
---|
199 | GetTextExtentPoint32A (hdc, "2000", 5, &size);
|
---|
200 | yeartxt->left = daynumtxt->right;
|
---|
201 | yeartxt->right = daynumtxt->right+size.cx;
|
---|
202 | yeartxt->top = rect->top;
|
---|
203 | yeartxt->bottom= rect->bottom;
|
---|
204 | DrawTextA ( hdc, txt, strlen(txt), yeartxt,
|
---|
205 | DT_RIGHT | DT_VCENTER | DT_SINGLELINE );
|
---|
206 | if (infoPtr->select==(DTHT_YEAR|DTHT_GOTFOCUS))
|
---|
207 | SetBkColor (hdc, oldBk);
|
---|
208 |
|
---|
209 | SelectObject (hdc, oldFont);
|
---|
210 | }
|
---|
211 |
|
---|
212 | if (!(dwStyle & DTS_UPDOWN)) {
|
---|
213 |
|
---|
214 | calbutton->right = rect->right;
|
---|
215 | calbutton->left = rect->right-15;
|
---|
216 | calbutton->top = rect->top;
|
---|
217 | calbutton->bottom= rect->bottom;
|
---|
218 |
|
---|
219 | DrawFrameControl(hdc, calbutton, DFC_SCROLL,
|
---|
220 | DFCS_SCROLLDOWN | (prssed ? DFCS_PUSHED : 0) |
|
---|
221 | (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
|
---|
222 | }
|
---|
223 |
|
---|
224 | }
|
---|
225 |
|
---|
226 | static LRESULT
|
---|
227 | DATETIME_HitTest (HWND hwnd, DATETIME_INFO *infoPtr, POINT pt)
|
---|
228 | {
|
---|
229 | //TRACE ("%ld, %ld\n",pt.x,pt.y);
|
---|
230 |
|
---|
231 | if (PtInRect (&infoPtr->calbutton, pt)) return DTHT_MCPOPUP;
|
---|
232 | if (PtInRect (&infoPtr->yeartxt, pt)) return DTHT_YEAR;
|
---|
233 | if (PtInRect (&infoPtr->daynumtxt, pt)) return DTHT_DAYNUM;
|
---|
234 | if (PtInRect (&infoPtr->rmonthtxt, pt)) return DTHT_MONTH;
|
---|
235 | if (PtInRect (&infoPtr->daytxt, pt)) return DTHT_DAY;
|
---|
236 | if (PtInRect (&infoPtr->checkbox, pt)) return DTHT_CHECKBOX;
|
---|
237 |
|
---|
238 | return 0;
|
---|
239 | }
|
---|
240 |
|
---|
241 | static LRESULT
|
---|
242 | DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
243 | {
|
---|
244 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
245 | POINT pt;
|
---|
246 | int old;
|
---|
247 |
|
---|
248 | //TRACE ("\n");
|
---|
249 |
|
---|
250 | old=infoPtr->select;
|
---|
251 | pt.x=(INT)LOWORD(lParam);
|
---|
252 | pt.y=(INT)HIWORD(lParam);
|
---|
253 | infoPtr->select=DATETIME_HitTest (hwnd, infoPtr, pt);
|
---|
254 |
|
---|
255 | if (infoPtr->select!=old) {
|
---|
256 | HDC hdc;
|
---|
257 |
|
---|
258 | SetFocus (hwnd);
|
---|
259 | hdc=GetDC (hwnd);
|
---|
260 | DATETIME_Refresh (hwnd,hdc);
|
---|
261 | ReleaseDC (hwnd, hdc);
|
---|
262 | }
|
---|
263 | if (infoPtr->select==DTHT_MCPOPUP) {
|
---|
264 | POINT pt;
|
---|
265 |
|
---|
266 | pt.x=8;
|
---|
267 | pt.y=infoPtr->rect.bottom+5;
|
---|
268 | ClientToScreen (hwnd, &pt);
|
---|
269 | infoPtr->hMonthCal=CreateWindowExA (0,"SysMonthCal32", 0,
|
---|
270 | WS_POPUP | WS_BORDER,
|
---|
271 | pt.x,pt.y,145,150,
|
---|
272 | GetParent (hwnd),
|
---|
273 | 0,0,0);
|
---|
274 |
|
---|
275 | //TRACE ("dt:%x mc:%x mc parent:%x, desktop:%x, mcpp:%x\n",
|
---|
276 | //hwnd,infoPtr->hMonthCal,
|
---|
277 | //GetParent (infoPtr->hMonthCal),
|
---|
278 | //GetDesktopWindow (),
|
---|
279 | //GetParent (GetParent (infoPtr->hMonthCal)));
|
---|
280 |
|
---|
281 | SetFocus (hwnd);
|
---|
282 | sendNotify(hwnd,DTN_DROPDOWN);
|
---|
283 | }
|
---|
284 | return 0;
|
---|
285 | }
|
---|
286 |
|
---|
287 |
|
---|
288 | static LRESULT
|
---|
289 | DATETIME_Paint (HWND hwnd, WPARAM wParam)
|
---|
290 | {
|
---|
291 | HDC hdc;
|
---|
292 | PAINTSTRUCT ps;
|
---|
293 |
|
---|
294 | hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
|
---|
295 | DATETIME_Refresh (hwnd, hdc);
|
---|
296 | if(!wParam)
|
---|
297 | EndPaint (hwnd, &ps);
|
---|
298 | return 0;
|
---|
299 | }
|
---|
300 |
|
---|
301 | static LRESULT
|
---|
302 | DATETIME_ParentNotify (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
303 | {
|
---|
304 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
305 | LPNMHDR lpnmh=(LPNMHDR) lParam;
|
---|
306 |
|
---|
307 | //TRACE ("%x,%lx\n",wParam, lParam);
|
---|
308 | //TRACE ("Got notification %x from %x\n", lpnmh->code, lpnmh->hwndFrom);
|
---|
309 | //TRACE ("info: %x %x %x\n",hwnd,infoPtr->hMonthCal,infoPtr->hUpdown);
|
---|
310 | return 0;
|
---|
311 | }
|
---|
312 |
|
---|
313 | static LRESULT
|
---|
314 | DATETIME_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
315 |
|
---|
316 | {
|
---|
317 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
318 | LPNMHDR lpnmh=(LPNMHDR) lParam;
|
---|
319 |
|
---|
320 | //TRACE ("%x,%lx\n",wParam, lParam);
|
---|
321 | //TRACE ("Got notification %x from %x\n", lpnmh->code, lpnmh->hwndFrom);
|
---|
322 | //TRACE ("info: %x %x %x\n",hwnd,infoPtr->hMonthCal,infoPtr->hUpdown);
|
---|
323 | return 0;
|
---|
324 | }
|
---|
325 |
|
---|
326 | static LRESULT
|
---|
327 | DATETIME_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
328 | {
|
---|
329 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
330 | HDC hdc;
|
---|
331 |
|
---|
332 | //TRACE ("\n");
|
---|
333 |
|
---|
334 | if (infoPtr->select) {
|
---|
335 | sendNotify(hwnd,NM_KILLFOCUS);
|
---|
336 | infoPtr->select&= ~DTHT_GOTFOCUS;
|
---|
337 | }
|
---|
338 | hdc = GetDC (hwnd);
|
---|
339 | DATETIME_Refresh (hwnd, hdc);
|
---|
340 | ReleaseDC (hwnd, hdc);
|
---|
341 | InvalidateRect (hwnd, NULL, TRUE);
|
---|
342 |
|
---|
343 | return 0;
|
---|
344 | }
|
---|
345 |
|
---|
346 |
|
---|
347 | static LRESULT
|
---|
348 | DATETIME_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
349 | {
|
---|
350 | HDC hdc;
|
---|
351 | DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
|
---|
352 |
|
---|
353 | //TRACE ("\n");
|
---|
354 |
|
---|
355 | if (infoPtr->select) {
|
---|
356 | sendNotify(hwnd,NM_SETFOCUS);
|
---|
357 | infoPtr->select|=DTHT_GOTFOCUS;
|
---|
358 | }
|
---|
359 | hdc = GetDC (hwnd);
|
---|
360 | DATETIME_Refresh (hwnd, hdc);
|
---|
361 | ReleaseDC (hwnd, hdc);
|
---|
362 |
|
---|
363 | return 0;
|
---|
364 | }
|
---|
365 |
|
---|
366 |
|
---|
367 | static LRESULT
|
---|
368 | DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
369 | {
|
---|
370 | DATETIME_INFO *infoPtr;
|
---|
371 | DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
---|
372 |
|
---|
373 | /* allocate memory for info structure */
|
---|
374 | infoPtr = (DATETIME_INFO*)initControl(hwnd,sizeof(DATETIME_INFO));
|
---|
375 | if (infoPtr == NULL) {
|
---|
376 | //ERR("could not allocate info memory!\n");
|
---|
377 | return 0;
|
---|
378 | }
|
---|
379 |
|
---|
380 | if (dwStyle & DTS_SHOWNONE) {
|
---|
381 | infoPtr->hwndCheckbut=CreateWindowExA (0,"button", 0,
|
---|
382 | WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
|
---|
383 | 2,2,13,13,
|
---|
384 | hwnd,
|
---|
385 | 0, GetWindowLongA (hwnd, GWL_HINSTANCE), 0);
|
---|
386 | SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, 1, 0);
|
---|
387 | }
|
---|
388 |
|
---|
389 | if (dwStyle & DTS_UPDOWN) {
|
---|
390 |
|
---|
391 | infoPtr->hUpdown=CreateUpDownControl (
|
---|
392 | WS_CHILD | WS_BORDER | WS_VISIBLE,
|
---|
393 | 120,1,20,20,
|
---|
394 | hwnd,1,0,0,
|
---|
395 | UD_MAXVAL, UD_MINVAL, 0);
|
---|
396 | }
|
---|
397 |
|
---|
398 | /* initialize info structure */
|
---|
399 | infoPtr->hMonthCal=0;
|
---|
400 | GetSystemTime (&infoPtr->date);
|
---|
401 | infoPtr->dateValid = TRUE;
|
---|
402 | infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT);
|
---|
403 | return 0;
|
---|
404 | }
|
---|
405 |
|
---|
406 |
|
---|
407 | static LRESULT
|
---|
408 | DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
409 | {
|
---|
410 | doneControl(hwnd);
|
---|
411 |
|
---|
412 | return 0;
|
---|
413 | }
|
---|
414 |
|
---|
415 |
|
---|
416 |
|
---|
417 |
|
---|
418 |
|
---|
419 | static LRESULT WINAPI
|
---|
420 | DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
---|
421 | {
|
---|
422 |
|
---|
423 | switch (uMsg)
|
---|
424 | {
|
---|
425 |
|
---|
426 | case DTM_GETSYSTEMTIME:
|
---|
427 | DATETIME_GetSystemTime (hwnd, wParam, lParam);
|
---|
428 |
|
---|
429 | case DTM_SETSYSTEMTIME:
|
---|
430 | DATETIME_SetSystemTime (hwnd, wParam, lParam);
|
---|
431 |
|
---|
432 | case DTM_GETRANGE:
|
---|
433 | //FIXME("Unimplemented msg DTM_GETRANGE\n");
|
---|
434 | return 0;
|
---|
435 |
|
---|
436 | case DTM_SETRANGE:
|
---|
437 | //FIXME("Unimplemented msg DTM_SETRANGE\n");
|
---|
438 | return 1;
|
---|
439 |
|
---|
440 | case DTM_SETFORMATA:
|
---|
441 | //FIXME("Unimplemented msg DTM_SETFORMAT32A\n");
|
---|
442 | return 1;
|
---|
443 |
|
---|
444 | case DTM_SETFORMATW:
|
---|
445 | //FIXME("Unimplemented msg DTM_SETFORMAT32W\n");
|
---|
446 | return 1;
|
---|
447 |
|
---|
448 | case DTM_SETMCCOLOR:
|
---|
449 | return DATETIME_SetMonthCalColor (hwnd, wParam, lParam);
|
---|
450 |
|
---|
451 | case DTM_GETMCCOLOR:
|
---|
452 | return DATETIME_GetMonthCalColor (hwnd, wParam);
|
---|
453 |
|
---|
454 | case DTM_GETMONTHCAL:
|
---|
455 | return DATETIME_GetMonthCal (hwnd);
|
---|
456 |
|
---|
457 | case DTM_SETMCFONT:
|
---|
458 | return DATETIME_SetMonthCalFont (hwnd, wParam, lParam);
|
---|
459 |
|
---|
460 | case DTM_GETMCFONT:
|
---|
461 | return DATETIME_GetMonthCalFont (hwnd);
|
---|
462 |
|
---|
463 | case WM_PARENTNOTIFY:
|
---|
464 | return DATETIME_ParentNotify (hwnd, wParam, lParam);
|
---|
465 |
|
---|
466 | case WM_NOTIFY:
|
---|
467 | return DATETIME_Notify (hwnd, wParam, lParam);
|
---|
468 |
|
---|
469 | case WM_PAINT:
|
---|
470 | return DATETIME_Paint (hwnd, wParam);
|
---|
471 |
|
---|
472 | case WM_KILLFOCUS:
|
---|
473 | return DATETIME_KillFocus (hwnd, wParam, lParam);
|
---|
474 |
|
---|
475 | case WM_SETFOCUS:
|
---|
476 | return DATETIME_SetFocus (hwnd, wParam, lParam);
|
---|
477 |
|
---|
478 | case WM_LBUTTONDOWN:
|
---|
479 | return DATETIME_LButtonDown (hwnd, wParam, lParam);
|
---|
480 |
|
---|
481 | case WM_CREATE:
|
---|
482 | return DATETIME_Create (hwnd, wParam, lParam);
|
---|
483 |
|
---|
484 | case WM_DESTROY:
|
---|
485 | return DATETIME_Destroy (hwnd, wParam, lParam);
|
---|
486 |
|
---|
487 | default:
|
---|
488 | //if (uMsg >= WM_USER)
|
---|
489 | //ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
---|
490 | // uMsg, wParam, lParam);
|
---|
491 | return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
|
---|
492 | }
|
---|
493 | return 0;
|
---|
494 | }
|
---|
495 |
|
---|
496 |
|
---|
497 | VOID
|
---|
498 | DATETIME_Register (void)
|
---|
499 | {
|
---|
500 | WNDCLASSA wndClass;
|
---|
501 |
|
---|
502 | ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
---|
503 | wndClass.style = CS_GLOBALCLASS;
|
---|
504 | wndClass.lpfnWndProc = (WNDPROC)DATETIME_WindowProc;
|
---|
505 | wndClass.cbClsExtra = 0;
|
---|
506 | wndClass.cbWndExtra = sizeof(DATETIME_INFO *);
|
---|
507 | wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
---|
508 | wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
---|
509 | wndClass.lpszClassName = DATETIMEPICK_CLASSA;
|
---|
510 |
|
---|
511 | RegisterClassA (&wndClass);
|
---|
512 | }
|
---|
513 |
|
---|
514 |
|
---|
515 | VOID
|
---|
516 | DATETIME_Unregister (void)
|
---|
517 | {
|
---|
518 | UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL);
|
---|
519 | }
|
---|
520 |
|
---|