summaryrefslogtreecommitdiff
path: root/alf
diff options
context:
space:
mode:
Diffstat (limited to 'alf')
-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) {