From bbd9e229e3c2676e9db7ce64d6a87bb75f506e84 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 17 Apr 2008 19:26:34 +0200 Subject: [PATCH] user32: Added support for WS_EX_RIGHT in the button control. --- dlls/user32/button.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/user32/button.c b/dlls/user32/button.c index 27f10b73598..d1ba2c159e1 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -567,9 +567,8 @@ static LRESULT WINAPI ButtonWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARA /********************************************************************** * Convert button styles to flags used by DrawText. - * TODO: handle WS_EX_RIGHT extended style. */ -static UINT BUTTON_BStoDT(DWORD style) +static UINT BUTTON_BStoDT( DWORD style, DWORD ex_style ) { UINT dtStyle = DT_NOCLIP; /* We use SelectClipRgn to limit output */ @@ -593,6 +592,8 @@ static UINT BUTTON_BStoDT(DWORD style) /* all other flavours have left aligned text */ } + if (ex_style & WS_EX_RIGHT) dtStyle = DT_RIGHT | (dtStyle & ~(DT_LEFT | DT_CENTER)); + /* DrawText ignores vertical alignment for multiline text, * but we use these flags to align label manually. */ @@ -626,10 +627,11 @@ static UINT BUTTON_BStoDT(DWORD style) static UINT BUTTON_CalcLabelRect(HWND hwnd, HDC hdc, RECT *rc) { LONG style = GetWindowLongW( hwnd, GWL_STYLE ); + LONG ex_style = GetWindowLongW( hwnd, GWL_EXSTYLE ); WCHAR *text; ICONINFO iconInfo; BITMAP bm; - UINT dtStyle = BUTTON_BStoDT(style); + UINT dtStyle = BUTTON_BStoDT( style, ex_style ); RECT r = *rc; INT n;