From 5c8711b522df31d7278aa9a3f05f5fa2349651b4 Mon Sep 17 00:00:00 2001 From: Jonas Kümmerlin Date: Wed, 22 Apr 2020 21:56:06 +0200 Subject: label: invalidate layout if one of the ALIGN_*_LIKE_EDIT flags is toggled --- alf/alflabel.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'alf/alflabel.cpp') 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) { -- cgit v1.2.3