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
This commit is contained in:
@@ -831,7 +831,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu )
|
|||||||
nFlag &= ~MENU_FLAG_HIDEDISABLEDENTRIES;
|
nFlag &= ~MENU_FLAG_HIDEDISABLEDENTRIES;
|
||||||
else
|
else
|
||||||
nFlag |= MENU_FLAG_HIDEDISABLEDENTRIES;
|
nFlag |= MENU_FLAG_HIDEDISABLEDENTRIES;
|
||||||
pMenu->SetMenuFlags( nFlag | MENU_FLAG_SHOWCHECKIMAGES );
|
pMenu->SetMenuFlags( nFlag );
|
||||||
|
|
||||||
if ( m_bActive )
|
if ( m_bActive )
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -1780,9 +1780,6 @@ PopupMenu * ToolBarManager::GetToolBarCustomMenu(ToolBox* pToolBar)
|
|||||||
if( !(pToolBar->GetFloatStyle() & WB_CLOSEABLE) )
|
if( !(pToolBar->GetFloatStyle() & WB_CLOSEABLE) )
|
||||||
aPopupMenu.EnableItem(MENUITEM_TOOLBAR_CLOSE, sal_False);
|
aPopupMenu.EnableItem(MENUITEM_TOOLBAR_CLOSE, sal_False);
|
||||||
|
|
||||||
pItemMenu->SetMenuFlags (pItemMenu->GetMenuFlags () |
|
|
||||||
MENU_FLAG_SHOWCHECKIMAGES);
|
|
||||||
|
|
||||||
for ( nPos = 0; nPos < m_pToolBar->GetItemCount(); ++nPos )
|
for ( nPos = 0; nPos < m_pToolBar->GetItemCount(); ++nPos )
|
||||||
{
|
{
|
||||||
if ( m_pToolBar->GetItemType(nPos) == TOOLBOXITEM_BUTTON )
|
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
|
// create an own submenu to avoid auto-delete when resource menu is deleted
|
||||||
PopupMenu *pItemMenu = new PopupMenu();
|
PopupMenu *pItemMenu = new PopupMenu();
|
||||||
|
|
||||||
pItemMenu->SetMenuFlags (pItemMenu->GetMenuFlags () |
|
|
||||||
MENU_FLAG_SHOWCHECKIMAGES);
|
|
||||||
|
|
||||||
for( i=0; i< aPopupMenu.GetPopupMenu( 1 )->GetItemCount(); i++)
|
for( i=0; i< aPopupMenu.GetPopupMenu( 1 )->GetItemCount(); i++)
|
||||||
pItemMenu->CopyItem( *aPopupMenu.GetPopupMenu( 1 ), i, MENU_APPEND );
|
pItemMenu->CopyItem( *aPopupMenu.GetPopupMenu( 1 ), i, MENU_APPEND );
|
||||||
|
|
||||||
|
@@ -1472,9 +1472,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted )
|
|||||||
|
|
||||||
// Image:
|
// Image:
|
||||||
if( pEntry->mbHasImage && bUseImages )
|
if( pEntry->mbHasImage && bUseImages )
|
||||||
{
|
|
||||||
// Don't render an image for a check thing
|
|
||||||
/* if((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pEntry->HasCheck() )*/
|
|
||||||
{
|
{
|
||||||
if( pEntry->mbChecked )
|
if( pEntry->mbChecked )
|
||||||
ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
|
ImplPaintCheckBackground( this, aOuterCheckRect, pThisOnly && bHighlighted );
|
||||||
@@ -1483,7 +1480,6 @@ void ToolbarMenu::implPaint( ToolbarMenuEntry* pThisOnly, bool bHighlighted )
|
|||||||
aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2;
|
aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pEntry->maImage.GetSizePixel().Height())/2;
|
||||||
DrawImage( aTmpPos, pEntry->maImage, nImageStyle );
|
DrawImage( aTmpPos, pEntry->maImage, nImageStyle );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Text:
|
// Text:
|
||||||
if( pEntry->mbHasText )
|
if( pEntry->mbHasText )
|
||||||
|
@@ -101,9 +101,6 @@ typedef sal_uInt16 MenuItemBits;
|
|||||||
// overrides default hiding of disabled entries in popup menus
|
// overrides default hiding of disabled entries in popup menus
|
||||||
#define MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES 0x0004
|
#define MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES 0x0004
|
||||||
|
|
||||||
// forces images & toggle visibility for toolbar config popup
|
|
||||||
#define MENU_FLAG_SHOWCHECKIMAGES 0x0008
|
|
||||||
|
|
||||||
struct ImplMenuDelData
|
struct ImplMenuDelData
|
||||||
{
|
{
|
||||||
ImplMenuDelData* mpNext;
|
ImplMenuDelData* mpNext;
|
||||||
|
@@ -959,7 +959,7 @@ void Menu::ImplInit()
|
|||||||
{
|
{
|
||||||
mnHighlightedItemPos = ITEMPOS_INVALID;
|
mnHighlightedItemPos = ITEMPOS_INVALID;
|
||||||
mpSalMenu = NULL;
|
mpSalMenu = NULL;
|
||||||
nMenuFlags = MENU_FLAG_SHOWCHECKIMAGES;
|
nMenuFlags = 0;
|
||||||
nDefaultItem = 0;
|
nDefaultItem = 0;
|
||||||
//bIsMenuBar = sal_False; // this is now set in the ctor, must not be changed here!!!
|
//bIsMenuBar = sal_False; // this is now set in the ctor, must not be changed here!!!
|
||||||
nSelectedId = 0;
|
nSelectedId = 0;
|
||||||
@@ -2360,10 +2360,6 @@ Size Menu::ImplCalcSize( Window* pWin )
|
|||||||
if( aMaxSize.Height() > nMinMenuItemHeight )
|
if( aMaxSize.Height() > nMinMenuItemHeight )
|
||||||
nMinMenuItemHeight = aMaxSize.Height();
|
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;
|
Size aMaxImgSz;
|
||||||
|
|
||||||
const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
|
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();
|
Size aImgSz = pData->aImage.GetSizePixel();
|
||||||
if ( aImgSz.Height() > aMaxImgSz.Height() )
|
if ( aImgSz.Height() > aMaxImgSz.Height() )
|
||||||
aMaxImgSz.Height() = aImgSz.Height();
|
aMaxImgSz.Height() = aImgSz.Height();
|
||||||
@@ -2432,13 +2425,10 @@ Size Menu::ImplCalcSize( Window* pWin )
|
|||||||
if ( !bIsMenuBar && pData->HasCheck() )
|
if ( !bIsMenuBar && pData->HasCheck() )
|
||||||
{
|
{
|
||||||
nCheckWidth = aMaxSize.Width();
|
nCheckWidth = aMaxSize.Width();
|
||||||
if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
|
|
||||||
{
|
|
||||||
// checks / images take the same place
|
// checks / images take the same place
|
||||||
if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
|
if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
|
||||||
nWidth += nCheckWidth + nExtra * 2;
|
nWidth += nCheckWidth + nExtra * 2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Text:
|
// Text:
|
||||||
if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) )
|
if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) )
|
||||||
@@ -2503,8 +2493,6 @@ Size Menu::ImplCalcSize( Window* pWin )
|
|||||||
|
|
||||||
sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
|
sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
|
||||||
nImgOrChkPos = (sal_uInt16)nExtra;
|
nImgOrChkPos = (sal_uInt16)nExtra;
|
||||||
if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
|
|
||||||
{
|
|
||||||
long nImgOrChkWidth = 0;
|
long nImgOrChkWidth = 0;
|
||||||
if( aMaxSize.Height() > 0 ) // NWF case
|
if( aMaxSize.Height() > 0 ) // NWF case
|
||||||
nImgOrChkWidth = aMaxSize.Height() + nExtra;
|
nImgOrChkWidth = aMaxSize.Height() + nExtra;
|
||||||
@@ -2512,11 +2500,6 @@ Size Menu::ImplCalcSize( Window* pWin )
|
|||||||
nImgOrChkWidth = nFontHeight/2 + gfxExtra;
|
nImgOrChkWidth = nFontHeight/2 + gfxExtra;
|
||||||
nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra );
|
nImgOrChkWidth = Max( nImgOrChkWidth, aMaxImgSz.Width() + gfxExtra );
|
||||||
nTextPos = (sal_uInt16)(nImgOrChkPos + nImgOrChkWidth);
|
nTextPos = (sal_uInt16)(nImgOrChkPos + nImgOrChkWidth);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nTextPos = (sal_uInt16)(nImgOrChkPos + Max( aMaxImgSz.Width(), nCheckWidth ));
|
|
||||||
}
|
|
||||||
nTextPos = nTextPos + gfxExtra;
|
nTextPos = nTextPos + gfxExtra;
|
||||||
|
|
||||||
aSz.Width() = nTextPos + nMaxWidth + nExtra;
|
aSz.Width() = nTextPos + nMaxWidth + nExtra;
|
||||||
@@ -2811,8 +2794,6 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa
|
|||||||
if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
|
if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
|
||||||
{
|
{
|
||||||
// Don't render an image for a check thing
|
// Don't render an image for a check thing
|
||||||
if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || !pData->HasCheck() )
|
|
||||||
{
|
|
||||||
if( pData->bChecked )
|
if( pData->bChecked )
|
||||||
ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted );
|
ImplPaintCheckBackground( pWin, aOuterCheckRect, pThisItemOnly && bHighlighted );
|
||||||
aTmpPos = aOuterCheckRect.TopLeft();
|
aTmpPos = aOuterCheckRect.TopLeft();
|
||||||
@@ -2820,7 +2801,6 @@ void Menu::ImplPaint( Window* pWin, sal_uInt16 nBorder, long nStartY, MenuItemDa
|
|||||||
aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pData->aImage.GetSizePixel().Height())/2;
|
aTmpPos.Y() += (aOuterCheckRect.GetHeight()-pData->aImage.GetSizePixel().Height())/2;
|
||||||
pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle );
|
pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Text:
|
// Text:
|
||||||
if ( ( pData->eType == MENUITEM_STRING ) || ( pData->eType == MENUITEM_STRINGIMAGE ) )
|
if ( ( pData->eType == MENUITEM_STRING ) || ( pData->eType == MENUITEM_STRINGIMAGE ) )
|
||||||
|
Reference in New Issue
Block a user