1998-10-11 13:17:47 +00:00
|
|
|
/*
|
|
|
|
* Native Font control
|
|
|
|
*
|
1999-03-12 17:42:50 +00:00
|
|
|
* Copyright 1998, 1999 Eric Kohl
|
1998-10-11 13:17:47 +00:00
|
|
|
*
|
2002-03-09 23:29:33 +00:00
|
|
|
* 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
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-09 23:29:33 +00:00
|
|
|
*
|
1998-10-11 13:17:47 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2004-11-01 21:08:10 +00:00
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "windef.h"
|
1999-03-16 10:53:11 +00:00
|
|
|
#include "winbase.h"
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "wingdi.h"
|
|
|
|
#include "winuser.h"
|
1998-10-11 13:17:47 +00:00
|
|
|
#include "commctrl.h"
|
2003-09-17 20:15:21 +00:00
|
|
|
#include "comctl32.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
1998-10-11 13:17:47 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(nativefont);
|
1999-04-19 14:56:29 +00:00
|
|
|
|
2000-08-09 00:41:17 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2004-11-01 21:08:10 +00:00
|
|
|
HWND hwndSelf; /* my own handle */
|
2000-08-09 00:41:17 +00:00
|
|
|
} NATIVEFONT_INFO;
|
1998-10-11 13:17:47 +00:00
|
|
|
|
2004-08-25 17:33:01 +00:00
|
|
|
#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0))
|
1998-10-11 13:17:47 +00:00
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 17:42:50 +00:00
|
|
|
NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-10-11 13:17:47 +00:00
|
|
|
{
|
|
|
|
NATIVEFONT_INFO *infoPtr;
|
|
|
|
|
|
|
|
/* allocate memory for info structure */
|
2003-09-22 21:32:33 +00:00
|
|
|
infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO));
|
2004-08-25 17:33:01 +00:00
|
|
|
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
|
1998-10-11 13:17:47 +00:00
|
|
|
|
|
|
|
/* initialize info structure */
|
2004-11-01 21:08:10 +00:00
|
|
|
infoPtr->hwndSelf = hwnd;
|
1998-10-11 13:17:47 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT
|
2004-11-01 21:08:10 +00:00
|
|
|
NATIVEFONT_Destroy (NATIVEFONT_INFO *infoPtr)
|
1998-10-11 13:17:47 +00:00
|
|
|
{
|
2004-11-01 21:08:10 +00:00
|
|
|
/* free control info data */
|
|
|
|
SetWindowLongPtrW( infoPtr->hwndSelf, 0, 0 );
|
2003-09-22 21:32:33 +00:00
|
|
|
Free (infoPtr);
|
1998-10-11 13:17:47 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-07-31 14:41:43 +00:00
|
|
|
static LRESULT WINAPI
|
1999-02-26 11:11:13 +00:00
|
|
|
NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1998-10-11 13:17:47 +00:00
|
|
|
{
|
2004-11-01 21:08:10 +00:00
|
|
|
NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(hwnd);
|
|
|
|
|
|
|
|
TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n",
|
|
|
|
hwnd, uMsg, wParam, lParam);
|
|
|
|
|
|
|
|
if (!infoPtr && (uMsg != WM_CREATE))
|
|
|
|
return DefWindowProcW( hwnd, uMsg, wParam, lParam );
|
2001-02-12 03:42:23 +00:00
|
|
|
|
1998-10-11 13:17:47 +00:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
1999-03-12 17:42:50 +00:00
|
|
|
return NATIVEFONT_Create (hwnd, wParam, lParam);
|
1998-10-11 13:17:47 +00:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
2004-11-01 21:08:10 +00:00
|
|
|
return NATIVEFONT_Destroy (infoPtr);
|
1998-10-11 13:17:47 +00:00
|
|
|
|
2002-01-29 17:11:30 +00:00
|
|
|
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); */
|
2004-11-01 21:08:10 +00:00
|
|
|
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
|
2002-01-29 17:11:30 +00:00
|
|
|
|
1998-10-11 13:17:47 +00:00
|
|
|
default:
|
2004-11-01 21:08:10 +00:00
|
|
|
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
|
|
|
|
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
1998-10-11 13:17:47 +00:00
|
|
|
uMsg, wParam, lParam);
|
2004-11-01 21:08:10 +00:00
|
|
|
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
|
1998-10-11 13:17:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 08:27:49 +00:00
|
|
|
NATIVEFONT_Register (void)
|
1998-10-11 13:17:47 +00:00
|
|
|
{
|
2004-11-01 21:08:10 +00:00
|
|
|
WNDCLASSW wndClass;
|
1998-10-11 13:17:47 +00:00
|
|
|
|
2004-11-01 21:08:10 +00:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
|
1998-10-11 13:17:47 +00:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
2004-11-06 03:49:03 +00:00
|
|
|
wndClass.lpfnWndProc = NATIVEFONT_WindowProc;
|
1998-10-11 13:17:47 +00:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(NATIVEFONT_INFO *);
|
2004-11-01 21:08:10 +00:00
|
|
|
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
|
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
|
|
|
wndClass.lpszClassName = WC_NATIVEFONTCTLW;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2004-11-01 21:08:10 +00:00
|
|
|
RegisterClassW (&wndClass);
|
1998-10-11 13:17:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 08:27:49 +00:00
|
|
|
NATIVEFONT_Unregister (void)
|
1998-10-11 13:17:47 +00:00
|
|
|
{
|
2004-11-01 21:08:10 +00:00
|
|
|
UnregisterClassW (WC_NATIVEFONTCTLW, NULL);
|
1998-10-11 13:17:47 +00:00
|
|
|
}
|