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

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

Added CVS tag to many files (comctl32 and headers) .

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