[PATCH 01/10] comctl32/button: Center align split buttons' text by default
Gabriel Ivăncescu
gabrielopcode at gmail.com
Mon Apr 1 07:19:36 CDT 2019
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/comctl32/button.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index f7497a1..0bd416d 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -215,6 +215,13 @@ static inline UINT get_button_type( LONG window_style )
return (window_style & BS_TYPEMASK);
}
+static inline BOOL button_centers_text( LONG window_style )
+{
+ /* Push button's text is centered by default, same for split buttons */
+ UINT type = get_button_type(window_style);
+ return type <= BS_DEFPUSHBUTTON || type == BS_SPLITBUTTON || type == BS_DEFSPLITBUTTON;
+}
+
/* paint a button of any type */
static inline void paint_button( BUTTON_INFO *infoPtr, LONG style, UINT action )
{
@@ -308,9 +315,7 @@ static UINT BUTTON_BStoDT( DWORD style, DWORD ex_style )
case BS_RIGHT: dtStyle |= DT_RIGHT; break;
case BS_CENTER: dtStyle |= DT_CENTER; break;
default:
- /* Pushbutton's text is centered by default */
- if (get_button_type(style) <= BS_DEFPUSHBUTTON) dtStyle |= DT_CENTER;
- /* all other flavours have left aligned text */
+ if (button_centers_text(style)) dtStyle |= DT_CENTER;
}
if (ex_style & WS_EX_RIGHT) dtStyle = DT_RIGHT | (dtStyle & ~(DT_LEFT | DT_CENTER));
@@ -984,8 +989,7 @@ static void BUTTON_PositionRect(LONG style, const RECT *outerRect, RECT *innerRe
if (!(style & BS_CENTER))
{
- /* Push button's text is centered by default, all other types have left aligned text */
- if (get_button_type(style) <= BS_DEFPUSHBUTTON)
+ if (button_centers_text(style))
style |= BS_CENTER;
else
style |= BS_LEFT;
--
2.20.1
More information about the wine-devel
mailing list