=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: comctl32/button: Center align split buttons' text by default.
Alexandre Julliard
julliard at winehq.org
Wed Apr 3 15:26:19 CDT 2019
Module: wine
Branch: master
Commit: 725d3ff9f31a82ab69d0498167c3baca8ebc4b93
URL: https://source.winehq.org/git/wine.git/?a=commit;h=725d3ff9f31a82ab69d0498167c3baca8ebc4b93
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Mon Apr 1 15:19:36 2019 +0300
comctl32/button: Center align split buttons' text by default.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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;
More information about the wine-cvs
mailing list