Various cosmetic changes.
[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 <string.h>
17 #include "winbase.h"
18 #include "commctrl.h"
19 #include "debugtools.h"
20
21 DEFAULT_DEBUG_CHANNEL(nativefont);
22
23 typedef struct
24 {
25     DWORD  dwDummy;   /* just to keep the compiler happy ;-) */
26 } NATIVEFONT_INFO;
27
28 #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
29
30
31 static LRESULT
32 NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
33 {
34     NATIVEFONT_INFO *infoPtr;
35
36     /* allocate memory for info structure */
37     infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
38     SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
39
40
41     /* initialize info structure */
42
43
44     return 0;
45 }
46
47
48 static LRESULT
49 NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
50 {
51     NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd);
52
53
54
55
56     /* free comboex info data */
57     COMCTL32_Free (infoPtr);
58     SetWindowLongA( hwnd, 0, 0 );
59
60     return 0;
61 }
62
63
64
65 static LRESULT WINAPI
66 NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
67 {
68     if (!NATIVEFONT_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
69         return DefWindowProcA( hwnd, uMsg, wParam, lParam );
70
71     switch (uMsg)
72     {
73
74         case WM_CREATE:
75             return NATIVEFONT_Create (hwnd, wParam, lParam);
76
77         case WM_DESTROY:
78             return NATIVEFONT_Destroy (hwnd, wParam, lParam);
79
80         case WM_MOVE:
81         case WM_SIZE:
82         case WM_SHOWWINDOW:
83         case WM_WINDOWPOSCHANGING:
84         case WM_WINDOWPOSCHANGED:
85         case WM_SETFONT:
86         case WM_GETDLGCODE:
87             /* FIXME("message %04x seen but stubbed\n", uMsg); */
88             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
89
90         default:
91             ERR("unknown msg %04x wp=%08x lp=%08lx\n",
92                      uMsg, wParam, lParam);
93             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
94     }
95     return 0;
96 }
97
98
99 VOID
100 NATIVEFONT_Register (void)
101 {
102     WNDCLASSA wndClass;
103
104     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
105     wndClass.style         = CS_GLOBALCLASS;
106     wndClass.lpfnWndProc   = (WNDPROC)NATIVEFONT_WindowProc;
107     wndClass.cbClsExtra    = 0;
108     wndClass.cbWndExtra    = sizeof(NATIVEFONT_INFO *);
109     wndClass.hCursor       = LoadCursorA (0, IDC_ARROWA);
110     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
111     wndClass.lpszClassName = WC_NATIVEFONTCTLA;
112  
113     RegisterClassA (&wndClass);
114 }
115
116
117 VOID
118 NATIVEFONT_Unregister (void)
119 {
120     UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
121 }
122