Link Here
|
1976 |
|
1976 |
|
1977 |
Size aSz; |
1977 |
Size aSz; |
1978 |
Size aMaxImgSz; |
1978 |
Size aMaxImgSz; |
1979 |
long nMaxTextWidth = 0; |
1979 |
long nMaxWidth = 0; |
1980 |
long nMaxAccWidth = 0; |
|
|
1981 |
long nMinMenuItemHeight = nFontHeight; |
1980 |
long nMinMenuItemHeight = nFontHeight; |
1982 |
|
1981 |
|
1983 |
const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); |
1982 |
const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); |
Link Here
|
2008 |
|
2007 |
|
2009 |
if ( ImplIsVisible( n ) ) |
2008 |
if ( ImplIsVisible( n ) ) |
2010 |
{ |
2009 |
{ |
|
|
2010 |
long nWidth = 0; |
2011 |
|
2011 |
|
2012 |
// Separator |
2012 |
// Separator |
2013 |
if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) ) |
2013 |
if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) ) |
Link Here
|
2032 |
if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) ) |
2032 |
if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) ) |
2033 |
{ |
2033 |
{ |
2034 |
long nTextWidth = pWin->GetCtrlTextWidth( pData->aText ); |
2034 |
long nTextWidth = pWin->GetCtrlTextWidth( pData->aText ); |
2035 |
if ( nTextWidth > nMaxTextWidth ) |
|
|
2036 |
nMaxTextWidth = nTextWidth; |
2037 |
long nTextHeight = pWin->GetTextHeight(); |
2035 |
long nTextHeight = pWin->GetTextHeight(); |
2038 |
|
2036 |
|
2039 |
// if ( nTextHeight > pData->aSz.Height() ) |
2037 |
// if ( nTextHeight > pData->aSz.Height() ) |
Link Here
|
2049 |
} |
2047 |
} |
2050 |
else |
2048 |
else |
2051 |
pData->aSz.Height() = Max( Max( nTextHeight, pData->aSz.Height() ), nMinMenuItemHeight ); |
2049 |
pData->aSz.Height() = Max( Max( nTextHeight, pData->aSz.Height() ), nMinMenuItemHeight ); |
|
|
2050 |
nWidth += nTextWidth; |
2052 |
} |
2051 |
} |
2053 |
|
2052 |
|
2054 |
// Accel |
2053 |
// Accel |
Link Here
|
2057 |
String aName = pData->aAccelKey.GetName(); |
2056 |
String aName = pData->aAccelKey.GetName(); |
2058 |
long nAccWidth = pWin->GetTextWidth( aName ); |
2057 |
long nAccWidth = pWin->GetTextWidth( aName ); |
2059 |
nAccWidth += nExtra; |
2058 |
nAccWidth += nExtra; |
2060 |
if ( nAccWidth > nMaxAccWidth ) |
2059 |
nWidth += nAccWidth; |
2061 |
nMaxAccWidth = nAccWidth; |
|
|
2062 |
} |
2060 |
} |
2063 |
|
2061 |
|
2064 |
// SubMenu? |
2062 |
// SubMenu? |
2065 |
if ( !bIsMenuBar && pData->pSubMenu ) |
2063 |
if ( !bIsMenuBar && pData->pSubMenu ) |
2066 |
{ |
2064 |
{ |
2067 |
if ( nFontHeight > nMaxAccWidth ) |
2065 |
if ( nFontHeight > nWidth ) |
2068 |
nMaxAccWidth = nFontHeight; |
2066 |
nWidth += nFontHeight; |
2069 |
|
2067 |
|
2070 |
pData->aSz.Height() = Max( Max( nFontHeight, pData->aSz.Height() ), nMinMenuItemHeight ); |
2068 |
pData->aSz.Height() = Max( Max( nFontHeight, pData->aSz.Height() ), nMinMenuItemHeight ); |
2071 |
} |
2069 |
} |
Link Here
|
2074 |
|
2072 |
|
2075 |
if ( !bIsMenuBar ) |
2073 |
if ( !bIsMenuBar ) |
2076 |
aSz.Height() += (long)pData->aSz.Height(); |
2074 |
aSz.Height() += (long)pData->aSz.Height(); |
|
|
2075 |
|
2076 |
if ( nWidth > nMaxWidth ) |
2077 |
nMaxWidth = nWidth; |
2077 |
} |
2078 |
} |
2078 |
} |
2079 |
} |
2079 |
|
2080 |
|
2080 |
if ( !bIsMenuBar ) |
2081 |
if ( !bIsMenuBar ) |
2081 |
{ |
2082 |
{ |
|
|
2083 |
int nCheckWidth = 0; |
2084 |
if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || aMaxImgSz.Width() <= 0) |
2085 |
nCheckWidth = nFontHeight/2 + nExtra; |
2082 |
USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text |
2086 |
USHORT gfxExtra = (USHORT) Max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text |
2083 |
nCheckPos = (USHORT)nExtra; |
2087 |
nCheckPos = nExtra; |
2084 |
nImagePos = (USHORT)(nCheckPos + nFontHeight/2 + gfxExtra ); |
2088 |
nImagePos = nCheckPos + nCheckWidth; |
2085 |
nTextPos = (USHORT)(nImagePos+aMaxImgSz.Width()); |
2089 |
nTextPos = nImagePos + aMaxImgSz.Width(); |
2086 |
if ( aMaxImgSz.Width() ) |
2090 |
if ( aMaxImgSz.Width() ) |
2087 |
nTextPos += gfxExtra; |
2091 |
nTextPos += gfxExtra; |
2088 |
|
2092 |
|
2089 |
aSz.Width() = nTextPos + nMaxTextWidth + nExtra + nMaxAccWidth; |
2093 |
aSz.Width() = nTextPos + nMaxWidth + nExtra; |
2090 |
aSz.Width() += 10*nExtra; // etwas mehr... |
2094 |
aSz.Width() += 4*nExtra; // a _little_ more ... |
2091 |
} |
2095 |
} |
2092 |
else |
2096 |
else |
2093 |
{ |
2097 |
{ |
Link Here
|
2166 |
// Image: |
2170 |
// Image: |
2167 |
if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) |
2171 |
if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) |
2168 |
{ |
2172 |
{ |
|
|
2173 |
// Don't render an image for a check thing |
2174 |
if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || |
2175 |
(!(pData->nBits & (MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK)) && !pData->bChecked)) |
2176 |
{ |
2169 |
aTmpPos.Y() = aPos.Y(); |
2177 |
aTmpPos.Y() = aPos.Y(); |
2170 |
aTmpPos.X() = aPos.X() + nImagePos; |
2178 |
aTmpPos.X() = aPos.X() + nImagePos; |
2171 |
aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2; |
2179 |
aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2; |
2172 |
pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle ); |
2180 |
pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle ); |
|
|
2181 |
} |
2173 |
} |
2182 |
} |
2174 |
|
2183 |
|
2175 |
// Text: |
2184 |
// Text: |
Link Here
|
4207 |
ImplDrawScroller( TRUE ); |
4216 |
ImplDrawScroller( TRUE ); |
4208 |
ImplDrawScroller( FALSE ); |
4217 |
ImplDrawScroller( FALSE ); |
4209 |
} |
4218 |
} |
|
|
4219 |
SetFillColor (GetSettings ().GetStyleSettings ().GetMenuColor ()); |
4210 |
pMenu->ImplPaint( this, nScrollerHeight, ImplGetStartY() ); |
4220 |
pMenu->ImplPaint( this, nScrollerHeight, ImplGetStartY() ); |
4211 |
if ( nHighlightedItem != ITEMPOS_INVALID ) |
4221 |
if ( nHighlightedItem != ITEMPOS_INVALID ) |
4212 |
HighlightItem( nHighlightedItem, TRUE ); |
4222 |
HighlightItem( nHighlightedItem, TRUE ); |
Link Here
|
4823 |
ImplGetFrame()->DrawMenuBar(); |
4833 |
ImplGetFrame()->DrawMenuBar(); |
4824 |
return; |
4834 |
return; |
4825 |
} |
4835 |
} |
4826 |
|
4836 |
SetFillColor (GetSettings ().GetStyleSettings ().GetMenuColor ()); |
4827 |
pMenu->ImplPaint( this, 0 ); |
4837 |
pMenu->ImplPaint( this, 0 ); |
4828 |
if ( nHighlightedItem != ITEMPOS_INVALID ) |
4838 |
if ( nHighlightedItem != ITEMPOS_INVALID ) |
4829 |
HighlightItem( nHighlightedItem, TRUE ); |
4839 |
HighlightItem( nHighlightedItem, TRUE ); |