summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-03 23:32:48 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-06-05 10:14:46 +0100
commit76f02c23ffff5dd442c78994eda1e6853cfe7e55 (patch)
tree4e8149d6c161f586e0e84a57fc8e7f0df1fe91a1
parentdrop a XubString (diff)
downloadcore-76f02c23ffff5dd442c78994eda1e6853cfe7e55.tar.gz
core-76f02c23ffff5dd442c78994eda1e6853cfe7e55.zip
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
-rw-r--r--framework/source/uielement/menubarmanager.cxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx6
-rw-r--r--svtools/source/control/toolbarmenu.cxx16
-rw-r--r--vcl/inc/vcl/menu.hxx3
-rw-r--r--vcl/source/window/menu.cxx54
5 files changed, 24 insertions, 57 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index d24da8c2b673..4c64446bfd8a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -831,7 +831,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
nFlag &= ~MENU_FLAG_HIDEDISABLEDENTRIES;
else
nFlag |= MENU_FLAG_HIDEDISABLEDENTRIES;
- pMenu->SetMenuFlags( nFlag | MENU_FLAG_SHOWCHECKIMAGES );
+ pMenu->SetMenuFlags( nFlag );
if ( m_bActive )
return 0;
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index f30f07ec80fe..63e24f7fb6b8 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1780,9 +1780,6 @@ PopupMenu * ToolBarManager::GetToolBarCustomMenu(ToolBox* pToolBar)
if( !(pToolBar->GetFloatStyle() & WB_CLOSEABLE) )
aPopupMenu.EnableItem(MENUITEM_TOOLBAR_CLOSE, sal_False);
- pItemMenu->SetMenuFlags (pItemMenu->GetMenuFlags () |
- MENU_FLAG_SHOWCHECKIMAGES);
-
for ( nPos = 0; nPos < m_pToolBar->GetItemCount(); ++nPos )
{
if ( m_pToolBar->GetItemType(nPos) == TOOLBOXITEM_BUTTON )
@@ -1827,9 +1824,6 @@ PopupMenu * ToolBarManager::GetToolBarCustomMenu(ToolBox* pToolBar)
// create an own submenu to avoid auto-delete when resource menu is deleted
PopupMenu *pItemMenu = new PopupMenu();
- pItemMenu->SetMenuFlags (pItemMenu->GetMenuFlags () |
- MENU_FLAG_SHOWCHECKIMAGES);
-
for( i=0; i< aPopupMenu.GetPopupMenu( 1 )->GetItemCount(); i++)
pItemMenu->CopyItem( *aPopupMenu.GetPopupMenu( 1 ), i, MENU_APPEND );
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 84b8af03cf5f..888b22599638 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -1473,16 +1473,12 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted )
// Image:
if( pEntry->mbHasImage && bUseImages )
{
- // Don't render an image for a check thing
- /* if((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pEntry->HasCheck() )*/
- {
- if( pEntry->mbChecked )
- ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
- aTmpPos = aOuterCheckRect.TopLeft();
- aTmpPos.X() += (aOuterCheckRect.GetWidth()-pEntry->maImage.GetSizePixel().Width())/2;
- aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2;
- DrawImage( aTmpPos, pEntry->maImage, nImageStyle );
- }
+ if( pEntry->mbChecked )
+ ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
+ aTmpPos = aOuterCheckRect.TopLeft();
+ aTmpPos.X() += (aOuterCheckRect.GetWidth()-pEntry->maImage.GetSizePixel().Width())/2;
+ aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2;
+ DrawImage( aTmpPos, pEntry->maImage, nImageStyle );
}
// Text:
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: