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