Release 990225.
[wine/multimedia.git] / dlls / comctl32 / monthcal.c
blob3ccc94656b3781130bee5badcd5dca34ebd4495f
1 /*
2 * Month calendar 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 "commctrl.h"
18 #include "monthcal.h"
19 #include "win.h"
20 #include "debug.h"
23 #define MONTHCAL_GetInfoPtr(wndPtr) ((MONTHCAL_INFO *)wndPtr->wExtra[0])
30 static LRESULT
31 MONTHCAL_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
33 MONTHCAL_INFO *infoPtr;
35 /* allocate memory for info structure */
36 infoPtr = (MONTHCAL_INFO *)COMCTL32_Alloc (sizeof(MONTHCAL_INFO));
37 wndPtr->wExtra[0] = (DWORD)infoPtr;
39 if (infoPtr == NULL) {
40 ERR (monthcal, "could not allocate info memory!\n");
41 return 0;
44 if ((MONTHCAL_INFO*)wndPtr->wExtra[0] != infoPtr) {
45 ERR (monthcal, "pointer assignment error!\n");
46 return 0;
49 /* initialize info structure */
53 return 0;
57 static LRESULT
58 MONTHCAL_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
60 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(wndPtr);
67 /* free ipaddress info data */
68 COMCTL32_Free (infoPtr);
70 return 0;
76 LRESULT WINAPI
77 MONTHCAL_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
79 WND *wndPtr = WIN_FindWndPtr(hwnd);
81 switch (uMsg)
85 case WM_CREATE:
86 return MONTHCAL_Create (wndPtr, wParam, lParam);
88 case WM_DESTROY:
89 return MONTHCAL_Destroy (wndPtr, wParam, lParam);
91 default:
92 if (uMsg >= WM_USER)
93 ERR (monthcal, "unknown msg %04x wp=%08x lp=%08lx\n",
94 uMsg, wParam, lParam);
95 return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
97 return 0;
101 VOID
102 MONTHCAL_Register (VOID)
104 WNDCLASS32A wndClass;
106 if (GlobalFindAtom32A (MONTHCAL_CLASS32A)) return;
108 ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
109 wndClass.style = CS_GLOBALCLASS;
110 wndClass.lpfnWndProc = (WNDPROC32)MONTHCAL_WindowProc;
111 wndClass.cbClsExtra = 0;
112 wndClass.cbWndExtra = sizeof(MONTHCAL_INFO *);
113 wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);
114 wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
115 wndClass.lpszClassName = MONTHCAL_CLASS32A;
117 RegisterClass32A (&wndClass);
121 VOID
122 MONTHCAL_Unregister (VOID)
124 if (GlobalFindAtom32A (MONTHCAL_CLASS32A))
125 UnregisterClass32A (MONTHCAL_CLASS32A, (HINSTANCE32)NULL);