[PATCH 7/7] [WinHelp]: picking nicer fonts for buttons
Eric Pouech
eric.pouech at orange.fr
Sat Jun 21 04:00:57 CDT 2008
A+
---
programs/winhlp32/winhelp.c | 15 +++++++++++++--
programs/winhlp32/winhelp.h | 1 +
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/programs/winhlp32/winhelp.c b/programs/winhlp32/winhelp.c
index df22988..13114f7 100644
--- a/programs/winhlp32/winhelp.c
+++ b/programs/winhlp32/winhelp.c
@@ -58,7 +58,7 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW*);
static void WINHELP_SetupText(HWND hWnd, WINHELP_WINDOW *win, ULONG relative);
static void WINHELP_DeletePageLinks(HLPFILE_PAGE* page);
-WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}};
+WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,NULL}},0}, NULL};
#define CTL_ID_BUTTON 0x700
#define CTL_ID_TEXT 0x701
@@ -1169,10 +1169,21 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
0, 0, 0, 0,
hWnd, (HMENU) button->wParam,
Globals.hInstance, 0);
- if (button->hWnd) {
+ if (button->hWnd)
+ {
if (Globals.button_proc == NULL)
+ {
+ NONCLIENTMETRICSW ncm;
Globals.button_proc = (WNDPROC) GetWindowLongPtr(button->hWnd, GWLP_WNDPROC);
+
+ ncm.cbSize = sizeof(NONCLIENTMETRICSW);
+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
+ sizeof(NONCLIENTMETRICSW), &ncm, 0);
+ Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont);
+ }
SetWindowLongPtr(button->hWnd, GWLP_WNDPROC, (LONG_PTR) WINHELP_ButtonWndProc);
+ if (Globals.hButtonFont)
+ SendMessage(button->hWnd, WM_SETFONT, (WPARAM)Globals.hButtonFont, TRUE);
}
}
hDc = GetDC(button->hWnd);
diff --git a/programs/winhlp32/winhelp.h b/programs/winhlp32/winhelp.h
index 7d959af..f06b082 100644
--- a/programs/winhlp32/winhelp.h
+++ b/programs/winhlp32/winhelp.h
@@ -137,6 +137,7 @@ typedef struct
WNDPROC button_proc;
WINHELP_DLL* dlls;
WINHELP_PAGESET history;
+ HFONT hButtonFont;
} WINHELP_GLOBALS;
extern WINHELP_GLOBALS Globals;
More information about the wine-patches
mailing list