diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-02 17:05:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-06-05 10:14:45 +0100 |
commit | 5366ca39cba57c2e994c8988c21ac05a905483f3 (patch) | |
tree | e3b23e5c6c65d0b68f5a5b2d67fe4eeebd5215f0 | |
parent | e586009e2c9356bacc4c9282e044f1c1b63e7601 (diff) |
make ImplGetNativeCheckAndRadioSize return max size
rather than just max height with max width smuggled out as a confusing extra
third argument
Change-Id: Id37ec4f679e5668715d5db0bc8875a27c8b2fb3c
-rw-r--r-- | vcl/inc/vcl/menu.hxx | 6 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 31 |
2 files changed, 19 insertions, 18 deletions
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx index 87ae47b78328..97dd29ce932e 100644 --- a/vcl/inc/vcl/menu.hxx +++ b/vcl/inc/vcl/menu.hxx @@ -195,9 +195,9 @@ protected: SAL_DLLPRIVATE void ImplSetSalMenu( SalMenu *pMenu ); SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const; - // returns native check and option menu symbol height; - // return value is Max( rCheckHeight, rRadioHeight ) - SAL_DLLPRIVATE long ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const; + // returns native check and option menu symbol height in rCheckHeight and rRadioHeight + // return value is maximum width and height of checkboxes and radiobuttons + SAL_DLLPRIVATE Size ImplGetNativeCheckAndRadioSize( Window*, long& rCheckHeight, long& rRadioHeight ) const; // returns native submenu arrow size and spacing from right border // return value is whether it's supported natively diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 028a3efd7499..4dfe6150a3d9 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2231,9 +2231,10 @@ void Menu::SetAccessible( const ::com::sun::star::uno::Reference< ::com::sun::st mxAccessible = rxAccessible; } -long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight, long &rMaxWidth ) const +Size Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, long& rRadioHeight ) const { - rMaxWidth = rCheckHeight = rRadioHeight = 0; + long nCheckWidth = 0, nRadioWidth = 0; + rCheckHeight = rRadioHeight = 0; if( ! bIsMenuBar ) { @@ -2255,7 +2256,7 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon ) { rCheckHeight = aNativeBounds.GetHeight(); - rMaxWidth = aNativeContent.GetWidth(); + nCheckWidth = aNativeBounds.GetWidth(); } } if( pWin->IsNativeControlSupported( CTRL_MENU_POPUP, PART_MENU_ITEM_RADIO_MARK ) ) @@ -2271,11 +2272,11 @@ long Menu::ImplGetNativeCheckAndRadioSize( Window* pWin, long& rCheckHeight, lon ) { rRadioHeight = aNativeBounds.GetHeight(); - rMaxWidth = Max (rMaxWidth, aNativeContent.GetWidth()); + nRadioWidth = aNativeBounds.GetWidth(); } } } - return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight; + return Size(Max(nCheckWidth, nRadioWidth), Max(rCheckHeight, rRadioHeight)); } sal_Bool Menu::ImplGetNativeSubmenuArrowSize( Window* pWin, Size& rArrowSize, long& rArrowSpacing ) const @@ -2359,14 +2360,14 @@ Size Menu::ImplCalcSize( Window* pWin ) long nMaxWidth = 0; long nMinMenuItemHeight = nFontHeight; long nCheckHeight = 0, nRadioHeight = 0; - long nCheckWidth = 0, nMaxCheckWidth = 0; - long nMaxHeight = ImplGetNativeCheckAndRadioSize( pWin, nCheckHeight, nRadioHeight, nMaxCheckWidth ); - if( nMaxHeight > nMinMenuItemHeight ) - nMinMenuItemHeight = nMaxHeight; + long nCheckWidth = 0; + Size aMaxSize = ImplGetNativeCheckAndRadioSize(pWin, nCheckHeight, nRadioHeight); + if( aMaxSize.Height() > nMinMenuItemHeight ) + nMinMenuItemHeight = aMaxSize.Height(); // When no native rendering of the checkbox & no image in the menu, we // have to add some extra space even in the MENU_FLAG_SHOWCHECKIMAGES case - bool bSpaceForCheckbox = ( nMaxHeight == 0 ); + bool bSpaceForCheckbox = ( aMaxSize.Height() == 0 ); const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); if ( rSettings.GetUseImagesInMenus() ) @@ -2429,7 +2430,7 @@ Size Menu::ImplCalcSize( Window* pWin ) // Check Buttons: if ( !bIsMenuBar && pData->HasCheck() ) { - nCheckWidth = nMaxCheckWidth; + nCheckWidth = aMaxSize.Width(); if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox ) { // checks / images take the same place @@ -2505,8 +2506,8 @@ Size Menu::ImplCalcSize( Window* pWin ) { long nImgOrChkWidth = 0; nImagePos = nCheckPos; - if( nMaxHeight > 0 ) // NWF case - nImgOrChkWidth = nMaxHeight + nExtra; + if( aMaxSize.Height() > 0 ) // NWF case + nImgOrChkWidth = aMaxSize.Height() + nExtra; else // non NWF case nImgOrChkWidth = nFontHeight/2 + gfxExtra; nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra ); @@ -2617,8 +2618,8 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa long nFontHeight = pWin->GetTextHeight(); long nExtra = nFontHeight/4; - long nCheckHeight = 0, nRadioHeight = 0, nMaxCheckWidth = 0; - ImplGetNativeCheckAndRadioSize( pWin, nCheckHeight, nRadioHeight, nMaxCheckWidth ); + long nCheckHeight = 0, nRadioHeight = 0; + ImplGetNativeCheckAndRadioSize( pWin, nCheckHeight, nRadioHeight ); DecorationView aDecoView( pWin ); const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); |