Lots of new defines and stubs.
[wine] / dlls / comctl32 / datetime.c
1 /*
2  * Date and time picker control
3  *
4  * Copyright 1998 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 "windows.h"
18 #include "commctrl.h"
19 #include "datetime.h"
20 #include "win.h"
21 #include "debug.h"
22
23
24 #define DATETIME_GetInfoPtr(wndPtr) ((DATETIME_INFO *)wndPtr->wExtra[0])
25
26
27
28
29
30
31 static LRESULT
32 DATETIME_Create (WND *wndPtr, WPARAM32 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     wndPtr->wExtra[0] = (DWORD)infoPtr;
39
40     if (infoPtr == NULL) {
41         ERR (datetime, "could not allocate info memory!\n");
42         return 0;
43     }
44
45     if ((DATETIME_INFO*)wndPtr->wExtra[0] != infoPtr) {
46         ERR (datetime, "pointer assignment error!\n");
47         return 0;
48     }
49
50     /* initialize info structure */
51
52
53
54     return 0;
55 }
56
57
58 static LRESULT
59 DATETIME_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
60 {
61     DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr(wndPtr);
62
63
64
65
66
67
68     /* free ipaddress info data */
69     COMCTL32_Free (infoPtr);
70
71     return 0;
72 }
73
74
75
76
77 LRESULT WINAPI
78 DATETIME_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
79 {
80     WND *wndPtr = WIN_FindWndPtr(hwnd);
81
82     switch (uMsg)
83     {
84
85
86         case WM_CREATE:
87             return DATETIME_Create (wndPtr, wParam, lParam);
88
89         case WM_DESTROY:
90             return DATETIME_Destroy (wndPtr, wParam, lParam);
91
92         default:
93             if (uMsg >= WM_USER)
94                 ERR (datetime, "unknown msg %04x wp=%08x lp=%08lx\n",
95                      uMsg, wParam, lParam);
96             return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
97     }
98     return 0;
99 }
100
101
102 VOID
103 DATETIME_Register (VOID)
104 {
105     WNDCLASS32A wndClass;
106
107     if (GlobalFindAtom32A (DATETIMEPICK_CLASS32A)) return;
108
109     ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
110     wndClass.style         = CS_GLOBALCLASS;
111     wndClass.lpfnWndProc   = (WNDPROC32)DATETIME_WindowProc;
112     wndClass.cbClsExtra    = 0;
113     wndClass.cbWndExtra    = sizeof(DATETIME_INFO *);
114     wndClass.hCursor       = LoadCursor32A (0, IDC_ARROW32A);
115     wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
116     wndClass.lpszClassName = DATETIMEPICK_CLASS32A;
117  
118     RegisterClass32A (&wndClass);
119 }
120
121
122 VOID
123 DATETIME_Unregister (VOID)
124 {
125     if (GlobalFindAtom32A (DATETIMEPICK_CLASS32A))
126         UnregisterClass32A (DATETIMEPICK_CLASS32A, (HINSTANCE32)NULL);
127 }
128