Large-scale renaming of all Win32 functions and types to use the
[wine.git] / dlls / comctl32 / nativefont.c
blob64d4afc52e8c4a9aebe5b6639113e21e0488ccea
1 /*
2 * Native Font 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.
16 #include "commctrl.h"
17 #include "nativefont.h"
18 #include "win.h"
19 #include "debug.h"
22 #define NATIVEFONT_GetInfoPtr(wndPtr) ((NATIVEFONT_INFO *)wndPtr->wExtra[0])
27 static LRESULT
28 NATIVEFONT_Create (WND *wndPtr, WPARAM wParam, LPARAM lParam)
30 NATIVEFONT_INFO *infoPtr;
32 /* allocate memory for info structure */
33 infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
34 wndPtr->wExtra[0] = (DWORD)infoPtr;
36 if (infoPtr == NULL) {
37 ERR (listview, "could not allocate info memory!\n");
38 return 0;
41 if ((NATIVEFONT_INFO*)wndPtr->wExtra[0] != infoPtr) {
42 ERR (listview, "pointer assignment error!\n");
43 return 0;
46 /* initialize info structure */
49 return 0;
53 static LRESULT
54 NATIVEFONT_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
56 NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(wndPtr);
61 /* free comboex info data */
62 COMCTL32_Free (infoPtr);
64 return 0;
69 LRESULT WINAPI
70 NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
72 WND *wndPtr = WIN_FindWndPtr(hwnd);
74 switch (uMsg)
77 case WM_CREATE:
78 return NATIVEFONT_Create (wndPtr, wParam, lParam);
80 case WM_DESTROY:
81 return NATIVEFONT_Destroy (wndPtr, wParam, lParam);
83 default:
84 ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n",
85 uMsg, wParam, lParam);
86 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
88 return 0;
92 VOID
93 NATIVEFONT_Register (VOID)
95 WNDCLASSA wndClass;
97 if (GlobalFindAtomA (WC_NATIVEFONTCTLA)) return;
99 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
100 wndClass.style = CS_GLOBALCLASS;
101 wndClass.lpfnWndProc = (WNDPROC)NATIVEFONT_WindowProc;
102 wndClass.cbClsExtra = 0;
103 wndClass.cbWndExtra = sizeof(NATIVEFONT_INFO *);
104 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
105 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
106 wndClass.lpszClassName = WC_NATIVEFONTCTLA;
108 RegisterClassA (&wndClass);
112 VOID
113 NATIVEFONT_Unregister (VOID)
115 if (GlobalFindAtomA (WC_NATIVEFONTCTLA))
116 UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);