source: trunk/src/comctl32/datetime.c@ 60

Last change on this file since 60 was 60, checked in by achimha, 26 years ago

* empty log message *

File size: 3.5 KB
Line 
1/*
2 * Date and time picker control
3 *
4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 1999 Achim Hasenmueller
6 *
7 * NOTES
8 * This is just a dummy control. An author is needed! Any volunteers?
9 * I will only improve this control once in a while.
10 * Eric <ekohl@abo.rhein-zeitung.de>
11 *
12 * TODO:
13 * - All messages.
14 * - All notifications.
15 *
16 */
17
18#include "winbase.h"
19#include "commctrl.h"
20#include "datetime.h"
21
22
23
24#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
25
26
27
28
29
30
31static LRESULT
32DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
33{
34 DATETIME_INFO *infoPtr;
35
36 /* allocate memory for info structure */
37 infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO));
38 if (infoPtr == NULL) {
39// ERR (datetime, "could not allocate info memory!\n");
40 return 0;
41 }
42
43 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
44
45
46 /* initialize info structure */
47
48
49
50 return 0;
51}
52
53
54static LRESULT
55DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
56{
57 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
58
59 /* free datetime info data */
60 COMCTL32_Free (infoPtr);
61
62 return 0;
63}
64
65
66
67
68LRESULT WINAPI
69DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
70{
71 switch (uMsg)
72 {
73
74 case DTM_GETSYSTEMTIME:
75// FIXME (datetime, "Unimplemented msg DTM_GETSYSTEMTIME\n");
76 return GDT_VALID;
77
78 case DTM_SETSYSTEMTIME:
79// FIXME (datetime, "Unimplemented msg DTM_SETSYSTEMTIME\n");
80 return 1;
81
82 case DTM_GETRANGE:
83// FIXME (datetime, "Unimplemented msg DTM_GETRANGE\n");
84 return 0;
85
86 case DTM_SETRANGE:
87// FIXME (datetime, "Unimplemented msg DTM_SETRANGE\n");
88 return 1;
89
90 case DTM_SETFORMATA:
91// FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32A\n");
92 return 1;
93
94 case DTM_SETFORMATW:
95// FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32W\n");
96 return 1;
97
98 case DTM_SETMCCOLOR:
99// FIXME (datetime, "Unimplemented msg DTM_SETMCCOLOR\n");
100 return 0;
101
102 case DTM_GETMCCOLOR:
103// FIXME (datetime, "Unimplemented msg DTM_GETMCCOLOR\n");
104 return 0;
105
106 case DTM_GETMONTHCAL:
107// FIXME (datetime, "Unimplemented msg DTM_GETMONTHCAL\n");
108 return 0;
109
110 case DTM_SETMCFONT:
111// FIXME (datetime, "Unimplemented msg DTM_SETMCFONT\n");
112 return 0;
113
114 case DTM_GETMCFONT:
115// FIXME (datetime, "Unimplemented msg DTM_GETMCFONT\n");
116 return 0;
117
118 case WM_CREATE:
119 return DATETIME_Create (hwnd, wParam, lParam);
120
121 case WM_DESTROY:
122 return DATETIME_Destroy (hwnd, wParam, lParam);
123
124 default:
125// if (uMsg >= WM_USER)
126// ERR (datetime, "unknown msg %04x wp=%08x lp=%08lx\n",
127// uMsg, wParam, lParam);
128 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
129 }
130 return 0;
131}
132
133
134VOID
135DATETIME_Register (VOID)
136{
137 WNDCLASSA wndClass;
138
139 if (GlobalFindAtomA (DATETIMEPICK_CLASSA)) return;
140
141 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
142 wndClass.style = CS_GLOBALCLASS;
143 wndClass.lpfnWndProc = (WNDPROC)DATETIME_WindowProc;
144 wndClass.cbClsExtra = 0;
145 wndClass.cbWndExtra = sizeof(DATETIME_INFO *);
146 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
147 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
148 wndClass.lpszClassName = DATETIMEPICK_CLASSA;
149
150 RegisterClassA (&wndClass);
151}
152
153
154VOID
155DATETIME_Unregister (VOID)
156{
157 if (GlobalFindAtomA (DATETIMEPICK_CLASSA))
158 UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL);
159}
160
Note: See TracBrowser for help on using the repository browser.