New debug scheme with explicit debug channels declaration.
[wine/hacks.git] / dlls / comctl32 / datetime.c
blobed22a25aaa5e2a122263563a63dc828f55963f11
1 /*
2 * Date and time picker control
4 * Copyright 1998, 1999 Eric Kohl
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>
11 * TODO:
12 * - All messages.
13 * - All notifications.
17 #include "winbase.h"
18 #include "commctrl.h"
19 #include "datetime.h"
20 #include "debug.h"
22 DEFAULT_DEBUG_CHANNEL(datetime)
25 #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
32 static LRESULT
33 DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
35 DATETIME_INFO *infoPtr;
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;
44 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
47 /* initialize info structure */
51 return 0;
55 static LRESULT
56 DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
58 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd);
60 /* free datetime info data */
61 COMCTL32_Free (infoPtr);
63 return 0;
69 LRESULT WINAPI
70 DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
72 switch (uMsg)
75 case DTM_GETSYSTEMTIME:
76 FIXME (datetime, "Unimplemented msg DTM_GETSYSTEMTIME\n");
77 return GDT_VALID;
79 case DTM_SETSYSTEMTIME:
80 FIXME (datetime, "Unimplemented msg DTM_SETSYSTEMTIME\n");
81 return 1;
83 case DTM_GETRANGE:
84 FIXME (datetime, "Unimplemented msg DTM_GETRANGE\n");
85 return 0;
87 case DTM_SETRANGE:
88 FIXME (datetime, "Unimplemented msg DTM_SETRANGE\n");
89 return 1;
91 case DTM_SETFORMATA:
92 FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32A\n");
93 return 1;
95 case DTM_SETFORMATW:
96 FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32W\n");
97 return 1;
99 case DTM_SETMCCOLOR:
100 FIXME (datetime, "Unimplemented msg DTM_SETMCCOLOR\n");
101 return 0;
103 case DTM_GETMCCOLOR:
104 FIXME (datetime, "Unimplemented msg DTM_GETMCCOLOR\n");
105 return 0;
107 case DTM_GETMONTHCAL:
108 FIXME (datetime, "Unimplemented msg DTM_GETMONTHCAL\n");
109 return 0;
111 case DTM_SETMCFONT:
112 FIXME (datetime, "Unimplemented msg DTM_SETMCFONT\n");
113 return 0;
115 case DTM_GETMCFONT:
116 FIXME (datetime, "Unimplemented msg DTM_GETMCFONT\n");
117 return 0;
119 case WM_CREATE:
120 return DATETIME_Create (hwnd, wParam, lParam);
122 case WM_DESTROY:
123 return DATETIME_Destroy (hwnd, wParam, lParam);
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);
131 return 0;
135 VOID
136 DATETIME_Register (VOID)
138 WNDCLASSA wndClass;
140 if (GlobalFindAtomA (DATETIMEPICK_CLASSA)) return;
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;
151 RegisterClassA (&wndClass);
155 VOID
156 DATETIME_Unregister (VOID)
158 if (GlobalFindAtomA (DATETIMEPICK_CLASSA))
159 UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL);