diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-04-11 21:34:06 +0400 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-04-17 16:56:17 +0200 |
commit | 672071c02622c8ad4b9f23f2a5b885cfe7f72669 (patch) | |
tree | 6881433754429836f1e64be1569e07ebdf22d902 | |
parent | 2d7ce65af37195343ff74b9e01c60f4b86eb6ebe (diff) |
fdo#42537: fix RTL menu rendering on Windows
Signed-off-by: Andras Timar <atimar@suse.com>
-rw-r--r-- | vcl/source/window/menu.cxx | 5 | ||||
-rw-r--r-- | vcl/win/source/gdi/salnativewidgets-luna.cxx | 33 |
2 files changed, 29 insertions, 9 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 3da96c2e4abf..92803a9ca4c8 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2775,7 +2775,10 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa aTmpPos.Y() = aOuterCheckRect.Top() + (aOuterCheckRect.GetHeight() - nCtrlHeight)/2; Rectangle aCheckRect( aTmpPos, Size( nCtrlHeight, nCtrlHeight ) ); - MenupopupValue aVal( nTextPos-GUTTERBORDER, Rectangle( aPos, pData->aSz ) ); + Size aSz( pData->aSz ); + aSz.Width() = aOutSz.Width() - 2*nOuterSpace; + Rectangle aItemRect( aPos, aSz ); + MenupopupValue aVal( nTextPos-GUTTERBORDER, aItemRect ); pWin->DrawNativeControl( CTRL_MENU_POPUP, nPart, aCheckRect, nState, diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index a4f094faa2bc..17b85179777a 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -989,8 +989,16 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( nPart == PART_ENTIRE_CONTROL ) { RECT aGutterRC = rc; - aGutterRC.left += aValue.getNumericVal(); - aGutterRC.right = aGutterRC.left+3; + if( Application::GetSettings().GetLayoutRTL() ) + { + aGutterRC.right -= aValue.getNumericVal()+1; + aGutterRC.left = aGutterRC.right-3; + } + else + { + aGutterRC.left += aValue.getNumericVal(); + aGutterRC.right = aGutterRC.left+3; + } return ImplDrawTheme( hTheme, hDC, MENU_POPUPBACKGROUND, 0, rc, aCaption ) && ImplDrawTheme( hTheme, hDC, MENU_POPUPGUTTER, 0, aGutterRC, aCaption ) @@ -1012,13 +1020,18 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, if( aValue.getType() == CTRL_MENU_POPUP ) { const MenupopupValue& rMVal( static_cast<const MenupopupValue&>(aValue) ); - aBGRect.left = rMVal.maItemRect.Left(); aBGRect.top = rMVal.maItemRect.Top(); aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl - aBGRect.right = rMVal.getNumericVal(); - - // FIXME: magic - aBGRect.left += 1; aBGRect.top += 1; aBGRect.bottom +=1; + if( Application::GetSettings().GetLayoutRTL() ) + { + aBGRect.right = rMVal.maItemRect.Right()+1; + aBGRect.left = aBGRect.right - (rMVal.getNumericVal()-rMVal.maItemRect.Left()); + } + else + { + aBGRect.right = rMVal.getNumericVal(); + aBGRect.left = rMVal.maItemRect.Left(); + } } iState = (nState & CTRL_STATE_ENABLED) ? MCB_NORMAL : MCB_DISABLED; ImplDrawTheme( hTheme, hDC, MENU_POPUPCHECKBACKGROUND, iState, aBGRect, aCaption ); @@ -1033,7 +1046,11 @@ sal_Bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, } else if( nPart == PART_MENU_SEPARATOR ) { - rc.left += aValue.getNumericVal(); // adjust for gutter position + // adjust for gutter position + if( Application::GetSettings().GetLayoutRTL() ) + rc.right -= aValue.getNumericVal()+1; + else + rc.left += aValue.getNumericVal()+1; Rectangle aRect( ImplGetThemeRect( hTheme, hDC, MENU_POPUPSEPARATOR, 0, Rectangle( rc.left, rc.top, rc.right, rc.bottom ) ) ); // center the separator inside the passed rectangle |