1998-10-11 15:17:47 +02:00
|
|
|
/*
|
|
|
|
* Native Font control
|
|
|
|
*
|
|
|
|
* Copyright 1998 Eric Kohl
|
|
|
|
*
|
|
|
|
* 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 "commctrl.h"
|
|
|
|
#include "nativefont.h"
|
|
|
|
#include "win.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define NATIVEFONT_GetInfoPtr(wndPtr) ((NATIVEFONT_INFO *)wndPtr->wExtra[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-02-26 12:11:13 +01:00
|
|
|
NATIVEFONT_Create (WND *wndPtr, 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));
|
|
|
|
wndPtr->wExtra[0] = (DWORD)infoPtr;
|
|
|
|
|
|
|
|
if (infoPtr == NULL) {
|
|
|
|
ERR (listview, "could not allocate info memory!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((NATIVEFONT_INFO*)wndPtr->wExtra[0] != infoPtr) {
|
|
|
|
ERR (listview, "pointer assignment error!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* initialize info structure */
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-02-26 12:11:13 +01:00
|
|
|
NATIVEFONT_Destroy (WND *wndPtr, WPARAM wParam, LPARAM lParam)
|
1998-10-11 15:17:47 +02:00
|
|
|
{
|
|
|
|
NATIVEFONT_INFO *infoPtr = NATIVEFONT_GetInfoPtr(wndPtr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
{
|
|
|
|
WND *wndPtr = WIN_FindWndPtr(hwnd);
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
|
|
|
|
case WM_CREATE:
|
|
|
|
return NATIVEFONT_Create (wndPtr, wParam, lParam);
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
return NATIVEFONT_Destroy (wndPtr, wParam, lParam);
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR (nativefont, "unknown msg %04x wp=%08x lp=%08lx\n",
|
|
|
|
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
|
|
|
|
NATIVEFONT_Register (VOID)
|
|
|
|
{
|
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
|
|
|
|
NATIVEFONT_Unregister (VOID)
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|