diff options
-rw-r--r-- | vcl/win/gdi/salnativewidgets-luna.cxx | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx index 73e780ca1584..2370efcfec69 100644 --- a/vcl/win/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/gdi/salnativewidgets-luna.cxx @@ -498,6 +498,31 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal ) } } +/** + * Gives the actual rectangle used for rendering by ControlType::MenuPopup's + * ControlPart::MenuItemCheckMark or ControlPart::MenuItemRadioMark. + */ +static tools::Rectangle GetMenuPopupMarkRegion(const ImplControlValue& rValue) +{ + tools::Rectangle aRet; + + const MenupopupValue& rMVal(static_cast<const MenupopupValue&>(rValue)); + aRet.Top() = rMVal.maItemRect.Top(); + aRet.Bottom() = rMVal.maItemRect.Bottom() + 1; // see below in drawNativeControl + if (AllSettings::GetLayoutRTL()) + { + aRet.Right() = rMVal.maItemRect.Right() + 1; + aRet.Left() = aRet.Right() - (rMVal.getNumericVal() - rMVal.maItemRect.Left()); + } + else + { + aRet.Right() = rMVal.getNumericVal(); + aRet.Left() = rMVal.maItemRect.Left(); + } + + return aRet; +} + bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, ControlType nType, ControlPart nPart, @@ -1088,19 +1113,11 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc, RECT aBGRect = rc; if( aValue.getType() == ControlType::MenuPopup ) { - const MenupopupValue& rMVal( static_cast<const MenupopupValue&>(aValue) ); - aBGRect.top = rMVal.maItemRect.Top(); - aBGRect.bottom = rMVal.maItemRect.Bottom()+1; // see below in drawNativeControl - if( AllSettings::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(); - } + tools::Rectangle aRectangle = GetMenuPopupMarkRegion(aValue); + aBGRect.top = aRectangle.Top(); + aBGRect.left = aRectangle.Left(); + aBGRect.bottom = aRectangle.Bottom(); + aBGRect.right = aRectangle.Right(); rc = aBGRect; } iState = (nState & ControlState::ENABLED) ? MCB_NORMAL : MCB_DISABLED; @@ -1164,6 +1181,14 @@ bool WinSalGraphics::drawNativeControl( ControlType nType, } } + if (pImpl && nType == ControlType::MenuPopup && (nPart == ControlPart::MenuItemCheckMark || nPart == ControlPart::MenuItemRadioMark)) + { + cacheRect = GetMenuPopupMarkRegion(aValue); + buttonRect = cacheRect; + keySize = cacheRect.GetSize(); + } + + ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize); if (pImpl != nullptr && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top())) { |