]>
Commit | Line | Data |
---|---|---|
efef92ce | 1 | Index: vcl/inc/menu.hxx |
2 | =================================================================== | |
3 | RCS file: /cvs/gsl/vcl/inc/menu.hxx,v | |
4 | retrieving revision 1.26 | |
5 | diff -u -p -u -r1.26 menu.hxx | |
6 | --- vcl/inc/menu.hxx 24 Apr 2003 16:29:29 -0000 1.26 | |
7 | +++ vcl/inc/menu.hxx 20 May 2003 11:37:16 -0000 | |
8 | @@ -139,9 +139,10 @@ typedef USHORT MenuItemBits; | |
9 | #define MIB_HELP ((MenuItemBits)0x0010) | |
10 | #define MIB_POPUPSELECT ((MenuItemBits)0x0020) | |
11 | ||
12 | -#define MENU_FLAG_NOAUTOMNEMONICS 0x0001 | |
13 | -#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002 | |
14 | - | |
15 | +#define MENU_FLAG_NOAUTOMNEMONICS 0x0001 | |
16 | +#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002 | |
17 | +#define MENU_FLAG_SHOWCHECKIMAGES 0x0004 | |
18 | + | |
19 | // -------- | |
20 | // - Menu - | |
21 | // -------- | |
22 | Index: sfx2/source/toolbox/tbxchild.cxx | |
23 | =================================================================== | |
24 | RCS file: /cvs/framework/sfx2/source/toolbox/tbxchild.cxx,v | |
25 | retrieving revision 1.33 | |
26 | diff -u -p -u -r1.33 tbxchild.cxx | |
27 | --- sfx2/source/toolbox/tbxchild.cxx 4 Apr 2003 17:38:56 -0000 1.33 | |
28 | +++ sfx2/source/toolbox/tbxchild.cxx 20 May 2003 11:38:20 -0000 | |
29 | @@ -940,6 +940,9 @@ void SfxToolbox::Command ( const Command | |
30 | SfxUInt16Item aConfigItem ( SID_CONFIGITEMID, pMgr->GetType() ); | |
31 | SfxUInt16Item *pItem = &aConfigItem; | |
32 | ||
33 | + pItemMenu->SetMenuFlags (pItemMenu->GetMenuFlags () | | |
34 | + MENU_FLAG_SHOWCHECKIMAGES); | |
35 | + | |
36 | Point aPoint( rCEvt.GetMousePosPixel() ); | |
37 | USHORT nId = aPop.Execute( aPoint, this, (const SfxPoolItem*)pItem, 0L ); | |
38 | ||
39 | Index: vcl/source/window/menu.cxx | |
40 | =================================================================== | |
41 | RCS file: /cvs/gsl/vcl/source/window/menu.cxx,v | |
42 | retrieving revision 1.93 | |
43 | diff -u -p -u -r1.93 menu.cxx | |
44 | --- vcl/source/window/menu.cxx 24 Apr 2003 16:32:17 -0000 1.93 | |
45 | +++ vcl/source/window/menu.cxx 20 May 2003 13:21:01 -0000 | |
46 | @@ -1863,8 +1863,7 @@ Size Menu::ImplCalcSize( Window* pWin ) | |
47 | ||
48 | Size aSz; | |
49 | Size aMaxImgSz; | |
50 | - long nMaxTextWidth = 0; | |
51 | - long nMaxAccWidth = 0; | |
52 | + long nMaxWidth = 0; | |
53 | long nMinMenuItemHeight = nFontHeight; | |
54 | ||
55 | const StyleSettings& rSettings = pWin->GetSettings().GetStyleSettings(); | |
56 | @@ -1895,6 +1894,7 @@ Size Menu::ImplCalcSize( Window* pWin ) | |
57 | ||
58 | if ( ImplIsVisible( n ) ) | |
59 | { | |
60 | + long nWidth = 0; | |
61 | ||
62 | // Separator | |
63 | if ( !bIsMenuBar && ( pData->eType == MENUITEM_SEPARATOR ) ) | |
64 | @@ -1919,8 +1919,6 @@ Size Menu::ImplCalcSize( Window* pWin ) | |
65 | if ( (pData->eType == MENUITEM_STRING) || (pData->eType == MENUITEM_STRINGIMAGE) ) | |
66 | { | |
67 | long nTextWidth = pWin->GetCtrlTextWidth( pData->aText ); | |
68 | - if ( nTextWidth > nMaxTextWidth ) | |
69 | - nMaxTextWidth = nTextWidth; | |
70 | long nTextHeight = pWin->GetTextHeight(); | |
71 | ||
72 | // if ( nTextHeight > pData->aSz.Height() ) | |
73 | @@ -1936,6 +1934,7 @@ Size Menu::ImplCalcSize( Window* pWin ) | |
74 | } | |
75 | else | |
76 | pData->aSz.Height() = std::max( std::max( nTextHeight, pData->aSz.Height() ), nMinMenuItemHeight ); | |
77 | + nWidth += nTextWidth; | |
78 | } | |
79 | ||
80 | // Accel | |
81 | @@ -1944,15 +1943,14 @@ Size Menu::ImplCalcSize( Window* pWin ) | |
82 | String aName = pData->aAccelKey.GetName(); | |
83 | long nAccWidth = pWin->GetTextWidth( aName ); | |
84 | nAccWidth += nExtra; | |
85 | - if ( nAccWidth > nMaxAccWidth ) | |
86 | - nMaxAccWidth = nAccWidth; | |
87 | + nWidth += nAccWidth; | |
88 | } | |
89 | ||
90 | // SubMenu? | |
91 | if ( !bIsMenuBar && pData->pSubMenu ) | |
92 | { | |
93 | - if ( nFontHeight > nMaxAccWidth ) | |
94 | - nMaxAccWidth = nFontHeight; | |
95 | + if ( nFontHeight > nWidth ) | |
96 | + nWidth += nFontHeight; | |
97 | ||
98 | pData->aSz.Height() = std::max( std::max( nFontHeight, pData->aSz.Height() ), nMinMenuItemHeight ); | |
99 | ||
100 | @@ -1964,20 +1962,26 @@ Size Menu::ImplCalcSize( Window* pWin ) | |
101 | ||
102 | if ( !bIsMenuBar ) | |
103 | aSz.Height() += (long)pData->aSz.Height(); | |
104 | + | |
105 | + if ( nWidth > nMaxWidth ) | |
10667934 | 106 | + nMaxWidth = nWidth; |
efef92ce | 107 | } |
108 | } | |
109 | ||
110 | if ( !bIsMenuBar ) | |
111 | { | |
10667934 | 112 | - USHORT gfxExtra = (USHORT) std::max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text |
efef92ce | 113 | - nCheckPos = (USHORT)nExtra; |
114 | - nImagePos = (USHORT)(nCheckPos + nFontHeight/2 + gfxExtra ); | |
115 | - nTextPos = (USHORT)(nImagePos+aMaxImgSz.Width()); | |
10667934 | 116 | + int nCheckWidth = 0; |
efef92ce | 117 | + if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || aMaxImgSz.Width() <= 0) |
10667934 | 118 | + nCheckWidth = nFontHeight/2 + nExtra; |
efef92ce | 119 | + USHORT gfxExtra = std::max( nExtra, 7L ); // #107710# increase space between checkmarks/images/text |
10667934 AM |
120 | + nCheckPos = nExtra; |
121 | + nImagePos = nCheckPos + nCheckWidth; | |
122 | + nTextPos = nImagePos + aMaxImgSz.Width(); | |
efef92ce | 123 | if ( aMaxImgSz.Width() ) |
124 | nTextPos += gfxExtra; | |
125 | ||
126 | - aSz.Width() = nTextPos + nMaxTextWidth + nExtra + nMaxAccWidth; | |
127 | - aSz.Width() += 10*nExtra; // etwas mehr... | |
10667934 AM |
128 | + aSz.Width() = nTextPos + nMaxWidth + nExtra; |
129 | + aSz.Width() += 4*nExtra; // a _little_ more ... | |
efef92ce | 130 | } |
131 | else | |
132 | { | |
133 | @@ -2057,10 +2061,15 @@ void Menu::ImplPaint( Window* pWin, USHO | |
134 | // Image: | |
135 | if ( !bLayout && !bIsMenuBar && ( ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ) ) ) | |
136 | { | |
137 | + // Don't render an image for a check thing | |
138 | + if ((nMenuFlags & MENU_FLAG_SHOWCHECKIMAGES) || | |
139 | + (!(pData->nBits & (MIB_RADIOCHECK | MIB_CHECKABLE | MIB_AUTOCHECK)) && !pData->bChecked)) | |
140 | + { | |
141 | aTmpPos.Y() = aPos.Y(); | |
142 | aTmpPos.X() = aPos.X() + nImagePos; | |
143 | aTmpPos.Y() += (pData->aSz.Height()-pData->aImage.GetSizePixel().Height())/2; | |
144 | pWin->DrawImage( aTmpPos, pData->aImage, nImageStyle ); | |
145 | + } | |
146 | } | |
147 | ||
148 | // Text: | |
149 | @@ -3973,6 +3982,7 @@ void MenuFloatingWindow::Paint( const Re | |
150 | ImplDrawScroller( TRUE ); | |
151 | ImplDrawScroller( FALSE ); | |
152 | } | |
153 | + SetFillColor (GetSettings ().GetStyleSettings ().GetMenuColor ()); | |
154 | pMenu->ImplPaint( this, nScrollerHeight, ImplGetStartY() ); | |
155 | if ( nHighlightedItem != ITEMPOS_INVALID ) | |
156 | HighlightItem( nHighlightedItem, TRUE ); | |
157 | @@ -4604,6 +4614,7 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( | |
158 | ||
159 | void MenuBarWindow::Paint( const Rectangle& rRect ) | |
160 | { | |
161 | + SetFillColor (GetSettings ().GetStyleSettings ().GetMenuColor ()); | |
162 | pMenu->ImplPaint( this, 0 ); | |
163 | if ( nHighlightedItem != ITEMPOS_INVALID ) | |
164 | HighlightItem( nHighlightedItem, TRUE ); |