summaryrefslogtreecommitdiff
path: root/alf/alflayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alflayout.cpp')
-rw-r--r--alf/alflayout.cpp39
1 files changed, 14 insertions, 25 deletions
diff --git a/alf/alflayout.cpp b/alf/alflayout.cpp
index 9c4b8f1..0cc6cdf 100644
--- a/alf/alflayout.cpp
+++ b/alf/alflayout.cpp
@@ -22,31 +22,15 @@ ALF_Layout_Clear(ALFLayout *layout)
layout->nRows = 0;
}
-
static void
-ALF_ApplyFontForWidget(ALFWidgetPriv *widget, const ALFWindowFonts *fonts)
-{
- if (widget->hwnd) {
- if (widget->flags & ALF_MESSAGEFONT) {
- SendMessage(widget->hwnd, WM_SETFONT, (WPARAM)fonts->hMessageFont, (LPARAM)NULL);
-
- // XXX: Invalidating should IMHO be the decision of the control, but at
- // least the commctl32 V5 static control doesn't do it.
- InvalidateRect(widget->hwnd, NULL, TRUE);
- }
- if (widget->flags & ALF_SENDAPPLYFONTS) {
- SendMessage(widget->hwnd, ALF_WM_APPLYFONTS, 0, (LPARAM)fonts);
- }
- }
-}
-
-void
-ALF_Layout_ApplyFonts(ALFLayout *layout, HWND window, const ALFWindowFonts *fonts)
+ALF_Layout_ForwardFont(ALFLayout *layout, HWND window, HFONT font, LPARAM redraw)
{
(void)window;
ALF_FOR_LIST(ALFWidgetPriv, list, &layout->widgets, i) {
- ALF_ApplyFontForWidget(i, fonts);
+ if (i->flags & ALF_INHERITFONT) {
+ SendMessage(i->hwnd, WM_SETFONT, (WPARAM)font, redraw);
+ }
}
}
@@ -265,6 +249,10 @@ ALF_Layout_AddWidget(ALFLayout* layout, HWND window, const ALFWidgetLayoutParams
if (GetParent(w->hwnd) != window)
SetParent(w->hwnd, window);
+ if (w->flags & ALF_INHERITFONT) {
+ SendMessage(w->hwnd, WM_SETFONT, (WPARAM)SendMessage(window, WM_GETFONT, 0, 0), 0);
+ }
+
ALF_ListInsert(layout->widgets.prev, &w->list);
}
@@ -340,11 +328,6 @@ ALF_Layout_HandleMessage(ALFLayout *layout, HWND hwnd, UINT msg, WPARAM wparam,
return TRUE;
}
- if (msg == ALF_WM_APPLYFONTS && lparam != 0) {
- ALF_Layout_ApplyFonts(layout, hwnd, (const ALFWindowFonts *)lparam);
- return TRUE;
- }
-
if (msg == ALF_WM_APPLYLAYOUT) {
ALF_Layout_Apply(layout, hwnd);
return TRUE;
@@ -370,5 +353,11 @@ ALF_Layout_HandleMessage(ALFLayout *layout, HWND hwnd, UINT msg, WPARAM wparam,
return TRUE;
}
+ if (msg == WM_SETFONT) {
+ ALF_Layout_ForwardFont(layout, hwnd, (HFONT)wparam, lparam);
+ *pRet = 0;
+ return TRUE;
+ }
+
return FALSE;
}