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