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

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

New Comctl32 controls - not all are compiling/linking yet!

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