diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-03 23:32:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-06-05 10:14:46 +0100 |
commit | 76f02c23ffff5dd442c78994eda1e6853cfe7e55 (patch) | |
tree | 4e8149d6c161f586e0e84a57fc8e7f0df1fe91a1 /vcl | |
parent | e7e6d0f72b5388db3d0db17befb6fc0a00fa13c4 (diff) |
assume for all menus we reserve space for checkboxes
so menus have consistent whitespace at left regardless of containing
checkboxes/radiobutton entries. Its nasty to have menus "suddenly"
appear without whitespace as submenus of ones with whitespace.
This is a logical consequence of MENU_FLAG_SHOWCHECKIMAGES always
set (in the absence of SetMenuFlags where usage has generally
dropped MENU_FLAG_SHOWCHECKIMAGES accidentally)
Change-Id: I9501381b91415131eff5143a0c88142221530fb6
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/menu.hxx | 3 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 54 |
2 files changed, 17 insertions, 40 deletions
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx index 60bd029c9157..c9388ee81991 100644 --- a/vcl/inc/vcl/menu.hxx +++ b/vcl/inc/vcl/menu.hxx @@ -101,9 +101,6 @@ typedef sal_uInt16 MenuItemBits; // overrides default hiding of disabled entries in popup menus #define MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES 0x0004 -// forces images & toggle visibility for toolbar config popup -#define MENU_FLAG_SHOWCHECKIMAGES 0x0008 - struct ImplMenuDelData { ImplMenuDelData* mpNext; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 2779b373a17b..7c1751c72f03 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -959,7 +959,7 @@ void Menu::ImplInit() { mnHighlightedItemPos = ITEMPOS_INVALID; mpSalMenu = NULL; - nMenuFlags = MENU_FLAG_SHOWCHECKIMAGES; + nMenuFlags = 0; nDefaultItem = 0; //bIsMenuBar = sal_False; // this is now set in the ctor, must not be changed here!!! nSelectedId = 0; @@ -2360,10 +2360,6 @@ Size Menu::ImplCalcSize( Window* pWin ) 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 = ( aMaxSize.Height() == 0 ); - Size aMaxImgSz; const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); @@ -2379,9 +2375,6 @@ Size Menu::ImplCalcSize( Window* pWin ) ) ) { - // we have an icon, don't add the extra space - bSpaceForCheckbox = false; - Size aImgSz = pData->aImage.GetSizePixel(); if ( aImgSz.Height() > aMaxImgSz.Height() ) aMaxImgSz.Height() = aImgSz.Height(); @@ -2432,12 +2425,9 @@ Size Menu::ImplCalcSize( Window* pWin ) if ( !bIsMenuBar && pData->HasCheck() ) { nCheckWidth = aMaxSize.Width(); - if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox ) - { - // checks / images take the same place - if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) - nWidth += nCheckWidth + nExtra * 2; - } + // checks / images take the same place + if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) + nWidth += nCheckWidth + nExtra * 2; } // Text: @@ -2503,20 +2493,13 @@ Size Menu::ImplCalcSize( Window* pWin ) sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text nImgOrChkPos = (sal_uInt16)nExtra; - if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox ) - { - long nImgOrChkWidth = 0; - if( aMaxSize.Height() > 0 ) // NWF case - nImgOrChkWidth = aMaxSize.Height() + nExtra; - else // non NWF case - nImgOrChkWidth = nFontHeight/2 + gfxExtra; - nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra ); - nTextPos = (sal_uInt16)(nImgOrChkPos + nImgOrChkWidth); - } - else - { - nTextPos = (sal_uInt16)(nImgOrChkPos + Max( aMaxImgSz.Width(), nCheckWidth )); - } + long nImgOrChkWidth = 0; + if( aMaxSize.Height() > 0 ) // NWF case + nImgOrChkWidth = aMaxSize.Height() + nExtra; + else // non NWF case + nImgOrChkWidth = nFontHeight/2 + gfxExtra; + nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra ); + nTextPos = (sal_uInt16)(nImgOrChkPos + nImgOrChkWidth); nTextPos = nTextPos + gfxExtra; aSz.Width() = nTextPos + nMaxWidth + nExtra; @@ -2811,15 +2794,12 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) { // Don't render an image for a check thing - if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pData->HasCheck() ) - { - if( pData->bChecked ) - ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted ); - aTmpPos = aOuterCheckRect.TopLeft(); - aTmpPos.X() += (aOuterCheckRect.GetWidth()-pData->aImage.GetSizePixel().Width())/2; - aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pData->aImage.GetSizePixel().Height())/2; - pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle ); - } + if( pData->bChecked ) + ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted ); + aTmpPos = aOuterCheckRect.TopLeft(); + aTmpPos.X() += (aOuterCheckRect.GetWidth()-pData->aImage.GetSizePixel().Width())/2; + aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pData->aImage.GetSizePixel().Height())/2; + pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle ); } // Text: |