summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-08-27 15:47:33 +0200
committerJan Holesovsky <kendy@suse.cz>2010-08-27 15:47:33 +0200
commitd36d42903c67d2fc1c66bb37f1e88119218357d4 (patch)
tree7248bb8d2eeddca9a6eb4ce0142cf83117946ece
parent316f21dbe9fd1a40b9791803eaee7557e1247cff (diff)
vcl-menu-fixes.diff: Make menu layout prettier.
i#67123, n#523852
Notes
split repo tag: libs-gui_OOO_BUILD_3_2_98_0
-rw-r--r--vcl/source/window/menu.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 81676eba3be4..fa6d9972d32a 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -965,7 +965,7 @@ void Menu::ImplInit()
{
mnHighlightedItemPos = ITEMPOS_INVALID;
mpSalMenu = NULL;
- nMenuFlags = MENU_FLAG_SHOWCHECKIMAGES;
+ nMenuFlags = 0;
nDefaultItem = 0;
//bIsMenuBar = FALSE; // this is now set in the ctor, must not be changed here!!!
nSelectedId = 0;
@@ -2363,6 +2363,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() )
{
@@ -2372,6 +2376,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();
@@ -2418,7 +2425,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 ) ) )
@@ -2482,7 +2489,7 @@ Size Menu::ImplCalcSize( Window* pWin )
{
USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
nCheckPos = (USHORT)nExtra;
- if (nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES)
+ if ( ( nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES ) || bSpaceForCheckbox )
{
long nImgOrChkWidth = 0;
nImagePos = nCheckPos;