View | Details | Raw Unified | Return to issue 17937
Collapse All | Expand All

(-)vcl/inc/menu.hxx (-3 / +4 lines)
Lines 139-147 typedef USHORT MenuItemBits; Link Here
139
#define MIB_HELP				((MenuItemBits)0x0010)
139
#define MIB_HELP				((MenuItemBits)0x0010)
140
#define MIB_POPUPSELECT 		((MenuItemBits)0x0020)
140
#define MIB_POPUPSELECT 		((MenuItemBits)0x0020)
141
141
142
#define MENU_FLAG_NOAUTOMNEMONICS		0x0001
142
#define MENU_FLAG_NOAUTOMNEMONICS     0x0001
143
#define MENU_FLAG_HIDEDISABLEDENTRIES	0x0002
143
#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002
144
144
#define MENU_FLAG_SHOWCHECKIMAGES     0x0004
145
  
145
// --------
146
// --------
146
// - Menu -
147
// - Menu -
147
// --------
148
// --------
(-)sfx2/source/toolbox/tbxchild.cxx (+3 lines)
Lines 940-945 void SfxToolbox::Command ( const Command Link Here
940
		SfxUInt16Item aConfigItem ( SID_CONFIGITEMID, pMgr->GetType() );
940
		SfxUInt16Item aConfigItem ( SID_CONFIGITEMID, pMgr->GetType() );
941
		SfxUInt16Item *pItem = &aConfigItem;
941
		SfxUInt16Item *pItem = &aConfigItem;
942
942
943
		pItemMenu->SetMenuFlags (pItemMenu->GetMenuFlags () | 
944
 					 MENU_FLAG_SHOWCHECKIMAGES);
945
943
        Point aPoint( rCEvt.GetMousePosPixel() );
946
        Point aPoint( rCEvt.GetMousePosPixel() );
944
        USHORT nId = aPop.Execute( aPoint, this, (const SfxPoolItem*)pItem, 0L );
947
        USHORT nId = aPop.Execute( aPoint, this, (const SfxPoolItem*)pItem, 0L );
945
948
(-)vcl/source/window/menu.cxx (-14 / +25 lines)
Lines 1863-1870 Size Menu::ImplCalcSize( Window* pWin ) Link Here
1863
1863
1864
    Size aSz;
1864
    Size aSz;
1865
    Size aMaxImgSz;
1865
    Size aMaxImgSz;
1866
    long nMaxTextWidth = 0;
1866
    long nMaxWidth = 0;
1867
    long nMaxAccWidth = 0;
1868
    long nMinMenuItemHeight = nFontHeight;
1867
    long nMinMenuItemHeight = nFontHeight;
1869
1868
1870
	const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
1869
	const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings();
Lines 1895-1900 Size Menu::ImplCalcSize( Window* pWin ) Link Here
1895
1894
1896
        if ( ImplIsVisible( n ) )
1895
        if ( ImplIsVisible( n ) )
1897
        {
1896
        {
1897
            long nWidth = 0;
1898
1898
1899
            // Separator
1899
            // Separator
1900
            if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) )
1900
            if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) )
Lines 1919-1926 Size Menu::ImplCalcSize( Window* pWin ) Link Here
1919
            if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) )
1919
            if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) )
1920
            {
1920
            {
1921
                long nTextWidth = pWin->GetCtrlTextWidth( pData->aText );
1921
                long nTextWidth = pWin->GetCtrlTextWidth( pData->aText );
1922
                if ( nTextWidth > nMaxTextWidth )
1923
                    nMaxTextWidth = nTextWidth;
1924
                long nTextHeight = pWin->GetTextHeight();
1922
                long nTextHeight = pWin->GetTextHeight();
1925
1923
1926
//                if ( nTextHeight > pData->aSz.Height() )
1924
//                if ( nTextHeight > pData->aSz.Height() )
Lines 1936-1941 Size Menu::ImplCalcSize( Window* pWin ) Link Here
1936
                }
1934
                }
1937
				else
1935
				else
1938
					pData->aSz.Height() = std::max( std::max( nTextHeight, pData->aSz.Height() ), nMinMenuItemHeight );
1936
					pData->aSz.Height() = std::max( std::max( nTextHeight, pData->aSz.Height() ), nMinMenuItemHeight );
1937
		nWidth += nTextWidth;
1939
            }
1938
            }
1940
1939
1941
            // Accel
1940
            // Accel
Lines 1944-1958 Size Menu::ImplCalcSize( Window* pWin ) Link Here
1944
                String aName = pData->aAccelKey.GetName();
1943
                String aName = pData->aAccelKey.GetName();
1945
                long nAccWidth = pWin->GetTextWidth( aName );
1944
                long nAccWidth = pWin->GetTextWidth( aName );
1946
                nAccWidth += nExtra;
1945
                nAccWidth += nExtra;
1947
                if ( nAccWidth > nMaxAccWidth )
1946
		nWidth += nAccWidth;
1948
                    nMaxAccWidth = nAccWidth;
1949
            }
1947
            }
1950
1948
1951
            // SubMenu?
1949
            // SubMenu?
1952
            if ( !bIsMenuBar && pData->pSubMenu )
