1 | /*
|
---|
2 | * Native Font control
|
---|
3 | *
|
---|
4 | * Copyright 1998, 1999 Eric Kohl
|
---|
5 | *
|
---|
6 | * This library is free software; you can redistribute it and/or
|
---|
7 | * modify it under the terms of the GNU Lesser General Public
|
---|
8 | * License as published by the Free Software Foundation; either
|
---|
9 | * version 2.1 of the License, or (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This library is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | * Lesser General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU Lesser General Public
|
---|
17 | * License along with this library; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
19 | *
|
---|
20 | * NOTES
|
---|
21 | * This is just a dummy control. An author is needed! Any volunteers?
|
---|
22 | * I will only improve this control once in a while.
|
---|
23 | * Eric <ekohl@abo.rhein-zeitung.de>
|
---|
24 | *
|
---|
25 | * TODO:
|
---|
26 | * - All messages.
|
---|
27 | * - All notifications.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #include <string.h>
|
---|
31 | #include "winbase.h"
|
---|
32 | #include "commctrl.h"
|
---|
33 | #include "wine/debug.h"
|
---|
34 |
|
---|
35 | WINE_DEFAULT_DEBUG_CHANNEL(nativefont);
|
---|
36 |
|
---|
37 | typedef struct
|
---|
38 | {
|
---|
39 | DWORD dwDummy; /* just to keep the compiler happy ;-) */
|
---|
40 | } NATIVEFONT_INFO;
|
---|
41 |
|
---|
42 | #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
|
---|
43 |
|
---|
44 |
|
---|
45 | static LRESULT
|
---|
46 | NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
47 | {
|
---|
48 | NATIVEFONT_INFO *infoPtr;
|
---|
49 |
|
---|
50 | /* allocate memory for info structure */
|
---|
51 | infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
|
---|
52 | SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
---|
53 |
|
---|
54 |
|
---|
55 | /* initialize info structure */
|
---|
56 |
|
---|
57 |
|
---|
58 | return 0;
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | static LRESULT
|
---|
63 | NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
---|
64 | {
|
---|
65 | NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd);
|
---|
66 |
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 | /* free comboex info data */
|
---|
71 | COMCTL32_Free (infoPtr);
|
---|
72 | SetWindowLongA( hwnd, 0, 0 );
|
---|
73 |
|
---|
74 | return 0;
|
---|
75 | }
|
---|
76 |
|
---|
77 |
|
---|
78 |
|
---|
79 | static LRESULT WINAPI
|
---|
80 | NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
---|
81 | {
|
---|
82 | if (!NATIVEFONT_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
|
---|
83 | return DefWindowProcA( hwnd, uMsg, wParam, lParam );
|
---|
84 |
|
---|
85 | switch (uMsg)
|
---|
86 | {
|
---|
87 |
|
---|
88 | case WM_CREATE:
|
---|
89 | return NATIVEFONT_Create (hwnd, wParam, lParam);
|
---|
90 |
|
---|
91 | case WM_DESTROY:
|
---|
92 | return NATIVEFONT_Destroy (hwnd, wParam, lParam);
|
---|
93 |
|
---|
94 | case WM_MOVE:
|
---|
95 | case WM_SIZE:
|
---|
96 | case WM_SHOWWINDOW:
|
---|
97 | case WM_WINDOWPOSCHANGING:
|
---|
98 | case WM_WINDOWPOSCHANGED:
|
---|
99 | case WM_SETFONT:
|
---|
100 | case WM_GETDLGCODE:
|
---|
101 | /* FIXME("message %04x seen but stubbed\n", uMsg); */
|
---|
102 | return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
---|
103 |
|
---|
104 | default:
|
---|
105 | ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
---|
106 | uMsg, wParam, lParam);
|
---|
107 | return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
---|
108 | }
|
---|
109 | return 0;
|
---|
110 | }
|
---|
111 |
|
---|
112 |
|
---|
113 | VOID
|
---|
114 | NATIVEFONT_Register (void)
|
---|
115 | {
|
---|
116 | WNDCLASSA wndClass;
|
---|
117 |
|
---|
118 | ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
---|
119 | wndClass.style = CS_GLOBALCLASS;
|
---|
120 | wndClass.lpfnWndProc = (WNDPROC)NATIVEFONT_WindowProc;
|
---|
121 | wndClass.cbClsExtra = 0;
|
---|
122 | wndClass.cbWndExtra = sizeof(NATIVEFONT_INFO *);
|
---|
123 | wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
---|
124 | wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
---|
125 | wndClass.lpszClassName = WC_NATIVEFONTCTLA;
|
---|
126 |
|
---|
127 | RegisterClassA (&wndClass);
|
---|
128 | }
|
---|
129 |
|
---|
130 |
|
---|
131 | VOID
|
---|
132 | NATIVEFONT_Unregister (void)
|
---|
133 | {
|
---|
134 | UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
|
---|
135 | }
|
---|
136 |
|
---|