Large-scale renaming of all Win32 functions and types to use the
[wine] / dlls / comctl32 / monthcal.c
1 /*
2  * Month calendar 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 "commctrl.h"
18 #include "monthcal.h"
19 #include "win.h"
20 #include "debug.h"
21
22
23 #define MONTHCAL_GetInfoPtr(wndPtr) ((MONTHCAL_INFO *)wndPtr->wExtra[0])
24
25
26
27
28
29
30 static LRESULT
31 MONTHCAL_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
32 {
33     MONTHCAL_INFO *infoPtr;
34
35     /* allocate memory for info structure */
36     infoPtr = (MONTHCAL_INFO *)COMCTL32_Alloc (sizeof(MONTHCAL_INFO));
37     wndPtr->wExtra[0] = (DWORD)infoPtr;
38
39     if (infoPtr == NULL) {
40         ERR (monthcal, "could not allocate info memory!\n");
41         return 0;
42     }
43
44     if ((MONTHCAL_INFO*)wndPtr->wExtra[0] != infoPtr) {
45         ERR (monthcal, "pointer assignment error!\n");
46         return 0;
47     }
48
49     /* initialize info structure */
50
51
52
53     return 0;
54 }
55
56
57 static LRESULT
58 MONTHCAL_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
59 {
60     MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(wndPtr);
61
62
63
64
65
66
67     /* free ipaddress info data */
68     COMCTL32_Free (infoPtr);
69
70     return 0;
71 }
72
73
74
75
76 LRESULT WINAPI
77 MONTHCAL_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
78 {
79     WND *wndPtr = WIN_FindWndPtr(hwnd);
80
81     switch (uMsg)
82     {
83
84
85         case WM_CREATE:
86             return MONTHCAL_Create (wndPtr, wParam, lParam);
87
88         case WM_DESTROY:
89             return MONTHCAL_Destroy (wndPtr, wParam, lParam);
90
91         default:
92             if (uMsg >= WM_USER)
93                 ERR (monthcal, "unknown msg %04x wp=%08x lp=%08lx\n",
94                      uMsg, wParam, lParam);
95             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
96     }
97     return 0;
98 }
99
100
101 VOID
102 MONTHCAL_Register (VOID)
103 {
104     WNDCLASSA wndClass;
105
106     if (GlobalFindAtomA (MONTHCAL_CLASSA)) return;
107
108     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
109     wndClass.style         = CS_GLOBALCLASS;
110     wndClass.lpfnWndProc   = (WNDPROC)MONTHCAL_WindowProc;
111     wndClass.cbClsExtra    = 0;
112     wndClass.cbWndExtra    = sizeof(MONTHCAL_INFO *);
113     wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
114     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
115     wndClass.lpszClassName = MONTHCAL_CLASSA;
116  
117     RegisterClassA (&wndClass);
118 }
119
120
121 VOID
122 MONTHCAL_Unregister (VOID)
123 {
124     if (GlobalFindAtomA (MONTHCAL_CLASSA))
125         UnregisterClassA (MONTHCAL_CLASSA, (HINSTANCE)NULL);
126 }
127