summaryrefslogtreecommitdiff
path: root/alf
diff options
context:
space:
mode:
Diffstat (limited to 'alf')
-rw-r--r--alf/alfnotebook.cpp6
-rw-r--r--alf/alfpanel.cpp40
2 files changed, 45 insertions, 1 deletions
diff --git a/alf/alfnotebook.cpp b/alf/alfnotebook.cpp
index d60ea6b..705d314 100644
--- a/alf/alfnotebook.cpp
+++ b/alf/alfnotebook.cpp
@@ -208,6 +208,12 @@ ALF__NotebookWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE;
} else if (uMsg == WM_SETFONT) {
SendMessage(priv->hwndTabCtrl, WM_SETFONT, wParam, lParam);
+
+ int n = ALF_Notebook_InternalTabCount(hwnd, priv->hwndTabCtrl);
+ for (int i = 0; i < n; ++i) {
+ HWND p = ALF_Notebook_InternalTabPanel(hwnd, priv->hwndTabCtrl, i);
+ SendMessage(p, WM_SETFONT, wParam, lParam);
+ }
} else if (uMsg == ALF_WM_QUERYSIZE) {
int n = ALF_Notebook_InternalTabCount(hwnd, priv->hwndTabCtrl);
RECT r = { 0, 0, 0, 0 };
diff --git a/alf/alfpanel.cpp b/alf/alfpanel.cpp
index b8ef8b3..ce640a2 100644
--- a/alf/alfpanel.cpp
+++ b/alf/alfpanel.cpp
@@ -4,6 +4,7 @@ TCHAR *_alf_panelClass = NULL;
typedef struct {
ALFLayout layout;
+ HFONT font;
} ALFPanelPriv;
static void
@@ -23,6 +24,27 @@ ALF_Panel_Paint(ALFPanelPriv *priv, HWND hwnd, HDC dc, RECT *r)
{
(void)priv;
ALF_Compat_DrawThemeParentBackground(hwnd, dc, r);
+
+ int textlen = GetWindowTextLength(hwnd);
+ if (textlen < 1)
+ return;
+
+ TCHAR *textbuf = ALF_New(TCHAR, textlen + 1);
+ GetWindowText(hwnd, textbuf, textlen+1);
+
+ HFONT oldFont = SelectFont(dc, priv->font);
+
+ SetTextColor(dc, GetSysColor(COLOR_BTNTEXT));
+ SetBkMode(dc, TRANSPARENT);
+
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+
+ DrawText(dc, textbuf, -1, &rc, DT_SINGLELINE | DT_EXPANDTABS | DT_HIDEPREFIX | DT_CENTER | DT_VCENTER);
+
+ ALF_Free(textbuf);
+
+ SelectFont(dc, oldFont);
}
static LRESULT WINAPI
@@ -48,6 +70,22 @@ ALF__PanelWindowProc(HWND window, UINT msg, WPARAM wparam, LPARAM lparam)
return TRUE;
}
+ if (msg == WM_SETFONT) {
+ priv->font = (HFONT)wparam;
+ if (LOWORD(lparam) != 0)
+ InvalidateRect(window, NULL, TRUE);
+
+ return 0;
+ }
+
+ if (msg == WM_GETFONT) {
+ return (LRESULT)priv->font;
+ }
+
+ if (msg == WM_SETTEXT) {
+ InvalidateRect(window, NULL, TRUE);
+ }
+
if (msg == WM_PRINTCLIENT) {
RECT r = { 0, 0, 0, 0 };
GetClientRect(window, &r);
@@ -129,7 +167,7 @@ ALF_AddPanel(HWND parent, WORD id, UINT x, UINT y)
p.y = y;
p.width = 0;
p.height = 0;
- p.flags = ALF_QUERYSIZE | ALF_SENDAPPLYFONTS;
+ p.flags = ALF_QUERYSIZE | ALF_SENDAPPLYFONTS | ALF_MESSAGEFONT;
ALF_AddWidgetEx(parent, &p);