1998-10-11 15:17:47 +02:00
|
|
|
/*
|
|
|
|
* Native Font control
|
|
|
|
*
|
1999-03-12 18:42:50 +01:00
|
|
|
* Copyright 1998, 1999 Eric Kohl
|
1998-10-11 15:17:47 +02: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.
|
|
|
|
*/
|
|
|
|
|
1999-03-16 11:53:11 +01:00
|
|
|
#include "winbase.h"
|
1998-10-11 15:17:47 +02:00
|
|
|
#include "commctrl.h"
|
|
|
|
#include "nativefont.h"
|
1999-06-12 17:45:58 +02:00
|
|
|
#include "debugtools.h"
|
1998-10-11 15:17:47 +02:00
|
|
|
|
1999-04-19 16:56:29 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(nativefont)
|
|
|
|
|
1998-10-11 15:17:47 +02:00
|
|
|
|
1999-03-12 18:42:50 +01:00
|
|
|
#define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongA (hwnd, 0))
|
1998-10-11 15:17:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 18:42:50 +01:00
|
|
|
NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-10-11 15:17:47 +02:00
|
|
|
{
|
|
|
|
NATIVEFONT_INFO *infoPtr;
|
|
|
|
|
|
|
|
/* allocate memory for info structure */
|
|
|
|
infoPtr = (NATIVEFONT_INFO *)COMCTL32_Alloc (sizeof(NATIVEFONT_INFO));
|
1999-03-12 18:42:50 +01:00
|
|
|
SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
|
1998-10-11 15:17:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* initialize info structure */
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 18:42:50 +01:00
|
|
|
NATIVEFONT_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1998-10-11 15:17:47 +02:00
|
|
|
{
|
1999-03-12 18:42:50 +01:00
|
|
|
NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr (hwnd);
|
1998-10-11 15:17:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* free comboex info data */
|
|
|
|
COMCTL32_Free (infoPtr);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LRESULT WINAPI
|
1999-02-26 12:11:13 +01:00
|
|
|
NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1998-10-11 15:17:47 +02:00
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
|
|
|
|
case WM_CREATE:
|
1999-03-12 18:42:50 +01:00
|
|
|
return NATIVEFONT_Create (hwnd, wParam, lParam);
|
1998-10-11 15:17:47 +02:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
1999-03-12 18:42:50 +01:00
|
|
|
return NATIVEFONT_Destroy (hwnd, wParam, lParam);
|
1998-10-11 15:17:47 +02:00
|
|
|
|
|
|
|
default:
|
1999-06-12 17:45:58 +02:00
|
|
|
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
1998-10-11 15:17:47 +02:00
|
|
|
uMsg, wParam, lParam);
|
1999-02-26 12:11:13 +01:00
|
|
|
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
1998-10-11 15:17:47 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
NATIVEFONT_Register (void)
|
1998-10-11 15:17:47 +02:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
WNDCLASSA wndClass;
|
1998-10-11 15:17:47 +02:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
if (GlobalFindAtomA (WC_NATIVEFONTCTLA)) return;
|
1998-10-11 15:17:47 +02:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
1998-10-11 15:17:47 +02:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.lpfnWndProc = (WNDPROC)NATIVEFONT_WindowProc;
|
1998-10-11 15:17:47 +02:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(NATIVEFONT_INFO *);
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
|
|
wndClass.lpszClassName = WC_NATIVEFONTCTLA;
|
1998-10-11 15:17:47 +02:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
RegisterClassA (&wndClass);
|
1998-10-11 15:17:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
NATIVEFONT_Unregister (void)
|
1998-10-11 15:17:47 +02:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
if (GlobalFindAtomA (WC_NATIVEFONTCTLA))
|
|
|
|
UnregisterClassA (WC_NATIVEFONTCTLA, (HINSTANCE)NULL);
|
1998-10-11 15:17:47 +02:00
|
|
|
}
|
|
|
|
|