summaryrefslogtreecommitdiff
path: root/alf/alflabel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alf/alflabel.cpp')
-rw-r--r--alf/alflabel.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/alf/alflabel.cpp b/alf/alflabel.cpp
index dbb6367..cc408d7 100644
--- a/alf/alflabel.cpp
+++ b/alf/alflabel.cpp
@@ -6,6 +6,7 @@ typedef struct {
DWORD style;
HFONT font;
ALFColor bgcolor;
+ ALFColor textcolor;
} ALFLabelPriv;
TCHAR *_alf_labelClass;
@@ -101,7 +102,7 @@ ALF__LabelWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (priv->font)
oldFont = SelectFont(hdc, priv->font);
- SetTextColor(hdc, GetSysColor(COLOR_BTNTEXT));
+ SetTextColor(hdc, ALF_ColorToGdi(priv->textcolor));
SetBkMode(hdc, TRANSPARENT);
// calc drawtext style
@@ -237,6 +238,17 @@ ALF__LabelWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return TRUE;
} else if (uMsg == ALF_WM_GETBGCOLOR) {
return (LRESULT)priv->bgcolor;
+ } else if (uMsg == ALF_WM_SETTEXTCOLOR) {
+ ALFColor newcolor = (ALFColor)lParam;
+ if (priv->textcolor == newcolor)
+ return TRUE;
+
+ priv->textcolor = newcolor;
+ InvalidateRect(hwnd, NULL, TRUE);
+
+ return TRUE;
+ } else if (uMsg == ALF_WM_GETTEXTCOLOR) {
+ return (LRESULT)priv->textcolor;
} else if (uMsg == WM_DESTROY) {
ALF_Free(priv);
SetWindowLongPtr(hwnd, 0, 0);
@@ -260,6 +272,7 @@ ALF_AddLabel(HWND win, WORD id, int x, int y, const TCHAR *text)
ALFLabelPriv *priv = ALF_New(ALFLabelPriv, 1);
priv->style = ALF_LABEL_ALIGN_LEFT | ALF_LABEL_ALIGN_TOP_LIKE_EDIT;
priv->bgcolor = ALF_COLOR_SYS(COLOR_BTNFACE);
+ priv->textcolor = ALF_COLOR_SYS(COLOR_BTNTEXT);
SetWindowLongPtr(hwndLabel, 0, (LONG_PTR)priv);
ALF_AddWidget(win, x, y, hwndLabel, 0, 0, ALF_LAYOUT_SIZE_QUERY | ALF_LAYOUT_INHERITFONT | ALF_LAYOUT_INHERITBGCOLOR | ALF_LAYOUT_SENDBGCHANGE);