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