author | Claus Gittinger <cg@exept.de> |
Sat, 24 Apr 1999 18:54:20 +0200 | |
changeset 1336 | 6087005f59a8 |
parent 1332 | 8969b8f75c6f |
child 1337 | f0ed36b3c3d6 |
permissions | -rw-r--r-- |
388 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1117 | 3 |
All Rights Reserved |
388 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
389 | 14 |
SimpleView subclass:#MenuPanel |
689 | 15 |
instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu |
16 |
shortKeyInset selection items groupSizes receiver enableChannel |
|
17 |
menuHolder enabled onLevel offLevel fgColor activeFgColor |
|
18 |
lastActiveMenu activeBgColor disabledFgColor groupDividerSize |
|
727 | 19 |
itemSpace fitFirstPanel rightArrow rightArrowShadow |
730 | 20 |
selectionFrameBrightColor selectionFrameDarkColor |
21 |
buttonLightColor buttonShadowColor buttonHalfLightColor |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
22 |
buttonHalfShadowColor lastButtonSelected enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
23 |
buttonEnteredBgColor' |
689 | 24 |
classVariableNames:'InitialSelectionQuerySignal DefaultAdornment |
25 |
DefaultGroupDividerSize DefaultHilightLevel DefaultLevel |
|
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
26 |
DefaultItemSpace DefaultButtonItemSpace DefaultForegroundColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
27 |
DefaultBackgroundColor DefaultHilightForegroundColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
28 |
DefaultHilightBackgroundColor DefaultDisabledForegroundColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
29 |
DefaultFitFirstPanel RightArrowForm RightArrowShadowForm |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
30 |
SelectionFrameBrightColor SelectionFrameDarkColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
31 |
ButtonActiveLevel ButtonPassiveLevel ButtonActiveBackgroundColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
32 |
ButtonPassiveBackgroundColor ButtonLightColor ButtonShadowColor |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
33 |
ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle Images |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
34 |
LigthenedImages ButtonEnteredBackgroundColor ButtonEnteredLevel' |
689 | 35 |
poolDictionaries:'' |
36 |
category:'Views-Menus' |
|
388 | 37 |
! |
38 |
||
39 |
Object subclass:#Item |
|
729
18395718ec8e
lighten the icon & image of a disabled LabelAndIcon if the
ca
parents:
728
diff
changeset
|
40 |
instanceVariableNames:'layout menuPanel subMenu adornment rawLabel disabledRawLabel |
18395718ec8e
lighten the icon & image of a disabled LabelAndIcon if the
ca
parents:
728
diff
changeset
|
41 |
enableChannel nameKey accessCharacterPosition value label |
794 | 42 |
rawImage activeHelpKey submenuChannel startGroup isButton |
43 |
isVisible' |
|
689 | 44 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
45 |
VerticalButtonInset LabelRightOffset ShortcutKeyOffset |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
46 |
IndicatorOn IndicatorOff' |
689 | 47 |
poolDictionaries:'' |
48 |
privateIn:MenuPanel |
|
388 | 49 |
! |
50 |
||
51 |
Object subclass:#Adornment |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
52 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument choice |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
53 |
choiceValue' |
689 | 54 |
classVariableNames:'' |
55 |
poolDictionaries:'' |
|
56 |
privateIn:MenuPanel::Item |
|
388 | 57 |
! |
58 |
||
59 |
!MenuPanel class methodsFor:'documentation'! |
|
60 |
||
61 |
copyright |
|
62 |
" |
|
63 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1117 | 64 |
All Rights Reserved |
388 | 65 |
|
66 |
This software is furnished under a license and may be used |
|
67 |
only in accordance with the terms of that license and with the |
|
68 |
inclusion of the above copyright notice. This software may not |
|
69 |
be provided or otherwise made available to, or used by, any |
|
70 |
other person. No title to or ownership of the software is |
|
71 |
hereby transferred. |
|
72 |
" |
|
73 |
||
74 |
! |
|
75 |
||
76 |
documentation |
|
77 |
" |
|
78 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
79 |
||
80 |
not yet finished MenuPanel class - this will eventually replace |
|
81 |
most of the MenuView and PopUpMenu stuff. |
|
82 |
(and hopefully be ST-80 compatible ...) |
|
83 |
||
502 | 84 |
To create a menu, there exists a MenuEditor which will generate |
85 |
a menu specification. |
|
86 |
||
87 |
||
388 | 88 |
[author:] |
1117 | 89 |
Claus Atzkern |
388 | 90 |
|
91 |
[see also:] |
|
1117 | 92 |
Menu |
93 |
MenuItem |
|
94 |
MenuEditor |
|
388 | 95 |
" |
96 |
||
97 |
! |
|
98 |
||
99 |
examples |
|
100 |
||
101 |
" |
|
102 |
start as PullDownMenu |
|
1117 | 103 |
[exBegin] |
388 | 104 |
|top subView mview desc s1 s2 s3 img lbs labels| |
105 |
||
106 |
top := StandardSystemView new. |
|
107 |
||
436 | 108 |
mview := MenuPanel in:top. |
388 | 109 |
|
502 | 110 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 111 |
mview level:2. |
112 |
mview verticalLayout:false. |
|
113 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 114 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 115 |
mview labels:lbs. |
116 |
mview shortcutKeyAt:2 put:#Cut. |
|
117 |
mview accessCharacterPositionAt:1 put:1. |
|
118 |
mview accessCharacterPositionAt:2 put:2. |
|
119 |
||
120 |
mview enabledAt:5 put:false. |
|
121 |
mview groupSizes:#( 2 2 ). |
|
436 | 122 |
s1 := MenuPanel labels:labels. |
388 | 123 |
s1 accessCharacterPositionAt:1 put:1. |
124 |
s1 accessCharacterPositionAt:2 put:2. |
|
125 |
s1 groupSizes:#( 2 2 ). |
|
436 | 126 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
127 |
s3 := MenuPanel labels:lbs. |
|
388 | 128 |
|
129 |
s1 subMenuAt:2 put:s2. |
|
436 | 130 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 131 |
s2 subMenuAt:3 put:s3. |
436 | 132 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 133 |
s3 shortcutKeyAt:3 put:$q. |
134 |
||
135 |
mview subMenuAt:1 put:s1. |
|
436 | 136 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 137 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
138 |
s1 shortcutKeyAt:1 put:#Copy. |
|
139 |
s1 shortcutKeyAt:3 put:#Paste. |
|
140 |
||
436 | 141 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 142 |
top extent:(mview preferredExtent). |
388 | 143 |
top open. |
1117 | 144 |
[exEnd] |
388 | 145 |
|
146 |
||
147 |
start as PopUpMenu |
|
1117 | 148 |
[exBegin] |
388 | 149 |
|subView mview desc s1 s2 s3 img lbs labels| |
150 |
||
436 | 151 |
mview := MenuPanel new. |
502 | 152 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 153 |
mview level:2. |
154 |
||
155 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 156 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 157 |
mview labels:lbs. |
158 |
||
436 | 159 |
s1 := MenuPanel labels:labels. |
160 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
161 |
s3 := MenuPanel labels:lbs. |
|
388 | 162 |
s1 subMenuAt:2 put:s2. |
436 | 163 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 164 |
s2 subMenuAt:3 put:s3. |
436 | 165 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 166 |
s3 shortcutKeyAt:3 put:$q. |
167 |
||
168 |
mview subMenuAt:1 put:s1. |
|
436 | 169 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 170 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
171 |
s1 shortcutKeyAt:1 put:#Copy. |
|
172 |
s1 shortcutKeyAt:3 put:#Paste. |
|
173 |
||
436 | 174 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 175 |
mview startUp |
1117 | 176 |
[exEnd] |
388 | 177 |
|
178 |
||
179 |
start from menu spec |
|
1117 | 180 |
[exBegin] |
388 | 181 |
|menu| |
182 |
||
436 | 183 |
menu := MenuPanel menu: |
1117 | 184 |
#(#Menu #( #(#MenuItem |
185 |
#label: 'File' |
|
186 |
#submenu: |
|
187 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
188 |
(#MenuItem |
|
189 |
#label: 'edit' |
|
190 |
#submenu: |
|
191 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
192 |
#(#MenuItem #label: 'close' #value:#close) |
|
193 |
) |
|
194 |
nil |
|
195 |
nil |
|
196 |
) |
|
197 |
) |
|
198 |
#(#MenuItem #label: 'help' #value:#help ) |
|
199 |
) |
|
200 |
nil |
|
201 |
nil |
|
202 |
) |
|
203 |
) |
|
204 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
205 |
#(#MenuItem #label: 'Bar' |
|
206 |
#submenu: |
|
207 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
208 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
209 |
) |
|
210 |
nil |
|
211 |
nil |
|
212 |
) |
|
213 |
) |
|
214 |
) |
|
215 |
#( 2 ) |
|
216 |
nil |
|
217 |
) decodeAsLiteralArray. |
|
388 | 218 |
|
219 |
menu verticalLayout:false. |
|
220 |
Transcript showCR:(menu startUp). |
|
1117 | 221 |
[exEnd] |
388 | 222 |
|
223 |
" |
|
224 |
||
225 |
! ! |
|
226 |
||
227 |
!MenuPanel class methodsFor:'instance creation'! |
|
228 |
||
229 |
fromSpec:aSpec |
|
230 |
^ self fromSpec:aSpec receiver:nil |
|
231 |
! |
|
232 |
||
233 |
fromSpec:aSpec receiver:aReceiver |
|
234 |
|menu| |
|
235 |
||
236 |
aSpec notNil ifTrue:[ |
|
1117 | 237 |
menu := Menu new. |
238 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 239 |
]. |
240 |
^ self menu:menu receiver:aReceiver |
|
241 |
! |
|
242 |
||
243 |
labels:labels |
|
244 |
^ self labels:labels nameKeys:nil receiver:nil |
|
245 |
! |
|
246 |
||
247 |
labels:labels nameKeys:nameKeys |
|
248 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
249 |
! |
|
250 |
||
251 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
252 |
|mview| |
|
253 |
||
254 |
mview := self menu:nil receiver:aReceiver. |
|
255 |
mview labels:labels. |
|
256 |
mview nameKeys:nameKeys. |
|
257 |
^ mview |
|
258 |
||
259 |
! |
|
260 |
||
502 | 261 |
labels:labels receiver:aReceiver |
262 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
263 |
! |
|
264 |
||
388 | 265 |
menu:aMenu |
266 |
^ self menu:aMenu receiver:nil |
|
267 |
! |
|
268 |
||
269 |
menu:aMenu receiver:aReceiver |
|
270 |
|mview| |
|
271 |
||
272 |
mview := self new. |
|
273 |
mview menu:aMenu. |
|
274 |
||
275 |
"/ a menu itself may contain a receiver |
|
276 |
"/ thus we do not overwrite the receiver |
|
277 |
||
278 |
aReceiver notNil ifTrue:[ |
|
1117 | 279 |
mview receiver:aReceiver |
388 | 280 |
]. |
281 |
^ mview |
|
282 |
||
283 |
! ! |
|
284 |
||
285 |
!MenuPanel class methodsFor:'class initialization'! |
|
286 |
||
287 |
initialize |
|
657 | 288 |
" |
289 |
DefaultAdornment := nil. |
|
290 |
self initialize |
|
291 |
" |
|
292 |
||
388 | 293 |
InitialSelectionQuerySignal isNil ifTrue:[ |
1117 | 294 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 295 |
]. |
390 | 296 |
|
388 | 297 |
DefaultAdornment isNil ifTrue:[ |
1117 | 298 |
DefaultAdornment := IdentityDictionary new |
299 |
at:#showSeparatingLines put:false; |
|
300 |
at:#showGroupDivider put:true; |
|
301 |
at:#verticalLayout put:true; |
|
302 |
at:#item put:nil; |
|
303 |
at:#value put:nil; |
|
304 |
yourself |
|
388 | 305 |
]. |
306 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
307 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 308 |
! |
309 |
||
310 |
preSnapshot |
|
311 |
"remove all resources |
|
312 |
" |
|
313 |
Images := nil. |
|
314 |
LigthenedImages := nil. |
|
315 |
||
616 | 316 |
! ! |
317 |
||
318 |
!MenuPanel class methodsFor:'defaults'! |
|
450 | 319 |
|
320 |
updateStyleCache |
|
657 | 321 |
|
616 | 322 |
|menuStyle style font| |
450 | 323 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
324 |
"/ MenuView updateStyleCache. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
325 |
"/ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
326 |
"/ menuStyle := MenuView styleSheet. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
327 |
"/ menuStyle isNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
328 |
"/ "make sure that style sheet is present" |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
329 |
"/ MenuView updateStyleCache. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
330 |
"/ menuStyle := MenuView styleSheet. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
331 |
"/ ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
332 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
333 |
menuStyle := StyleSheet. |
616 | 334 |
style := menuStyle name. |
335 |
||
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
336 |
"/ DefaultForegroundColor := menuStyle colorAt:'pullDownMenu.foregroundColor'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
337 |
"/ DefaultForegroundColor isNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
338 |
DefaultForegroundColor := menuStyle colorAt:#'menu.foregroundColor' |
1130 | 339 |
default:Color black. |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
340 |
"/ ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
341 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
342 |
DefaultLevel := menuStyle at:#'pullDownMenu.level' default:0. |
616 | 343 |
|
344 |
(style == #motif or:[style == #iris]) ifTrue:[ |
|
1130 | 345 |
DefaultBackgroundColor := DefaultViewBackgroundColor. |
346 |
DefaultHilightForegroundColor := DefaultForegroundColor. |
|
347 |
DefaultHilightLevel := 2. |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
348 |
DefaultLevel := DefaultLevel + 1. |
616 | 349 |
] ifFalse:[ |
1130 | 350 |
(DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[ |
351 |
DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0. |
|
352 |
]. |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
353 |
menuStyle is3D ifTrue:[DefaultLevel := DefaultLevel + 1]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
354 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
355 |
"/ DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
356 |
"/ DefaultBackgroundColor isNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
357 |
DefaultBackgroundColor := menuStyle colorAt:#'menu.backgroundColor' |
1130 | 358 |
default:DefaultViewBackgroundColor. |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
359 |
"/ ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
360 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
361 |
"/ DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
362 |
"/ DefaultHilightForegroundColor isNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
363 |
DefaultHilightForegroundColor := menuStyle colorAt:#'menu.hilightForegroundColor' |
1130 | 364 |
default:DefaultBackgroundColor |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
365 |
"/ ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
366 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
367 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
368 |
DefaultDisabledForegroundColor := menuStyle colorAt:#'menu.disabledForegroundColor'. |
616 | 369 |
DefaultDisabledForegroundColor isNil ifTrue:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
370 |
DefaultDisabledForegroundColor := menuStyle colorAt:#'button.disabledForegroundColor' |
1130 | 371 |
default:Color darkGray. |
616 | 372 |
]. |
373 |
||
374 |
style == #motif ifTrue:[ |
|
1130 | 375 |
DefaultHilightBackgroundColor := DefaultBackgroundColor |
616 | 376 |
] ifFalse:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
377 |
"/ DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
378 |
"/ DefaultHilightBackgroundColor isNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
379 |
DefaultHilightBackgroundColor := menuStyle colorAt:#'menu.hilightBackgroundColor' |
1130 | 380 |
default:(menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]). |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
381 |
"/ ] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
382 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
383 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
384 |
DefaultGroupDividerSize := menuStyle at:#'menu.groupDividerSize' default:6. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
385 |
DefaultItemSpace := menuStyle at:#'menu.itemSpace' default:0. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
386 |
DefaultButtonItemSpace := menuStyle at:#'menu.buttonItemSpace' default:0. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
387 |
DefaultFitFirstPanel := menuStyle at:#'menu.fitFirstPanel' default:true. |
616 | 388 |
|
829 | 389 |
MenuView updateStyleCache. |
390 |
DefaultFont := MenuView defaultFont. |
|
391 |
"/ font := menuStyle fontAt:'pullDownMenu.font'. |
|
392 |
"/ font isNil ifTrue:[font := menuStyle fontAt:'menu.font']. |
|
393 |
"/ DefaultFont := font. |
|
616 | 394 |
|
395 |
RightArrowForm := SelectionInListView rightArrowFormOn:Display. |
|
396 |
||
1054
f56416a8d26b
win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents:
1051
diff
changeset
|
397 |
(style ~~ #os2 and:[style ~~ #win95]) ifTrue:[ |
1130 | 398 |
RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display. |
616 | 399 |
] ifFalse:[ |
1130 | 400 |
RightArrowShadowForm := nil |
616 | 401 |
]. |
402 |
||
730 | 403 |
SelectionFrameBrightColor := Color white. |
404 |
SelectionFrameDarkColor := Color black. |
|
405 |
||
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
406 |
ButtonActiveLevel := menuStyle at:#'menu.buttonActiveLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]). |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
407 |
ButtonActiveLevel isNil ifTrue:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
408 |
ButtonActiveLevel := menuStyle at:#'button.activeLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
409 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
410 |
ButtonPassiveLevel := menuStyle at:#'menu.buttonPassiveLevel'. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
411 |
ButtonPassiveLevel isNil ifTrue:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
412 |
ButtonPassiveLevel := menuStyle at:#'button.passiveLevel' default:(menuStyle is3D ifTrue:[2] ifFalse:[0]). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
413 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
414 |
ButtonActiveBackgroundColor := menuStyle at:#'button.activeBackgroundColor' default: DefaultBackgroundColor. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
415 |
ButtonPassiveBackgroundColor := (menuStyle at:#'button.backgroundColor') ? (menuStyle at:'viewBackground') ? DefaultBackgroundColor. |
1336 | 416 |
|
417 |
ButtonLightColor := menuStyle at:#'button.lightColor'. |
|
418 |
ButtonLightColor isNil ifTrue:[ |
|
419 |
ButtonLightColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened. "/ Color white |
|
420 |
]. |
|
421 |
ButtonShadowColor := menuStyle at:#'button.shadowColor'. |
|
422 |
ButtonShadowColor isNil ifTrue:[ |
|
423 |
ButtonShadowColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened. "/ Color white |
|
424 |
"/ (style == #next ifTrue:[ |
|
425 |
"/ ButtonShadowColor := Color black |
|
426 |
"/ ] ifFalse:[ |
|
427 |
"/ ButtonShadowColor := Color gray |
|
428 |
"/ ] |
|
429 |
]. |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
430 |
ButtonHalfLightColor := menuStyle at:#'button.halfLightColor'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
431 |
ButtonHalfShadowColor := menuStyle at:#'button.halfShadowColor'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
432 |
ButtonEdgeStyle := menuStyle at:#'button.edgeStyle'. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
433 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
434 |
ButtonEnteredBackgroundColor := menuStyle colorAt:#'menu.buttonEnteredBackgroundColor'. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
435 |
ButtonEnteredBackgroundColor isNil ifTrue:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
436 |
ButtonEnteredBackgroundColor := menuStyle colorAt:#'button.enteredBackgroundColor' |
1130 | 437 |
default:ButtonPassiveBackgroundColor. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
438 |
]. |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
439 |
ButtonEnteredLevel := menuStyle at:#'menu.buttonEnteredLevel' default:ButtonPassiveLevel. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
440 |
|
616 | 441 |
Item updateStyleCache |
1018
67c883ab05d6
kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
442 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
443 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
444 |
self updateStyleCache |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
445 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
446 |
|
1130 | 447 |
"Modified: / 10.9.1998 / 21:40:32 / cg" |
388 | 448 |
! ! |
449 |
||
794 | 450 |
!MenuPanel class methodsFor:'image registration'! |
451 |
||
452 |
image:anImage onDevice:aDevice |
|
453 |
" |
|
454 |
Images := nil |
|
455 |
" |
|
1097 | 456 |
|deviceImages image| |
794 | 457 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
458 |
anImage device == aDevice ifTrue:[ |
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
459 |
^ anImage |
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
460 |
]. |
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
461 |
|
794 | 462 |
Images isNil ifTrue:[ Images := IdentityDictionary new ]. |
463 |
||
1097 | 464 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
465 |
Images at:aDevice put:(deviceImages := Dictionary new) |
1097 | 466 |
]. |
467 |
||
468 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
469 |
^ image |
794 | 470 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
471 |
|
794 | 472 |
image := anImage copy onDevice:aDevice. |
473 |
image clearMaskedPixels. |
|
1097 | 474 |
deviceImages at:anImage put:image. |
794 | 475 |
^ image |
476 |
||
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
477 |
"Modified: / 29.9.1998 / 12:02:41 / cg" |
794 | 478 |
! |
479 |
||
480 |
lightenedImage:anImage onDevice:aDevice |
|
481 |
" |
|
482 |
LigthenedImages := nil |
|
483 |
" |
|
1097 | 484 |
|deviceImages image| |
794 | 485 |
|
486 |
LigthenedImages isNil ifTrue:[ LigthenedImages := IdentityDictionary new ]. |
|
487 |
||
1097 | 488 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
1117 | 489 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 490 |
]. |
491 |
||
492 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
1117 | 493 |
^ image |
794 | 494 |
]. |
495 |
||
496 |
((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[ |
|
1117 | 497 |
image := anImage copy lightened onDevice:aDevice. |
498 |
image clearMaskedPixels. |
|
794 | 499 |
] ifFalse:[ |
1117 | 500 |
image := self image:anImage onDevice:aDevice |
794 | 501 |
]. |
1097 | 502 |
deviceImages at:anImage put:image. |
794 | 503 |
^ image |
504 |
||
505 |
||
506 |
! ! |
|
507 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
508 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
509 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
510 |
subMenu:aSubMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
511 |
"create a submenu; can be redifined in derived classes |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
512 |
" |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
513 |
^ (self new) menu:aSubMenu. |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
514 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
515 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
516 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
517 |
|
389 | 518 |
!MenuPanel methodsFor:'accept'! |
519 |
||
520 |
accept |
|
521 |
"accept current selected item |
|
522 |
" |
|
510 | 523 |
^ self accept:(self selection) |
389 | 524 |
! |
525 |
||
526 |
accept:anItem |
|
527 |
"this is the topMenu: accept item |
|
528 |
" |
|
1293
5b3836bd4024
handle all exposes when hiding a popup,
Claus Gittinger <cg@exept.de>
parents:
1271
diff
changeset
|
529 |
|value item tgState itemIdx recv panel masterGroup| |
389 | 530 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
531 |
self superMenu notNil ifTrue:[ |
1211 | 532 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
533 |
]. |
816 | 534 |
lastButtonSelected := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
535 |
self selection:nil. |
420 | 536 |
self forceUngrabMouseAndKeyboard. |
537 |
||
538 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
1211 | 539 |
tgState := anItem toggleIndication. |
1212 | 540 |
panel := anItem menuPanel. |
541 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
1211 | 542 |
item := anItem. |
1212 | 543 |
recv := panel receiver. |
389 | 544 |
]. |
545 |
||
510 | 546 |
self isPopUpView ifFalse:[ |
1211 | 547 |
self do:[:el| el updateIndicators]. |
548 |
self windowGroup processExposeEvents. |
|
524 | 549 |
] ifTrue:[ |
1211 | 550 |
self unmap. |
551 |
"/ give expose event a chance to arrive |
|
552 |
[shown] whileTrue:[ |
|
553 |
self windowGroup processExposeEventsFor:self |
|
554 |
]. |
|
1293
5b3836bd4024
handle all exposes when hiding a popup,
Claus Gittinger <cg@exept.de>
parents:
1271
diff
changeset
|
555 |
masterGroup := self windowGroup previousGroup. |
1211 | 556 |
self destroy. |
1293
5b3836bd4024
handle all exposes when hiding a popup,
Claus Gittinger <cg@exept.de>
parents:
1271
diff
changeset
|
557 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
524 | 558 |
]. |
559 |
value := self accept:item index:itemIdx toggle:tgState receiver:recv. |
|
560 |
||
561 |
self isPopUpView ifTrue:[ |
|
1211 | 562 |
self menuAdornmentAt:#value put:value. |
563 |
self menuAdornmentAt:#item put:item. |
|
524 | 564 |
]. |
653 | 565 |
|
524 | 566 |
^ item. |
567 |
||
1212 | 568 |
"Modified: / 22.2.1999 / 20:14:48 / cg" |
524 | 569 |
! |
570 |
||
571 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
572 |
"accept an item |
|
573 |
" |
|
1313
0d0a82851838
only send message to app (instead of view)
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
574 |
|value argument numArgs isKindOfValueModel rec arg2 app| |
524 | 575 |
|
576 |
anItem isNil ifTrue:[ |
|
1218 | 577 |
self menuAdornmentAt:#hasPerformed put:true. |
524 | 578 |
^ nil |
579 |
]. |
|
580 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
581 |
self menuAdornmentAt:#hasPerformed put:(aReceiver isValueModel). |
524 | 582 |
|
583 |
(value := anItem value) isNil ifTrue:[ |
|
1218 | 584 |
^ anIndex |
524 | 585 |
]. |
586 |
||
587 |
(argument := anItem argument) isNil ifTrue:[ |
|
1218 | 588 |
argument := aState ? anItem |
389 | 589 |
]. |
524 | 590 |
|
591 |
value isSymbol ifFalse:[ |
|
1218 | 592 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
593 |
||
594 |
numArgs == 0 ifTrue:[ |
|
595 |
value value |
|
596 |
] ifFalse:[ |
|
597 |
numArgs == 1 ifTrue:[ |
|
598 |
value value:argument] |
|
599 |
ifFalse:[ |
|
600 |
value value:argument value:self |
|
601 |
] |
|
602 |
]. |
|
603 |
self menuAdornmentAt:#hasPerformed put:true. |
|
524 | 604 |
^ anIndex |
605 |
]. |
|
606 |
||
607 |
aReceiver isNil ifTrue:[ |
|
1218 | 608 |
^ value |
524 | 609 |
]. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
610 |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
611 |
isKindOfValueModel := aReceiver isValueModel. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
612 |
isKindOfValueModel ifTrue:[ |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
613 |
aReceiver value:value |
465 | 614 |
] ifFalse:[ |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
615 |
rec := aReceiver. |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
616 |
arg2 := self. |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
617 |
|
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
618 |
"/ support for ST80 style applications |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
619 |
"/ (expecting the message to go to the application |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
620 |
"/ if not understood by the view) |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
621 |
"/ These expect the controller to be passed as argument. |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
622 |
"/ sigh. |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
623 |
|
1271 | 624 |
(aReceiver isView |
625 |
and:[(aReceiver respondsTo:value) not |
|
1313
0d0a82851838
only send message to app (instead of view)
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
626 |
and:[(app := aReceiver application) ~~ aReceiver |
0d0a82851838
only send message to app (instead of view)
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
627 |
and:[app notNil]]]) ifTrue:[ |
0d0a82851838
only send message to app (instead of view)
Claus Gittinger <cg@exept.de>
parents:
1300
diff
changeset
|
628 |
rec := app. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
629 |
arg2 := aReceiver controller "/ the Views controller |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
630 |
]. |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
631 |
|
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
632 |
(numArgs := value numArgs) == 0 ifTrue:[ |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
633 |
rec perform:value |
1218 | 634 |
] ifFalse:[ |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
635 |
numArgs == 1 ifTrue:[ |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
636 |
rec perform:value with:argument |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
637 |
] ifFalse:[ |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
638 |
rec perform:value with:argument with:arg2 |
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
639 |
] |
1218 | 640 |
] |
420 | 641 |
]. |
524 | 642 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
643 |
^ value |
389 | 644 |
! |
645 |
||
646 |
lastItemAccepted |
|
647 |
"returns last item selected or nil |
|
648 |
" |
|
390 | 649 |
^ self topMenu menuAdornmentAt:#item |
389 | 650 |
! |
651 |
||
652 |
lastValueAccepted |
|
653 |
"returns last value accepted or nil |
|
654 |
" |
|
971 | 655 |
^ (self lastItemAccepted) value |
656 |
"/ |top| |
|
657 |
"/ |
|
658 |
"/ top := self topMenu. |
|
659 |
"/ |
|
660 |
"/ (top menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
|
661 |
"/ ^ self topMenu menuAdornmentAt:#value. |
|
662 |
"/ ]. |
|
663 |
"/ ^ nil |
|
664 |
||
665 |
"Modified: / 18.6.1998 / 23:37:09 / cg" |
|
389 | 666 |
! ! |
667 |
||
388 | 668 |
!MenuPanel methodsFor:'accessing'! |
669 |
||
670 |
accessCharacterPositionAt:stringOrNumber |
|
390 | 671 |
"get the access character position for a textLabel |
388 | 672 |
" |
673 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
|
674 |
! |
|
675 |
||
676 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
390 | 677 |
"get the access character position for a textLabel |
388 | 678 |
" |
679 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
|
680 |
! |
|
681 |
||
682 |
accessCharacterPositions |
|
683 |
"returns a collection of accessCharacterPosition's or nil |
|
684 |
" |
|
685 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
|
686 |
||
687 |
! |
|
688 |
||
689 |
accessCharacterPositions:something |
|
690 |
"define accessCharacterPosition's for each item |
|
691 |
" |
|
692 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
|
693 |
! |
|
694 |
||
695 |
args |
|
696 |
"returns a collection of argument's or nil |
|
697 |
" |
|
698 |
^ self collect:[:anItem| anItem argument ] |
|
699 |
! |
|
700 |
||
701 |
args:something |
|
702 |
"define arguments for each item |
|
703 |
" |
|
704 |
self onEachPerform:#argument: withArgList:something |
|
705 |
! |
|
706 |
||
707 |
argsAt:stringOrNumber |
|
708 |
"gets the argument of an item or nil |
|
709 |
" |
|
710 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
|
711 |
! |
|
712 |
||
713 |
argsAt:stringOrNumber put:anArgument |
|
714 |
"sets the argument of an item |
|
715 |
" |
|
716 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
|
717 |
! |
|
718 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
719 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
720 |
"return the item over which the mouse pointer is located; |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
721 |
nil if the mouse is not over any item" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
722 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
723 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
724 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
725 |
"Created: / 20.8.1998 / 13:12:34 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
726 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
727 |
|
388 | 728 |
groupSizes |
729 |
"gets collection of group sizes |
|
730 |
" |
|
731 |
^ groupSizes |
|
732 |
! |
|
733 |
||
734 |
groupSizes:aGroupSizes |
|
735 |
"sets collection of group sizes |
|
736 |
" |
|
737 |
aGroupSizes = groupSizes ifFalse:[ |
|
1117 | 738 |
groupSizes := aGroupSizes copy. |
739 |
self mustRearrange. |
|
388 | 740 |
]. |
741 |
! |
|
742 |
||
743 |
labelAt:stringOrNumber |
|
744 |
"gets the label of an item or nil |
|
745 |
" |
|
746 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
|
747 |
! |
|
748 |
||
749 |
labelAt:stringOrNumber put:aLabel |
|
750 |
"sets the label of an item |
|
751 |
" |
|
752 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
|
753 |
! |
|
754 |
||
755 |
labels |
|
756 |
"returns a collection of labels's or nil |
|
757 |
" |
|
758 |
^ self collect:[:anItem| anItem label ] |
|
759 |
||
760 |
! |
|
761 |
||
762 |
labels:labels |
|
763 |
"define labels for each item |
|
764 |
" |
|
765 |
self disabledRedrawDo:[ |
|
1117 | 766 |
self removeAll. |
767 |
||
768 |
labels notNil ifTrue:[ |
|
769 |
labels do:[:aLabel|(self createAtIndex:nil) label:aLabel] |
|
770 |
] |
|
388 | 771 |
] |
772 |
! |
|
773 |
||
774 |
nameKeyAt:stringOrNumber |
|
775 |
"gets the nameKey of an item or nil |
|
776 |
" |
|
777 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
778 |
! |
|
779 |
||
780 |
nameKeyAt:stringOrNumber put:aNameKey |
|
781 |
"sets the nameKey of an item |
|
782 |
" |
|
783 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
|
784 |
! |
|
785 |
||
786 |
nameKeys |
|
787 |
"returns a collection of nameKeys's or nil |
|
788 |
" |
|
789 |
^ self collect:[:anItem| anItem nameKey ] |
|
790 |
! |
|
791 |
||
792 |
nameKeys:something |
|
793 |
"define nameKeys for each item |
|
794 |
" |
|
795 |
self onEachPerform:#nameKey: withArgList:something |
|
796 |
! |
|
797 |
||
798 |
numberOfItems |
|
799 |
"gets number of items |
|
800 |
" |
|
801 |
^ items size |
|
802 |
! |
|
803 |
||
804 |
receiver |
|
805 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
806 |
from all submenus no specific receiver is defined ). |
|
807 |
" |
|
389 | 808 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
1117 | 809 |
^ superMenu receiver |
388 | 810 |
]. |
389 | 811 |
^ receiver |
388 | 812 |
! |
813 |
||
814 |
receiver:anObject |
|
815 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
816 |
from all submenus no specific receiver is defined ). |
|
817 |
" |
|
389 | 818 |
receiver := anObject |
388 | 819 |
! |
820 |
||
821 |
shortcutKeyAt:stringOrNumber |
|
822 |
"gets the shortCutKey of an item or nil |
|
823 |
" |
|
824 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
825 |
! |
|
826 |
||
827 |
shortcutKeyAt:stringOrNumber put:aKey |
|
828 |
"sets the shortCutKey of an item |
|
829 |
" |
|
830 |
self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ] |
|
831 |
! |
|
832 |
||
833 |
shortcutKeys |
|
834 |
"returns a collection of shortcutKey's or nil |
|
835 |
" |
|
836 |
^ self collect:[:anItem| anItem shortcutKey ] |
|
837 |
||
838 |
! |
|
839 |
||
840 |
shortcutKeys:something |
|
841 |
"define shortcutKey's for each item |
|
842 |
" |
|
843 |
self onEachPerform:#shortcutKey: withArgList:something |
|
844 |
! |
|
845 |
||
846 |
valueAt:stringOrNumber |
|
847 |
"gets value of an item; a block, valueHolder, ... |
|
848 |
" |
|
849 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
850 |
||
851 |
! |
|
852 |
||
853 |
valueAt:stringOrNumber put:someThing |
|
854 |
"sets value of an item; a block, valueHolder, ... |
|
855 |
" |
|
856 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
|
857 |
||
858 |
||
859 |
! |
|
860 |
||
861 |
values:something |
|
862 |
"define values for each item |
|
863 |
" |
|
864 |
self onEachPerform:#value: withArgList:something |
|
865 |
! ! |
|
866 |
||
867 |
!MenuPanel methodsFor:'accessing behavior'! |
|
868 |
||
869 |
disableAll |
|
498 | 870 |
"disable all items; not the menu in case of enabled |
388 | 871 |
" |
498 | 872 |
self do:[:anItem| anItem enabled:false] |
388 | 873 |
! |
874 |
||
875 |
disableAll:collectionOfIndicesOrNames |
|
876 |
"disable an collection of items |
|
877 |
" |
|
878 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
|
879 |
||
880 |
! |
|
881 |
||
882 |
enableAll |
|
498 | 883 |
"enable all items; not the menu in case of disabled |
388 | 884 |
" |
498 | 885 |
self do:[:anItem| anItem enabled:true] |
388 | 886 |
! |
887 |
||
888 |
enableAll:collectionOfIndicesOrNames |
|
889 |
"enable an collection of items |
|
890 |
" |
|
891 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
|
892 |
||
893 |
! |
|
894 |
||
895 |
enabled |
|
896 |
"returns enabled state |
|
897 |
" |
|
498 | 898 |
^ enabled |
388 | 899 |
! |
900 |
||
901 |
enabled:aState |
|
902 |
"change enabled state of menu |
|
903 |
" |
|
545 | 904 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
905 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
906 |
state := aState ? true. |
388 | 907 |
|
1218 | 908 |
enabled == state ifTrue:[ |
909 |
^ self |
|
498 | 910 |
]. |
911 |
enabled := state. |
|
912 |
||
913 |
self canDrawItem ifTrue:[ |
|
1218 | 914 |
self do:[:anItem| anItem enabledStateOfMenuChangedTo:enabled] |
498 | 915 |
]. |
388 | 916 |
! |
917 |
||
918 |
enabledAt:stringOrNumber |
|
919 |
"gets the enabled state of an item or false |
|
920 |
" |
|
921 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
|
922 |
! |
|
923 |
||
924 |
enabledAt:stringOrNumber put:aState |
|
925 |
"sets the enabled state of an item |
|
926 |
" |
|
927 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
|
928 |
! |
|
929 |
||
930 |
isEnabled:stringOrNumber |
|
931 |
"gets the enabled state of an item or false |
|
932 |
" |
|
933 |
^ self enabledAt:stringOrNumber |
|
934 |
! ! |
|
935 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
936 |
!MenuPanel methodsFor:'accessing channels'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
937 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
938 |
enableChannel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
939 |
"gets a enable channel or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
940 |
" |
498 | 941 |
^ enableChannel |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
942 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
943 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
944 |
enableChannel:aValueHolder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
945 |
"set my enableChannel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
946 |
" |
498 | 947 |
enableChannel notNil ifTrue:[ |
1117 | 948 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
949 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
950 |
|
498 | 951 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
1117 | 952 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
953 |
]. |
498 | 954 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
955 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
956 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
957 |
menuHolder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
958 |
"gets a menu holder or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
959 |
" |
498 | 960 |
^ menuHolder |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
961 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
962 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
963 |
menuHolder:aValueHolder |
498 | 964 |
"set my menuHolder |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
965 |
" |
498 | 966 |
menuHolder notNil ifTrue:[ |
1117 | 967 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
968 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
969 |
|
498 | 970 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
1117 | 971 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
972 |
]. |
498 | 973 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
974 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
975 |
|
390 | 976 |
!MenuPanel methodsFor:'accessing color & font'! |
977 |
||
616 | 978 |
activeBackgroundColor |
979 |
"get the background drawing color used to highlight selection |
|
980 |
" |
|
981 |
^ activeBgColor |
|
982 |
! |
|
983 |
||
390 | 984 |
activeBackgroundColor:aColor |
985 |
"set the background drawing color used to highlight selection. You should not |
|
986 |
use this method; instead leave the value as defined in the styleSheet. |
|
987 |
" |
|
616 | 988 |
activeBgColor ~~ aColor ifTrue:[ |
1117 | 989 |
activeBgColor := aColor on:device. |
990 |
shown ifTrue:[ |
|
991 |
self invalidate "/ RepairNow:true |
|
992 |
] |
|
616 | 993 |
] |
994 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
995 |
"Modified: / 6.6.1998 / 19:49:46 / cg" |
616 | 996 |
! |
997 |
||
998 |
activeForegroundColor |
|
999 |
"get the foreground color used to highlight selections |
|
1000 |
" |
|
1001 |
^ activeFgColor |
|
1002 |
! |
|
1003 |
||
1004 |
activeForegroundColor:aColor |
|
1005 |
"set the foreground color used to highlight selections; You should not |
|
1006 |
use this method; instead leave the value as defined in the styleSheet. |
|
1007 |
" |
|
1008 |
activeFgColor ~~ aColor ifTrue:[ |
|
1117 | 1009 |
activeFgColor := aColor on:device. |
1010 |
shown ifTrue:[ |
|
1011 |
self invalidate "/ RepairNow:true |
|
1012 |
] |
|
616 | 1013 |
] |
1014 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1015 |
"Modified: / 6.6.1998 / 19:50:01 / cg" |
390 | 1016 |
! |
1017 |
||
1018 |
backgroundColor |
|
1019 |
"return the background color |
|
1020 |
" |
|
502 | 1021 |
^ super viewBackground |
390 | 1022 |
! |
1023 |
||
1024 |
backgroundColor:aColor |
|
1025 |
"set the background drawing color. You should not use this method; |
|
1026 |
instead leave the value as defined in the styleSheet. |
|
1027 |
" |
|
616 | 1028 |
super viewBackground ~~ aColor ifTrue:[ |
1117 | 1029 |
super viewBackground:aColor. |
1030 |
shown ifTrue:[ |
|
1031 |
self invalidate "/ RepairNow:true |
|
1032 |
] |
|
616 | 1033 |
] |
1034 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1035 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1036 |
! |
1037 |
||
727 | 1038 |
buttonActiveBackgroundColor |
1039 |
"get the background drawing color used to highlight button selection |
|
1040 |
" |
|
1041 |
^ButtonActiveBackgroundColor |
|
1042 |
! |
|
1043 |
||
730 | 1044 |
buttonEdgeStyle |
1045 |
"get the button edge style |
|
1046 |
" |
|
1047 |
^ButtonEdgeStyle |
|
1048 |
! |
|
1049 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1050 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1051 |
"get the background drawing color used to highlight entered button items |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1052 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1053 |
^ buttonEnteredBgColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1054 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1055 |
"Created: / 20.8.1998 / 13:53:37 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1056 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1057 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1058 |
buttonEnteredLevel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1059 |
"get the 3D-level used to highlight entered button items |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1060 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1061 |
^ ButtonEnteredLevel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1062 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1063 |
"Created: / 20.8.1998 / 13:53:46 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1064 |
"Modified: / 20.8.1998 / 15:49:32 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1065 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1066 |
|
730 | 1067 |
buttonHalfLightColor |
1068 |
"get the background drawing color used to half light button frame |
|
1069 |
" |
|
1070 |
^buttonHalfLightColor |
|
1071 |
! |
|
1072 |
||
1073 |
buttonHalfShadowColor |
|
1074 |
"get the background drawing color used to half shadow button frame |
|
1075 |
" |
|
1076 |
^buttonHalfShadowColor |
|
727 | 1077 |
! |
1078 |
||
1079 |
buttonLightColor |
|
1080 |
"get the background drawing color used to light button frame |
|
1081 |
" |
|
1082 |
^buttonLightColor |
|
1083 |
! |
|
1084 |
||
1085 |
buttonPassiveBackgroundColor |
|
1086 |
"get the background drawing color used for button |
|
1087 |
" |
|
1088 |
^ButtonPassiveBackgroundColor |
|
1089 |
! |
|
1090 |
||
1091 |
buttonShadowColor |
|
1092 |
"get the background drawing color used to shadow button frame |
|
1093 |
" |
|
1094 |
^buttonShadowColor |
|
1095 |
! |
|
1096 |
||
390 | 1097 |
disabledForegroundColor |
1098 |
"return the foreground color used by disabled items |
|
1099 |
" |
|
616 | 1100 |
^ disabledFgColor |
390 | 1101 |
|
1102 |
! |
|
1103 |
||
1104 |
disabledForegroundColor:aColor |
|
1105 |
"set the foregroundColor drawing color used by disabled items. You should not |
|
1106 |
use this method; instead leave the value as defined in the styleSheet. |
|
1107 |
" |
|
616 | 1108 |
disabledFgColor ~~ aColor ifTrue:[ |
1117 | 1109 |
disabledFgColor := aColor on:device. |
1110 |
shown ifTrue:[ |
|
1111 |
self invalidate "/ RepairNow:true |
|
1112 |
] |
|
616 | 1113 |
]. |
1114 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1115 |
"Modified: / 6.6.1998 / 19:50:17 / cg" |
390 | 1116 |
! |
1117 |
||
1118 |
font:aFont |
|
1119 |
"set the font |
|
1120 |
" |
|
829 | 1121 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
1117 | 1122 |
super font:(aFont on:device). |
1123 |
||
1124 |
superMenu notNil ifTrue:[ |
|
1125 |
self extent:(self preferredExtent) |
|
1126 |
]. |
|
1127 |
self mustRearrange. |
|
390 | 1128 |
] |
1129 |
! |
|
1130 |
||
1131 |
foregroundColor |
|
1132 |
"return the passive foreground color |
|
1133 |
" |
|
616 | 1134 |
^ fgColor |
390 | 1135 |
|
1136 |
||
1137 |
! |
|
1138 |
||
1139 |
foregroundColor:aColor |
|
1140 |
"set the foregroundColor drawing color. You should not use this method; |
|
1141 |
instead leave the value as defined in the styleSheet. |
|
1142 |
" |
|
616 | 1143 |
fgColor ~~ aColor ifTrue:[ |
1117 | 1144 |
fgColor := aColor on:device. |
1145 |
shown ifTrue:[ |
|
1146 |
self invalidate "/ RepairNow:true |
|
1147 |
] |
|
616 | 1148 |
] |
1149 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1150 |
"Modified: / 6.6.1998 / 19:50:46 / cg" |
580 | 1151 |
! |
1152 |
||
390 | 1153 |
lightColor |
1154 |
"get the lightColor |
|
1155 |
" |
|
1156 |
^ lightColor |
|
1157 |
||
1158 |
||
1159 |
! |
|
1160 |
||
1161 |
lightColor:aColor |
|
1162 |
"set the light drawing color. You should not use this method; |
|
1163 |
instead leave the value as defined in the styleSheet. |
|
1164 |
" |
|
1165 |
lightColor ~~ aColor ifTrue:[ |
|
1117 | 1166 |
super lightColor:aColor. |
1167 |
shown ifTrue:[ |
|
1168 |
self invalidate "/ RepairNow:true |
|
1169 |
] |
|
390 | 1170 |
] |
1171 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1172 |
"Modified: / 6.6.1998 / 19:50:39 / cg" |
390 | 1173 |
! |
1174 |
||
730 | 1175 |
selectionFrameBrightColor |
1176 |
"get the selection frame bright color |
|
1177 |
" |
|
1178 |
^selectionFrameBrightColor |
|
1179 |
! |
|
1180 |
||
1181 |
selectionFrameDarkColor |
|
1182 |
"get the selection frame dark color |
|
1183 |
" |
|
1184 |
^selectionFrameDarkColor |
|
1185 |
! |
|
1186 |
||
390 | 1187 |
shadowColor |
1188 |
"get the shadowColor |
|
1189 |
" |
|
1190 |
^ shadowColor |
|
1191 |
||
1192 |
||
1193 |
! |
|
1194 |
||
1195 |
shadowColor:aColor |
|
1196 |
"set the shadow drawing color. You should not use this method; |
|
1197 |
instead leave the value as defined in the styleSheet. |
|
1198 |
" |
|
1199 |
shadowColor ~~ aColor ifTrue:[ |
|
1117 | 1200 |
super shadowColor:aColor. |
1201 |
shown ifTrue:[ |
|
1202 |
self invalidate "/ RepairNow:true |
|
1203 |
] |
|
390 | 1204 |
] |
1205 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1206 |
"Modified: / 6.6.1998 / 19:50:32 / cg" |
390 | 1207 |
! ! |
1208 |
||
388 | 1209 |
!MenuPanel methodsFor:'accessing dimensions'! |
1210 |
||
1211 |
height |
|
1212 |
"default height |
|
1213 |
" |
|
1214 |
|item| |
|
1215 |
||
1216 |
(explicitExtent ~~ true) ifTrue:[ |
|
1117 | 1217 |
(item := self itemAt:1) notNil ifTrue:[ |
1218 |
self rearrangeItems. |
|
1219 |
^ item height |
|
1220 |
]. |
|
1221 |
^ 4 + (font height + (font descent * 2)). |
|
388 | 1222 |
]. |
1223 |
^ super height |
|
1224 |
! |
|
1225 |
||
1226 |
preferredExtent |
|
1227 |
"compute and returns my preferred extent |
|
1228 |
" |
|
650 | 1229 |
|x y hasMenu shCtKey space hrzInset| |
388 | 1230 |
|
1231 |
self numberOfItems == 0 ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1232 |
^ 32 @ 32 |
388 | 1233 |
]. |
616 | 1234 |
space := (items size + 1) * itemSpace. |
1235 |
||
390 | 1236 |
self isFitPanel ifTrue:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1237 |
x := 0 |
390 | 1238 |
] ifFalse:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1239 |
x := groupSizes size * groupDividerSize. |
390 | 1240 |
]. |
650 | 1241 |
hrzInset := items first horizontalInset. |
388 | 1242 |
|
1243 |
self verticalLayout ifFalse:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1244 |
"/ horizontal - add x-extents; take max of y-extents |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1245 |
y := 0. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1246 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1247 |
self do:[:el| |elY elPref| |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1248 |
el isVisible ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1249 |
elPref := el preferredExtent. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1250 |
x := x + elPref x. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1251 |
elY := elPref y. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1252 |
el isButton ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1253 |
elY := elY + (2 * DefaultButtonItemSpace). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1254 |
x := x + (2 * DefaultButtonItemSpace). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1255 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1256 |
y := y max:elY. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1257 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1258 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1259 |
x := x + space. |
388 | 1260 |
] ifTrue:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1261 |
"/ vertical - add y-extents |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1262 |
hasMenu := false. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1263 |
shCtKey := 0. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1264 |
y := x. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1265 |
x := 0. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1266 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1267 |
self do:[:el| |l e| |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1268 |
el isVisible ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1269 |
(l := el rawLabel) notNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1270 |
(e := l widthOn:self) > x ifTrue:[x := e]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1271 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1272 |
(el hasSubmenu or:[el submenuChannel notNil]) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1273 |
hasMenu := true |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1274 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1275 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1276 |
( (l := el shortcutKeyAsString) notNil |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1277 |
and:[(e := l widthOn:self) > shCtKey] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1278 |
) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1279 |
shCtKey := e |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1280 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1281 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1282 |
y := y + el preferredExtent y |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1283 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1284 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1285 |
x := x + hrzInset. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1286 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1287 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1288 |
shortKeyInset := x + Item labelRightOffset. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1289 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1290 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1291 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1292 |
x := x + (Item shortcutKeyOffset) |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1293 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1294 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1295 |
y := y + space. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1296 |
x := x + hrzInset. |
388 | 1297 |
]. |
1101 | 1298 |
^ (x @ y) + (margin + margin) |
1095 | 1299 |
|
1300 |
"Modified: / 24.8.1998 / 19:16:02 / cg" |
|
388 | 1301 |
! |
1302 |
||
1303 |
shortKeyInset |
|
1304 |
"left inset of shortcutKey |
|
1305 |
" |
|
1306 |
^ shortKeyInset |
|
616 | 1307 |
! |
1308 |
||
1309 |
subMenuIndicationWidth |
|
1310 |
^ RightArrowForm width |
|
388 | 1311 |
! ! |
1312 |
||
1313 |
!MenuPanel methodsFor:'accessing items'! |
|
1314 |
||
1315 |
itemAt:stringOrNumber |
|
390 | 1316 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
1317 |
If no item match nil is returned. |
|
388 | 1318 |
" |
1319 |
|idx| |
|
1320 |
||
1321 |
idx := self indexOf:stringOrNumber. |
|
1322 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
|
1323 |
^ nil |
|
1324 |
||
1325 |
! |
|
1326 |
||
1327 |
itemAt:stringOrNumber do:aOneArgBlock |
|
1328 |
"evaluate teh block for an item and return the result from the block. In case that |
|
1329 |
the item not exists nil is returned |
|
1330 |
" |
|
1331 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
|
1332 |
! |
|
1333 |
||
1334 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1335 |
"evaluate teh block for an item and return the result from the block. In case that |
|
1336 |
the item not exists the result of the exception block is returned (no arguments). |
|
1337 |
" |
|
1338 |
|item| |
|
1339 |
||
1340 |
item := self itemAt:stringOrNumber. |
|
1341 |
item notNil ifTrue:[ ^ aOneArgBlock value:item ]. |
|
1342 |
^ exceptionBlock value |
|
706 | 1343 |
! |
1344 |
||
1345 |
itemAtIndex:anIndex |
|
1346 |
"returns item at an index or nil |
|
1347 |
" |
|
1348 |
^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil] |
|
388 | 1349 |
! ! |
1350 |
||
1351 |
!MenuPanel methodsFor:'accessing look'! |
|
1352 |
||
727 | 1353 |
buttonActiveLevel |
1354 |
"get the button active level |
|
1355 |
" |
|
1356 |
^ButtonActiveLevel |
|
1357 |
||
1358 |
! |
|
1359 |
||
1360 |
buttonPassiveLevel |
|
1361 |
"get the button passive level |
|
1362 |
" |
|
1363 |
^ButtonPassiveLevel |
|
1364 |
||
1365 |
! |
|
1366 |
||
390 | 1367 |
fitFirstPanel |
1368 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1369 |
to the extent of its superView |
|
388 | 1370 |
" |
616 | 1371 |
^ fitFirstPanel |
388 | 1372 |
! |
1373 |
||
390 | 1374 |
fitFirstPanel:aState |
1375 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1376 |
to the extent of its superView |
|
388 | 1377 |
" |
616 | 1378 |
(fitFirstPanel == aState or:[self isPopUpView]) ifFalse:[ |
1117 | 1379 |
fitFirstPanel := aState. |
1380 |
self mustRearrange |
|
616 | 1381 |
] |
388 | 1382 |
! |
1383 |
||
390 | 1384 |
groupDividerSize |
1385 |
"get the size of the group dividers |
|
388 | 1386 |
" |
616 | 1387 |
^ groupDividerSize |
1388 |
||
388 | 1389 |
! |
1390 |
||
390 | 1391 |
groupDividerSize:aSize |
616 | 1392 |
"set the size of the group dividers. You should not use this |
1393 |
method; instead leave the value as defined in the styleSheet. |
|
388 | 1394 |
" |
616 | 1395 |
aSize ~~ groupDividerSize ifTrue:[ |
1117 | 1396 |
groupDividerSize := aSize. |
1397 |
self mustRearrange. |
|
616 | 1398 |
]. |
1399 |
||
388 | 1400 |
! |
1401 |
||
616 | 1402 |
itemSpace |
1403 |
"get the space space between to items |
|
388 | 1404 |
" |
616 | 1405 |
^ itemSpace |
1406 |
||
388 | 1407 |
! |
1408 |
||
616 | 1409 |
itemSpace:aSize |
1410 |
"set the horizontal space between to items. You should not use this |
|
1411 |
method; instead leave the value as defined in the styleSheet. |
|
388 | 1412 |
" |
616 | 1413 |
aSize ~~ itemSpace ifTrue:[ |
1117 | 1414 |
itemSpace := aSize. |
1415 |
self mustRearrange |
|
616 | 1416 |
]. |
1417 |
||
1418 |
! |
|
1419 |
||
1093 | 1420 |
level:anInt |
1421 |
super level:anInt. |
|
1422 |
mustRearrange := true |
|
1423 |
! |
|
1424 |
||
616 | 1425 |
rightArrow |
1426 |
^ rightArrow |
|
1427 |
! |
|
1428 |
||
1429 |
rightArrowShadow |
|
1430 |
^ rightArrowShadow |
|
388 | 1431 |
! |
1432 |
||
390 | 1433 |
showGroupDivider |
1434 |
"get the enabled flag for showing groupDiveders |
|
388 | 1435 |
" |
1222 | 1436 |
^ (self menuAdornmentAt:#showGroupDivider) |
388 | 1437 |
! |
1438 |
||
390 | 1439 |
showGroupDivider:aState |
1440 |
"set the enabled flag for showing groupDiveders |
|
388 | 1441 |
" |
653 | 1442 |
(self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[ |
1117 | 1443 |
self mustRearrange. |
653 | 1444 |
] |
388 | 1445 |
! |
1446 |
||
1447 |
showSeparatingLines |
|
1448 |
"gets true if drawing of separating lines is enabled. |
|
1449 |
" |
|
1222 | 1450 |
^ (self menuAdornmentAt:#showSeparatingLines) |
388 | 1451 |
! |
1452 |
||
390 | 1453 |
showSeparatingLines:aState |
388 | 1454 |
"turn on/off drawing of separating lines. |
1455 |
" |
|
653 | 1456 |
(self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[ |
1117 | 1457 |
self mustRearrange |
653 | 1458 |
] |
388 | 1459 |
! |
1460 |
||
1461 |
verticalLayout |
|
1462 |
"get the layout: or vertical( true ) or horizontal( false ) |
|
1463 |
" |
|
1222 | 1464 |
^ (self menuAdornmentAt:#verticalLayout) |
388 | 1465 |
! |
1466 |
||
1467 |
verticalLayout:aState |
|
1468 |
"set the layout: or vertical( true ) or horizontal( false ) |
|
1469 |
" |
|
653 | 1470 |
(self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[ |
1117 | 1471 |
self mustRearrange |
653 | 1472 |
] |
388 | 1473 |
! ! |
1474 |
||
1475 |
!MenuPanel methodsFor:'accessing submenu'! |
|
1476 |
||
1477 |
subMenuAt:stringOrNumber |
|
1478 |
"gets the submenu of an item or nil |
|
1479 |
" |
|
1480 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
1481 |
! |
|
1482 |
||
1483 |
subMenuAt:stringOrNumber put:aSubMenu |
|
1484 |
"sets the submenu of an item |
|
1485 |
" |
|
1486 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
|
1487 |
||
1488 |
! |
|
1489 |
||
1490 |
subMenuShown |
|
1491 |
"return the currently visible submenu - or nil if there is none |
|
1492 |
" |
|
1493 |
|item| |
|
1494 |
||
1495 |
(item := self selection) notNil ifTrue:[ |
|
1117 | 1496 |
^ item submenu |
388 | 1497 |
]. |
1498 |
^ nil |
|
1499 |
! ! |
|
1500 |
||
1501 |
!MenuPanel methodsFor:'activation'! |
|
1502 |
||
1503 |
hide |
|
1504 |
"hide the view, leave its modal event loop |
|
1505 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1506 |
|
388 | 1507 |
self selection:nil. |
1508 |
self unmap. |
|
1509 |
||
1510 |
||
1511 |
! |
|
1512 |
||
1513 |
show |
|
1514 |
"realize the view at its last position |
|
1515 |
" |
|
1516 |
^ self showAt:(self origin) resizing:true |
|
1517 |
||
1518 |
! |
|
1519 |
||
1520 |
showAt:aPoint |
|
1521 |
"realize the view at aPoint |
|
1522 |
" |
|
1523 |
^ self showAt:aPoint resizing:true |
|
1524 |
||
1525 |
||
1526 |
! |
|
1527 |
||
1528 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1529 |
"realize the view at aPoint; return nil if no item was selected, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1530 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1531 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1532 |
Notice, that this is returned back to the one who started this |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1533 |
menu (i.e. the view or controller), which will perform the action |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1534 |
if a non-nil is returned. |
388 | 1535 |
" |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1536 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1537 |
self initPopUpDependentStyle:true. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1538 |
self rearrangeItemsIfItemVisibilityChanged. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1539 |
"/ self rearrangeItems. |
388 | 1540 |
|
1541 |
aBoolean ifTrue:[ |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1542 |
self fixSize. |
388 | 1543 |
]. |
1544 |
self origin:aPoint. |
|
1545 |
self makeFullyVisible. |
|
1546 |
self openModal:[true]. "realize " |
|
1547 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1548 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1549 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1550 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1551 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1552 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1553 |
]. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1554 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1555 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1556 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 1557 |
! |
1558 |
||
1559 |
showAtPointer |
|
1560 |
"realize the view at the current pointer position |
|
1561 |
" |
|
1562 |
^ self showAt:(device pointerPosition) resizing:true |
|
1563 |
||
1564 |
||
1565 |
! |
|
1566 |
||
1567 |
showCenteredIn:aView |
|
1568 |
"make myself visible at the screen center. |
|
1569 |
" |
|
1570 |
|top| |
|
1571 |
||
1572 |
top := aView topView. |
|
1573 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1574 |
^ self showAt:(top origin + (aView originRelativeTo:top) + (aView extent // 2) - (self extent // 2)) |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1575 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1576 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 1577 |
! |
1578 |
||
1579 |
startUp |
|
1580 |
"realize the menu at the current pointer position |
|
1581 |
" |
|
1582 |
^ self showAtPointer |
|
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1583 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1584 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1585 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1586 |
"realize the menu at aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1587 |
" |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1588 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1589 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1590 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
388 | 1591 |
! ! |
1592 |
||
1593 |
!MenuPanel methodsFor:'adding & removing'! |
|
1594 |
||
1595 |
createAtIndex:anIndexOrNil |
|
1596 |
"create an item and add this item to the index. In case of nil the item |
|
1597 |
is added to the end. If the index is not valid nil is returned otherwise |
|
1598 |
the new created item. |
|
1599 |
" |
|
1600 |
|max item| |
|
1601 |
||
1602 |
max := (items size) + 1. |
|
1603 |
||
1604 |
anIndexOrNil notNil ifTrue:[ |
|
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1605 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1606 |
^ nil |
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1607 |
] |
388 | 1608 |
]. |
1609 |
items isNil ifTrue:[ |
|
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1610 |
items := OrderedCollection new |
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1611 |
] ifFalse:[ |
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1612 |
items := items asOrderedCollection |
388 | 1613 |
]. |
1614 |
item := Item in:self. |
|
1615 |
||
1616 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1617 |
items add:item |
388 | 1618 |
] ifFalse:[ |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
1619 |
items add:item beforeIndex:anIndexOrNil |
388 | 1620 |
]. |
1621 |
^ item |
|
1622 |
! |
|
1623 |
||
1624 |
remove:stringOrNumber |
|
1625 |
"remove the first item which is assigned to stringOrNumber; |
|
1626 |
if found, remove and return it |
|
1627 |
" |
|
1628 |
|item| |
|
1629 |
||
1630 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
1117 | 1631 |
items remove:item. |
1632 |
item destroy. |
|
1633 |
items isEmpty ifTrue:[items := nil]. |
|
1634 |
self mustRearrange. |
|
388 | 1635 |
]. |
1636 |
^ item |
|
1637 |
! |
|
1638 |
||
1639 |
removeAll |
|
1640 |
"remove all items and submenus |
|
1641 |
" |
|
1642 |
self disabledRedrawDo:[ |
|
1117 | 1643 |
self selection:nil. |
1644 |
groupSizes := nil. |
|
1645 |
self do:[:el| el destroy ]. |
|
1646 |
items := nil |
|
388 | 1647 |
]. |
1648 |
! ! |
|
1649 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1650 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1651 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1652 |
update:something with:aParameter from:changedObject |
498 | 1653 |
|
1654 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
1655 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1656 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1657 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1658 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1659 |
|
388 | 1660 |
!MenuPanel methodsFor:'converting'! |
1661 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1662 |
asMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1663 |
"convert contents to menu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1664 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1665 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1666 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1667 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1668 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1669 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1670 |
^ menu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1671 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1672 |
|
388 | 1673 |
fromSpec:aMenuSpec |
1674 |
"build from spec |
|
1675 |
" |
|
1676 |
|menu| |
|
1677 |
||
1678 |
menu := Menu new. |
|
1679 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
1680 |
self menu:menu |
|
1681 |
||
1682 |
! |
|
1683 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1684 |
menu:aMenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1685 |
"convert to Menu |
388 | 1686 |
" |
1687 |
self disabledRedrawDo:[ |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1688 |
|menu newItems| |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1689 |
|
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1690 |
self removeAll. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1691 |
|
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1692 |
(menu := aMenu) notNil ifTrue:[ |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1693 |
(aMenu isCollection) ifTrue:[ |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1694 |
menu := Menu new. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1695 |
menu fromLiteralArrayEncoding:aMenu. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1696 |
] ifFalse:[ |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1697 |
menu receiver notNil ifTrue:[receiver := menu receiver] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1698 |
]. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1699 |
(newItems := menu menuItems) notNil ifTrue:[ |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1700 |
items := newItems collect:[:ni | |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1701 |
|i| |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1702 |
|
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1703 |
i:= Item in:self. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1704 |
i menuItem:ni. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1705 |
i. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1706 |
]. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1707 |
]. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1708 |
self groupSizes:(menu groupSizes). |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1709 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
1710 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
1711 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
1712 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 1713 |
! ! |
1714 |
||
1715 |
!MenuPanel methodsFor:'drawing'! |
|
1716 |
||
1717 |
disabledRedrawDo:aBlock |
|
1718 |
"evaluate a block without redrawing within the block; after processing |
|
1719 |
of the block a redraw might be performed |
|
1720 |
" |
|
1721 |
|state| |
|
1722 |
||
1723 |
state := mustRearrange. |
|
1724 |
mustRearrange := true. |
|
1725 |
aBlock value. |
|
1726 |
mustRearrange := state. |
|
1727 |
self mustRearrange |
|
1728 |
! |
|
1729 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1730 |
drawButtonEdgesInLayout: layout withLevel: aLevel selected:isSelected |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1731 |
|shadow| |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1732 |
|
1018
67c883ab05d6
kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
1733 |
styleSheet is3D ifFalse:[ |
1218 | 1734 |
^ self displayRectangle:layout. |
1018
67c883ab05d6
kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
1735 |
]. |
746 | 1736 |
|
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1737 |
shadow := buttonShadowColor. |
1218 | 1738 |
"/ |
1739 |
"/ never encountered ? |
|
1740 |
"/ |
|
1741 |
"/ isSelected ifTrue:[ |
|
1742 |
"/ buttonShadowColor == self buttonActiveBackgroundColor ifTrue:[ |
|
1743 |
"/ shadow := buttonShadowColor darkened |
|
1744 |
"/ ]. |
|
1745 |
"/ ]. |
|
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1746 |
|
746 | 1747 |
self drawEdgesForX: layout left y: layout top width: layout width height: layout height level: aLevel |
1218 | 1748 |
shadow: shadow |
1749 |
light: buttonLightColor |
|
1750 |
halfShadow: buttonHalfShadowColor |
|
1751 |
halfLight: buttonHalfLightColor |
|
1752 |
style: ButtonEdgeStyle |
|
1018
67c883ab05d6
kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
1753 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1754 |
"Created: / 20.8.1998 / 15:43:38 / cg" |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1755 |
"Modified: / 20.8.1998 / 19:09:05 / cg" |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1756 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1757 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1758 |
drawEdgesForX:x y:y width:w height:height isSelected:selectedBool isEntered:enteredBool |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1759 |
|level| |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1760 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1761 |
level := selectedBool |
1117 | 1762 |
ifTrue:[onLevel] |
1763 |
ifFalse:[offLevel]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1764 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1765 |
level ~~ 0 ifTrue:[ |
1117 | 1766 |
self drawEdgesForX:x y:y width:w height:height level:level |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1767 |
]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1768 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1769 |
"Modified: / 20.8.1998 / 15:43:11 / cg" |
746 | 1770 |
! |
1771 |
||
388 | 1772 |
mustRearrange |
910
5c9592e782fd
always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents:
898
diff
changeset
|
1773 |
"force rearrange (i.e. set the rearrange flag) |
388 | 1774 |
" |
590 | 1775 |
mustRearrange == true ifFalse:[ |
1117 | 1776 |
mustRearrange := true. |
1777 |
shown ifTrue:[ |
|
1778 |
self invalidate "/ RepairNow:true |
|
1779 |
] |
|
388 | 1780 |
] |
590 | 1781 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1782 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 1783 |
! |
1784 |
||
710 | 1785 |
rearrangeGroups |
1786 |
|layout |
|
1787 |
dltX "{ Class:SmallInteger }" |
|
1788 |
start "{ Class:SmallInteger }" |
|
1789 |
| |
|
1790 |
||
1791 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1792 |
^ self |
710 | 1793 |
]. |
1794 |
||
1795 |
layout := items last layout. |
|
1796 |
||
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1797 |
(dltX := width "- margin" "- 2" - layout right) <= 0 ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1798 |
^ self "/ no free space |
710 | 1799 |
]. |
1800 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
1801 |
||
1802 |
start == 0 ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1803 |
^ self "/ no item detected |
710 | 1804 |
]. |
1805 |
||
1806 |
"/ change layout |
|
1807 |
||
1808 |
items from:start do:[:anItem| |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1809 |
anItem isVisible ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1810 |
layout := anItem layout. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1811 |
layout left:(layout left + dltX). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1812 |
layout right:(layout right + dltX). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1813 |
] |
710 | 1814 |
]. |
1815 |
! |
|
1816 |
||
388 | 1817 |
rearrangeItems |
1818 |
"recompute layout of my items |
|
1819 |
" |
|
710 | 1820 |
|expLast e grpDivSz layout isVert |
1821 |
x "{ Class:SmallInteger }" |
|
1822 |
y "{ Class:SmallInteger }" |
|
1823 |
noItems "{ Class:SmallInteger }" |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1824 |
f |
710 | 1825 |
| |
390 | 1826 |
|
1827 |
mustRearrange ifFalse:[ ^ self ]. |
|
1828 |
||
1829 |
"/ fetch font from superMenu |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1830 |
(superMenu notNil and:[(f := superMenu font) ~~ font]) ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1831 |
super font:(f on:device) |
388 | 1832 |
]. |
710 | 1833 |
(noItems := items size) == 0 ifTrue:[ |
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1834 |
mustRearrange := false. |
390 | 1835 |
^ self |
1836 |
]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1837 |
expLast := false. |
616 | 1838 |
isVert := self verticalLayout. |
390 | 1839 |
|
1840 |
self hasGroupDividers ifTrue:[ |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1841 |
self isFitPanel ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1842 |
grpDivSz := groupDividerSize |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1843 |
] ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1844 |
expLast := true. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1845 |
x := margin. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1846 |
e := self computeExtent. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1847 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1848 |
isVert ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1849 |
items do:[:el | x := x + el preferredExtent y]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1850 |
y := e y. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1851 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1852 |
items do:[:el|x := x + el preferredExtent x]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1853 |
y := e x. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1854 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1855 |
x := x + (noItems + 1 * itemSpace). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1856 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1857 |
(grpDivSz := (y - x) // (groupSizes size)) <= 0 ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1858 |
grpDivSz := nil |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1859 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1860 |
x > (width-margin) ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1861 |
grpDivSz := nil |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1862 |
] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1863 |
] |
388 | 1864 |
]. |
390 | 1865 |
|
1866 |
(self isPopUpView or:[explicitExtent ~~ true]) ifTrue:[ |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1867 |
e := self preferredExtent copy. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1868 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1869 |
self isPopUpView ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1870 |
isVert ifTrue:[e y:1.0] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1871 |
ifFalse:[e x:1.0] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1872 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1873 |
self extent:e |
390 | 1874 |
] ifFalse:[ |
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1875 |
e := self computeExtent |
390 | 1876 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1877 |
|
1093 | 1878 |
x := y := margin. |
1879 |
||
1880 |
isVert ifTrue:[y := y + itemSpace] |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1881 |
ifFalse:[x := x + itemSpace]. |
390 | 1882 |
|
1096 | 1883 |
self keysAndValuesDo:[:anIndex :el| |org corn elPref| |
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1884 |
el isVisible ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1885 |
el isButton ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1886 |
org := Point x:(x+DefaultButtonItemSpace) y:(y+DefaultButtonItemSpace). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1887 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1888 |
org := Point x:x y:y. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1889 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1890 |
elPref := el preferredExtent. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1891 |
isVert ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1892 |
y := y + elPref y. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1893 |
corn := (e x - margin @ y). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1894 |
el isButton ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1895 |
corn := corn - (DefaultButtonItemSpace @ 0). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1896 |
el layout:(Rectangle origin:org corner:corn). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1897 |
y := y + (2 * DefaultButtonItemSpace). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1898 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1899 |
el layout:(Rectangle origin:org corner:corn). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1900 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1901 |
y := y + itemSpace. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1902 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1903 |
x := x + elPref x. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1904 |
el isButton ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1905 |
x := x + DefaultButtonItemSpace. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1906 |
corn := (x @ (e y - margin)). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1907 |
corn := corn - (0 @ DefaultButtonItemSpace). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1908 |
el layout:(Rectangle origin:org corner:corn). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1909 |
x := x + DefaultButtonItemSpace. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1910 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1911 |
corn := (x @ e y). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1912 |
el layout:(Rectangle origin:org corner:corn). |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1913 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1914 |
x := x + itemSpace. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1915 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1916 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1917 |
(grpDivSz notNil and:[self hasGroupDividerAt:anIndex]) ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1918 |
isVert ifTrue:[y := y + grpDivSz] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1919 |
ifFalse:[x := x + grpDivSz] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1920 |
] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1921 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1922 |
org := Point x:x y:y. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1923 |
el layout:(Rectangle origin:org corner:org) |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1924 |
] |
390 | 1925 |
]. |
710 | 1926 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1927 |
expLast ifTrue:[ |
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1928 |
e := items last. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1929 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1930 |
e isVisible ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1931 |
layout := items last layout. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1932 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1933 |
isVert ifTrue:[layout bottom:((self extent y) + 1)] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1934 |
ifFalse:[layout right:((self extent x) + 1)]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1935 |
] |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1936 |
]. |
710 | 1937 |
self rearrangeGroups. |
388 | 1938 |
mustRearrange := false. |
1939 |
||
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
1940 |
"Modified: / 19.1.1999 / 16:00:14 / cg" |
388 | 1941 |
! |
1942 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1943 |
rearrangeItemsIfItemVisibilityChanged |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1944 |
"if I have any items with changing visibility, rearrange" |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1945 |
|
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1946 |
items do:[:item | |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1947 |
item canChangeVisibility ifTrue:[ |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1948 |
mustRearrange := true. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1949 |
self rearrangeItems. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1950 |
^ self |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1951 |
]. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1952 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1953 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
1954 |
|
388 | 1955 |
redrawX:x y:y width:w height:h |
1956 |
"redraw a rectangle |
|
1957 |
" |
|
650 | 1958 |
|start end isVrt x1 x2 y1 y2 item layout lnSz hrzInset prevClipArea| |
388 | 1959 |
|
710 | 1960 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 1961 |
|
1962 |
self paint:(self backgroundColor). |
|
1963 |
self clearRectangleX:x y:y width:w height:h. |
|
1964 |
||
1965 |
isVrt := self verticalLayout. |
|
1966 |
end := items size. |
|
1967 |
||
1968 |
mustRearrange ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1969 |
self isPopUpView not ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1970 |
explicitExtent := true |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1971 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1972 |
self rearrangeItems. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1973 |
start := 1 |
388 | 1974 |
] ifFalse:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1975 |
end == 0 ifTrue:[ ^ self ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1976 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1977 |
isVrt ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1978 |
start := self findFirst:[:el| (el layout bottom) >= y ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1979 |
start == 0 ifTrue:[ ^ self ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1980 |
end := y + h. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1981 |
end := self findLast:[:el| (el layout top) < end ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1982 |
] ifFalse:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1983 |
start := self findFirst:[:el| (el layout right) >= x ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1984 |
start == 0 ifTrue:[ ^ self ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1985 |
end := x + w. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1986 |
end := self findLast:[:el| (el layout left) < end ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1987 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1988 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1989 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1990 |
start := start - 1 |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1991 |
] |
388 | 1992 |
]. |
1993 |
||
390 | 1994 |
( self hasGroupDividers |
1995 |
and:[self showGroupDivider |
|
1996 |
and:[self isFitPanel not]] |
|
1997 |
) ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1998 |
lnSz := groupDividerSize // 2 |
390 | 1999 |
]. |
1101 | 2000 |
|
650 | 2001 |
end == 0 ifTrue:[^ self ]. |
2002 |
||
2003 |
hrzInset := items first horizontalInset. |
|
2004 |
||
2005 |
prevClipArea := clipRect. |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2006 |
"/ clipRect := nil. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2007 |
"/ device setClipX:x y:y width:w height:h in:drawableId gc:gcId. |
650 | 2008 |
|
388 | 2009 |
start to:end do:[:i| |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2010 |
item := items at:i. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2011 |
item redraw. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2012 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2013 |
(lnSz notNil and:[self hasGroupDividerAt:i]) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2014 |
layout := item layout. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2015 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2016 |
isVrt ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2017 |
x1 := layout left + hrzInset. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2018 |
x2 := layout right - hrzInset. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2019 |
y1 := (layout bottom) + lnSz. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2020 |
y2 := y1. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2021 |
] ifFalse:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2022 |
x1 := (layout right) + lnSz. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2023 |
x2 := x1. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2024 |
y1 := layout top. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2025 |
y2 := layout bottom. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2026 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2027 |
self paint:(self shadowColor). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2028 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2029 |
self paint:(self lightColor). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2030 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2031 |
isVrt ifTrue:[y1 := y1 + 1. y2 := y1 ] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2032 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2033 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2034 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2035 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2036 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2037 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2038 |
"/ clipRect := nil. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2039 |
"/ prevClipArea isNil ifTrue:[device noClipIn:drawableId gc:gcId] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2040 |
"/ ifFalse:[self clippingRectangle:prevClipArea]. |
650 | 2041 |
|
388 | 2042 |
|
2043 |
||
2044 |
! ! |
|
2045 |
||
2046 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2047 |
||
2048 |
collect:aOneArgBlock |
|
2049 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2050 |
and return a collection of the results |
|
2051 |
" |
|
2052 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
|
2053 |
^ nil |
|
2054 |
||
2055 |
! |
|
2056 |
||
2057 |
do:aOneArgBlock |
|
2058 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel. |
|
2059 |
" |
|
2060 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
|
2061 |
||
2062 |
! |
|
2063 |
||
2064 |
findFirst:aOneArgBlock |
|
2065 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2066 |
returns true; return its index or 0 if none detected. |
|
2067 |
" |
|
2068 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
|
2069 |
^ 0 |
|
2070 |
||
2071 |
! |
|
2072 |
||
2073 |
findLast:aOneArgBlock |
|
2074 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2075 |
returns true; return its index or 0 if none detected. |
|
2076 |
" |
|
2077 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
|
2078 |
^ 0 |
|
2079 |
||
2080 |
! |
|
2081 |
||
390 | 2082 |
indexOf:something |
2083 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2084 |
If no item match 0 is returned. No range checks are performed on a number argument |
|
388 | 2085 |
" |
390 | 2086 |
|i v| |
2087 |
||
2088 |
something isNumber ifTrue:[ ^ something ]. |
|
2089 |
something isNil ifTrue:[ ^ 0 ]. |
|
2090 |
||
1218 | 2091 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2092 |
|
2093 |
i ~~ 0 ifTrue:[ |
|
1218 | 2094 |
^ i |
388 | 2095 |
]. |
390 | 2096 |
|
2097 |
something isSymbol ifTrue:[ |
|
1218 | 2098 |
i := self findFirst:[:el| |
2099 |
v := el value. |
|
2100 |
v isSymbol and:[v == something] |
|
2101 |
]. |
|
2102 |
i ~~ 0 ifTrue:[ |
|
2103 |
^ i |
|
2104 |
] |
|
390 | 2105 |
]. |
2106 |
||
2107 |
(something respondsTo:#string) ifTrue:[ |
|
1218 | 2108 |
v := something string. |
2109 |
^ self findFirst:[:el | el textLabel = v]. |
|
2110 |
]. |
|
2111 |
^ 0 |
|
388 | 2112 |
! |
2113 |
||
706 | 2114 |
indexOfItem:anItem |
2115 |
"returns the index of the item or 0 |
|
2116 |
" |
|
2117 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
|
2118 |
! |
|
2119 |
||
388 | 2120 |
keysAndValuesDo:aTwoArgBlock |
2121 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel. |
|
2122 |
" |
|
2123 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
|
2124 |
||
2125 |
! ! |
|
2126 |
||
2127 |
!MenuPanel methodsFor:'event handling'! |
|
2128 |
||
2129 |
buttonMotion:state x:x y:y |
|
2130 |
"open or close the corresponding submenus |
|
2131 |
" |
|
1218 | 2132 |
|menu point sensor sel itm| |
388 | 2133 |
|
2134 |
( (sensor := self sensor) notNil |
|
2135 |
and:[sensor hasButtonMotionEventFor:nil] |
|
2136 |
) ifTrue:[ |
|
1218 | 2137 |
^ self |
388 | 2138 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2139 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2140 |
sensor anyButtonPressed ifFalse:[ |
1218 | 2141 |
"/ TODO: remember item over which pointer is |
2142 |
"/ (for enteredFG/enteredBG/enteredLevel handling) |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2143 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2144 |
|
1218 | 2145 |
(buttonEnteredBgColor ~= ButtonPassiveBackgroundColor |
2146 |
or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[ |
|
2147 |
(self containsPointX:x y:y) ifTrue:[ |
|
2148 |
((sel := self itemAtX:x y:y) notNil |
|
2149 |
and:[sel isButton |
|
2150 |
and:[superMenu isNil |
|
2151 |
and:[sel canSelect]]]) ifTrue:[ |
|
2152 |
itm := sel. |
|
2153 |
] ifFalse:[ |
|
2154 |
itm := nil |
|
2155 |
]. |
|
2156 |
self itemEntered:itm. |
|
2157 |
]. |
|
2158 |
]. |
|
2159 |
^ self |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2160 |
]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2161 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2162 |
"/ ok, a button is pressed. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2163 |
(buttonEnteredBgColor ~= ButtonPassiveBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2164 |
or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[ |
1218 | 2165 |
self itemEntered:nil. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2166 |
]. |
388 | 2167 |
|
1044 | 2168 |
lastButtonSelected notNil ifTrue:[ |
1218 | 2169 |
^ self |
1044 | 2170 |
]. |
816 | 2171 |
|
388 | 2172 |
(self containsPointX:x y:y) ifTrue:[ |
1218 | 2173 |
((sel := self itemAtX:x y:y) notNil |
2174 |
and:[sel isButton |
|
2175 |
and:[superMenu isNil |
|
2176 |
and:[sel canSelect]]]) ifTrue:[ |
|
2177 |
lastButtonSelected := sel |
|
2178 |
]. |
|
2179 |
^ self selection:sel |
|
388 | 2180 |
]. |
736 | 2181 |
|
388 | 2182 |
menu := self superMenuAtX:x y:y. |
2183 |
||
2184 |
menu isNil ifTrue:[ |
|
736 | 2185 |
^ self selection:nil |
388 | 2186 |
]. |
2187 |
point := self translatePoint:(x@y) to:menu. |
|
2188 |
menu selection:(menu itemAtX:(point x) y:(point y)) |
|
1022
4519009d5f9c
ignore motion events when no button is down.
Claus Gittinger <cg@exept.de>
parents:
1018
diff
changeset
|
2189 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
2190 |
"Modified: / 22.8.1998 / 12:51:17 / cg" |
388 | 2191 |
! |
2192 |
||
2193 |
buttonPress:button x:x y:y |
|
2194 |
"any button pressed; open or close the corresponding submenus |
|
2195 |
" |
|
2196 |
|menu point item| |
|
2197 |
||
2198 |
menu := self superMenuAtX:x y:y. |
|
2199 |
||
2200 |
menu isNil ifTrue:[ |
|
1255 | 2201 |
menu := self topMenu. |
388 | 2202 |
] ifFalse:[ |
1255 | 2203 |
point := self translatePoint:(x@y) to:menu. |
2204 |
item := menu itemAtX:(point x) y:(point y) |
|
2205 |
]. |
|
2206 |
menu selection:item. |
|
2207 |
||
2208 |
self requestFocus |
|
388 | 2209 |
! |
2210 |
||
2211 |
buttonRelease:button x:x y:y |
|
2212 |
"button release action; accept selection and close all views |
|
2213 |
" |
|
816 | 2214 |
|menu item| |
687 | 2215 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2216 |
menu := self topMenu activeMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2217 |
|
1251 | 2218 |
( menu selection notNil |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2219 |
or:[menu isPopUpView not |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2220 |
or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue) |
1251 | 2221 |
and:(menu mapTime)) > 200]] |
388 | 2222 |
) ifTrue:[ |
1251 | 2223 |
item := nil. |
2224 |
||
2225 |
( (menu := self superMenuAtX:x y:y) notNil |
|
2226 |
and:[(item := menu selection) notNil |
|
2227 |
and:[item submenu notNil]] |
|
2228 |
) ifTrue:[ |
|
2229 |
menu selection:nil |
|
2230 |
] ifFalse:[ |
|
2231 |
( lastButtonSelected isNil |
|
2232 |
or:[item isNil |
|
2233 |
or:[(menu itemAtX:x y:y) == lastButtonSelected]] |
|
2234 |
) ifFalse:[ |
|
2235 |
item := nil |
|
2236 |
]. |
|
2237 |
self topMenu accept:item |
|
2238 |
] |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2239 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2240 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2241 |
"Modified: / 27.2.1998 / 17:41:23 / cg" |
388 | 2242 |
! |
2243 |
||
2244 |
cursorPressed:aKey |
|
2245 |
"handle a cursor key |
|
2246 |
" |
|
687 | 2247 |
|next submenu item |
2248 |
n "{ Class:SmallInteger }" |
|
2249 |
idx "{ Class:SmallInteger }" |
|
2250 |
first "{ Class:SmallInteger }" |
|
2251 |
| |
|
1251 | 2252 |
|
2253 |
(self selection isNil |
|
2254 |
and:[superMenu notNil]) ifTrue:[ |
|
2255 |
^ superMenu cursorPressed:aKey |
|
388 | 2256 |
]. |
2257 |
||
2258 |
self verticalLayout ifTrue:[ |
|
1251 | 2259 |
aKey == #CursorLeft ifTrue:[^ self selection:nil]. |
2260 |
aKey ~~ #CursorRight ifTrue:[next := aKey == #CursorDown]. |
|
388 | 2261 |
] ifFalse:[ |
1251 | 2262 |
aKey == #CursorUp ifTrue:[^ self selection:nil]. |
2263 |
aKey ~~ #CursorDown ifTrue:[next := aKey == #CursorRight]. |
|
388 | 2264 |
]. |
2265 |
||
2266 |
next isNil ifTrue:[ |
|
1251 | 2267 |
(item := self selection) notNil ifTrue:[ |
2268 |
(submenu := item submenu) notNil ifTrue:[ |
|
2269 |
idx := submenu findFirst:[:el| el canSelect ]. |
|
2270 |
^ submenu selectionIndex:idx |
|
2271 |
]. |
|
2272 |
^ self selection:nil |
|
2273 |
]. |
|
388 | 2274 |
^ self |
2275 |
]. |
|
2276 |
first := self findFirst:[:el| el canSelect ]. |
|
2277 |
first == 0 ifTrue:[^ self]. |
|
2278 |
||
2279 |
idx := self selectionIndex. |
|
687 | 2280 |
n := 1 + (self sensor compressKeyPressEventsWithKey:aKey). |
2281 |
||
2282 |
n timesRepeat:[ |
|
1251 | 2283 |
next ifTrue:[ |
2284 |
[((idx := idx + 1) <= items size and:[(items at:idx) canSelect not]) |
|
2285 |
] whileTrue. |
|
2286 |
||
2287 |
idx > items size ifTrue:[ |
|
2288 |
idx := first |
|
2289 |
]. |
|
2290 |
] ifFalse:[ |
|
2291 |
[((idx := idx - 1) > 0 and:[(items at:idx) canSelect not]) |
|
2292 |
] whileTrue. |
|
687 | 2293 |
|
1251 | 2294 |
idx < 1 ifTrue:[ idx := self findLast:[:el| el canSelect ] ] |
2295 |
] |
|
2296 |
]. |
|
2297 |
self selectionIndex:idx. |
|
2298 |
||
388 | 2299 |
! |
2300 |
||
1199 | 2301 |
handleFocusNext |
2302 |
"handle focus next key |
|
2303 |
" |
|
2304 |
|idx| |
|
2305 |
||
2306 |
(self isPopUpView or:[items isNil]) ifFalse:[ |
|
2307 |
idx := self selectionIndex. |
|
2308 |
idx := items findFirst:[:el|el canSelect] startingAt:(1 + idx). |
|
2309 |
idx ~~ 0 ifTrue:[ ^ self selectionIndex:idx ] |
|
2310 |
]. |
|
2311 |
self selection:nil. |
|
2312 |
self windowGroup focusNextFrom:self. |
|
2313 |
||
2314 |
! |
|
2315 |
||
2316 |
handleFocusPrevious |
|
2317 |
"handle focus previous |
|
2318 |
" |
|
2319 |
|idx sel| |
|
2320 |
||
2321 |
(self isPopUpView or:[items isNil]) ifFalse:[ |
|
2322 |
sel := self selectionIndex. |
|
2323 |
idx := sel == 0 ifTrue:[self numberOfItems] |
|
2324 |
ifFalse:[sel - 1]. |
|
2325 |
idx := items findLast:[:el|el canSelect] startingAt:idx. |
|
2326 |
idx ~~ 0 ifTrue:[ ^ self selectionIndex:idx ] |
|
2327 |
]. |
|
2328 |
self selection:nil. |
|
2329 |
self windowGroup focusPreviousFrom:self. |
|
2330 |
||
2331 |
! |
|
2332 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2333 |
itemEntered:anItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2334 |
|prevEnteredItem| |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2335 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2336 |
anItem == enteredItem ifTrue:[^ self]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2337 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2338 |
prevEnteredItem := enteredItem. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2339 |
enteredItem := anItem. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2340 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2341 |
prevEnteredItem notNil ifTrue:[ |
1117 | 2342 |
prevEnteredItem redraw |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2343 |
]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2344 |
enteredItem notNil ifTrue:[ |
1117 | 2345 |
enteredItem redraw |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2346 |
]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2347 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2348 |
"Created: / 20.8.1998 / 13:18:23 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2349 |
"Modified: / 20.8.1998 / 14:03:55 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2350 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2351 |
|
388 | 2352 |
keyPress:key x:x y:y |
2353 |
"any key is pressed |
|
2354 |
" |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2355 |
|listOfItems item menu idx cIdx upperKey lowerKey rawKey| |
388 | 2356 |
|
2357 |
menu := self. |
|
2358 |
||
2359 |
[ menu shown ] whileFalse:[ |
|
1255 | 2360 |
(menu := superMenu) isNil ifTrue:[ |
2361 |
^ self |
|
2362 |
] |
|
388 | 2363 |
]. |
2364 |
||
2365 |
key == #Return ifTrue:[ |
|
1199 | 2366 |
^ menu accept |
2367 |
]. |
|
2368 |
||
1250 | 2369 |
"/ cg: must hide the active menu ... |
2370 |
key == #Escape ifTrue:[ |
|
2371 |
menu isPopUpView ifTrue:[ |
|
2372 |
menu hide |
|
2373 |
] |
|
2374 |
]. |
|
2375 |
||
2376 |
"/ (key == #Tab or:[key == #FocusNext]) ifTrue:[ |
|
2377 |
"/ ^ self topMenu handleFocusNext |
|
2378 |
"/ ]. |
|
2379 |
"/ key == #FocusPrevious ifTrue:[ |
|
2380 |
"/ ^ self topMenu handleFocusPrevious |
|
2381 |
"/ ]. |
|
2382 |
"/ CG: the old code above prevented |
|
2383 |
"/ tabbing to the next view ... |
|
2384 |
(key == #Tab |
|
2385 |
or:[key == #FocusNext |
|
2386 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2387 |
"/ if there is a menu open, hide it ... |
|
2388 |
self isPopUpView ifFalse:[ |
|
2389 |
^ super keyPress:key x:x y:y |
|
2390 |
] |
|
388 | 2391 |
]. |
2392 |
||
2393 |
( key == #CursorDown or:[key == #CursorUp |
|
2394 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
|
2395 |
) ifTrue:[ |
|
1199 | 2396 |
^ menu cursorPressed:key |
388 | 2397 |
]. |
2398 |
||
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2399 |
rawKey := device keyboardMap keyAtValue:key ifAbsent:key. |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2400 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2401 |
listOfItems := self selectItemsForShortcutKey:rawKey. |
1240
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2402 |
(listOfItems isNil and:[key ~~ rawKey]) ifTrue:[ |
1199 | 2403 |
listOfItems := self selectItemsForShortcutKey:key. |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2404 |
]. |
388 | 2405 |
listOfItems notNil ifTrue:[ |
1199 | 2406 |
item := listOfItems first. |
2407 |
||
2408 |
item hasSubmenu ifFalse:[ |
|
2409 |
^ menu accept:item |
|
2410 |
]. |
|
2411 |
^ self openMenusFromItems:listOfItems |
|
388 | 2412 |
]. |
2413 |
||
1251 | 2414 |
(self selection isNil and:[superMenu notNil]) ifTrue:[ |
1199 | 2415 |
(superMenu containsPoint:(self translatePoint:(x@y) to:superMenu)) ifTrue:[ |
2416 |
menu := superMenu |
|
2417 |
] |
|
388 | 2418 |
]. |
2419 |
||
2420 |
cIdx := menu selectionIndex. |
|
2421 |
cIdx isNil ifTrue:[cIdx := 0]. |
|
2422 |
||
389 | 2423 |
upperKey := key asUppercase. |
2424 |
lowerKey := key asLowercase. |
|
2425 |
||
388 | 2426 |
menu keysAndValuesDo:[:anIndex :el| |c l| |
1199 | 2427 |
(el canSelect and:[(l := el textLabel) notNil]) ifTrue:[ |
2428 |
l size ~~ 0 ifTrue:[ |
|
2429 |
(c := el accessCharacter) notNil ifTrue:[ |
|
2430 |
(c == upperKey or:[c == lowerKey]) ifTrue:[ |
|
2431 |
^ menu selection:el |
|
2432 |
] |
|
2433 |
] ifFalse:[ |
|
2434 |
((c := l first) == upperKey or:[c == lowerKey]) ifTrue:[ |
|
2435 |
anIndex > cIdx ifTrue:[ |
|
2436 |
^ menu selection:el |
|
2437 |
] ifFalse:[ |
|
2438 |
idx isNil ifTrue:[ |
|
2439 |
idx := anIndex |
|
2440 |
] ifFalse:[ |
|
2441 |
anIndex > idx ifTrue:[ |
|
2442 |
anIndex ~~ cIdx ifTrue:[ |
|
2443 |
idx := anIndex |
|
2444 |
] |
|
2445 |
] |
|
2446 |
] |
|
2447 |
] |
|
388 | 2448 |
|
1199 | 2449 |
] |
2450 |
] |
|
2451 |
] |
|
2452 |
] |
|
388 | 2453 |
]. |
417 | 2454 |
(item := menu itemAt:idx) isNil ifTrue:[ |
1251 | 2455 |
menu selection isNil ifTrue:[ |
1199 | 2456 |
(menu := menu superMenu) isNil ifTrue:[ |
2457 |
^ super keyPress:key x:x y:y |
|
2458 |
] |
|
2459 |
] |
|
417 | 2460 |
]. |
2461 |
menu selection:item. |
|
388 | 2462 |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2463 |
"Modified: / 8.8.1998 / 13:38:36 / cg" |
390 | 2464 |
! |
2465 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2466 |
pointerLeave:state |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2467 |
self itemEntered:nil. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2468 |
super pointerLeave:state |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2469 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2470 |
"Created: / 20.8.1998 / 14:04:29 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2471 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2472 |
|
1240
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2473 |
processShortcutKeyEventInMenuBar:event |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2474 |
"an event as forwarded from the keyboardProcessor - |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2475 |
if there is a short-key for that character, process it |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2476 |
and return true. Otherwise, return false." |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2477 |
|
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2478 |
|key rawKey listOfItems item| |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2479 |
|
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2480 |
key := event key. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2481 |
rawKey := device keyboardMap keyAtValue:key ifAbsent:key. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2482 |
|
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2483 |
listOfItems := self selectItemsForShortcutKey:rawKey. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2484 |
(listOfItems isNil and:[key ~~ rawKey]) ifTrue:[ |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2485 |
listOfItems := self selectItemsForShortcutKey:key. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2486 |
]. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2487 |
listOfItems notNil ifTrue:[ |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2488 |
item := listOfItems first. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2489 |
|
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2490 |
item hasSubmenu ifFalse:[ |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2491 |
self accept:item |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2492 |
] ifTrue:[ |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2493 |
self openMenusFromItems:listOfItems. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2494 |
]. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2495 |
^ true. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2496 |
]. |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2497 |
^ false |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2498 |
! |
167fcc9bd9de
prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents:
1222
diff
changeset
|
2499 |
|
390 | 2500 |
sizeChanged:how |
2501 |
self isFitPanel ifTrue:[ |
|
1117 | 2502 |
self mustRearrange. |
390 | 2503 |
]. |
2504 |
super sizeChanged:how |
|
388 | 2505 |
! ! |
2506 |
||
2507 |
!MenuPanel methodsFor:'grabbing'! |
|
2508 |
||
420 | 2509 |
forceUngrabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2510 |
"ungrab resources (mouse and keyboard) |
420 | 2511 |
" |
2512 |
|sensor| |
|
2513 |
||
2514 |
device ungrabPointer. |
|
2515 |
||
2516 |
(sensor := self sensor) notNil ifTrue:[ |
|
1117 | 2517 |
"/ make certain all X events have been received |
2518 |
device sync. |
|
2519 |
"/ now all events have been received. |
|
2520 |
"/ now, flush all pointer events |
|
2521 |
sensor flushKeyboardFor:nil |
|
420 | 2522 |
]. |
2523 |
device ungrabKeyboard. |
|
2524 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2525 |
"Modified: / 2.2.1998 / 09:24:48 / stefan" |
420 | 2526 |
! |
2527 |
||
388 | 2528 |
grabMouseAndKeyboard |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2529 |
"get exclusive access to pointer and keyboard. |
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2530 |
Only used for popUp menus." |
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2531 |
|
388 | 2532 |
|sensor| |
2533 |
||
2534 |
realized ifTrue:[ |
|
1253
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2535 |
sensor := self sensor. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2536 |
|
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2537 |
device activePointerGrab ~~ self ifTrue:[ |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2538 |
sensor notNil ifTrue:[ |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2539 |
sensor flushMotionEventsFor:nil. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2540 |
]. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2541 |
|
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2542 |
(device grabPointerInView:self) ifFalse:[ |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2543 |
Delay waitForSeconds:0.1. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2544 |
(device grabPointerInView:self) ifFalse:[ |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2545 |
"give up" |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2546 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2547 |
self unmap |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2548 |
] |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2549 |
] |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2550 |
]. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2551 |
|
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2552 |
device activeKeyboardGrab ~~ self ifTrue:[ |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2553 |
sensor notNil ifTrue:[ |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2554 |
device sync. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2555 |
sensor flushKeyboardFor:nil |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2556 |
]. |
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2557 |
device grabKeyboardInView:self. |
1255 | 2558 |
]. |
2559 |
||
2560 |
superMenu notNil ifTrue:[ |
|
2561 |
self requestFocus. |
|
2562 |
self getKeyboardFocus |
|
1253
0677a30811d2
adapted for new focus handling
Claus Gittinger <cg@exept.de>
parents:
1252
diff
changeset
|
2563 |
] |
388 | 2564 |
] |
2565 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2566 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 2567 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 2568 |
! |
2569 |
||
2570 |
ungrabMouseAndKeyboard |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2571 |
"ungrab resources (mouse and keyboard) |
388 | 2572 |
" |
2573 |
|sensor| |
|
2574 |
||
2575 |
device activePointerGrab == self ifTrue:[ |
|
1117 | 2576 |
device ungrabPointer. |
388 | 2577 |
]. |
2578 |
device activeKeyboardGrab == self ifTrue:[ |
|
1117 | 2579 |
sensor := self sensor. |
2580 |
sensor notNil ifTrue:[ |
|
2581 |
"/ make certain all X events have been received |
|
2582 |
device sync. |
|
2583 |
"/ now all events have been received. |
|
2584 |
"/ now, flush all pointer events |
|
2585 |
sensor flushKeyboardFor:self |
|
2586 |
]. |
|
2587 |
device ungrabKeyboard. |
|
388 | 2588 |
]. |
687 | 2589 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2590 |
"Modified: / 2.2.1998 / 10:27:12 / stefan" |
388 | 2591 |
! ! |
2592 |
||
1251 | 2593 |
!MenuPanel methodsFor:'help'! |
2594 |
||
2595 |
helpText |
|
1252 | 2596 |
"return the helpText for the currently selected item (empty if none)" |
2597 |
||
1251 | 2598 |
|appl item key| |
2599 |
||
2600 |
(item := self selection) notNil ifTrue:[ |
|
2601 |
(key := item activeHelpKey) notNil ifTrue:[ |
|
2602 |
(appl := self application) notNil ifTrue:[ |
|
2603 |
^ (appl helpTextForKey:key) ? ''. |
|
2604 |
]. |
|
2605 |
] |
|
2606 |
]. |
|
2607 |
^ '' "/ nil. |
|
2608 |
||
2609 |
"Modified: / 31.7.1998 / 03:15:17 / cg" |
|
2610 |
! |
|
2611 |
||
2612 |
helpTextAt:aPoint |
|
1252 | 2613 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2614 |
If there is a selection, that items helpText is used (ignoreing the given point). |
|
2615 |
" |
|
2616 |
||
1251 | 2617 |
|menu point item key appl| |
2618 |
||
2619 |
selection notNil ifTrue:[ |
|
2620 |
^ self helpText |
|
2621 |
]. |
|
2622 |
||
2623 |
(self containsPoint:aPoint) ifFalse:[ |
|
2624 |
superMenu notNil ifTrue:[ |
|
2625 |
^ superMenu helptext |
|
2626 |
] |
|
2627 |
]. |
|
2628 |
||
2629 |
menu := self superMenuAtX:aPoint x y:aPoint y. |
|
2630 |
menu isNil ifTrue:[ |
|
2631 |
^ '' |
|
2632 |
]. |
|
2633 |
||
2634 |
point := self translatePoint:aPoint to:menu. |
|
2635 |
item := menu itemAtX:(point x) y:(point y). |
|
2636 |
item notNil ifTrue:[ |
|
2637 |
(key := item activeHelpKey) notNil ifTrue:[ |
|
2638 |
(appl := self application) notNil ifTrue:[ |
|
2639 |
^ (appl helpTextForKey:key) ? ''. |
|
2640 |
]. |
|
2641 |
] |
|
2642 |
]. |
|
2643 |
"/ 'nil item' printCR. |
|
2644 |
^ '' "/ nil. |
|
2645 |
||
2646 |
"Modified: / 31.7.1998 / 03:15:07 / cg" |
|
2647 |
! ! |
|
2648 |
||
794 | 2649 |
!MenuPanel methodsFor:'image registration'! |
2650 |
||
2651 |
imageOnDevice:anImage |
|
2652 |
"returns image registered on device |
|
2653 |
" |
|
2654 |
^ self class image:anImage onDevice:device |
|
2655 |
! |
|
2656 |
||
2657 |
lightenedImageOnDevice:anImage |
|
2658 |
"returns lightened image registered on device |
|
2659 |
" |
|
2660 |
^ self class lightenedImage:anImage onDevice:device |
|
2661 |
! ! |
|
2662 |
||
388 | 2663 |
!MenuPanel methodsFor:'initialize / release'! |
2664 |
||
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
2665 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
2666 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
2667 |
|
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
2668 |
^self |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
2669 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
2670 |
|
388 | 2671 |
create |
616 | 2672 |
"create the shadow view for a none contained submenu |
388 | 2673 |
" |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2674 |
|style bw lwl| |
436 | 2675 |
|
388 | 2676 |
super create. |
2677 |
||
2678 |
self isPopUpView ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2679 |
(styleSheet at:#'popup.shadow' default:false) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2680 |
shadowView isNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2681 |
shadowView := (ShadowView onDevice:device) for:self |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2682 |
] ifFalse:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2683 |
self saveUnder:true. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2684 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2685 |
] |
388 | 2686 |
] ifFalse:[ |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2687 |
explicitExtent == true ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2688 |
(self width) == (superView width) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2689 |
self verticalLayout:false |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2690 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2691 |
] |
388 | 2692 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
2693 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
2694 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 2695 |
! |
2696 |
||
2697 |
destroy |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2698 |
"destroy items and shadowView; remove dependencies |
388 | 2699 |
" |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2700 |
self clearLastActiveMenu. |
388 | 2701 |
self do:[:el|el destroy]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2702 |
|
498 | 2703 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
2704 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2705 |
|
388 | 2706 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2707 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2708 |
items := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2709 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2710 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2711 |
"Modified: / 27.2.1998 / 17:41:25 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2712 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2713 |
|
616 | 2714 |
fetchDeviceResources |
2715 |
"fetch device colors, to avoid reallocation at redraw time" |
|
2716 |
||
2717 |
|style| |
|
2718 |
||
2719 |
super fetchDeviceResources. |
|
2720 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2721 |
style := styleSheet name. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2722 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2723 |
"/ thats a kludge - will be replaced by values from the styleSheet ... |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2724 |
"/ (i.e. read menu.buttonActiveLevel & menu.buttonPassiveLevel) |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2725 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2726 |
onLevel := styleSheet at:#'menu.hilightLevel' default:0. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2727 |
|
616 | 2728 |
superMenu isNil ifTrue:[ |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2729 |
fgColor := DefaultForegroundColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2730 |
activeBgColor := DefaultHilightBackgroundColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2731 |
activeFgColor := DefaultHilightForegroundColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2732 |
disabledFgColor := DefaultDisabledForegroundColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2733 |
rightArrow := RightArrowForm onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2734 |
selectionFrameBrightColor := SelectionFrameBrightColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2735 |
selectionFrameDarkColor := SelectionFrameDarkColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2736 |
buttonLightColor := ButtonLightColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2737 |
buttonShadowColor := ButtonShadowColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2738 |
ButtonHalfLightColor notNil ifTrue: [ |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2739 |
buttonHalfLightColor := ButtonHalfLightColor onDevice:device]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2740 |
ButtonHalfShadowColor notNil ifTrue: [ |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2741 |
buttonHalfShadowColor := ButtonHalfShadowColor onDevice:device]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2742 |
buttonEnteredBgColor := ButtonEnteredBackgroundColor onDevice:device. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2743 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2744 |
(rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[ |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2745 |
rightArrowShadow := rightArrowShadow onDevice:device |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2746 |
] |
616 | 2747 |
] ifFalse:[ |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2748 |
fgColor := superMenu foregroundColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2749 |
activeBgColor := superMenu activeBackgroundColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2750 |
activeFgColor := superMenu activeForegroundColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2751 |
disabledFgColor := superMenu disabledForegroundColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2752 |
rightArrow := superMenu rightArrow. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2753 |
rightArrowShadow := superMenu rightArrowShadow. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2754 |
selectionFrameBrightColor := superMenu selectionFrameBrightColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2755 |
selectionFrameDarkColor := superMenu selectionFrameDarkColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2756 |
buttonLightColor := superMenu buttonLightColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2757 |
buttonShadowColor := superMenu buttonShadowColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2758 |
buttonHalfLightColor := superMenu buttonHalfLightColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2759 |
buttonHalfShadowColor := superMenu buttonHalfShadowColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2760 |
buttonEnteredBgColor := superMenu buttonEnteredBackgroundColor. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2761 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2762 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2763 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 2764 |
! |
2765 |
||
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2766 |
initPopUpDependentStyle:isPopUp |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2767 |
"/ stupid - must be invoked explicit, since, |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2768 |
"/ #isPopUpView does not return a correct value at initStyle time |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2769 |
"/ (thinks that all are popup views) ... |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2770 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2771 |
|bw lvl| |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2772 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2773 |
isPopUp ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2774 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2775 |
lvl := styleSheet at:#'popup.level' default:0. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2776 |
] ifFalse:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2777 |
bw := (styleSheet is3D ifFalse:[1] ifTrue:[0]). |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2778 |
lvl := DefaultLevel. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2779 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2780 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2781 |
bw notNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2782 |
self borderWidth:bw |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2783 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2784 |
lvl notNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2785 |
self level:lvl |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2786 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2787 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2788 |
! |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2789 |
|
580 | 2790 |
initStyle |
2791 |
"initialize style specific stuff" |
|
2792 |
||
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2793 |
|style bw lwl| |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2794 |
|
580 | 2795 |
super initStyle. |
616 | 2796 |
|
1336 | 2797 |
viewBackground := DefaultBackgroundColor. |
1117 | 2798 |
|
616 | 2799 |
onLevel := DefaultHilightLevel. |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2800 |
offLevel := 0. "/ DefaultLevel. |
616 | 2801 |
itemSpace := DefaultItemSpace. |
2802 |
||
2803 |
groupDividerSize := DefaultGroupDividerSize. |
|
2804 |
fitFirstPanel := DefaultFitFirstPanel. |
|
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2805 |
|
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2806 |
style := styleSheet name. |
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2807 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2808 |
"/ for now, assume not popUp (since superMenu is always nil at this time) |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2809 |
self initPopUpDependentStyle:false. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2810 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2811 |
font := MenuView defaultFont. |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2812 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2813 |
"Modified: / 15.9.1998 / 12:50:14 / cg" |
580 | 2814 |
! |
2815 |
||
388 | 2816 |
initialize |
2817 |
"set default configuration |
|
2818 |
" |
|
616 | 2819 |
|
388 | 2820 |
super initialize. |
616 | 2821 |
|
498 | 2822 |
enabled := true. |
388 | 2823 |
originChanged := extentChanged := false. |
2824 |
explicitExtent := nil. |
|
2825 |
shortKeyInset := 0. |
|
2826 |
mustRearrange := false. |
|
829 | 2827 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2828 |
"Modified: / 15.9.1998 / 12:49:51 / cg" |
388 | 2829 |
! |
2830 |
||
2831 |
mapped |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2832 |
"grab the pointer here, when visible (but not if control has already been lost). |
388 | 2833 |
If the grab fails, try again and unmap myself if that fails too. |
2834 |
" |
|
2835 |
|anItemList| |
|
2836 |
||
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
2837 |
self enableMotionEvents. |
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
2838 |
|
816 | 2839 |
lastButtonSelected := nil. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2840 |
self becomesActiveMenu. |
388 | 2841 |
super mapped. |
1078 | 2842 |
self do:[:anItem| anItem fetchImages ]. |
388 | 2843 |
|
1257
79a40d3f8c2f
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
1255
diff
changeset
|
2844 |
anItemList := InitialSelectionQuerySignal query. |
388 | 2845 |
|
2846 |
self isPopUpView ifTrue:[ |
|
1177 | 2847 |
self grabMouseAndKeyboard |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2848 |
] ifFalse:[ |
1177 | 2849 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2850 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2851 |
self do:[:el| el updateIndicators ]. |
388 | 2852 |
|
2853 |
anItemList size > 0 ifTrue:[ |
|
1177 | 2854 |
"/ self invalidateRepairNow:false. |
2855 |
self redrawX:0 y:0 width:width height:height. |
|
2856 |
self openMenusFromItems:anItemList. |
|
388 | 2857 |
]. |
2858 |
||
1177 | 2859 |
"Modified: / 19.11.1998 / 12:59:00 / cg" |
1257
79a40d3f8c2f
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
1255
diff
changeset
|
2860 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 2861 |
! |
2862 |
||
2863 |
realize |
|
2864 |
"realize menu and shadowView |
|
2865 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2866 |
|
388 | 2867 |
self isPopUpView ifTrue:[ |
1117 | 2868 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
2869 |
shadowView must be realized before self" |
|
2870 |
self hiddenOnRealize:true. |
|
2871 |
super realize. |
|
2872 |
self resize. |
|
2873 |
shadowView notNil ifTrue:[ |
|
2874 |
shadowView realize. |
|
2875 |
]. |
|
2876 |
super map. |
|
2877 |
self raise. |
|
736 | 2878 |
] ifFalse:[ |
1117 | 2879 |
super realize. |
736 | 2880 |
] |
388 | 2881 |
! |
2882 |
||
2883 |
recreate |
|
2884 |
"this is called after a snapin. If the image was saved with an active menu, |
|
2885 |
hide the menu |
|
2886 |
" |
|
2887 |
self selection:nil. |
|
2888 |
super recreate. |
|
2889 |
||
2890 |
! |
|
2891 |
||
1130 | 2892 |
reinitStyle |
2893 |
"handle style change while being open (win32 only - for now)" |
|
2894 |
||
2895 |
super reinitStyle. |
|
2896 |
||
2897 |
self fetchDeviceResources. |
|
2898 |
items notNil ifTrue:[ |
|
2899 |
items do:[:anItem | |
|
2900 |
anItem reinitSubmenuStyle |
|
2901 |
] |
|
2902 |
] |
|
2903 |
||
2904 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
2905 |
"Modified: / 11.9.1998 / 13:20:57 / cg" |
|
2906 |
! |
|
2907 |
||
388 | 2908 |
unmap |
1330 | 2909 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
2910 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 2911 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2912 |
self clearLastActiveMenu. |
879 | 2913 |
|
736 | 2914 |
"/ |
2915 |
"/ Kludge for X11: after grabbing and ungrabbing other views may get buttonMotionEvents |
|
2916 |
"/ when a mouse button is still pressed. To avoid this we grab the mouse for the superview. |
|
2917 |
"/ (Move from upperMenuPanel of NewLauncher to lowerMenuPanel) |
|
2918 |
"/ |
|
1218 | 2919 |
(superMenu notNil |
2920 |
and:[superMenu shown |
|
2921 |
and:[superMenu isPopUpView |
|
2922 |
or:[superMenu sensor anyButtonPressed]]]) |
|
2923 |
ifTrue:[ |
|
2924 |
superMenu grabMouseAndKeyboard |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2925 |
] ifFalse:[ |
1218 | 2926 |
self ungrabMouseAndKeyboard. |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2927 |
]. |
388 | 2928 |
super unmap. |
2929 |
shadowView notNil ifTrue:[shadowView unmap]. |
|
2930 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
2931 |
"Modified: / 2.2.1998 / 10:27:06 / stefan" |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2932 |
"Modified: / 27.2.1998 / 17:41:24 / cg" |
388 | 2933 |
! ! |
2934 |
||
2935 |
!MenuPanel methodsFor:'misc'! |
|
2936 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
2937 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
2938 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
2939 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
2940 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
2941 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
2942 |
|
388 | 2943 |
superMenu |
2944 |
"returns supermenu or nil |
|
2945 |
" |
|
2946 |
^ superMenu |
|
2947 |
||
2948 |
||
2949 |
! |
|
2950 |
||
2951 |
superMenu:aSuperMenu |
|
2952 |
"set the supermenu starting from |
|
2953 |
" |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2954 |
|prev| |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2955 |
|
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2956 |
prev := superMenu. |
388 | 2957 |
superMenu := aSuperMenu. |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2958 |
(prev isNil and:[superMenu notNil]) ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2959 |
self initPopUpDependentStyle:(self isPopUpView) |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2960 |
]. |
388 | 2961 |
! |
2962 |
||
2963 |
topMenu |
|
2964 |
"returns the topMenu; the one having no superMenu |
|
2965 |
" |
|
2966 |
|top| |
|
2967 |
||
2968 |
top := self. |
|
2969 |
||
2970 |
[ top superMenu notNil ] whileTrue:[ |
|
1117 | 2971 |
top := top superMenu |
388 | 2972 |
]. |
2973 |
^ top |
|
2974 |
||
2975 |
||
2976 |
! ! |
|
2977 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2978 |
!MenuPanel methodsFor:'printing'! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2979 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2980 |
printString |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2981 |
"return a printed representation of the menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2982 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2983 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2984 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2985 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2986 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2987 |
self do:[:anItem| |
1117 | 2988 |
label := anItem label ? ''. |
2989 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2990 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2991 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2992 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2993 |
"Modified: / 27.2.1998 / 17:41:22 / cg" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2994 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
2995 |
|
388 | 2996 |
!MenuPanel methodsFor:'private'! |
2997 |
||
434 | 2998 |
application |
2999 |
|appl| |
|
3000 |
||
3001 |
superMenu notNil ifTrue:[ |
|
1117 | 3002 |
^ superMenu application |
434 | 3003 |
]. |
3004 |
(appl := super application) isNil ifTrue:[ |
|
1117 | 3005 |
windowGroup notNil ifTrue:[ |
3006 |
appl := windowGroup mainGroup topViews first application |
|
3007 |
] |
|
434 | 3008 |
]. |
3009 |
^ appl |
|
3010 |
! |
|
3011 |
||
390 | 3012 |
menuAdornmentAt:aSymbol |
388 | 3013 |
"returns a value derived from adornment |
3014 |
" |
|
390 | 3015 |
|adm| |
3016 |
||
3017 |
adm := adornment ? DefaultAdornment. |
|
3018 |
^ adm at:aSymbol ifAbsent:nil |
|
388 | 3019 |
! |
3020 |
||
390 | 3021 |
menuAdornmentAt:aSymbol put:something |
653 | 3022 |
"sets a value for the specific menu; if the value differs to the |
3023 |
current stored value, true is returned otherwise false |
|
388 | 3024 |
" |
653 | 3025 |
(self menuAdornmentAt:aSymbol) == something ifTrue:[ |
1117 | 3026 |
^ false |
653 | 3027 |
]. |
3028 |
adornment isNil ifTrue:[ |
|
1117 | 3029 |
adornment := DefaultAdornment copy |
653 | 3030 |
]. |
3031 |
adornment at:aSymbol put:something. |
|
3032 |
^ true |
|
388 | 3033 |
! |
3034 |
||
3035 |
onEachPerform:aSelector withArgList:aList |
|
3036 |
"on each item perform selector with an argument derived from aList |
|
3037 |
" |
|
3038 |
aList isCollection ifTrue:[ |
|
1117 | 3039 |
items size >= aList size ifTrue:[ |
3040 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
3041 |
(items at:anIndex) perform:aSelector with:anArg |
|
3042 |
] |
|
3043 |
] |
|
388 | 3044 |
] ifFalse:[ |
1117 | 3045 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 3046 |
] |
3047 |
||
3048 |
||
3049 |
! |
|
3050 |
||
3051 |
openMenusFromItems:anItemList |
|
3052 |
"open all menus derived from sequence of items |
|
3053 |
" |
|
3054 |
|item| |
|
3055 |
||
3056 |
(anItemList isNil or:[anItemList isEmpty]) ifTrue:[ |
|
1117 | 3057 |
^ self |
388 | 3058 |
]. |
3059 |
item := anItemList removeLast. |
|
3060 |
||
3061 |
item enabled ifFalse:[ |
|
1117 | 3062 |
^ self |
388 | 3063 |
]. |
3064 |
||
3065 |
InitialSelectionQuerySignal answer:anItemList do:[ |
|
1117 | 3066 |
self selection:item |
388 | 3067 |
] |
3068 |
! |
|
3069 |
||
3070 |
selectItemsForShortcutKey:aKey |
|
3071 |
"get sequence of items up to the item providing the key (inclusive). The |
|
3072 |
first entry into the collection is the item providing the key, the last |
|
3073 |
entry is the item in the topMenu( reverse ) |
|
3074 |
" |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3075 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3076 |
"/ cg: must limit the recursion (see GUIDemoToolBar - pressing CTRL in the recursive-link example) |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3077 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3078 |
^ self selectItemsForShortcutKey:aKey maxDepth:10 |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3079 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3080 |
"Modified: / 19.1.1999 / 16:00:22 / cg" |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3081 |
! |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3082 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3083 |
selectItemsForShortcutKey:aKey maxDepth:maxDepth |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3084 |
"get sequence of items up to the item providing the key (inclusive). The |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3085 |
first entry into the collection is the item providing the key, the last |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3086 |
entry is the item in the topMenu( reverse ) |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3087 |
" |
388 | 3088 |
|seq| |
3089 |
||
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3090 |
maxDepth <= 0 ifTrue:[^ nil]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3091 |
|
388 | 3092 |
self do:[:anItem| |
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3093 |
anItem isEnabled ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3094 |
anItem shortcutKey = aKey ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3095 |
seq := OrderedCollection new. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3096 |
] ifFalse:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3097 |
anItem hasSubmenu ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3098 |
seq := anItem submenu selectItemsForShortcutKey:aKey maxDepth:maxDepth-1 |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3099 |
] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3100 |
]. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3101 |
seq notNil ifTrue:[ |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3102 |
seq add:anItem. |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3103 |
^ seq |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3104 |
] |
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3105 |
] |
388 | 3106 |
]. |
3107 |
^ nil |
|
1181
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3108 |
|
97ee0869b374
care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3109 |
"Created: / 19.1.1999 / 16:00:16 / cg" |
388 | 3110 |
! |
3111 |
||
3112 |
translatePoint:aPoint to:aView |
|
3113 |
"translate a point into a views point; in case of no view nil is returned |
|
3114 |
" |
|
1218 | 3115 |
aView == self ifTrue:[^ aPoint]. |
388 | 3116 |
aView notNil ifTrue:[ |
3117 |
^ device translatePoint:aPoint from:(self id) to:(aView id) |
|
3118 |
]. |
|
1218 | 3119 |
^ nil |
388 | 3120 |
|
3121 |
! ! |
|
3122 |
||
687 | 3123 |
!MenuPanel methodsFor:'private activation'! |
3124 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3125 |
activeMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3126 |
"returns the current active menu or self (the top menu) |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3127 |
" |
687 | 3128 |
^ lastActiveMenu ? self |
3129 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3130 |
"Created: / 27.2.1998 / 17:41:15 / cg" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3131 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3132 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3133 |
activeMenu:aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3134 |
"set the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3135 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3136 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3137 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3138 |
"Created: / 27.2.1998 / 17:41:16 / cg" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3139 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3140 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3141 |
becomesActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3142 |
"submenu becomes the active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3143 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3144 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3145 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3146 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3147 |
"Created: / 27.2.1998 / 17:41:23 / cg" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3148 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3149 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3150 |
clearLastActiveMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3151 |
"reset the current active menu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3152 |
" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3153 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3154 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3155 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3156 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3157 |
top activeMenu == self ifTrue:[ |
1117 | 3158 |
top activeMenu:nil |
687 | 3159 |
] |
3160 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3161 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 3162 |
! |
3163 |
||
3164 |
mapTime |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3165 |
"returns the time when the menu becomes active |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3166 |
" |
687 | 3167 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3168 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3169 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 3170 |
! ! |
3171 |
||
388 | 3172 |
!MenuPanel methodsFor:'private searching'! |
3173 |
||
3174 |
itemAtX:x y:y |
|
3175 |
"returns item at a point or nil |
|
3176 |
" |
|
3177 |
self do:[:el| (el containsPointX:x y:y) ifTrue:[^el] ]. |
|
3178 |
^ nil |
|
3179 |
! |
|
3180 |
||
3181 |
superMenuAtX:x y:y |
|
3182 |
"returns supermenu at a point or nil |
|
3183 |
" |
|
3184 |
|menu| |
|
3185 |
||
3186 |
(self containsPointX:x y:y) ifTrue:[^ self]. |
|
3187 |
menu := self. |
|
3188 |
||
3189 |
[ (menu := menu superMenu) notNil ] whileTrue:[ |
|
1117 | 3190 |
(menu containsPoint:(self translatePoint:(x@y) to:menu)) ifTrue:[ |
3191 |
^ menu |
|
3192 |
] |
|
388 | 3193 |
]. |
3194 |
^ nil |
|
3195 |
! ! |
|
3196 |
||
3197 |
!MenuPanel methodsFor:'queries'! |
|
3198 |
||
3199 |
canDrawItem |
|
3200 |
"returns true if an item could be drawn otherwise false |
|
3201 |
" |
|
710 | 3202 |
^ (mustRearrange not and:[shown]) |
388 | 3203 |
! |
3204 |
||
3205 |
containsPoint:aPoint |
|
3206 |
"returns true if point is contained by the view |
|
3207 |
" |
|
3208 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
|
3209 |
! |
|
3210 |
||
3211 |
containsPointX:x y:y |
|
3212 |
"returns true if point is contained by the view |
|
3213 |
" |
|
708 | 3214 |
^ (x between:0 and:width) and:[y between:0 and:height] |
879 | 3215 |
|
3216 |
"/ |ext| |
|
3217 |
"/ |
|
708 | 3218 |
"/ (x >= 0 and:[y >= 0]) ifTrue:[ |
3219 |
"/ ext := self computeExtent. |
|
3220 |
"/ ^ (x < ext x and:[y < ext y]) |
|
3221 |
"/ ]. |
|
3222 |
"/ ^ false |
|
3223 |
||
3224 |
"Modified: / 29.1.1998 / 16:46:10 / cg" |
|
388 | 3225 |
! |
3226 |
||
390 | 3227 |
hasGroupDividerAt:anIndex |
388 | 3228 |
"returns true if a divider is defined at an index |
3229 |
" |
|
3230 |
|i| |
|
3231 |
||
3232 |
groupSizes size ~~ 0 ifTrue:[ |
|
1117 | 3233 |
i := 0. |
3234 |
||
3235 |
groupSizes do:[:t| |
|
3236 |
(i := i + t) == anIndex ifTrue:[ |
|
3237 |
^ true |
|
3238 |
] |
|
3239 |
] |
|
388 | 3240 |
]. |
3241 |
^ false |
|
3242 |
||
3243 |
! |
|
3244 |
||
390 | 3245 |
hasGroupDividers |
3246 |
"returns true if any group divider exists |
|
3247 |
" |
|
3248 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
3249 |
! |
|
3250 |
||
388 | 3251 |
isEnabled |
3252 |
"returns enabled state of menu and items |
|
3253 |
" |
|
3254 |
^ self enabled |
|
3255 |
! |
|
3256 |
||
390 | 3257 |
isFitPanel |
3258 |
"returns true if the panel is the first in the menu hierarchy in must |
|
3259 |
be fit to the extent of its superView |
|
3260 |
" |
|
616 | 3261 |
^ self isPopUpView ifTrue:[false] ifFalse:[fitFirstPanel] |
390 | 3262 |
! |
3263 |
||
388 | 3264 |
isPopUpView |
3265 |
"return true if view is a popup view; without decoration |
|
3266 |
and popUp to top immediately |
|
3267 |
" |
|
3268 |
^ superView isNil |
|
3269 |
||
3270 |
||
3271 |
! |
|
3272 |
||
3273 |
isVerticalLayout |
|
3274 |
"returns true if vertical layout otherwise false( horizontal layout ) |
|
3275 |
" |
|
3276 |
^ self verticalLayout |
|
3277 |
||
3278 |
||
416 | 3279 |
! |
3280 |
||
3281 |
type |
|
428 | 3282 |
^ nil. |
416 | 3283 |
|
388 | 3284 |
! ! |
3285 |
||
3286 |
!MenuPanel methodsFor:'selection'! |
|
3287 |
||
3288 |
hasSelection |
|
3289 |
"returns true if a selection exists |
|
3290 |
" |
|
3291 |
^ self selection notNil |
|
3292 |
! |
|
3293 |
||
3294 |
isValidSelection:something |
|
3295 |
"returns true if something could be selected |
|
3296 |
" |
|
3297 |
|item| |
|
3298 |
||
498 | 3299 |
enabled ifTrue:[ |
1117 | 3300 |
(item := self itemAt:something) notNil ifTrue:[ |
3301 |
^ item canSelect |
|
3302 |
] |
|
388 | 3303 |
]. |
3304 |
^ false |
|
3305 |
! |
|
3306 |
||
3307 |
selection |
|
3308 |
"returns current selected item or nil |
|
3309 |
" |
|
3310 |
^ selection |
|
3311 |
||
3312 |
||
3313 |
! |
|
3314 |
||
3315 |
selection:anItemOrNil |
|
3316 |
"change selection to an item |
|
3317 |
" |
|
434 | 3318 |
|item newSel hlp| |
388 | 3319 |
|
3320 |
selection isNumber ifTrue:[ |
|
1251 | 3321 |
newSel := self itemAt:anItemOrNil |
388 | 3322 |
] ifFalse:[ |
1251 | 3323 |
(anItemOrNil notNil and:[anItemOrNil canSelect]) ifTrue:[ |
3324 |
newSel := anItemOrNil |
|
3325 |
] |
|
388 | 3326 |
]. |
3327 |
||
3328 |
selection == newSel ifTrue:[^ self]. |
|
3329 |
||
3330 |
(item := selection) notNil ifTrue:[ |
|
1251 | 3331 |
selection := nil. |
3332 |
item selected:false. |
|
388 | 3333 |
]. |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3334 |
newSel notNil ifTrue:[ |
1251 | 3335 |
selection := newSel. |
3336 |
||
3337 |
ActiveHelp isActive ifTrue:[ |
|
3338 |
hlp := ActiveHelp currentHelpListener. |
|
3339 |
hlp initiateHelpFor:self atX:nil y:nil now:true. |
|
3340 |
]. |
|
3341 |
selection selected:true. |
|
388 | 3342 |
]. |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3343 |
|
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3344 |
"Modified: / 2.2.1998 / 10:13:46 / stefan" |
1039
faa24ee79e12
fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents:
1033
diff
changeset
|
3345 |
"Modified: / 31.7.1998 / 03:14:18 / cg" |
388 | 3346 |
! |
3347 |
||
3348 |
selectionIndex |
|
3349 |
"returns index of current selection or 0 |
|
3350 |
" |
|
3351 |
|item| |
|
3352 |
||
3353 |
(item := self selection) notNil ifTrue:[ |
|
1117 | 3354 |
^ self findFirst:[:el| el == item ] |
388 | 3355 |
]. |
3356 |
^ 0 |
|
3357 |
||
3358 |
! |
|
3359 |
||
3360 |
selectionIndex:anIndex |
|
3361 |
"set selection at an index |
|
3362 |
" |
|
3363 |
self selection:(self itemAt:anIndex) |
|
3364 |
! ! |
|
3365 |
||
3366 |
!MenuPanel::Item class methodsFor:'accessing'! |
|
3367 |
||
689 | 3368 |
horizontalInset |
3369 |
^ HorizontalInset |
|
3370 |
! |
|
3371 |
||
388 | 3372 |
labelRightOffset |
3373 |
^ LabelRightOffset |
|
3374 |
! |
|
3375 |
||
3376 |
shortcutKeyOffset |
|
3377 |
^ ShortcutKeyOffset |
|
689 | 3378 |
! |
3379 |
||
3380 |
verticalInset |
|
3381 |
^ VerticalInset |
|
388 | 3382 |
! ! |
3383 |
||
616 | 3384 |
!MenuPanel::Item class methodsFor:'defaults'! |
3385 |
||
3386 |
separatorSize:aType |
|
3387 |
"returns size of a separator |
|
3388 |
" |
|
3389 |
aType == #doubleLine ifTrue:[^ 10 ]. |
|
3390 |
aType == #singleLine ifTrue:[^ 10 ]. |
|
706 | 3391 |
^ 10 |
616 | 3392 |
! |
3393 |
||
3394 |
updateStyleCache |
|
388 | 3395 |
"setup defaults |
650 | 3396 |
self updateStyleCache |
388 | 3397 |
" |
681 | 3398 |
HorizontalInset := 4. |
3399 |
VerticalInset := 3. |
|
727 | 3400 |
|
3401 |
HorizontalButtonInset := 3. |
|
3402 |
VerticalButtonInset := 3. |
|
3403 |
||
681 | 3404 |
LabelRightOffset := 15. |
3405 |
ShortcutKeyOffset := 5. |
|
388 | 3406 |
|
1110 | 3407 |
IndicatorOn := self checkedImage. |
3408 |
IndicatorOff := self uncheckedImage. |
|
388 | 3409 |
! ! |
3410 |
||
1078 | 3411 |
!MenuPanel::Item class methodsFor:'image specs'! |
3412 |
||
3413 |
checkOffIcon |
|
3414 |
"This resource specification was automatically generated |
|
3415 |
by the ImageEditor of ST/X." |
|
3416 |
||
3417 |
"Do not manually edit this!! If it is corrupted, |
|
3418 |
the ImageEditor may not be able to read the specification." |
|
3419 |
||
3420 |
" |
|
3421 |
self checkOffIcon inspect |
|
3422 |
ImageEditor openOnClass:self andSelector:#checkOffIcon |
|
3423 |
" |
|
3424 |
||
3425 |
<resource: #image> |
|
3426 |
||
3427 |
^Icon |
|
1117 | 3428 |
constantNamed:#'MenuPanel::Item checkOffIcon' |
3429 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D_?>(AO??;AO???LS???3D???<1O???LS???3A_??3@Z??<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]! |
|
1078 | 3430 |
|
3431 |
checkOnIcon |
|
3432 |
"This resource specification was automatically generated |
|
3433 |
by the ImageEditor of ST/X." |
|
3434 |
||
3435 |
"Do not manually edit this!! If it is corrupted, |
|
3436 |
the ImageEditor may not be able to read the specification." |
|
3437 |
||
3438 |
" |
|
3439 |
self checkOnIcon inspect |
|
3440 |
ImageEditor openOnClass:self andSelector:#checkOnIcon |
|
3441 |
" |
|
3442 |
||
3443 |
<resource: #image> |
|
3444 |
||
3445 |
^Icon |
|
1117 | 3446 |
constantNamed:#'MenuPanel::Item checkOnIcon' |
3447 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D]@^(AL@@;AM@@GLS@@@3D0@@L1L@@CLSP@A3A\@@3@Z4A<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]! |
|
1110 | 3448 |
|
3449 |
checkedImage |
|
3450 |
"This resource specification was automatically generated |
|
3451 |
by the ImageEditor of ST/X." |
|
3452 |
||
3453 |
"Do not manually edit this!! If it is corrupted, |
|
3454 |
the ImageEditor may not be able to read the specification." |
|
3455 |
||
3456 |
" |
|
3457 |
self checkedImage inspect |
|
3458 |
ImageEditor openOnClass:self andSelector:#checkedImage |
|
3459 |
" |
|
3460 |
||
3461 |
<resource: #image> |
|
3462 |
||
3463 |
^Icon |
|
1124 | 3464 |
constantNamed:#'MenuPanel::Item checkedImage' |
3465 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
3466 |
||
3467 |
"Modified: / 6.9.1998 / 22:29:58 / cg" |
|
3468 |
! |
|
1110 | 3469 |
|
3470 |
uncheckedImage |
|
3471 |
"This resource specification was automatically generated |
|
3472 |
by the ImageEditor of ST/X." |
|
3473 |
||
3474 |
"Do not manually edit this!! If it is corrupted, |
|
3475 |
the ImageEditor may not be able to read the specification." |
|
3476 |
||
3477 |
" |
|
3478 |
self uncheckedImage inspect |
|
3479 |
ImageEditor openOnClass:self andSelector:#uncheckedImage |
|
3480 |
" |
|
3481 |
||
3482 |
<resource: #image> |
|
3483 |
||
3484 |
^Icon |
|
1124 | 3485 |
constantNamed:#'MenuPanel::Item uncheckedImage' |
3486 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
3487 |
||
3488 |
"Modified: / 6.9.1998 / 22:24:24 / cg" |
|
3489 |
! ! |
|
1078 | 3490 |
|
388 | 3491 |
!MenuPanel::Item class methodsFor:'instance creation'! |
3492 |
||
3493 |
in:aSuperMenu |
|
3494 |
^ self in:aSuperMenu label:nil |
|
3495 |
! |
|
3496 |
||
3497 |
in:aSuperMenu label:aLabel |
|
3498 |
|item| |
|
3499 |
||
3500 |
item := self new in:aSuperMenu. |
|
3501 |
item label:aLabel. |
|
3502 |
^ item |
|
3503 |
! |
|
3504 |
||
3505 |
in:aSuperMenu menuItem:aMenuItem |
|
3506 |
|item| |
|
3507 |
||
3508 |
item := self in:aSuperMenu. |
|
3509 |
item menuItem:aMenuItem. |
|
3510 |
^ item. |
|
3511 |
! ! |
|
3512 |
||
389 | 3513 |
!MenuPanel::Item methodsFor:'accept'! |
3514 |
||
420 | 3515 |
canAccept |
3516 |
"returns true if item is acceptable |
|
3517 |
" |
|
3518 |
^ (self enabled and:[self hasSubmenu not]) |
|
524 | 3519 |
! |
3520 |
||
3521 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3522 |
"toggle indication or choice |
524 | 3523 |
" |
3524 |
|arg| |
|
3525 |
||
723 | 3526 |
self hasIndication ifTrue:[ |
1117 | 3527 |
arg := self indicationValue not. |
3528 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3529 |
] ifFalse:[ |
1117 | 3530 |
self hasChoice ifTrue:[ |
3531 |
arg := self choiceValue. |
|
3532 |
self choice value:arg. |
|
3533 |
arg := true. |
|
3534 |
] |
|
524 | 3535 |
]. |
3536 |
^ arg |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3537 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3538 |
"Modified: / 14.8.1998 / 16:13:37 / cg" |
389 | 3539 |
! ! |
3540 |
||
388 | 3541 |
!MenuPanel::Item methodsFor:'accessing'! |
3542 |
||
3543 |
accessCharacter |
|
389 | 3544 |
"returns my accessCharacter or nil |
388 | 3545 |
" |
389 | 3546 |
accessCharacterPosition isNil ifTrue:[ |
1117 | 3547 |
^ nil |
388 | 3548 |
]. |
1078 | 3549 |
^ (rawLabel string) at:accessCharacterPosition ifAbsent:nil |
388 | 3550 |
! |
3551 |
||
3552 |
accessCharacterPosition |
|
390 | 3553 |
"get the access character position or nil |
388 | 3554 |
" |
389 | 3555 |
^ accessCharacterPosition |
388 | 3556 |
! |
3557 |
||
3558 |
accessCharacterPosition:anIndex |
|
390 | 3559 |
"set the access character position or nil |
388 | 3560 |
" |
1078 | 3561 |
accessCharacterPosition ~~ anIndex ifTrue:[ |
1117 | 3562 |
accessCharacterPosition := anIndex. |
3563 |
self updateRawLabel. |
|
388 | 3564 |
]. |
3565 |
! |
|
3566 |
||
434 | 3567 |
activeHelpKey |
3568 |
^ activeHelpKey |
|
3569 |
! |
|
3570 |
||
3571 |
activeHelpKey:aHelpKey |
|
3572 |
activeHelpKey := aHelpKey |
|
3573 |
! |
|
3574 |
||
388 | 3575 |
argument |
3576 |
"gets the argument |
|
3577 |
" |
|
3578 |
adornment isNil ifTrue:[^ nil ]. |
|
3579 |
^ adornment argument |
|
3580 |
! |
|
3581 |
||
3582 |
argument:anArgument |
|
3583 |
"sets the argument |
|
3584 |
" |
|
3585 |
self argument ~~ anArgument ifTrue:[ |
|
1117 | 3586 |
self adornment argument:anArgument. |
388 | 3587 |
] |
3588 |
! |
|
3589 |
||
389 | 3590 |
compareAccessCharacterWith:aKey |
3591 |
"returns true if key is my access character |
|
3592 |
" |
|
1048 | 3593 |
^ self accessCharacter == aKey |
3594 |
||
389 | 3595 |
! |
3596 |
||
388 | 3597 |
label |
3598 |
"returns the label |
|
3599 |
" |
|
3600 |
^ label |
|
3601 |
! |
|
3602 |
||
3603 |
label:aLabel |
|
399 | 3604 |
"set a new label; if the label changed, a redraw is performed; |
3605 |
handle characters $& (ST-80 compatibility) |
|
388 | 3606 |
" |
475 | 3607 |
|i rest s| |
389 | 3608 |
|
3609 |
accessCharacterPosition := nil. |
|
399 | 3610 |
label := aLabel value. |
3611 |
||
3612 |
(label isString and:[(s := label size) > 1]) ifTrue:[ |
|
1117 | 3613 |
i := 1. |
3614 |
||
3615 |
[((i := label indexOf:$& startingAt:i) ~~ 0 |
|
3616 |
and:[i < s])] whileTrue:[ |
|
3617 |
rest := label copyFrom:(i+1). |
|
3618 |
||
3619 |
i == 1 ifTrue:[label := rest] |
|
3620 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
3621 |
||
3622 |
(label at:i) == $& ifTrue:[i := i + 1] |
|
3623 |
ifFalse:[accessCharacterPosition := i]. |
|
3624 |
s := s - 1. |
|
3625 |
] |
|
389 | 3626 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3627 |
|
399 | 3628 |
self updateRawLabel |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
3629 |
|
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
3630 |
"Modified: / 31.7.1998 / 00:52:26 / cg" |
388 | 3631 |
! |
3632 |
||
3633 |
menuPanel |
|
3634 |
"returns my menuPanel |
|
3635 |
" |
|
399 | 3636 |
^ menuPanel |
388 | 3637 |
! |
3638 |
||
3639 |
nameKey |
|
3640 |
"gets the nameKey |
|
3641 |
" |
|
3642 |
^ nameKey |
|
3643 |
! |
|
3644 |
||
3645 |
nameKey:aNameKey |
|
3646 |
"sets the nameKey |
|
3647 |
" |
|
3648 |
nameKey := aNameKey. |
|
3649 |
! |
|
3650 |
||
3651 |
rawLabel |
|
390 | 3652 |
"returns my printable Label |
388 | 3653 |
" |
3654 |
^ rawLabel |
|
3655 |
! |
|
3656 |
||
3657 |
shortcutKey |
|
3658 |
"get the key to press to select the submenu from the keyboard or if |
|
3659 |
no submenu exists evaluate the action assigned to the item (accept). |
|
3660 |
" |
|
3661 |
adornment isNil ifTrue:[^ nil ]. |
|
3662 |
^ adornment shortcutKey |
|
3663 |
! |
|
3664 |
||
3665 |
shortcutKey:aKey |
|
3666 |
"set the key to press to select the submenu from the keyboard or if |
|
3667 |
no submenu exists evaluate the action assigned to the item (accept). |
|
3668 |
" |
|
3669 |
self shortcutKey ~~ aKey ifTrue:[ |
|
1117 | 3670 |
self adornment shortcutKey:aKey. |
3671 |
self redraw. |
|
388 | 3672 |
]. |
3673 |
! |
|
3674 |
||
710 | 3675 |
startGroup |
3676 |
"start group #left #right #center ... or nil |
|
3677 |
at the moment only #right is implemented |
|
3678 |
" |
|
3679 |
^ startGroup |
|
3680 |
! |
|
3681 |
||
3682 |
startGroup:aSymbol |
|
3683 |
"start group #left #right #center ... |
|
3684 |
at the moment only #right is implemented |
|
3685 |
" |
|
3686 |
(startGroup isNil or:[startGroup == #right]) ifTrue:[ |
|
1117 | 3687 |
startGroup := aSymbol |
710 | 3688 |
] ifFalse:[ |
1117 | 3689 |
self warn:('not supported group: ', aSymbol printString ). |
710 | 3690 |
] |
3691 |
||
3692 |
! |
|
3693 |
||
388 | 3694 |
submenu |
3695 |
"returns my submenu or nil |
|
3696 |
" |
|
464 | 3697 |
subMenu notNil ifTrue:[^ subMenu]. |
3698 |
^ self setupSubmenu |
|
388 | 3699 |
! |
3700 |
||
3701 |
submenu:aSubMenu |
|
3702 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
3703 |
to a redraw if 'hasSubmenu' changed |
|
3704 |
" |
|
580 | 3705 |
|
3706 |
(aSubMenu notNil |
|
3707 |
and:[(aSubMenu isView or:[aSubMenu isKindOf:Menu]) not]) ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3708 |
^ self submenuChannel:aSubMenu |
388 | 3709 |
]. |
3710 |
||
3711 |
(subMenu := aSubMenu) notNil ifTrue:[ |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3712 |
aSubMenu class == Menu ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3713 |
subMenu := MenuPanel new. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3714 |
menuPanel notNil ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3715 |
subMenu receiver:menuPanel receiver. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3716 |
]. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3717 |
subMenu menu:aSubMenu. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3718 |
subMenu superMenu:menuPanel. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3719 |
] ifFalse:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3720 |
subMenu isView ifTrue:[ |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3721 |
subMenu superMenu:menuPanel. |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3722 |
] |
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
3723 |
] |
388 | 3724 |
]. |
3725 |
||
1068
155168a813ad
oops - subMenu must be an instance of MenuPanel
Claus Gittinger <cg@exept.de>
parents:
1063
diff
changeset
|
3726 |
"Modified: / 10.8.1998 / 13:26:28 / cg" |
389 | 3727 |
! |
3728 |
||
390 | 3729 |
textLabel |
3730 |
"returns my textLabel or nil if none text |
|
3731 |
" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3732 |
(rawLabel respondsTo:#string) ifTrue:[ |
1117 | 3733 |
^ rawLabel string |
390 | 3734 |
]. |
3735 |
^ nil |
|
3736 |
! |
|
3737 |
||
389 | 3738 |
value |
3739 |
"gets value |
|
3740 |
" |
|
3741 |
^ value |
|
3742 |
! |
|
3743 |
||
3744 |
value:something |
|
3745 |
"could be a value holder, an action or selector |
|
3746 |
" |
|
3747 |
value := something. |
|
502 | 3748 |
! |
3749 |
||
3750 |
value:aValue argument:anArgument |
|
3751 |
"set the value and an argument |
|
3752 |
" |
|
3753 |
self value:aValue. |
|
3754 |
self argument:anArgument. |
|
388 | 3755 |
! ! |
3756 |
||
3757 |
!MenuPanel::Item methodsFor:'accessing behavior'! |
|
3758 |
||
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3759 |
choice |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3760 |
"get choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3761 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3762 |
adornment isNil ifTrue:[^ nil]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3763 |
^ adornment choice |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3764 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3765 |
"Created: / 14.8.1998 / 14:38:52 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3766 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3767 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3768 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3769 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3770 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3771 |
|old new| |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3772 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3773 |
old := self choice. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3774 |
old == something ifTrue:[^ self]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3775 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3776 |
(self isKindOfValueHolder:old) ifTrue:[ |
1117 | 3777 |
old removeDependent:self |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3778 |
]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3779 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3780 |
new := something. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3781 |
new isSymbol ifTrue:[ |
1117 | 3782 |
new := self aspectAt:new. |
3783 |
new isNil ifTrue:[ |
|
3784 |
new := something |
|
3785 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3786 |
]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3787 |
(self isKindOfValueHolder:new) ifTrue:[ |
1117 | 3788 |
new addDependent:self |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3789 |
]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3790 |
self adornment choice:new. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3791 |
self updateRawLabel. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3792 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3793 |
"Created: / 14.8.1998 / 14:39:11 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3794 |
"Modified: / 14.8.1998 / 16:13:19 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3795 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3796 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3797 |
choiceValue |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3798 |
"get choice value |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3799 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3800 |
adornment isNil ifTrue:[^ nil]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3801 |
^ adornment choiceValue |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3802 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3803 |
"Created: / 14.8.1998 / 15:46:33 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3804 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3805 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3806 |
choiceValue:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3807 |
"set choice value |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3808 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3809 |
self adornment choiceValue:something. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3810 |
self updateRawLabel. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3811 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3812 |
"Created: / 14.8.1998 / 15:46:59 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3813 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
3814 |
|
388 | 3815 |
enabled |
3816 |
"returns the enabled state |
|
3817 |
" |
|
524 | 3818 |
|state| |
3819 |
||
3820 |
menuPanel enabled ifTrue:[ |
|
1117 | 3821 |
enableChannel isSymbol ifTrue:[ |
3822 |
state := self aspectAt:enableChannel. |
|
3823 |
||
3824 |
(self isKindOfValueHolder:state) ifTrue:[ |
|
3825 |
enableChannel := state. |
|
3826 |
enableChannel addDependent:self. |
|
3827 |
state := enableChannel value. |
|
3828 |
] ifFalse:[ |
|
3829 |
state := state value |
|
3830 |
] |
|
3831 |
] ifFalse:[ |
|
3832 |
state := enableChannel value |
|
3833 |
]. |
|
524 | 3834 |
^ state ~~ false |
460 | 3835 |
]. |
524 | 3836 |
^ false |
388 | 3837 |
! |
3838 |
||
389 | 3839 |
enabled:something |
388 | 3840 |
"change the enabled state; if the state changed, a redraw is performed |
3841 |
" |
|
390 | 3842 |
|oldState newState| |
3843 |
||
3844 |
enableChannel isNil ifTrue:[ |
|
1117 | 3845 |
oldState := true |
390 | 3846 |
] ifFalse:[ |
1117 | 3847 |
oldState := enableChannel value. |
3848 |
(self isKindOfValueHolder:enableChannel) ifTrue:[ |
|
3849 |
enableChannel removeDependent:self |
|
3850 |
] |
|
388 | 3851 |
]. |
390 | 3852 |
enableChannel := something. |
3853 |
||
3854 |
enableChannel isNil ifTrue:[ |
|
1117 | 3855 |
menuPanel shown ifFalse:[^ self]. |
3856 |
newState := true |
|
390 | 3857 |
] ifFalse:[ |
1117 | 3858 |
(self isKindOfValueHolder:enableChannel) ifTrue:[ |
3859 |
enableChannel addDependent:self |
|
3860 |
] ifFalse:[ |
|
3861 |
enableChannel isSymbol ifTrue:[^ self] |
|
3862 |
]. |
|
3863 |
menuPanel shown ifFalse:[^ self]. |
|
3864 |
newState := enableChannel value. |
|
390 | 3865 |
]. |
3866 |
||
3867 |
newState ~~ oldState ifTrue:[ |
|
1117 | 3868 |
(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[ |
3869 |
self drawLabel |
|
3870 |
] |
|
390 | 3871 |
] |
388 | 3872 |
|
580 | 3873 |
"Modified: / 27.10.1997 / 16:13:42 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3874 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3875 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3876 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3877 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3878 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3879 |
adornment isNil ifTrue:[^ nil]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3880 |
^ adornment indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3881 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3882 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3883 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3884 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3885 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3886 |
|old| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3887 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3888 |
old := self indication. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3889 |
old == something ifTrue:[^ self]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3890 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3891 |
(self isKindOfValueHolder:old) ifTrue:[ |
1117 | 3892 |
old removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3893 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3894 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3895 |
(self isKindOfValueHolder:something) ifTrue:[ |
1117 | 3896 |
something addDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3897 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3898 |
self adornment indication:something. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3899 |
self updateRawLabel. |
464 | 3900 |
! |
3901 |
||
650 | 3902 |
isButton |
3903 |
"returns whether item looks like a Button |
|
3904 |
" |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3905 |
^ isButton |
650 | 3906 |
! |
3907 |
||
3908 |
isButton:anBoolean |
|
3909 |
"sets whether item looks like a Button |
|
3910 |
" |
|
3911 |
isButton := anBoolean. |
|
3912 |
||
1045 | 3913 |
layout notNil ifTrue:[ |
1117 | 3914 |
self redrawAsButton |
1045 | 3915 |
] |
650 | 3916 |
|
3917 |
||
3918 |
||
3919 |
! |
|
3920 |
||
464 | 3921 |
submenuChannel |
3922 |
"get the submenu channel |
|
3923 |
" |
|
3924 |
^ submenuChannel |
|
3925 |
! |
|
3926 |
||
3927 |
submenuChannel:aSelectorOrNil |
|
3928 |
"returns the submenu channel |
|
3929 |
" |
|
3930 |
submenuChannel := aSelectorOrNil. |
|
388 | 3931 |
! ! |
3932 |
||
3933 |
!MenuPanel::Item methodsFor:'accessing dimension'! |
|
3934 |
||
3935 |
height |
|
3936 |
"gets height |
|
3937 |
" |
|
3938 |
layout isNil ifTrue:[ |
|
1117 | 3939 |
^ self preferredExtent y |
1096 | 3940 |
]. |
3941 |
^ layout height |
|
388 | 3942 |
! |
3943 |
||
650 | 3944 |
horizontalInset |
3945 |
||
1045 | 3946 |
isButton ifTrue: [^menuPanel buttonPassiveLevel + HorizontalButtonInset]. |
650 | 3947 |
^HorizontalInset |
3948 |
! |
|
3949 |
||
388 | 3950 |
layout |
3951 |
"returns my layout ( Rectangle ) |
|
3952 |
" |
|
3953 |
^ layout |
|
3954 |
! |
|
3955 |
||
3956 |
layout:aLayout |
|
3957 |
"set a new layout ( Rectangle ) |
|
3958 |
" |
|
3959 |
layout := aLayout. |
|
3960 |
self redraw. |
|
3961 |
! |
|
3962 |
||
650 | 3963 |
verticalInset |
3964 |
||
1045 | 3965 |
isButton ifTrue: [^menuPanel buttonPassiveLevel + VerticalButtonInset]. |
650 | 3966 |
^VerticalInset |
3967 |
! |
|
3968 |
||
388 | 3969 |
width |
3970 |
"gets width |
|
3971 |
" |
|
1096 | 3972 |
|
388 | 3973 |
layout isNil ifTrue:[ |
1117 | 3974 |
^ self preferredExtent x |
1096 | 3975 |
]. |
3976 |
^ layout width |
|
388 | 3977 |
! ! |
3978 |
||
524 | 3979 |
!MenuPanel::Item methodsFor:'building'! |
3980 |
||
3981 |
aspectAt:aKey |
|
3982 |
"retursns value assigned to key or nil |
|
3983 |
" |
|
3984 |
|appl value| |
|
3985 |
||
3986 |
appl := menuPanel receiver. |
|
3987 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3988 |
(appl isValueModel) ifTrue:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3989 |
^ appl value:aKey |
524 | 3990 |
]. |
3991 |
||
3992 |
(appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[ |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3993 |
Object messageNotUnderstoodSignal handle:[:ex| |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3994 |
ex parameter selector == aKey ifFalse:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3995 |
ex reject |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3996 |
]. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3997 |
] do:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3998 |
(appl isKindOf:ApplicationModel) |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
3999 |
ifTrue:[value := appl aspectFor:aKey] |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4000 |
ifFalse:[value := appl perform:aKey] |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4001 |
] |
524 | 4002 |
]. |
4003 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
4004 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
4005 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 4006 |
! ! |
4007 |
||
390 | 4008 |
!MenuPanel::Item methodsFor:'change & update'! |
4009 |
||
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4010 |
choiceChanged |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4011 |
"called when the choice changed |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4012 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4013 |
|indicator| |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4014 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4015 |
isButton ifFalse:[ |
1117 | 4016 |
indicator := self choiceForm. |
4017 |
||
4018 |
indicator = rawLabel icon ifTrue:[ |
|
4019 |
^ self |
|
4020 |
]. |
|
4021 |
rawLabel icon:indicator. |
|
4022 |
||
4023 |
disabledRawLabel notNil ifTrue:[ |
|
4024 |
disabledRawLabel icon:indicator |
|
4025 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4026 |
]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4027 |
self redraw |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4028 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4029 |
"Created: / 14.8.1998 / 16:14:59 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4030 |
"Modified: / 14.8.1998 / 17:19:32 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4031 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4032 |
|
498 | 4033 |
enabledStateOfMenuChangedTo:aState |
4034 |
"enabled state of menu changed to aState |
|
4035 |
" |
|
4036 |
rawLabel notNil ifTrue:[ |
|
1117 | 4037 |
self drawLabel |
498 | 4038 |
]. |
4039 |
||
4040 |
! |
|
4041 |
||
1048 | 4042 |
indicationChanged |
4043 |
"called when the indication changed |
|
4044 |
" |
|
4045 |
|indicator| |
|
4046 |
||
4047 |
isButton ifFalse:[ |
|
1117 | 4048 |
indicator := self indicatorForm. |
4049 |
||
4050 |
indicator = rawLabel icon ifTrue:[ |
|
4051 |
^ self |
|
4052 |
]. |
|
4053 |
rawLabel icon:indicator. |
|
4054 |
||
4055 |
disabledRawLabel notNil ifTrue:[ |
|
4056 |
disabledRawLabel icon:indicator |
|
4057 |
] |
|
1048 | 4058 |
]. |
4059 |
self redraw |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4060 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4061 |
"Modified: / 14.8.1998 / 17:19:38 / cg" |
1048 | 4062 |
! |
4063 |
||
390 | 4064 |
update:something with:aParameter from:changedObject |
498 | 4065 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4066 |
changedObject == self indication ifTrue:[ |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4067 |
^ self indicationChanged |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4068 |
]. |
498 | 4069 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4070 |
changedObject == self choice ifTrue:[ |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4071 |
^ self choiceChanged |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4072 |
]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4073 |
|
498 | 4074 |
changedObject == enableChannel ifTrue:[ |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4075 |
(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[ |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4076 |
self drawLabel |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4077 |
]. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4078 |
^ self |
498 | 4079 |
]. |
712 | 4080 |
|
4081 |
changedObject == isVisible ifTrue:[ |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4082 |
menuPanel mustRearrange. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4083 |
menuPanel rearrangeItems. |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4084 |
^ self. |
712 | 4085 |
]. |
4086 |
||
498 | 4087 |
super update:something with:aParameter from:changedObject |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4088 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4089 |
"Modified: / 14.8.1998 / 16:13:41 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4090 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4091 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4092 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4093 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4094 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4095 |
|indicator| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4096 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4097 |
(indicator := self indication) notNil ifTrue:[ |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4098 |
"/ (isButton and:[menuPanel isPopUpView]) ifFalse:[ |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4099 |
"/ (self isKindOfValueHolder:indicator) ifTrue:[ |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4100 |
"/ ^ self |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4101 |
"/ ] |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4102 |
"/ ]. |
1117 | 4103 |
self indicationChanged |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4104 |
] |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4105 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4106 |
"Modified: / 14.8.1998 / 15:19:38 / cg" |
390 | 4107 |
! ! |
4108 |
||
388 | 4109 |
!MenuPanel::Item methodsFor:'converting'! |
4110 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4111 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4112 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4113 |
" |
466 | 4114 |
|item label rcv| |
4115 |
||
4116 |
label := self label. |
|
4117 |
item := MenuItem labeled:(label printString). |
|
4118 |
||
4119 |
label isImage ifTrue:[ |
|
1117 | 4120 |
rcv := ResourceRetriever new. |
4121 |
rcv className:#MenuEditor. |
|
4122 |
rcv selector:#iconUnknown. |
|
4123 |
item labelImage:rcv. |
|
464 | 4124 |
]. |
466 | 4125 |
|
434 | 4126 |
item activeHelpKey:activeHelpKey. |
460 | 4127 |
|
4128 |
enableChannel notNil ifTrue:[ |
|
1117 | 4129 |
item enabled:(enableChannel value) |
460 | 4130 |
]. |
4131 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4132 |
item accessCharacterPosition:(self accessCharacterPosition). |
710 | 4133 |
item startGroup:(self startGroup). |
502 | 4134 |
item argument:(self argument). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4135 |
item nameKey:(self nameKey). |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4136 |
item shortcutKeyCharacter:(self shortcutKey). |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4137 |
item value:(value value). |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4138 |
item indication:(self indication value). |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4139 |
item choice:(self choice value). |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4140 |
item choiceValue:(self choiceValue). |
712 | 4141 |
item isVisible:(self isVisible). |
1045 | 4142 |
item isButton:isButton. |
388 | 4143 |
|
464 | 4144 |
submenuChannel isSymbol ifTrue:[ |
1117 | 4145 |
item submenuChannel:submenuChannel |
464 | 4146 |
] ifFalse:[ |
1117 | 4147 |
self submenu notNil ifTrue:[ |
4148 |
item submenu:(self submenu asMenu) |
|
4149 |
] |
|
388 | 4150 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4151 |
^ item |
388 | 4152 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4153 |
"Modified: / 14.8.1998 / 15:47:21 / cg" |
388 | 4154 |
! |
4155 |
||
4156 |
menuItem:aMenuItem |
|
4157 |
"setup attributes from a MenuItem |
|
4158 |
" |
|
502 | 4159 |
|var lbl| |
389 | 4160 |
|
388 | 4161 |
menuPanel disabledRedrawDo:[ |
1117 | 4162 |
label := nil. |
4163 |
activeHelpKey := aMenuItem activeHelpKey. |
|
4164 |
self enabled:(aMenuItem enabled). |
|
4165 |
self nameKey:(aMenuItem nameKey). |
|
4166 |
self indication:(aMenuItem indication). |
|
4167 |
self choice:(aMenuItem choice). |
|
4168 |
self choiceValue:(aMenuItem choiceValue). |
|
4169 |
self isButton:(aMenuItem isButton). |
|
4170 |
self startGroup:(aMenuItem startGroup). |
|
4171 |
self isVisible:(aMenuItem isVisible). |
|
4172 |
||
4173 |
(var := aMenuItem accessCharacterPosition) notNil ifTrue:[ |
|
4174 |
self accessCharacterPosition:var. |
|
4175 |
]. |
|
4176 |
||
4177 |
(lbl := aMenuItem labelImage value) isNil ifTrue:[ |
|
4178 |
lbl := aMenuItem rawLabel. "/ avoid translating &'s twice |
|
4179 |
]. |
|
4180 |
self label:lbl. |
|
4181 |
||
4182 |
self shortcutKey:(aMenuItem shortcutKeyCharacter). |
|
4183 |
||
4184 |
(var := aMenuItem argument) notNil ifTrue:[ |
|
4185 |
self argument:var. |
|
4186 |
]. |
|
4187 |
||
4188 |
submenuChannel := aMenuItem submenuChannel. |
|
4189 |
self submenu:(aMenuItem submenu). |
|
4190 |
self value:(aMenuItem value). |
|
388 | 4191 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
4192 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
4193 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 4194 |
! ! |
4195 |
||
4196 |
!MenuPanel::Item methodsFor:'drawing'! |
|
4197 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4198 |
drawLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4199 |
"draw label |
388 | 4200 |
" |
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
4201 |
|y x h l t scKey cLb cLa img fg asc arrow hrzInset |
1267 | 4202 |
buttonLevel isSelected| |
464 | 4203 |
|
1046 | 4204 |
self isVisible ifFalse:[^ self]. |
4205 |
||
464 | 4206 |
img := rawLabel. |
1048 | 4207 |
|
608 | 4208 |
asc := menuPanel font ascent. |
4209 |
h := layout height. |
|
4210 |
l := layout left. |
|
4211 |
t := layout top. |
|
650 | 4212 |
hrzInset := self horizontalInset. |
1078 | 4213 |
isSelected := self drawSelected. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4214 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4215 |
self enabled ifTrue:[ |
1124 | 4216 |
fg := isSelected ifTrue:[self activeForegroundColor] |
4217 |
ifFalse:[menuPanel foregroundColor]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4218 |
] ifFalse:[ |
1124 | 4219 |
fg := menuPanel disabledForegroundColor. |
4220 |
||
4221 |
(img := disabledRawLabel) isNil ifTrue:[ |
|
4222 |
img := self disabledRawLabel |
|
4223 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4224 |
]. |
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
4225 |
menuPanel paint:fg. |
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
4226 |
|
650 | 4227 |
"/ t := t + menuPanel level. |
608 | 4228 |
y := t + ((h - (img heightOn:menuPanel)) // 2). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4229 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4230 |
(self textLabel) notNil ifTrue:[ |
1124 | 4231 |
y := y + asc. |
464 | 4232 |
]. |
650 | 4233 |
|
1045 | 4234 |
isButton ifTrue:[ |
1124 | 4235 |
(isSelected or:[self indicationValue == true]) ifTrue: |
4236 |
[ |
|
4237 |
img displayOn:menuPanel x:(l + hrzInset) + 1 y: y + 1. |
|
4238 |
buttonLevel := menuPanel buttonActiveLevel. |
|
4239 |
] ifFalse:[ |
|
4240 |
img displayOn:menuPanel x:(l + hrzInset) y:y. |
|
4241 |
self isEntered ifTrue:[ |
|
4242 |
buttonLevel := menuPanel buttonEnteredLevel |
|
4243 |
] ifFalse:[ |
|
4244 |
buttonLevel := menuPanel buttonPassiveLevel |
|
4245 |
] |
|
4246 |
]. |
|
4247 |
buttonLevel ~~ 0 ifTrue:[ |
|
4248 |
menuPanel |
|
4249 |
drawButtonEdgesInLayout:layout |
|
4250 |
withLevel:buttonLevel |
|
4251 |
selected:isSelected. |
|
4252 |
]. |
|
4253 |
^ self |
|
650 | 4254 |
]. |
1046 | 4255 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4256 |
"/ label = 'Sort By Name' ifTrue:[self halt.]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4257 |
|
1046 | 4258 |
img displayOn:menuPanel x:(l + hrzInset) y:y. |
4259 |
||
608 | 4260 |
"/ DRAW SHORTCUT KEY |
4261 |
||
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
4262 |
MenuView showAcceleratorKeys == true ifTrue:[ |
1124 | 4263 |
menuPanel isVerticalLayout ifTrue:[ "/ only for vertical menus ... |
4264 |
(scKey:= self shortcutKeyAsString) notNil ifTrue:[ |
|
4265 |
(x := menuPanel shortKeyInset) == 0 ifTrue:[ |
|
4266 |
x := hrzInset + LabelRightOffset + (img widthOn:menuPanel) |
|
4267 |
]. |
|
4268 |
x := l + x. |
|
4269 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
|
4270 |
y := y + asc. |
|
4271 |
scKey displayOn:menuPanel x:x y:y. |
|
4272 |
]. |
|
4273 |
]. |
|
608 | 4274 |
]. |
963
2660033bc16e
hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
4275 |
|
608 | 4276 |
"/ DRAW SUBMENU INDICATION |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4277 |
|
616 | 4278 |
(menuPanel isVerticalLayout and:[self submenu notNil]) ifTrue:[ |
1124 | 4279 |
arrow := menuPanel rightArrow. |
4280 |
x := layout right - arrow width - hrzInset. |
|
4281 |
y := t + (h - arrow height // 2). |
|
4282 |
||
4283 |
(menuPanel styleSheet is3D not |
|
4284 |
or:[(img := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
4285 |
^ menuPanel displayForm:arrow x:x y:y |
|
4286 |
]. |
|
4287 |
cLa := menuPanel shadowColor. |
|
4288 |
cLb := menuPanel lightColor. |
|
4289 |
||
4290 |
isSelected ifFalse:[ |
|
4291 |
fg := cLa. |
|
4292 |
cLa := cLb. |
|
4293 |
cLb := fg |
|
4294 |
]. |
|
4295 |
menuPanel paint:cLa. |
|
4296 |
menuPanel displayForm:arrow x:x y:y. |
|
4297 |
menuPanel paint:cLb. |
|
4298 |
menuPanel displayForm:img x:x y:y. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4299 |
] |
746 | 4300 |
|
1124 | 4301 |
"Modified: / 6.9.1998 / 21:48:53 / cg" |
388 | 4302 |
! |
4303 |
||
1078 | 4304 |
drawSelected |
4305 |
"return true if item is selected or if item implements |
|
4306 |
a toggle in a radio group which is selected |
|
4307 |
" |
|
4308 |
|holder| |
|
4309 |
||
4310 |
self isSelected ifTrue:[ |
|
1117 | 4311 |
^ true |
1078 | 4312 |
]. |
4313 |
isButton ifTrue:[ |
|
1117 | 4314 |
^ ((holder := self choice) notNil and:[holder value = self choiceValue]) |
1078 | 4315 |
]. |
4316 |
^ false |
|
4317 |
! |
|
4318 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4319 |
redraw |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4320 |
"redraw item |
388 | 4321 |
" |
706 | 4322 |
|isSelected ownBgCol showItemSep type paint lgCol shCol |
4323 |
h "{ Class:SmallInteger }" |
|
4324 |
w "{ Class:SmallInteger }" |
|
4325 |
l "{ Class:SmallInteger }" |
|
4326 |
t "{ Class:SmallInteger }" |
|
4327 |
r "{ Class:SmallInteger }" |
|
4328 |
b "{ Class:SmallInteger }" |
|
4329 |
x "{ Class:SmallInteger }" |
|
4330 |
y "{ Class:SmallInteger }" |
|
4331 |
hrzInset "{ Class:SmallInteger }" |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4332 |
isEntered |
706 | 4333 |
| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4334 |
|
712 | 4335 |
(self isVisible and:[menuPanel canDrawItem]) ifFalse:[ |
1117 | 4336 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4337 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4338 |
|
1078 | 4339 |
isSelected := self drawSelected. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4340 |
isEntered := self isEntered. |
650 | 4341 |
hrzInset := self horizontalInset. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4342 |
|
616 | 4343 |
isSelected ifFalse:[ |
1117 | 4344 |
(isButton and:[isEntered]) ifTrue:[ |
4345 |
paint := self buttonEnteredBackgroundColor |
|
4346 |
] ifFalse:[ |
|
4347 |
paint := self backgroundColor |
|
4348 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4349 |
] ifTrue:[ |
1117 | 4350 |
paint := self activeBackgroundColor |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4351 |
]. |
608 | 4352 |
l := layout left. |
4353 |
t := layout top. |
|
4354 |
r := layout right. |
|
4355 |
b := layout bottom. |
|
4356 |
h := layout height. |
|
4357 |
w := layout width. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4358 |
(ownBgCol := self backgroundColorFromLabel) isNil ifTrue:[ |
1117 | 4359 |
menuPanel paint:paint. |
4360 |
menuPanel fillRectangle:layout. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4361 |
] ifFalse:[ |
1117 | 4362 |
self hasIndication ifFalse:[ |
4363 |
menuPanel paint:ownBgCol. |
|
4364 |
menuPanel fillRectangle:layout. |
|
4365 |
] ifTrue:[ |
|
4366 |
menuPanel paint:paint. |
|
4367 |
x := (rawLabel icon width) + hrzInset + 4. |
|
4368 |
||
4369 |
menuPanel fillRectangleX:l y:t width:x height:h. |
|
4370 |
menuPanel paint:ownBgCol. |
|
4371 |
menuPanel fillRectangleX:(l + x) y:t width:(w - x) height:h. |
|
4372 |
ownBgCol := nil. |
|
650 | 4373 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4374 |
]. |
608 | 4375 |
lgCol := menuPanel lightColor. |
4376 |
shCol := menuPanel shadowColor. |
|
616 | 4377 |
showItemSep := menuPanel showSeparatingLines. |
706 | 4378 |
type := self separatorType. |
4379 |
||
4380 |
type notNil ifTrue:[ |
|
1117 | 4381 |
type == #blankLine ifTrue:[ |
4382 |
^ self |
|
4383 |
]. |
|
4384 |
"/ draw separator |
|
4385 |
menuPanel paint:shCol. |
|
4386 |
||
4387 |
menuPanel verticalLayout ifTrue:[ |
|
4388 |
l := l + hrzInset. |
|
4389 |
r := r - hrzInset. |
|
4390 |
y := t - 1 + (h // 2). |
|
4391 |
||
4392 |
type == #doubleLine ifTrue:[y := y - 2]. |
|
4393 |
||
4394 |
menuPanel displayLineFromX:l y:y toX:r y:y. |
|
4395 |
menuPanel paint:lgCol. |
|
4396 |
y := y + 1. |
|
4397 |
menuPanel displayLineFromX:l y:y toX:r y:y. |
|
4398 |
||
4399 |
type == #doubleLine ifTrue:[ |
|
4400 |
y := y + 3. |
|
4401 |
menuPanel paint:shCol. |
|
4402 |
menuPanel displayLineFromX:l y:y toX:r y:y. |
|
4403 |
menuPanel paint:lgCol. |
|
4404 |
y := y + 1. |
|
4405 |
menuPanel displayLineFromX:l y:y toX:r y:y. |
|
4406 |
]. |
|
4407 |
] ifFalse:[ |
|
4408 |
x := l - 1 + (w // 2). |
|
4409 |
||
4410 |
type == #doubleLine ifTrue:[x := x - 2]. |
|
4411 |
||
4412 |
menuPanel displayLineFromX:x y:t toX:x y:b. |
|
4413 |
menuPanel paint:lgCol. |
|
4414 |
x := x + 1. |
|
4415 |
menuPanel displayLineFromX:x y:t toX:x y:b. |
|
4416 |
||
4417 |
type == #doubleLine ifTrue:[ |
|
4418 |
x := x + 3. |
|
4419 |
menuPanel paint:shCol. |
|
4420 |
menuPanel displayLineFromX:x y:t toX:x y:b. |
|
4421 |
menuPanel paint:lgCol. |
|
4422 |
x := x + 1. |
|
4423 |
menuPanel displayLineFromX:x y:t toX:x y:b. |
|
4424 |
] |
|
4425 |
]. |
|
4426 |
^ self |
|
608 | 4427 |
]. |
4428 |
||
1045 | 4429 |
isButton ifTrue:[ |
1117 | 4430 |
^ self drawLabel |
706 | 4431 |
]. |
4432 |
||
4433 |
showItemSep ifTrue:[ |
|
1117 | 4434 |
|col index item lfSep rtSep| |
4435 |
col := menuPanel paint. |
|
4436 |
||
4437 |
index := menuPanel indexOfItem:self. |
|
4438 |
item := menuPanel itemAtIndex:(index - 1). |
|
4439 |
lfSep := item notNil and:[item isButton not]. |
|
4440 |
item := menuPanel itemAtIndex:(index + 1). |
|
4441 |
rtSep := item notNil and:[item isButton not]. |
|
4442 |
||
4443 |
menuPanel paint:lgCol. |
|
4444 |
||
4445 |
menuPanel verticalLayout ifTrue:[ |
|
4446 |
lfSep ifTrue:[ |
|
4447 |
menuPanel displayLineFromX:l y:t - 1 toX:r y:t - 1. |
|
4448 |
]. |
|
4449 |
rtSep ifTrue:[ |
|
4450 |
menuPanel displayLineFromX:l y:b - 1 toX:r y:b - 1. |
|
4451 |
]. |
|
4452 |
menuPanel paint:shCol. |
|
4453 |
||
4454 |
lfSep ifTrue:[ |
|
4455 |
menuPanel displayLineFromX:l y:t - 2 toX:r y:t - 2. |
|
4456 |
]. |
|
4457 |
rtSep ifTrue:[ |
|
4458 |
menuPanel displayLineFromX:l y:b - 2 toX:r y:b - 2. |
|
4459 |
] |
|
4460 |
] ifFalse:[ |
|
4461 |
lfSep ifTrue:[ |
|
4462 |
menuPanel displayLineFromX:l - 1 y:t toX:l - 1 y:b |
|
4463 |
]. |
|
4464 |
rtSep ifTrue:[ |
|
4465 |
menuPanel displayLineFromX:r - 1 y:t toX:r - 1 y:b. |
|
4466 |
]. |
|
4467 |
menuPanel paint:shCol. |
|
4468 |
||
4469 |
lfSep ifTrue:[ |
|
4470 |
menuPanel displayLineFromX:l - 2 y:t toX:l - 2 y:b |
|
4471 |
]. |
|
4472 |
rtSep ifTrue:[ |
|
4473 |
menuPanel displayLineFromX:r - 2 y:t toX:r - 2 y:b. |
|
4474 |
] |
|
4475 |
] |
|
608 | 4476 |
]. |
4477 |
||
650 | 4478 |
self drawLabel. |
4479 |
||
1045 | 4480 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
1117 | 4481 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
4482 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
|
4483 |
||
4484 |
menuPanel displayRectangleX:(l + 1) y:(t + 1) width:(w - 2) height:(h - 2). |
|
4485 |
menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4). |
|
706 | 4486 |
]. |
4487 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4488 |
menuPanel drawEdgesForX:l y:t width:w height:h isSelected:isSelected isEntered:isEntered. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4489 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4490 |
"Modified: / 20.8.1998 / 15:11:33 / cg" |
388 | 4491 |
! ! |
4492 |
||
4493 |
!MenuPanel::Item methodsFor:'initialization'! |
|
4494 |
||
4495 |
destroy |
|
616 | 4496 |
"destroy submenus, remove dependencies |
388 | 4497 |
" |
616 | 4498 |
|channel| |
4499 |
||
4500 |
self submenu:nil. |
|
4501 |
||
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4502 |
(enableChannel notNil and:[self isKindOfValueHolder:enableChannel]) ifTrue:[ |
1117 | 4503 |
enableChannel removeDependent:self |
616 | 4504 |
]. |
4505 |
||
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4506 |
(isVisible notNil and:[self isKindOfValueHolder:isVisible]) ifTrue:[ |
1117 | 4507 |
isVisible removeDependent:self |
712 | 4508 |
]. |
4509 |
||
616 | 4510 |
channel := self indication. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4511 |
(channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[ |
1117 | 4512 |
channel removeDependent:self |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4513 |
]. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4514 |
channel := self choice. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4515 |
(channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[ |
1117 | 4516 |
channel removeDependent:self |
616 | 4517 |
]. |
4518 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4519 |
menuPanel := nil. |
616 | 4520 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4521 |
"Modified: / 14.8.1998 / 14:37:57 / cg" |
616 | 4522 |
! |
4523 |
||
794 | 4524 |
in:aPanel |
4525 |
"create item in a menuPanel |
|
4526 |
" |
|
4527 |
menuPanel := aPanel. |
|
1045 | 4528 |
isButton := false. |
794 | 4529 |
! ! |
4530 |
||
4531 |
!MenuPanel::Item methodsFor:'label basics'! |
|
4532 |
||
4533 |
disabledRawLabel |
|
4534 |
"returns the label used if the item is disabled |
|
4535 |
" |
|
4536 |
disabledRawLabel isNil ifTrue:[ |
|
1117 | 4537 |
( rawImage notNil |
4538 |
and:[(rawImage respondsTo:#colorMap) |
|
4539 |
and:[rawImage colorMap notNil]] |
|
4540 |
) ifFalse:[ |
|
4541 |
disabledRawLabel := rawLabel. |
|
4542 |
] ifTrue:[ |
|
4543 |
disabledRawLabel := menuPanel lightenedImageOnDevice:rawImage. |
|
4544 |
||
4545 |
rawLabel class == LabelAndIcon ifTrue:[ |
|
4546 |
(isButton |
|
4547 |
or:[((self indication notNil or:[self choice notNil]) |
|
4548 |
and:[label class == LabelAndIcon])] |
|
4549 |
) ifTrue:[ |
|
4550 |
disabledRawLabel := LabelAndIcon form:(rawLabel icon) |
|
4551 |
image:disabledRawLabel |
|
4552 |
string:(rawLabel string) |
|
4553 |
] ifFalse:[ |
|
4554 |
disabledRawLabel := LabelAndIcon form:disabledRawLabel |
|
4555 |
image:(rawLabel image) |
|
4556 |
string:(rawLabel string) |
|
4557 |
] |
|
4558 |
] |
|
4559 |
] |
|
794 | 4560 |
]. |
4561 |
^ disabledRawLabel |
|
4562 |
! |
|
4563 |
||
616 | 4564 |
fetchImages |
4565 |
"fetch images |
|
4566 |
" |
|
1078 | 4567 |
|icon| |
4568 |
||
4569 |
rawImage notNil ifTrue:[ |
|
1117 | 4570 |
rawLabel isImage ifTrue:[ |
4571 |
rawLabel := menuPanel imageOnDevice:rawImage |
|
4572 |
] ifFalse:[ |
|
4573 |
rawLabel class == LabelAndIcon ifTrue:[ |
|
4574 |
(icon := rawLabel image) notNil ifTrue:[ |
|
4575 |
rawLabel image:(menuPanel imageOnDevice:icon) |
|
4576 |
]. |
|
4577 |
(icon := rawLabel icon) notNil ifTrue:[ |
|
4578 |
(self indication isNil and:[self choice isNil]) ifTrue:[ |
|
4579 |
rawLabel icon:(menuPanel imageOnDevice:icon) |
|
4580 |
] |
|
4581 |
] |
|
4582 |
] |
|
4583 |
] |
|
1048 | 4584 |
]. |
794 | 4585 |
! |
4586 |
||
4587 |
updateRawLabel |
|
4588 |
"recreate rawLabel |
|
4589 |
" |
|
1078 | 4590 |
|char size form| |
4591 |
||
4592 |
label isNil ifTrue:[ "/ not yet initialized |
|
1117 | 4593 |
^ self |
794 | 4594 |
]. |
4595 |
||
1078 | 4596 |
(form := self indicatorForm) isNil ifTrue:[ |
1117 | 4597 |
form := self choiceForm |
794 | 4598 |
]. |
1078 | 4599 |
rawImage := nil. |
4600 |
disabledRawLabel := nil. |
|
4601 |
rawLabel := label value. |
|
4602 |
||
4603 |
rawLabel isString ifTrue:[ |
|
1117 | 4604 |
rawLabel isText ifFalse:[ |
4605 |
rawLabel := rawLabel withoutSeparators |
|
4606 |
]. |
|
4607 |
||
4608 |
form isNil ifTrue:[ "/ check for separator |
|
4609 |
rawLabel isEmpty ifTrue:[ |
|
4610 |
rawLabel := nil. |
|
4611 |
^ self |
|
4612 |
]. |
|
4613 |
||
4614 |
rawLabel size == 1 ifTrue:[ |
|
4615 |
char := rawLabel first. |
|
4616 |
||
4617 |
(char == $- or:[char == $=]) ifTrue:[ "/ other line separators |
|
4618 |
label := String new:1. |
|
4619 |
label at:1 put:char. |
|
4620 |
rawLabel := nil. |
|
4621 |
^ self |
|
4622 |
] |
|
4623 |
] |
|
4624 |
]. |
|
4625 |
rawLabel isEmpty ifTrue:[ |
|
4626 |
rawLabel := label value |
|
4627 |
]. |
|
4628 |
size := self accessCharacterPosition. |
|
4629 |
||
4630 |
(size notNil and:[size <= rawLabel size]) ifTrue:[ |
|
4631 |
rawLabel isText ifFalse:[ |
|
4632 |
rawLabel := Text string:rawLabel |
|
4633 |
]. |
|
4634 |
rawLabel emphasisAt:size add:#underline |
|
4635 |
] |
|
1078 | 4636 |
]. |
4637 |
rawLabel isImage ifTrue:[ |
|
1117 | 4638 |
rawImage := rawLabel. |
4639 |
||
4640 |
form notNil ifTrue:[ |
|
4641 |
isButton ifTrue:[form := nil]. |
|
4642 |
rawLabel := LabelAndIcon form:form image:rawImage. |
|
4643 |
] |
|
794 | 4644 |
] ifFalse:[ |
1117 | 4645 |
rawLabel class == LabelAndIcon ifTrue:[ |
4646 |
rawImage := rawLabel icon. |
|
4647 |
||
4648 |
(form notNil and:[isButton not]) ifTrue:[ |
|
4649 |
rawLabel image:rawImage. |
|
4650 |
rawLabel icon:form |
|
4651 |
] |
|
4652 |
] ifFalse:[ |
|
4653 |
rawImage := nil. |
|
4654 |
rawLabel isNil ifTrue:[rawLabel := '']. |
|
4655 |
||
4656 |
(form notNil and:[isButton not]) ifTrue:[ |
|
4657 |
rawLabel := LabelAndIcon icon:form string:rawLabel. |
|
4658 |
] ifFalse:[ |
|
4659 |
disabledRawLabel := rawLabel. |
|
4660 |
] |
|
4661 |
]. |
|
794 | 4662 |
]. |
1078 | 4663 |
menuPanel shown ifTrue:[ self fetchImages ]. |
4664 |
menuPanel mustRearrange |
|
388 | 4665 |
! ! |
4666 |
||
4667 |
!MenuPanel::Item methodsFor:'private'! |
|
4668 |
||
650 | 4669 |
activeBackgroundColor |
4670 |
"returns the active background color derived from menuPanel |
|
4671 |
" |
|
4672 |
||
1045 | 4673 |
isButton ifTrue: [^menuPanel buttonActiveBackgroundColor]. |
650 | 4674 |
^menuPanel activeBackgroundColor |
4675 |
! |
|
4676 |
||
4677 |
activeForegroundColor |
|
4678 |
"returns the active foreground color derived from menuPanel |
|
4679 |
" |
|
4680 |
||
4681 |
^menuPanel activeForegroundColor |
|
4682 |
! |
|
4683 |
||
388 | 4684 |
adornment |
4685 |
"returns adornment; if not existing yet a new instance |
|
4686 |
is created |
|
4687 |
" |
|
4688 |
adornment isNil ifTrue:[ |
|
1117 | 4689 |
adornment := Adornment new |
388 | 4690 |
]. |
4691 |
^ adornment |
|
4692 |
! |
|
4693 |
||
727 | 4694 |
backgroundColor |
4695 |
"returns the background color derived from menuPanel |
|
4696 |
" |
|
4697 |
||
1045 | 4698 |
isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor]. |
727 | 4699 |
^menuPanel backgroundColor |
4700 |
! |
|
4701 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4702 |
backgroundColorFromLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4703 |
"returns the background color derived from label or nil |
388 | 4704 |
" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4705 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4706 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4707 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4708 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4709 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4710 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4711 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4712 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4713 |
run size == 0 ifTrue:[ |
1117 | 4714 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
4715 |
^ run value |
|
4716 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4717 |
] ifFalse:[ |
1117 | 4718 |
run do:[:r| |
4719 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
4720 |
^ r value |
|
4721 |
] |
|
4722 |
] |
|
388 | 4723 |
]. |
4724 |
^ nil |
|
4725 |
! |
|
4726 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4727 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4728 |
"returns the background color to use when thhe mouse has entered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4729 |
derived from menuPanel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4730 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4731 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4732 |
isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor]. |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4733 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4734 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4735 |
"Created: / 20.8.1998 / 13:56:10 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4736 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4737 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4738 |
choiceForm |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4739 |
"returns choice form or nil |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4740 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4741 |
|holder| |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4742 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4743 |
(holder := self choice) isNil ifTrue:[^ nil]. |
1078 | 4744 |
|
1107
0ace8de67a4e
better styled round choice images + test choice values only for #=
tz
parents:
1101
diff
changeset
|
4745 |
holder value = self choiceValue ifTrue:[ |
1117 | 4746 |
^ self class checkOnIcon |
1078 | 4747 |
]. |
4748 |
^ self class checkOffIcon |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4749 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4750 |
|
663 | 4751 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
4752 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
4753 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
4754 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
4755 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
4756 |
|
890
28c4470c6858
dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents:
879
diff
changeset
|
4757 |
|subm argument sel| |
663 | 4758 |
|
4759 |
subm := nil. |
|
4760 |
||
4761 |
aRecv notNil ifTrue:[ |
|
1117 | 4762 |
submenuChannel last ~~ $: ifTrue:[ |
4763 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
4764 |
|selector| |
|
4765 |
||
4766 |
((selector := ex parameter selector) == submenuChannel |
|
4767 |
or:[selector == #aspectFor:]) ifFalse:[ |
|
4768 |
ex reject |
|
4769 |
]. |
|
4770 |
] do:[ |
|
4771 |
subm := aRecv aspectFor:submenuChannel |
|
4772 |
]. |
|
4773 |
subm isNil ifTrue:[ |
|
4774 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
4775 |
ex parameter selector == submenuChannel ifFalse:[ |
|
4776 |
ex reject |
|
4777 |
]. |
|
4778 |
] do:[ |
|
4779 |
subm := aRecv perform:submenuChannel |
|
4780 |
] |
|
4781 |
]. |
|
4782 |
subm isNil ifTrue:[ |
|
4783 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
4784 |
ex parameter selector == submenuChannel ifFalse:[ |
|
4785 |
ex reject |
|
4786 |
]. |
|
4787 |
] do:[ |
|
4788 |
subm := aRecv class perform:submenuChannel |
|
4789 |
] |
|
4790 |
] |
|
4791 |
] ifFalse:[ |
|
4792 |
(argument := self argument) notNil ifTrue:[ |
|
4793 |
sel := submenuChannel asSymbol. |
|
4794 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
4795 |
ex parameter selector == sel ifFalse:[ |
|
4796 |
ex reject |
|
4797 |
]. |
|
4798 |
] do:[ |
|
4799 |
subm := aRecv perform:sel with:argument |
|
4800 |
]. |
|
4801 |
||
4802 |
subm isNil ifTrue:[ |
|
4803 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
4804 |
ex parameter selector == sel ifFalse:[ |
|
4805 |
ex reject |
|
4806 |
]. |
|
4807 |
] do:[ |
|
4808 |
subm := aRecv class perform:sel with:argument |
|
4809 |
] |
|
4810 |
] |
|
4811 |
] |
|
4812 |
] |
|
663 | 4813 |
]. |
4814 |
^ subm |
|
4815 |
||
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
4816 |
"Modified: / 4.8.1998 / 17:40:09 / cg" |
663 | 4817 |
! |
4818 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4819 |
indicationValue |
524 | 4820 |
"returns indication value or nil in case of no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4821 |
" |
608 | 4822 |
|indication numArgs sel recv| |
524 | 4823 |
|
4824 |
(indication := self indication) isNil ifTrue:[ |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4825 |
^ nil "/ has no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4826 |
]. |
524 | 4827 |
|
4828 |
indication isSymbol ifTrue:[ |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4829 |
(numArgs := indication numArgs) ~~ 0 ifTrue:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4830 |
numArgs == 2 ifTrue:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4831 |
recv := menuPanel receiver. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4832 |
|
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4833 |
(recv isValueModel) ifFalse:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4834 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4835 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4836 |
indication := nil. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4837 |
sel := sel asSymbol. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4838 |
|
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4839 |
Object messageNotUnderstoodSignal handle:[:ex| |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4840 |
ex parameter selector == sel ifFalse:[ |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
4841 |
"/ Transcript showCR:'no indication for: ' , sel. |
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4842 |
ex reject |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4843 |
]. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4844 |
] do:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4845 |
indication := recv perform:sel with:self argument |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4846 |
] |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4847 |
]. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4848 |
]. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4849 |
^ indication value == true |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4850 |
]. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4851 |
indication := (indication copyWithoutLast:1) asSymbol |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4852 |
]. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4853 |
indication := self aspectAt:indication. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4854 |
|
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4855 |
(self isKindOfValueHolder:indication) ifTrue:[ |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4856 |
self adornment indication:indication. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4857 |
indication addDependent:self. |
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
4858 |
] |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4859 |
]. |
524 | 4860 |
^ indication value == true |
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
4861 |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
4862 |
"Modified: / 8.8.1998 / 02:15:15 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4863 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4864 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4865 |
indicationValue:aValue |
1218 | 4866 |
"set the indication value |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4867 |
" |
608 | 4868 |
|numArgs indication recv| |
524 | 4869 |
|
4870 |
(indication := self indication) isNil ifTrue:[ |
|
1218 | 4871 |
^ self "/ has no indication |
524 | 4872 |
]. |
4873 |
||
4874 |
indication isSymbol ifFalse:[ |
|
1218 | 4875 |
(indication respondsTo:#value:) ifTrue:[ "/ valueHolder or block |
4876 |
indication value:aValue |
|
4877 |
]. |
|
4878 |
^ self |
|
4879 |
]. |
|
4880 |
||
524 | 4881 |
recv := menuPanel receiver. |
1218 | 4882 |
recv isNil ifTrue:[ |
4883 |
recv := menuPanel application. |
|
4884 |
recv isNil ifTrue:[^ self]. |
|
4885 |
]. |
|
4886 |
||
4887 |
(numArgs := indication numArgs) ~~ 0 ifTrue:[ |
|
4888 |
Object messageNotUnderstoodSignal handle:[:ex| |
|
4889 |
(ex parameter selector ~~ indication) ifTrue:[ |
|
4890 |
ex reject |
|
4891 |
] |
|
4892 |
] do:[ |
|
4893 |
numArgs == 1 ifTrue:[ |
|
4894 |
recv perform:indication with:aValue |
|
4895 |
] ifFalse:[ |
|
4896 |
recv perform:indication with:(self argument ? self) with:aValue |
|
4897 |
] |
|
4898 |
] |
|
524 | 4899 |
]. |
1026
29bd433b27d3
dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents:
1024
diff
changeset
|
4900 |
|
29bd433b27d3
dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents:
1024
diff
changeset
|
4901 |
"Modified: / 28.7.1998 / 20:47:08 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4902 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4903 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4904 |
indicatorForm |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4905 |
"returns indication form or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4906 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4907 |
|value| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4908 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4909 |
(value := self indicationValue) isNil ifTrue:[ |
1117 | 4910 |
^ nil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4911 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4912 |
^ value ifTrue:[IndicatorOn] ifFalse:[IndicatorOff] |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4913 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4914 |
"Created: / 14.8.1998 / 15:53:53 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4915 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4916 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4917 |
isEntered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4918 |
"returns true if the mouse pointer is over the item |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4919 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4920 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4921 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4922 |
"Created: / 20.8.1998 / 13:11:50 / cg" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4923 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4924 |
|
1130 | 4925 |
reinitSubmenuStyle |
4926 |
"returns my submenu or nil |
|
4927 |
" |
|
4928 |
subMenu notNil ifTrue:[ |
|
4929 |
subMenu reinitStyle |
|
4930 |
]. |
|
4931 |
||
4932 |
"Created: / 10.9.1998 / 21:36:09 / cg" |
|
4933 |
! |
|
4934 |
||
464 | 4935 |
separatorType |
4936 |
"returns type of separator line or nil |
|
388 | 4937 |
" |
390 | 4938 |
|c lbl| |
388 | 4939 |
|
4940 |
rawLabel isNil ifFalse:[ |
|
1117 | 4941 |
^ nil |
388 | 4942 |
]. |
4943 |
||
390 | 4944 |
(lbl := label value) isNil ifTrue:[ |
1117 | 4945 |
^ #singleLine |
388 | 4946 |
]. |
4947 |
||
390 | 4948 |
lbl size == 1 ifTrue:[ |
1117 | 4949 |
c := lbl first. |
4950 |
c == $- ifTrue:[^ #singleLine]. |
|
4951 |
c == $= ifTrue:[^ #doubleLine]. |
|
388 | 4952 |
]. |
4953 |
^ #blankLine |
|
1130 | 4954 |
! |
4955 |
||
4956 |
setupSubmenu |
|
4957 |
|appl recv subm| |
|
4958 |
||
4959 |
submenuChannel notNil ifTrue:[ |
|
4960 |
submenuChannel isSymbol ifFalse:[ |
|
4961 |
subm := submenuChannel |
|
4962 |
] ifTrue:[ |
|
4963 |
appl := menuPanel application. |
|
4964 |
||
4965 |
(subm := self findSubMenuIn:appl) isNil ifTrue:[ |
|
4966 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
|
4967 |
subm := self findSubMenuIn:recv |
|
4968 |
] |
|
4969 |
] |
|
4970 |
]. |
|
4971 |
||
4972 |
(subm := subm value) isArray ifTrue:[ |
|
4973 |
subm := Menu new fromLiteralArrayEncoding:subm. |
|
4974 |
"/ cg: linked menus also may contain translations ... |
|
4975 |
subm notNil ifTrue:[ |
|
4976 |
appl notNil ifTrue:[ |
|
4977 |
subm findGuiResourcesIn:appl. |
|
4978 |
] |
|
4979 |
]. |
|
4980 |
]. |
|
4981 |
self submenu:subm. |
|
4982 |
]. |
|
4983 |
||
4984 |
^ subMenu |
|
4985 |
||
4986 |
"Modified: / 19.5.1998 / 19:36:56 / cg" |
|
388 | 4987 |
! ! |
4988 |
||
4989 |
!MenuPanel::Item methodsFor:'queries'! |
|
4990 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4991 |
canChangeVisibility |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4992 |
"return true if I am not always visible |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4993 |
" |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4994 |
|
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4995 |
^ isVisible notNil and:[isVisible ~~ true] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4996 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4997 |
|
388 | 4998 |
canSelect |
4999 |
"returns true if item is selectable |
|
5000 |
" |
|
1078 | 5001 |
|holder| |
5002 |
||
5003 |
(self isVisible and:[self enabled and:[rawLabel notNil]]) ifTrue:[ |
|
1117 | 5004 |
((holder := self choice) isNil or:[holder value ~= self choiceValue]) ifTrue:[ |
5005 |
^ true |
|
5006 |
]. |
|
1078 | 5007 |
]. |
5008 |
^ false |
|
388 | 5009 |
! |
5010 |
||
5011 |
containsPointX:x y:y |
|
5012 |
"returns true if point is contained in my layout |
|
5013 |
" |
|
712 | 5014 |
(self isVisible and:[layout notNil]) ifTrue:[ |
1117 | 5015 |
^ ( (x >= layout left) |
5016 |
and:[x < layout right |
|
5017 |
and:[y > layout top |
|
5018 |
and:[y <= layout bottom]]] |
|
5019 |
) |
|
505 | 5020 |
]. |
5021 |
^ false |
|
388 | 5022 |
! |
5023 |
||
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5024 |
hasChoice |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5025 |
"returns true if a choice indication (RadioButton) exists |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5026 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5027 |
^ self choice notNil |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5028 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5029 |
"Created: / 14.8.1998 / 14:38:20 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5030 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5031 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5032 |
hasIndication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5033 |
"returns true if on/off indication exists |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5034 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5035 |
^ self indication notNil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5036 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5037 |
|
388 | 5038 |
hasSubmenu |
5039 |
"returns true if a submenu exists |
|
5040 |
" |
|
5041 |
^ self submenu notNil |
|
5042 |
! |
|
5043 |
||
5044 |
isEnabled |
|
5045 |
"returns enabled state |
|
5046 |
" |
|
5047 |
^ self enabled |
|
5048 |
! |
|
5049 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5050 |
isKindOfValueHolder:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5051 |
"returns true if something is kind of vlaue holder |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5052 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5053 |
^ ((something respondsTo:#value:) and:[something isBlock not]) |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5054 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5055 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5056 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5057 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5058 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5059 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5060 |
|
608 | 5061 |
isSeparator |
5062 |
"returns true if item is a separator |
|
5063 |
" |
|
5064 |
^ rawLabel isNil |
|
5065 |
! |
|
5066 |
||
712 | 5067 |
isVisible |
5068 |
"returns the visibility state |
|
5069 |
" |
|
5070 |
|state| |
|
5071 |
||
5072 |
isVisible isSymbol ifTrue:[ |
|
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5073 |
state := self aspectAt:isVisible. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5074 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5075 |
(self isKindOfValueHolder:state) ifTrue:[ |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5076 |
isVisible := state. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5077 |
isVisible addDependent:self. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5078 |
state := isVisible. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5079 |
] |
712 | 5080 |
] ifFalse:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5081 |
state := isVisible |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5082 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5083 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5084 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5085 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 5086 |
! |
5087 |
||
5088 |
isVisible:something |
|
5089 |
"change the state; if the state changed, a redraw is performed |
|
5090 |
" |
|
5091 |
|oldState newState| |
|
5092 |
||
5093 |
isVisible isNil ifTrue:[ |
|
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5094 |
oldState := true |
712 | 5095 |
] ifFalse:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5096 |
oldState := isVisible value. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5097 |
(self isKindOfValueHolder:isVisible) ifTrue:[ |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5098 |
isVisible removeDependent:self |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5099 |
] |
712 | 5100 |
]. |
5101 |
isVisible := something. |
|
5102 |
||
5103 |
isVisible isNil ifTrue:[ |
|
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5104 |
newState := true |
712 | 5105 |
] ifFalse:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5106 |
(self isKindOfValueHolder:isVisible) ifTrue:[ |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5107 |
isVisible addDependent:self |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5108 |
] ifFalse:[ |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5109 |
isVisible isSymbol ifTrue:[^ self] |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5110 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5111 |
menuPanel shown ifFalse:[^ self]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5112 |
newState := isVisible value. |
712 | 5113 |
]. |
5114 |
||
5115 |
newState ~~ oldState ifTrue:[ |
|
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5116 |
menuPanel mustRearrange |
712 | 5117 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5118 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5119 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 5120 |
! |
5121 |
||
1096 | 5122 |
preferredExtent |
5123 |
"compute my preferred extent |
|
5124 |
" |
|
5125 |
|x y s isVertical sepSize| |
|
5126 |
||
5127 |
self isVisible ifFalse:[^ (0 @ 0) ]. |
|
5128 |
||
5129 |
x := self horizontalInset * 2. |
|
5130 |
y := self verticalInset * 2. |
|
5131 |
||
5132 |
isVertical := menuPanel verticalLayout. |
|
5133 |
||
5134 |
self isSeparator ifFalse:[ |
|
1117 | 5135 |
x := x + (rawLabel widthOn:menuPanel). |
5136 |
y := y + (rawLabel heightOn:menuPanel). |
|
5137 |
||
5138 |
MenuView showAcceleratorKeys == true ifTrue:[ |
|
5139 |
isVertical ifTrue:[ "/ only for vertical menus ... |
|
5140 |
(s := self shortcutKeyAsString) notNil ifTrue:[ |
|
5141 |
x := x + LabelRightOffset + (s widthOn:menuPanel) |
|
5142 |
]. |
|
5143 |
]. |
|
5144 |
]. |
|
5145 |
(isVertical and:[self hasSubmenu or:[submenuChannel notNil]]) ifTrue:[ |
|
5146 |
x := x + menuPanel subMenuIndicationWidth. |
|
5147 |
||
5148 |
s notNil ifTrue:[x := x + ShortcutKeyOffset] |
|
5149 |
ifFalse:[x := x + LabelRightOffset] |
|
5150 |
]. |
|
1096 | 5151 |
] ifTrue:[ |
5152 |
||
1117 | 5153 |
sepSize := (self class separatorSize:(self separatorType)). |
5154 |
isVertical ifFalse:[ |
|
5155 |
x := x max:sepSize. |
|
5156 |
y := y + (menuPanel font height) |
|
5157 |
] ifTrue:[ |
|
5158 |
y := y max:sepSize |
|
5159 |
]. |
|
1096 | 5160 |
]. |
5161 |
||
5162 |
^ (x @ y) |
|
5163 |
||
5164 |
"Modified: / 8.8.1998 / 01:38:26 / cg" |
|
5165 |
! |
|
5166 |
||
5167 |
preferredExtentX |
|
5168 |
"compute my preferred extent x |
|
5169 |
" |
|
5170 |
^ self preferredExtent x |
|
5171 |
||
5172 |
! |
|
5173 |
||
388 | 5174 |
shortcutKeyAsString |
5175 |
"converts shortcutKey to a text object |
|
5176 |
" |
|
987 | 5177 |
|nm key prefix| |
388 | 5178 |
|
5179 |
(key := self shortcutKey) isNil ifTrue:[ |
|
1117 | 5180 |
^ nil |
388 | 5181 |
]. |
5182 |
||
5183 |
key isCharacter ifTrue:[ |
|
1117 | 5184 |
nm := key asString |
388 | 5185 |
] ifFalse:[ |
1117 | 5186 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
5187 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
|
5188 |
"/ Ask the devices keyboardMap for the backtranslation. |
|
5189 |
||
5190 |
nm := menuPanel device keyboardMap keyAtValue:key ifAbsent:key. |
|
5191 |
"/ |
|
5192 |
"/ some modifier-key combination ? |
|
5193 |
"/ |
|
5194 |
(nm startsWith:#Cmd) ifTrue:[ |
|
5195 |
prefix := #Cmd. |
|
5196 |
] ifFalse:[(nm startsWith:#Alt) ifTrue:[ |
|
5197 |
prefix := #Alt. |
|
5198 |
] ifFalse:[(nm startsWith:#Meta) ifTrue:[ |
|
5199 |
prefix := #Meta. |
|
5200 |
] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[ |
|
5201 |
prefix := #Ctrl. |
|
5202 |
]]]]. |
|
5203 |
prefix notNil ifTrue:[ |
|
5204 |
nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1)) |
|
5205 |
] ifFalse:[ |
|
5206 |
nm := nm asString |
|
5207 |
] |
|
388 | 5208 |
]. |
608 | 5209 |
^ nm |
388 | 5210 |
|
987 | 5211 |
"Modified: / 17.7.1998 / 11:56:40 / cg" |
388 | 5212 |
! |
5213 |
||
5214 |
shortcutKeyPrefixFor:aModifier |
|
5215 |
"returns prefix assigned to a modifier |
|
5216 |
" |
|
5217 |
|m| |
|
5218 |
||
5219 |
m := menuPanel device modifierKeyTopFor:aModifier. |
|
5220 |
m notNil ifTrue:[ |
|
1117 | 5221 |
^ m , '-' |
388 | 5222 |
]. |
987 | 5223 |
^ aModifier , '-'. |
5224 |
||
5225 |
"Modified: / 17.7.1998 / 11:56:46 / cg" |
|
388 | 5226 |
! ! |
5227 |
||
5228 |
!MenuPanel::Item methodsFor:'selection'! |
|
5229 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5230 |
hideSubmenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5231 |
"hide submenu |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5232 |
" |
580 | 5233 |
|subMenu id| |
464 | 5234 |
|
5235 |
subMenu := self submenu. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5236 |
subMenu realized ifFalse:[ |
1117 | 5237 |
(id := subMenu id) notNil ifTrue:[ |
5238 |
menuPanel device unmapWindow:id |
|
5239 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5240 |
] ifTrue:[ |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5241 |
subMenu hide |
1076
1bd7e9b6fee8
remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
5242 |
]. |
1bd7e9b6fee8
remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
5243 |
|
1bd7e9b6fee8
remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
5244 |
subMenu windowGroup:nil. |
1bd7e9b6fee8
remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
5245 |
menuPanel windowGroup removeView:subMenu. |
1bd7e9b6fee8
remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
5246 |
|
1bd7e9b6fee8
remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
5247 |
"Modified: / 14.8.1998 / 17:36:01 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5248 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5249 |
|
388 | 5250 |
isSelected |
5251 |
"returns true if item is selected |
|
5252 |
" |
|
5253 |
^ menuPanel selection == self |
|
5254 |
! |
|
5255 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5256 |
openSubmenuAt:aPoint |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5257 |
"open submenu at a point |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5258 |
" |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
5259 |
|top windowGrp| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5260 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5261 |
windowGrp := menuPanel topMenu windowGroup. |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
5262 |
self setupSubmenu. |
890
28c4470c6858
dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents:
879
diff
changeset
|
5263 |
subMenu isNil ifTrue:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5264 |
^ self |
890
28c4470c6858
dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents:
879
diff
changeset
|
5265 |
]. |
829 | 5266 |
subMenu font:(menuPanel topMenu font). |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5267 |
subMenu becomesActiveMenu. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5268 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5269 |
windowGrp notNil ifTrue:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5270 |
subMenu windowGroup:windowGrp. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5271 |
windowGrp addTopView:subMenu. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5272 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5273 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5274 |
"/ Q&D kludge - if any visibility attributes are blocks; |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5275 |
"/ TODO: only invoke mustRearrange if any are blocks |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
5276 |
"/ (since I react correctly on valueHolder changes) |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
5277 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5278 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5279 |
subMenu fixSize. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5280 |
subMenu origin:aPoint. |
816 | 5281 |
"/ subMenu makeFullyVisible. |
680 | 5282 |
top := menuPanel topMenu. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5283 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5284 |
subMenu realized ifFalse:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5285 |
subMenu realize. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5286 |
] ifTrue:[ |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5287 |
top device mapWindow:subMenu id. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5288 |
]. |
816 | 5289 |
subMenu makeFullyVisible. |
5290 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5291 |
|
680 | 5292 |
"/ (top styleSheet at:'menu.autoSelectFirst') ifTrue:[ |
5293 |
"/ subMenu selectionIndex:1 |
|
5294 |
"/ ] |
|
5295 |
||
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
5296 |
"Modified: / 5.10.1998 / 12:16:27 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5297 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5298 |
|
388 | 5299 |
selected:aState |
5300 |
"change selection to a state. Dependant on the state open or hide an existing |
|
5301 |
submenu and perform a redraw |
|
5302 |
" |
|
5303 |
|p d subMenu| |
|
5304 |
||
5305 |
subMenu := self submenu. |
|
5306 |
||
5307 |
aState ifFalse:[ |
|
1117 | 5308 |
self redraw. |
5309 |
subMenu notNil ifTrue:[ |
|
5310 |
self hideSubmenu |
|
5311 |
]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5312 |
^ self |
388 | 5313 |
]. |
720 | 5314 |
menuPanel shown ifFalse:[^ self]. |
1045 | 5315 |
(self hasIndication not or: [isButton not]) ifTrue: [self redraw]. |
388 | 5316 |
|
5317 |
subMenu isNil ifTrue:[ |
|
1117 | 5318 |
menuPanel isPopUpView ifTrue:[ |
5319 |
menuPanel grabMouseAndKeyboard. |
|
5320 |
]. |
|
5321 |
^ self. |
|
388 | 5322 |
]. |
5323 |
||
1054
f56416a8d26b
win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents:
1051
diff
changeset
|
5324 |
menuPanel verticalLayout ifTrue:[p := (layout right - 4) @ (layout top)] |
1117 | 5325 |
ifFalse:[p := (layout left) @ (layout bottom)]. |
388 | 5326 |
|
5327 |
d := menuPanel device. |
|
5328 |
p := d translatePoint:p from:(menuPanel id) to:(d rootWindowId). |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5329 |
self openSubmenuAt:p. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5330 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
5331 |
"Modified: / 2.2.1998 / 10:17:41 / stefan" |
1054
f56416a8d26b
win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents:
1051
diff
changeset
|
5332 |
"Modified: / 5.8.1998 / 00:15:36 / cg" |
388 | 5333 |
! ! |
5334 |
||
5335 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
|
5336 |
||
5337 |
accessCharacterPosition |
|
5338 |
"get the index of the access character in the label text or string, or nil if none |
|
5339 |
" |
|
5340 |
^ accessCharacterPosition |
|
5341 |
! |
|
5342 |
||
5343 |
accessCharacterPosition:anIndexOrNil |
|
5344 |
"set the index of the access character in the label text or string, or nil if none |
|
5345 |
" |
|
5346 |
accessCharacterPosition := anIndexOrNil |
|
5347 |
! |
|
5348 |
||
5349 |
argument |
|
5350 |
"ST/X goody; get argunment to a selector or block |
|
5351 |
" |
|
5352 |
^ argument |
|
5353 |
! |
|
5354 |
||
5355 |
argument:anArgumentOrNil |
|
5356 |
"ST/X goody; set argunment to a selector or block |
|
5357 |
" |
|
5358 |
argument := anArgumentOrNil |
|
5359 |
! |
|
5360 |
||
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5361 |
choice |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5362 |
"get has choice indicator value |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5363 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5364 |
^ choice |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5365 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5366 |
"Created: / 14.8.1998 / 14:41:31 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5367 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5368 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5369 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5370 |
"set choice indicator value |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5371 |
" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5372 |
choice := something. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5373 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5374 |
"Created: / 14.8.1998 / 14:41:39 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5375 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5376 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5377 |
choiceValue |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5378 |
"return the value of the instance variable 'choiceValue' (automatically generated)" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5379 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5380 |
^ choiceValue |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5381 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5382 |
"Created: / 14.8.1998 / 15:47:52 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5383 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5384 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5385 |
choiceValue:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5386 |
"set the value of the instance variable 'choiceValue' (automatically generated)" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5387 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5388 |
choiceValue := something. |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5389 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5390 |
"Created: / 14.8.1998 / 15:47:52 / cg" |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5391 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5392 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5393 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5394 |
"get has on/off indicator value |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5395 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5396 |
^ indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5397 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5398 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5399 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5400 |
"set has on/off indicator value |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5401 |
" |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5402 |
indication := something. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5403 |
! |
388 | 5404 |
|
5405 |
shortcutKey |
|
5406 |
"get the character that is used as a shortcut key for this item |
|
5407 |
" |
|
5408 |
^ shortcutKey |
|
5409 |
! |
|
5410 |
||
5411 |
shortcutKey:aKeyOrNil |
|
5412 |
"set the character that is used as a shortcut key for this item |
|
5413 |
" |
|
5414 |
shortcutKey := aKeyOrNil |
|
5415 |
! ! |
|
5416 |
||
5417 |
!MenuPanel class methodsFor:'documentation'! |
|
5418 |
||
5419 |
version |
|
1336 | 5420 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.159 1999-04-24 16:54:20 cg Exp $' |
388 | 5421 |
! ! |
5422 |
MenuPanel initialize! |