Removed a few dependencies on kernel32 functions.
[wine] / dlls / comctl32 / nativefont.c
1 /*
2  * Native Font control
3  *
4  * Copyright 1998, 1999 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 "winbase.h"
17 #include "commctrl.h"
18 #include "debugtools.h"
19
20 DEFAULT_DEBUG_CHANNEL(nativefont);
21
22 typedef struct
23 {
24     DWORD  dwDummy;   /* just to keep the compiler happy ;-) */
25 } NATIVEFONT_INFO;
26
27 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
28
29
30 static LRESULT
31 NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
32 {
33     NATIVEFONT_INFO *infoPtr;
34
35     /* allocate memory for info structure */
36     infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
37     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
38
39
40     /* initialize info structure */
41
42
43     return 0;
44 }
45
46
47 static LRESULT
48 NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
49 {
50     NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd);
51
52
53
54
55     /* free comboex info data */
56     COMCTL32_Free (infoPtr);
57
58     return 0;
59 }
60
61
62
63 static LRESULT WINAPI
64 NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
65 {
66     switch (uMsg)
67     {
68
69         case WM_CREATE:
70             return NATIVEFONT_Create (hwnd, wParam, lParam);
71
72         case WM_DESTROY:
73             return NATIVEFONT_Destroy (hwnd, wParam, lParam);
74
75         default:
76             ERR("unknown msg %04x wp=%08x lp=%08lx\n",
77                      uMsg, wParam, lParam);
78             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
79     }
80     return 0;
81 }
82
83
84 VOID
85 NATIVEFONT_Register (void)
86 {
87     WNDCLASSA wndClass;
88
89     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
90     wndClass.style         = CS_GLOBALCLASS;
91     wndClass.lpfnWndProc   = (WNDPROC)NATIVEFONT_WindowProc;
92     wndClass.cbClsExtra    = 0;
93     wndClass.cbWndExtra    = sizeof(NATIVEFONT_INFO *);
94     wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
95     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
96     wndClass.lpszClassName = WC_NATIVEFONTCTLA;
97  
98     RegisterClassA (&wndClass);
99 }
100
101
102 VOID
103 NATIVEFONT_Unregister (void)
104 {
105     UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
106 }
107