summaryrefslogtreecommitdiff
path: root/alf/alflabel.cpp
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2020-04-22 21:56:06 +0200
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2020-04-22 21:56:06 +0200
commit5c8711b522df31d7278aa9a3f05f5fa2349651b4 (patch)
treecaa1ebb4f7e89d6060107948787045ab6ea9433c /alf/alflabel.cpp
parent863cc559af7382c8a9b71a5f76edfd94171a1950 (diff)
label: invalidate layout if one of the ALIGN_*_LIKE_EDIT flags is toggled
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 cc408d7..adc70d4 100644
--- a/alf/alflabel.cpp
+++ b/alf/alflabel.cpp
@@ -66,7 +66,20 @@ ALF__LabelWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (uMsg == ALF_WM_LBL_GETSTYLE) {
return (LRESULT)priv->style;
} else if (uMsg == ALF_WM_LBL_SETSTYLE) {
- priv->style = (DWORD)lParam;
+ DWORD newStyle = (DWORD)lParam;
+
+ // if the ALF_LABEL_ALIGN_LEFT_LIKE_EDIT or ALF_LABEL_ALIGN_TOP_LIKE_EDIT
+ // styles have been toggled, a new layout calculation is necessary
+ if (((newStyle & ALF_LABEL_HALIGN_MASK) != (priv->style & ALF_LABEL_HALIGN_MASK)
+ && ((newStyle & ALF_LABEL_HALIGN_MASK) == ALF_LABEL_ALIGN_LEFT_LIKE_EDIT
+ || (priv->style & ALF_LABEL_HALIGN_MASK) == ALF_LABEL_ALIGN_LEFT_LIKE_EDIT))
+ || ((newStyle & ALF_LABEL_VALIGN_MASK) != (priv->style & ALF_LABEL_VALIGN_MASK)
+ && ((newStyle & ALF_LABEL_VALIGN_MASK) == ALF_LABEL_ALIGN_TOP_LIKE_EDIT
+ || (priv->style & ALF_LABEL_VALIGN_MASK) == ALF_LABEL_ALIGN_TOP_LIKE_EDIT))) {
+ ALF_InvalidateLayout(GetParent(hwnd));
+ }
+
+ priv->style = newStyle;
InvalidateRect(hwnd, NULL, TRUE);
return TRUE;
} else if (uMsg == WM_SETTEXT) {