Large-scale renaming of all Win32 functions and types to use the
[wine.git] / dlls / comctl32 / datetime.c
blobbb5a01670d82ba09dd77e3bb034b8b86ecd27354
1 /*
2 * Date and time picker control
4 * Copyright 1998 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 "win.h"
18 #include "commctrl.h"
19 #include "datetime.h"
20 #include "debug.h"
23 #define DATETIME_GetInfoPtr(wndPtr) ((DATETIME_INFO *)wndPtr->wExtra[0])
30 static LRESULT
31 DATETIME_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
33 DATETIME_INFO *infoPtr;
35 /* allocate memory for info structure */
36 infoPtr = (DATETIME_INFO *)COMCTL32_Alloc (sizeof(DATETIME_INFO));
37 wndPtr->wExtra[0] = (DWORD)infoPtr;
39 if (infoPtr == NULL) {
40 ERR (datetime, "could not allocate info memory!\n");
41 return 0;
44 if ((DATETIME_INFO*)wndPtr->wExtra[0] != infoPtr) {
45 ERR (datetime, "pointer assignment error!\n");
46 return 0;
49 /* initialize info structure */
53 return 0;
57 static LRESULT
58 DATETIME_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
60 DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr(wndPtr);
62 /* free datetime info data */
63 COMCTL32_Free (infoPtr);
65 return 0;
71 LRESULT WINAPI
72 DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
74 WND *wndPtr = WIN_FindWndPtr(hwnd);
76 switch (uMsg)
79 case DTM_GETSYSTEMTIME:
80 FIXME (datetime, "Unimplemented msg DTM_GETSYSTEMTIME\n");
81 return GDT_VALID;
83 case DTM_SETSYSTEMTIME:
84 FIXME (datetime, "Unimplemented msg DTM_SETSYSTEMTIME\n");
85 return 1;
87 case DTM_GETRANGE:
88 FIXME (datetime, "Unimplemented msg DTM_GETRANGE\n");
89 return 0;
91 case DTM_SETRANGE:
92 FIXME (datetime, "Unimplemented msg DTM_SETRANGE\n");
93 return 1;
95 case DTM_SETFORMATA:
96 FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32A\n");
97 return 1;
99 case DTM_SETFORMATW:
100 FIXME (datetime, "Unimplemented msg DTM_SETFORMAT32W\n");
101 return 1;
103 case DTM_SETMCCOLOR:
104 FIXME (datetime, "Unimplemented msg DTM_SETMCCOLOR\n");
105 return 0;
107 case DTM_GETMCCOLOR:
108 FIXME (datetime, "Unimplemented msg DTM_GETMCCOLOR\n");
109 return 0;
111 case DTM_GETMONTHCAL:
112 FIXME (datetime, "Unimplemented msg DTM_GETMONTHCAL\n");
113 return 0;
115 case DTM_SETMCFONT:
116 FIXME (datetime, "Unimplemented msg DTM_SETMCFONT\n");
117 return 0;
119 case DTM_GETMCFONT:
120 FIXME (datetime, "Unimplemented msg DTM_GETMCFONT\n");
121 return 0;
123 case WM_CREATE:
124 return DATETIME_Create (wndPtr, wParam, lParam);
126 case WM_DESTROY:
127 return DATETIME_Destroy (wndPtr, wParam, lParam);
129 default:
130 if (uMsg >= WM_USER)
131 ERR (datetime, "unknown msg %04x wp=%08x lp=%08lx\n",
132 uMsg, wParam, lParam);
133 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
135 return 0;
139 VOID
140 DATETIME_Register (VOID)
142 WNDCLASSA wndClass;
144 if (GlobalFindAtomA (DATETIMEPICK_CLASSA)) return;
146 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
147 wndClass.style = CS_GLOBALCLASS;
148 wndClass.lpfnWndProc = (WNDPROC)DATETIME_WindowProc;
149 wndClass.cbClsExtra = 0;
150 wndClass.cbWndExtra = sizeof(DATETIME_INFO *);
151 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
152 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
153 wndClass.lpszClassName = DATETIMEPICK_CLASSA;
155 RegisterClassA (&wndClass);
159 VOID
160 DATETIME_Unregister (VOID)
162 if (GlobalFindAtomA (DATETIMEPICK_CLASSA))
163 UnregisterClassA (DATETIMEPICK_CLASSA, (HINSTANCE)NULL);