summaryrefslogtreecommitdiff
path: root/vcl/source/window/menu.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/menu.cxx')
-rw-r--r--[-rwxr-xr-x]vcl/source/window/menu.cxx43
1 files changed, 20 insertions, 23 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 72715139f699..af79642516f4 100755..100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1,3 +1,5 @@
+
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,7 +30,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#include "tools/list.hxx"
#include "tools/debug.hxx"
#include "tools/diagnose_ex.h"
#include "tools/rc.h"
@@ -561,7 +562,6 @@ public:
Size getMinSize();
Image maImage;
- Image maImageHC;
};
DecoToolBox::DecoToolBox( Window* pParent, WinBits nStyle ) :
@@ -639,8 +639,7 @@ void DecoToolBox::SetImages( long nMaxHeight, bool bForce )
Color aEraseColor( 255, 255, 255, 255 );
BitmapEx aBmpExDst( maImage.GetBitmapEx() );
- BitmapEx aBmpExSrc( GetSettings().GetStyleSettings().GetHighContrastMode() ?
- maImageHC.GetBitmapEx() : aBmpExDst );
+ BitmapEx aBmpExSrc( aBmpExDst );
aEraseColor.SetTransparency( 255 );
aBmpExDst.Erase( aEraseColor );
@@ -965,7 +964,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;
@@ -1102,9 +1101,6 @@ void Menu::Deactivate()
if( !aDelData.isDeleted() )
{
bInCallback = sal_False;
-
- if ( this == pStartMenu )
- GetpApp()->HideHelpStatusText();
}
}
@@ -1118,9 +1114,6 @@ void Menu::Highlight()
if ( pStartMenu && ( pStartMenu != this ) )
pStartMenu->aHighlightHdl.Call( this );
}
-
- if ( !aDelData.isDeleted() && GetCurItemId() )
- GetpApp()->ShowHelpStatusText( GetHelpText( GetCurItemId() ) );
}
void Menu::ImplSelect()
@@ -1190,7 +1183,7 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos )
ImplGetSVData()->mpApp->ImplCallEventListeners( &aEvent );
}
- if ( !aDelData.isDeleted() && !maEventListeners.empty() )
+ if ( !aDelData.isDeleted() )
maEventListeners.Call( &aEvent );
if( !aDelData.isDeleted() )
@@ -1198,8 +1191,7 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos )
Menu* pMenu = this;
while ( pMenu )
{
- if ( !maChildEventListeners.empty() )
- maChildEventListeners.Call( &aEvent );
+ maChildEventListeners.Call( &aEvent );
if( aDelData.isDeleted() )
break;
@@ -1211,12 +1203,12 @@ void Menu::ImplCallEventListeners( sal_uLong nEvent, sal_uInt16 nPos )
void Menu::AddEventListener( const Link& rEventListener )
{
- maEventListeners.push_back( rEventListener );
+ maEventListeners.addListener( rEventListener );
}
void Menu::RemoveEventListener( const Link& rEventListener )
{
- maEventListeners.remove( rEventListener );
+ maEventListeners.removeListener( rEventListener );
}
// -----------------------------------------------------------------------
@@ -2369,6 +2361,10 @@ Size Menu::ImplCalcSize( Window* pWin )
if( nMax > nMinMenuItemHeight )
nMinMenuItemHeight = nMax;
+ // 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 = ( nMax == 0 );
+
const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
if ( rSettings.GetUseImagesInMenus() )
{
@@ -2378,6 +2374,9 @@ Size Menu::ImplCalcSize( Window* pWin )
MenuItemData* pData = pItemList->GetDataFromPos( --i );
if ( ImplIsVisible( i ) && (( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE )))
{
+ // 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();
@@ -2424,7 +2423,7 @@ Size Menu::ImplCalcSize( Window* pWin )
if ( !bIsMenuBar && pData->HasCheck() )
{
nCheckWidth = nMaxCheckWidth;
- if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES)
+ if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
{
// checks / images take the same place
if( ! ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
@@ -2498,7 +2497,7 @@ Size Menu::ImplCalcSize( Window* pWin )
sal_uInt16 gfxExtra = (sal_uInt16) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
nCheckPos = (sal_uInt16)nExtra;
- if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES)
+ if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
{
long nImgOrChkWidth = 0;
nImagePos = nCheckPos;
@@ -5220,18 +5219,14 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) :
if( pResMgr )
{
BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
- BitmapEx aBitmapHC( ResId( SV_RESID_BITMAP_CLOSEDOCHC, *pResMgr ) );
-
aCloser.maImage = Image( aBitmap );
- aCloser.maImageHC = Image( aBitmapHC );
aCloser.SetOutStyle( TOOLBOX_STYLE_FLAT );
aCloser.SetBackground();
aCloser.SetPaintTransparent( sal_True );
aCloser.SetParentClipMode( PARENTCLIPMODE_NOCLIP );
- aCloser.InsertItem( IID_DOCUMENTCLOSE,
- GetSettings().GetStyleSettings().GetHighContrastMode() ? aCloser.maImageHC : aCloser.maImage, 0 );
+ aCloser.InsertItem( IID_DOCUMENTCLOSE, aCloser.maImage, 0 );
aCloser.SetSelectHdl( LINK( this, MenuBarWindow, CloserHdl ) );
aCloser.AddEventListener( LINK( this, MenuBarWindow, ToolboxEventHdl ) );
aCloser.SetQuickHelpText( IID_DOCUMENTCLOSE, XubString( ResId( SV_HELPTEXT_CLOSEDOCUMENT, *pResMgr ) ) );
@@ -6160,3 +6155,5 @@ ImplMenuDelData::~ImplMenuDelData()
if( mpMenu )
const_cast< Menu* >( mpMenu )->ImplRemoveDel( *this );
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */