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