1950
            if ( !bIsMenuBar && pData->pSubMenu )
1953
            {
1951
            {
1954
                if ( nFontHeight > nMaxAccWidth )
1952
                if ( nFontHeight > nWidth )
1955
                    nMaxAccWidth = nFontHeight;
1953
                    nWidth += nFontHeight;
1956
1954
1957
				pData->aSz.Height() = std::max( std::max( nFontHeight, pData->aSz.Height() ), nMinMenuItemHeight );
1955
				pData->aSz.Height() = std::max( std::max( nFontHeight, pData->aSz.Height() ), nMinMenuItemHeight );
1958
1956
Lines 1964-1983 Size Menu::ImplCalcSize( Window* pWin ) Link Here
1964
1962
1965
            if ( !bIsMenuBar )
1963
            if ( !bIsMenuBar )
1966
                aSz.Height() += (long)pData->aSz.Height();
1964
                aSz.Height() += (long)pData->aSz.Height();
1965
1966
	    if ( nWidth > nMaxWidth )
1967
                nMaxWidth = nWidth;
1967
        }
1968
        }
1968
    }
1969
    }
1969
1970
1970
    if ( !bIsMenuBar )
1971
    if ( !bIsMenuBar )
1971
    {
1972
    {
1972
        USHORT gfxExtra = std::max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
1973
        int nCheckWidth = 0;
1973
        nCheckPos = (USHORT)nExtra;
1974
	if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || aMaxImgSz.Width() <= 0)
1974
        nImagePos = (USHORT)(nCheckPos + nFontHeight/2 + gfxExtra );
1975
	  nCheckWidth = nFontHeight/2 + nExtra;
1975
        nTextPos = (USHORT)(nImagePos+aMaxImgSz.Width());
1976
	USHORT gfxExtra = std::max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text
1977
        nCheckPos = nExtra;
1978
        nImagePos = nCheckPos + nCheckWidth;
1979
        nTextPos = nImagePos + aMaxImgSz.Width();
1976
        if ( aMaxImgSz.Width() )
1980
        if ( aMaxImgSz.Width() )
1977
            nTextPos += gfxExtra;
1981
            nTextPos += gfxExtra;
1978
1982
1979
        aSz.Width() = nTextPos + nMaxTextWidth + nExtra + nMaxAccWidth;
1983
        aSz.Width() = nTextPos + nMaxWidth + nExtra;
1980
        aSz.Width() += 10*nExtra;   // etwas mehr...
1984
        aSz.Width() += 4*nExtra;   // a _little_ more ...
1981
    }
1985
    }
1982
    else
1986
    else
1983
    {
1987
    {
Lines 2057-2066 void Menu::ImplPaint( Window* pWin, USHO Link Here
2057
                // Image:
2061
                // Image:
2058
                if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
2062
                if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) )
2059
                {
2063
                {
2064
		  // Don't render an image for a check thing
2065
		  if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) ||
2066
                     (!(pData->nBits & (MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK)) && !pData->bChecked))
2067
		  {
2060
                    aTmpPos.Y() = aPos.Y();
2068
                    aTmpPos.Y() = aPos.Y();
2061
                    aTmpPos.X() = aPos.X() + nImagePos;
2069
                    aTmpPos.X() = aPos.X() + nImagePos;
2062
                    aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2;
2070
                    aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2;
2063
                    pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle );
2071
                    pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle );
2072
		  }
2064
                }
2073
                }
2065
2074
2066
                // Text:
2075
                // Text:
Lines 3973-3978 void MenuFloatingWindow::Paint( const Re Link Here
3973
        ImplDrawScroller( TRUE );
3982
        ImplDrawScroller( TRUE );
3974
        ImplDrawScroller( FALSE );
3983
        ImplDrawScroller( FALSE );
3975
    }
3984
    }
3985
    SetFillColor (GetSettings ().GetStyleSettings ().GetMenuColor ());
3976
    pMenu->ImplPaint( this, nScrollerHeight, ImplGetStartY() );
3986
    pMenu->ImplPaint( this, nScrollerHeight, ImplGetStartY() );
3977
    if ( nHighlightedItem != ITEMPOS_INVALID )
3987
    if ( nHighlightedItem != ITEMPOS_INVALID )
3978
        HighlightItem( nHighlightedItem, TRUE );
3988
        HighlightItem( nHighlightedItem, TRUE );
Lines 4604-4609 BOOL MenuBarWindow::ImplHandleKeyEvent( Link Here
4604
4614
4605
void MenuBarWindow::Paint( const Rectangle& rRect )
4615
void MenuBarWindow::Paint( const Rectangle& rRect )
4606
{
4616
{
4617
    SetFillColor (GetSettings ().GetStyleSettings ().GetMenuColor ());
4607
    pMenu->ImplPaint( this, 0 );
4618
    pMenu->ImplPaint( this, 0 );
4608
    if ( nHighlightedItem != ITEMPOS_INVALID )
4619
    if ( nHighlightedItem != ITEMPOS_INVALID )
4609
        HighlightItem( nHighlightedItem, TRUE );
4620
        HighlightItem( nHighlightedItem, TRUE );

Return to issue 17937