New Files. Added 'date and time picker' and 'month calendar' control
[wine/multimedia.git] / dlls / comctl32 / monthcal.c
blobeb29519db28c05a4645a8054e8719b8c37049e50
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 "windows.h"
18 #include "commctrl.h"
19 #include "monthcal.h"
20 #include "win.h"
21 #include "debug.h"
24 #define MONTHCAL_GetInfoPtr(wndPtr) ((MONTHCAL_INFO *)wndPtr->wExtra[0])
31 static LRESULT
32 MONTHCAL_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
34 MONTHCAL_INFO *infoPtr;
36 /* allocate memory for info structure */
37 infoPtr = (MONTHCAL_INFO *)COMCTL32_Alloc (sizeof(MONTHCAL_INFO));
38 wndPtr->wExtra[0] = (DWORD)infoPtr;
40 if (infoPtr == NULL) {
41 ERR (monthcal, "could not allocate info memory!\n");
42 return 0;
45 if ((MONTHCAL_INFO*)wndPtr->wExtra[0] != infoPtr) {
46 ERR (monthcal, "pointer assignment error!\n");
47 return 0;
50 /* initialize info structure */
54 return 0;
58 static LRESULT
59 MONTHCAL_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
61 MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(wndPtr);
68 /* free ipaddress info data */
69 COMCTL32_Free (infoPtr);
71 return 0;
77 LRESULT WINAPI
78 MONTHCAL_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
80 WND *wndPtr = WIN_FindWndPtr(hwnd);
82 switch (uMsg)
86 case WM_CREATE:
87 return MONTHCAL_Create (wndPtr, wParam, lParam);
89 case WM_DESTROY:
90 return MONTHCAL_Destroy (wndPtr, wParam, lParam);
92 default:
93 if (uMsg >= WM_USER)
94 ERR (monthcal, "unknown msg %04x wp=%08x lp=%08lx\n",
95 uMsg, wParam, lParam);
96 return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
98 return 0;
102 VOID
103 MONTHCAL_Register (VOID)
105 WNDCLASS32A wndClass;
107 if (GlobalFindAtom32A (MONTHCAL_CLASS32A)) return;
109 ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
110 wndClass.style = CS_GLOBALCLASS;
111 wndClass.lpfnWndProc = (WNDPROC32)MONTHCAL_WindowProc;
112 wndClass.cbClsExtra = 0;
113 wndClass.cbWndExtra = sizeof(MONTHCAL_INFO *);
114 wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);
115 wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
116 wndClass.lpszClassName = MONTHCAL_CLASS32A;
118 RegisterClass32A (&wndClass);
122 VOID
123 MONTHCAL_Unregister (VOID)
125 if (GlobalFindAtom32A (MONTHCAL_CLASS32A))
126 UnregisterClass32A (MONTHCAL_CLASS32A, (HINSTANCE32)NULL);