Optimized include/*.h: (recursively) include all headers needed by
[wine] / dlls / comctl32 / nativefont.c
1 /*
2  * Native Font 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 #include "commctrl.h"
17 #include "nativefont.h"
18 #include "win.h"
19 #include "debug.h"
20
21
22 #define NATIVEFONT_GetInfoPtr(wndPtr) ((NATIVEFONT_INFO *)wndPtr->wExtra[0])
23
24
25
26
27 static LRESULT
28 NATIVEFONT_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
29 {
30     NATIVEFONT_INFO *infoPtr;
31
32     /* allocate memory for info structure */
33     infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
34     wndPtr->wExtra[0] = (DWORD)infoPtr;
35
36     if (infoPtr == NULL) {
37         ERR (listview, "could not allocate info memory!\n");
38         return 0;
39     }
40
41     if ((NATIVEFONT_INFO*)wndPtr->wExtra[0] != infoPtr) {
42         ERR (listview, "pointer assignment error!\n");
43         return 0;
44     }
45
46     /* initialize info structure */
47
48
49     return 0;
50 }
51
52
53 static LRESULT
54 NATIVEFONT_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
55 {
56     NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(wndPtr);
57
58
59
60
61     /* free comboex info data */
62     COMCTL32_Free (infoPtr);
63
64     return 0;
65 }
66
67
68
69 LRESULT WINAPI
70 NATIVEFONT_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
71 {
72     WND *wndPtr = WIN_FindWndPtr(hwnd);
73
74     switch (uMsg)
75     {
76
77         case WM_CREATE:
78             return NATIVEFONT_Create (wndPtr, wParam, lParam);
79
80         case WM_DESTROY:
81             return NATIVEFONT_Destroy (wndPtr, wParam, lParam);
82
83         default:
84             ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n",
85                      uMsg, wParam, lParam);
86             return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
87     }
88     return 0;
89 }
90
91
92 VOID
93 NATIVEFONT_Register (VOID)
94 {
95     WNDCLASS32A wndClass;
96
97     if (GlobalFindAtom32A (WC_NATIVEFONTCTL32A)) return;
98
99     ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
100     wndClass.style         = CS_GLOBALCLASS;
101     wndClass.lpfnWndProc   = (WNDPROC32)NATIVEFONT_WindowProc;
102     wndClass.cbClsExtra    = 0;
103     wndClass.cbWndExtra    = sizeof(NATIVEFONT_INFO *);
104     wndClass.hCursor       = LoadCursor32A (0, IDC_ARROW32A);
105     wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
106     wndClass.lpszClassName = WC_NATIVEFONTCTL32A;
107  
108     RegisterClass32A (&wndClass);
109 }
110
111
112 VOID
113 NATIVEFONT_Unregister (VOID)
114 {
115     if (GlobalFindAtom32A (WC_NATIVEFONTCTL32A))
116         UnregisterClass32A (WC_NATIVEFONTCTL32A, (HINSTANCE32)NULL);
117 }
118