diff options
| author | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-04-22 21:56:06 +0200 |
|---|---|---|
| committer | Jonas Kümmerlin <jonas@kuemmerlin.eu> | 2020-04-22 21:56:06 +0200 |
| commit | 5c8711b522df31d7278aa9a3f05f5fa2349651b4 (patch) | |
| tree | caa1ebb4f7e89d6060107948787045ab6ea9433c /alf/alflabel.cpp | |
| parent | 863cc559af7382c8a9b71a5f76edfd94171a1950 (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.cpp | 15 |
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) { |
