author | ca |
Wed, 09 Nov 2011 16:34:36 +0100 | |
changeset 4089 | 0de7cd2f7734 |
parent 4086 | d4818ca73683 |
child 4090 | 9f67a25034b7 |
permissions | -rw-r--r-- |
2005 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 3 |
All Rights Reserved |
2005 | 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 |
" |
|
1750 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
2182
59a770bbb95a
changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
14 |
View subclass:#MenuPanel |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
15 |
instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
16 |
selection items groupSizes receiver enabled lastActiveMenu |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
17 |
enteredItem prevFocusView previousPointerGrab |
3147 | 18 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
19 |
scrollActivity rightArrowShadow rightArrow fgColor verticalLayout |
|
20 |
showSeparatingLines showGroupDivider implicitGrabView |
|
21 |
lastPointerView openDelayedMenuBlock preferredWidth application |
|
22 |
originator centerItems hideOnRelease defaultHideOnRelease |
|
23 |
buttonInsetX buttonInsetY itemSpace activeBackgroundColor |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
24 |
stringOffsetX doAccessCharacterTranslation lastItem hasPerformed |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
25 |
focusComesByTab lastDrawnScrollerNextBounds' |
3147 | 26 |
classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages |
27 |
DefaultForegroundColor DefaultBackgroundColor IconIndicationOn |
|
28 |
IconIndicationOff IconRadioOn IconRadioOff |
|
29 |
IconDisabledIndicationOn IconDisabledIndicationOff |
|
30 |
IconDisabledRadioOn IconDisabledRadioOff' |
|
31 |
poolDictionaries:'' |
|
32 |
category:'Views-Menus' |
|
388 | 33 |
! |
34 |
||
35 |
Object subclass:#Item |
|
3147 | 36 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
37 |
disabledDisplayLabel enableChannel label activeHelpText |
|
38 |
flyByHelpText isVisible indication choice accessCharacter' |
|
39 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
|
40 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
41 |
poolDictionaries:'' |
|
42 |
privateIn:MenuPanel |
|
388 | 43 |
! |
44 |
||
2692 | 45 |
Object subclass:#Adornment |
3147 | 46 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
47 |
choice choiceValue' |
|
48 |
classVariableNames:'' |
|
49 |
poolDictionaries:'' |
|
50 |
privateIn:MenuPanel::Item |
|
2692 | 51 |
! |
52 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
53 |
Object subclass:#ScrollActivity |
3147 | 54 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
55 |
classVariableNames:'' |
|
56 |
poolDictionaries:'' |
|
57 |
privateIn:MenuPanel |
|
2016 | 58 |
! |
59 |
||
388 | 60 |
!MenuPanel class methodsFor:'documentation'! |
61 |
||
2005 | 62 |
copyright |
63 |
" |
|
64 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 65 |
All Rights Reserved |
2005 | 66 |
|
67 |
This software is furnished under a license and may be used |
|
68 |
only in accordance with the terms of that license and with the |
|
69 |
inclusion of the above copyright notice. This software may not |
|
70 |
be provided or otherwise made available to, or used by, any |
|
71 |
other person. No title to or ownership of the software is |
|
72 |
hereby transferred. |
|
73 |
" |
|
74 |
||
388 | 75 |
! |
76 |
||
77 |
documentation |
|
78 |
" |
|
79 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
80 |
||
2170 | 81 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 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 |
||
2061 | 88 |
Notice: |
3938 | 89 |
This is going to replace the obsolete MenuView. |
2061 | 90 |
|
388 | 91 |
[author:] |
3938 | 92 |
Claus Atzkern |
388 | 93 |
|
94 |
[see also:] |
|
3938 | 95 |
Menu |
96 |
MenuItem |
|
97 |
MenuEditor |
|
2170 | 98 |
|
99 |
cg: this code is so ugly - needs a complete rewrite... |
|
100 |
||
388 | 101 |
" |
102 |
! |
|
103 |
||
104 |
examples |
|
105 |
||
106 |
" |
|
4081 | 107 |
a PullDownMenu |
108 |
[exBegin] |
|
388 | 109 |
|top subView mview desc s1 s2 s3 img lbs labels| |
110 |
||
111 |
top := StandardSystemView new. |
|
112 |
||
436 | 113 |
mview := MenuPanel in:top. |
388 | 114 |
|
502 | 115 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 116 |
mview level:2. |
117 |
mview verticalLayout:false. |
|
118 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 119 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 120 |
mview labels:lbs. |
121 |
mview shortcutKeyAt:2 put:#Cut. |
|
122 |
mview accessCharacterPositionAt:1 put:1. |
|
123 |
mview accessCharacterPositionAt:2 put:2. |
|
124 |
||
125 |
mview enabledAt:5 put:false. |
|
126 |
mview groupSizes:#( 2 2 ). |
|
436 | 127 |
s1 := MenuPanel labels:labels. |
388 | 128 |
s1 accessCharacterPositionAt:1 put:1. |
129 |
s1 accessCharacterPositionAt:2 put:2. |
|
130 |
s1 groupSizes:#( 2 2 ). |
|
436 | 131 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
132 |
s3 := MenuPanel labels:lbs. |
|
388 | 133 |
|
134 |
s1 subMenuAt:2 put:s2. |
|
436 | 135 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 136 |
s2 subMenuAt:3 put:s3. |
436 | 137 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 138 |
s3 shortcutKeyAt:3 put:$q. |
139 |
||
140 |
mview subMenuAt:1 put:s1. |
|
436 | 141 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 142 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
143 |
s1 shortcutKeyAt:1 put:#Copy. |
|
144 |
s1 shortcutKeyAt:3 put:#Paste. |
|
145 |
||
436 | 146 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 147 |
top extent:(mview preferredExtent). |
388 | 148 |
top open. |
4081 | 149 |
[exEnd] |
150 |
||
151 |
a PullDownMenu with applications |
|
152 |
[exBegin] |
|
1767 | 153 |
|top menu view item| |
154 |
||
155 |
top := StandardSystemView extent:240@100. |
|
156 |
menu := MenuPanel in:top. |
|
157 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
158 |
menu verticalLayout:false. |
|
159 |
||
160 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
161 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
162 |
||
163 |
view := ClockView new. |
|
164 |
view preferredExtent:100@100. |
|
165 |
item := menu itemAt:3. |
|
166 |
item submenu:view. |
|
167 |
||
4081 | 168 |
view := ImageView new. |
169 |
view image:(Image fromScreen:(0@0 corner:200@200)). |
|
170 |
view preferredExtent:(200@200). |
|
1767 | 171 |
item := menu itemAt:2. |
172 |
item submenu:view. |
|
173 |
||
174 |
menu origin:0@0 corner:1.0@30. |
|
175 |
top open. |
|
4081 | 176 |
[exEnd] |
177 |
||
178 |
||
179 |
a PopUpMenu |
|
180 |
[exBegin] |
|
388 | 181 |
|subView mview desc s1 s2 s3 img lbs labels| |
182 |
||
436 | 183 |
mview := MenuPanel new. |
502 | 184 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 185 |
mview level:2. |
186 |
||
187 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 188 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 189 |
mview labels:lbs. |
190 |
||
436 | 191 |
s1 := MenuPanel labels:labels. |
192 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
193 |
s3 := MenuPanel labels:lbs. |
|
388 | 194 |
s1 subMenuAt:2 put:s2. |
436 | 195 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 196 |
s2 subMenuAt:3 put:s3. |
436 | 197 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 198 |
s3 shortcutKeyAt:3 put:$q. |
199 |
||
200 |
mview subMenuAt:1 put:s1. |
|
436 | 201 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 202 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
203 |
s1 shortcutKeyAt:1 put:#Copy. |
|
204 |
s1 shortcutKeyAt:3 put:#Paste. |
|
205 |
||
436 | 206 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 207 |
mview startUp |
4081 | 208 |
[exEnd] |
209 |
||
210 |
||
211 |
a menu spec |
|
212 |
[exBegin] |
|
388 | 213 |
|menu| |
214 |
||
436 | 215 |
menu := MenuPanel menu: |
4081 | 216 |
#(#Menu #( #(#MenuItem |
217 |
#label: 'File' |
|
218 |
#submenu: |
|
219 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
220 |
(#MenuItem |
|
221 |
#label: 'edit' |
|
222 |
#submenu: |
|
223 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
224 |
#(#MenuItem #label: 'close' #value:#close) |
|
225 |
) |
|
226 |
nil |
|
227 |
nil |
|
228 |
) |
|
229 |
) |
|
230 |
#(#MenuItem #label: 'help' #value:#help ) |
|
231 |
) |
|
232 |
nil |
|
233 |
nil |
|
234 |
) |
|
235 |
) |
|
236 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
237 |
#(#MenuItem #label: 'Bar' |
|
238 |
#submenu: |
|
239 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
240 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
241 |
) |
|
242 |
nil |
|
243 |
nil |
|
244 |
) |
|
245 |
) |
|
246 |
) |
|
247 |
#( 2 ) |
|
248 |
nil |
|
249 |
) decodeAsLiteralArray. |
|
388 | 250 |
|
251 |
menu verticalLayout:false. |
|
252 |
Transcript showCR:(menu startUp). |
|
4081 | 253 |
[exEnd] |
388 | 254 |
|
255 |
" |
|
256 |
! ! |
|
257 |
||
258 |
!MenuPanel class methodsFor:'instance creation'! |
|
259 |
||
260 |
fromSpec:aSpec |
|
261 |
^ self fromSpec:aSpec receiver:nil |
|
262 |
! |
|
263 |
||
264 |
fromSpec:aSpec receiver:aReceiver |
|
265 |
|menu| |
|
266 |
||
267 |
aSpec notNil ifTrue:[ |
|
3147 | 268 |
menu := Menu new. |
269 |
menu receiver:aReceiver. |
|
270 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 271 |
]. |
272 |
^ self menu:menu receiver:aReceiver |
|
273 |
! |
|
274 |
||
275 |
labels:labels |
|
276 |
^ self labels:labels nameKeys:nil receiver:nil |
|
277 |
! |
|
278 |
||
279 |
labels:labels nameKeys:nameKeys |
|
280 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
281 |
! |
|
282 |
||
283 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
284 |
|mview| |
|
285 |
||
286 |
mview := self menu:nil receiver:aReceiver. |
|
287 |
mview labels:labels. |
|
288 |
mview nameKeys:nameKeys. |
|
289 |
^ mview |
|
290 |
||
291 |
! |
|
292 |
||
502 | 293 |
labels:labels receiver:aReceiver |
294 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
295 |
! |
|
296 |
||
388 | 297 |
menu:aMenu |
298 |
^ self menu:aMenu receiver:nil |
|
299 |
! |
|
300 |
||
301 |
menu:aMenu receiver:aReceiver |
|
302 |
|mview| |
|
303 |
||
304 |
mview := self new. |
|
1955 | 305 |
|
306 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
3147 | 307 |
"/ no receiver specified in the menu; thus set the receiver immediately |
308 |
mview receiver:aReceiver |
|
1955 | 309 |
]. |
310 |
||
388 | 311 |
mview menu:aMenu. |
312 |
||
1955 | 313 |
|
388 | 314 |
"/ a menu itself may contain a receiver |
315 |
"/ thus we do not overwrite the receiver |
|
316 |
||
317 |
aReceiver notNil ifTrue:[ |
|
3147 | 318 |
mview receiver:aReceiver |
388 | 319 |
]. |
320 |
^ mview |
|
321 |
! ! |
|
322 |
||
323 |
!MenuPanel class methodsFor:'class initialization'! |
|
324 |
||
325 |
initialize |
|
326 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
3938 | 327 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 328 |
]. |
329 |
||
2715 | 330 |
" |
331 |
self initialize |
|
332 |
" |
|
333 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
334 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 335 |
! |
336 |
||
337 |
preSnapshot |
|
2715 | 338 |
"remove all resources" |
339 |
||
794 | 340 |
Images := nil. |
341 |
LigthenedImages := nil. |
|
616 | 342 |
! ! |
343 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
344 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
345 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
346 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
347 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
348 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
349 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
350 |
"Do not manually edit this!! If it is corrupted, |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
351 |
the ImageEditor may not be able to read the specification." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
352 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
353 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
355 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
356 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
357 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
358 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
359 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
360 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
361 |
^Icon |
3938 | 362 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
363 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself] |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
364 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
365 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
366 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
367 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
368 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
369 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
370 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
371 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
372 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
373 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
375 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
376 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
377 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
378 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
379 |
|
2755 | 380 |
IconDisabledIndicationOff isNil ifTrue:[ |
3938 | 381 |
IconDisabledIndicationOff := Icon |
382 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
|
383 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@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] |
|
2755 | 384 |
]. |
385 |
^ IconDisabledIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
386 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
387 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
388 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
390 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
391 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
392 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
393 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
394 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
395 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
396 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
397 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
398 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
399 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
400 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
401 |
|
2755 | 402 |
IconDisabledIndicationOn isNil ifTrue:[ |
3938 | 403 |
IconDisabledIndicationOn := Icon |
404 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
|
405 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???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] |
|
2755 | 406 |
]. |
407 |
^ IconDisabledIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
408 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
409 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
410 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
411 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
415 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
416 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
417 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
418 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
419 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
420 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
422 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
423 |
|
2752 | 424 |
IconIndicationOff isNil ifTrue:[ |
3938 | 425 |
IconIndicationOff := Icon |
426 |
constantNamed:#'MenuPanel iconIndicationOff' |
|
427 |
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] |
|
2752 | 428 |
]. |
429 |
^ IconIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
430 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
431 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
432 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
433 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
434 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
435 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
436 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
437 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
438 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
439 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
440 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
441 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
442 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
443 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
444 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
445 |
|
2752 | 446 |
IconIndicationOn isNil ifTrue:[ |
3938 | 447 |
IconIndicationOn := Icon |
448 |
constantNamed:#'MenuPanel iconIndicationOn' |
|
449 |
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] |
|
2752 | 450 |
]. |
451 |
^ IconIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
452 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
453 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
454 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
455 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
456 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
457 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
459 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
460 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
461 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
462 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
463 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
464 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
465 |
|
3565 | 466 |
"/ <resource: #image> |
467 |
"/ |
|
468 |
"/ IconDisabledRadioOff isNil ifTrue:[ |
|
469 |
"/ IconDisabledRadioOff := Icon |
|
470 |
"/ constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
|
471 |
"/ ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DZ**(AJ**+AJ***LR***#D***(1J***LR***#AZ**#@Z**(0A** 0@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] |
|
472 |
"/ ]. |
|
473 |
"/ ^ IconDisabledRadioOff |
|
474 |
||
475 |
<resource: #programImage> |
|
476 |
^ RadioButton disabledPassiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
477 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
478 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
479 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
480 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
481 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
482 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
483 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
484 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
485 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
486 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
487 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
488 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 489 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
490 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
491 |
|
3565 | 492 |
"/ <resource: #image> |
493 |
"/ |
|
494 |
"/ IconDisabledRadioOn isNil ifTrue:[ |
|
495 |
"/ IconDisabledRadioOn := Icon |
|
496 |
"/ constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
497 |
"/ ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DYUZ(AIUU+AIUUVLRUUU#D%UUX1IUUVLRUUU#AYUU#@Z%U(0A** 0@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] |
|
498 |
"/ ]. |
|
499 |
"/ ^ IconDisabledRadioOn |
|
500 |
||
501 |
<resource: #programImage> |
|
502 |
^ RadioButton disabledActiveForm |
|
503 |
! |
|
504 |
||
505 |
iconRadioGroupEnteredOff |
|
506 |
<resource: #programImage> |
|
507 |
^ RadioButton enteredPassiveForm |
|
508 |
! |
|
509 |
||
510 |
iconRadioGroupEnteredOn |
|
511 |
<resource: #programImage> |
|
512 |
^ RadioButton enteredActiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
513 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
514 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
515 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
516 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
517 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
518 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
519 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
520 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
521 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
522 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
523 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
524 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
525 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
526 |
|
3565 | 527 |
"/ <resource: #image> |
528 |
"/ |
|
529 |
"/ IconRadioOff isNil ifTrue:[ |
|
530 |
"/ IconRadioOff := Icon |
|
531 |
"/ constantNamed:#'MenuPanel iconRadioGroupOff' |
|
532 |
"/ 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] |
|
533 |
"/ ]. |
|
534 |
"/ ^ IconRadioOff |
|
535 |
||
536 |
<resource: #programImage> |
|
537 |
^ RadioButton passiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
538 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
539 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
540 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
541 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
542 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
543 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
544 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
545 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
546 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
547 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
548 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
549 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
550 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
551 |
|
3565 | 552 |
"/ <resource: #image> |
553 |
"/ |
|
554 |
"/ IconRadioOn isNil ifTrue:[ |
|
555 |
"/ IconRadioOn := Icon |
|
556 |
"/ constantNamed:#'MenuPanel iconRadioGroupOn' |
|
557 |
"/ 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] |
|
558 |
"/ ]. |
|
559 |
"/ ^ IconRadioOn |
|
560 |
||
561 |
<resource: #programImage> |
|
562 |
^ RadioButton activeForm |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
563 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
564 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
565 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
566 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
567 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
568 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
569 |
"Do not manually edit this!! If it is corrupted, |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
570 |
the ImageEditor may not be able to read the specification." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
571 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
572 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
573 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
574 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
575 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
576 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
577 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
578 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
579 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
580 |
^Icon |
3938 | 581 |
constantNamed:#'MenuPanel class menuIndicator' |
582 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 4; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@B@0 @a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 4; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?''08D@@a') ; yourself); yourself] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
583 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
584 |
|
616 | 585 |
!MenuPanel class methodsFor:'defaults'! |
450 | 586 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
587 |
defaultBackgroundColor |
2609 | 588 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 589 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
590 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
591 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
592 |
defaultLevel |
2372 | 593 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
594 |
" |
|
595 |
self defaultLevel |
|
596 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
597 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
598 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
599 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
600 |
"returns an additional offset between the label and the |
2715 | 601 |
delayedMenu indication (i.e. the down-arrow icon)" |
602 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
603 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
604 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
605 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
606 |
maxShortCutSearchLevel |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
607 |
"1 means: only search in top items. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
608 |
2 means: search one level of menus. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
609 |
used to be 10" |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
610 |
|
3384 | 611 |
MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.]. |
612 |
^ MaxShortCutSearchLevel |
|
613 |
! |
|
614 |
||
615 |
maxShortCutSearchLevel: anInteger |
|
616 |
"1 means: only search in top items. |
|
617 |
2 means: search one level of menus." |
|
618 |
||
619 |
MaxShortCutSearchLevel := anInteger |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
620 |
! |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
621 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
622 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
623 |
"returns an additional offset between the label and the |
2715 | 624 |
delayedMenu indication (i.e. the down-arrow icon)" |
625 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
626 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
627 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
628 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
629 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
630 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
631 |
ex: |
3938 | 632 |
&File mnemonic := Cmdf |
633 |
F&ile mnemonic := Cmdi |
|
634 |
....." |
|
2715 | 635 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
636 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
637 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
638 |
|
450 | 639 |
updateStyleCache |
2777 | 640 |
"extract values from the styleSheet and cache them in class variables" |
657 | 641 |
|
2219 | 642 |
<resource: #style ( |
3938 | 643 |
#'selection.disabledForegroundColor' |
644 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
645 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
646 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
|
647 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
|
648 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
649 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
650 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
651 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
652 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
653 |
#'menu.selectionFollowsMouse' |
|
654 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
655 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
656 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
657 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
658 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
|
659 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
|
660 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
|
661 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
|
662 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
|
663 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
|
664 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
|
665 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
|
2219 | 666 |
)> |
667 |
||
668 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 669 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 670 |
|
2611 | 671 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
672 |
which returns the default cashed DefaultBackgroundColor |
|
673 |
" |
|
674 |
DefaultBackgroundColor := nil. |
|
675 |
||
2219 | 676 |
MenuView updateStyleCache. |
677 |
SelectionInListView updateStyleCache. |
|
1699 | 678 |
|
2372 | 679 |
styleSheet := StyleSheet. |
680 |
style := styleSheet name. |
|
681 |
||
2607 | 682 |
DefaultFont := MenuView defaultFont. |
3938 | 683 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
684 |
default:[styleSheet |
|
685 |
colorAt:#'menu.foregroundColor' |
|
686 |
default:Color black]. |
|
2609 | 687 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 688 |
|
689 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 690 |
var isNil ifTrue:[ |
3938 | 691 |
style == #motif ifTrue:[ var := backgroundColor ] |
692 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
2219 | 693 |
]. |
694 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
695 |
||
696 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 697 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 698 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
699 |
||
700 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 701 |
var isNil ifTrue:[ |
3938 | 702 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
703 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
|
2219 | 704 |
]. |
705 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
706 |
||
707 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 708 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 709 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
710 |
||
711 |
||
712 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 713 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 714 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
715 |
||
716 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 717 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 718 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
719 |
||
720 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
721 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
722 |
||
723 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
724 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
725 |
||
726 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 727 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
3938 | 728 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
2219 | 729 |
]. |
730 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
731 |
||
732 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 733 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 734 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
735 |
||
736 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 737 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 738 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
739 |
||
740 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 741 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 742 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
743 |
||
744 |
Item updateStyleCache. |
|
2607 | 745 |
|
2754 | 746 |
getBitmapOrFile := [:key :fileKey | |
3938 | 747 |
|var| |
748 |
||
749 |
var := styleSheet at:key ifAbsent:nil. |
|
750 |
var isNil ifTrue:[ |
|
751 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
752 |
var notNil ifTrue:[ |
|
753 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
|
754 |
]. |
|
755 |
]. |
|
756 |
var |
|
2754 | 757 |
]. |
758 |
||
2883 | 759 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
760 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
761 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
762 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
763 |
||
764 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
765 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
766 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
767 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 768 |
|
2607 | 769 |
" |
770 |
self updateStyleCache |
|
771 |
" |
|
388 | 772 |
! ! |
773 |
||
794 | 774 |
!MenuPanel class methodsFor:'image registration'! |
775 |
||
776 |
image:anImage onDevice:aDevice |
|
777 |
" |
|
778 |
Images := nil |
|
779 |
" |
|
2269 | 780 |
|deviceImages| |
794 | 781 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
782 |
anImage device == aDevice ifTrue:[ |
3938 | 783 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
784 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
785 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
786 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 787 |
|
1097 | 788 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
3938 | 789 |
Images at:aDevice put:(deviceImages := Dictionary new) |
2269 | 790 |
]. |
791 |
||
792 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
3938 | 793 |
image := anImage copy onDevice:aDevice. |
794 |
image clearMaskedPixels. |
|
795 |
deviceImages at:anImage put:image. |
|
796 |
image |
|
2269 | 797 |
]. |
794 | 798 |
! |
799 |
||
800 |
lightenedImage:anImage onDevice:aDevice |
|
801 |
" |
|
802 |
LigthenedImages := nil |
|
803 |
" |
|
2374 | 804 |
|deviceImages image colorMap| |
794 | 805 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
806 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 807 |
|
1097 | 808 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
3938 | 809 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 810 |
]. |
811 |
||
812 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
3938 | 813 |
^ image |
2374 | 814 |
]. |
815 |
||
816 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
817 |
||
818 |
colorMap notNil ifTrue:[ |
|
3938 | 819 |
image := anImage copy lightened onDevice:aDevice. |
820 |
image clearMaskedPixels. |
|
794 | 821 |
] ifFalse:[ |
3938 | 822 |
image := self image:anImage onDevice:aDevice |
794 | 823 |
]. |
1097 | 824 |
deviceImages at:anImage put:image. |
794 | 825 |
^ image |
826 |
! ! |
|
827 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
828 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
829 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
830 |
subMenu:aSubMenu |
2715 | 831 |
"create a submenu; can be redifined in derived classes" |
832 |
||
833 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
834 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
835 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
836 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
837 |
|
1808 | 838 |
!MenuPanel methodsFor:'accepting'! |
389 | 839 |
|
840 |
accept |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
841 |
"accept the current selected item" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
842 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
843 |
|item| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
844 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
845 |
(item := self selection) isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
846 |
self topMenu |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
847 |
openDelayed:nil; |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
848 |
accept:nil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
849 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
850 |
self acceptItem:item inMenu:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
851 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
852 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
853 |
"Modified: / 29-06-2011 / 16:14:26 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
854 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
855 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
856 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
857 |
"this is the topMenu: close the menu and accept the item (if not nil)" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
858 |
|
4089 | 859 |
|itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor| |
1630 | 860 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
861 |
self superMenu notNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
862 |
^ self topMenu accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
863 |
]. |
3142 | 864 |
prevFocusView ~~ self ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
865 |
focusView := prevFocusView. |
3142 | 866 |
]. |
867 |
prevFocusView := nil. |
|
868 |
||
2199 | 869 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
870 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
871 |
self selection:nil. |
420 | 872 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
873 |
(anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
874 |
tgState := anItemOrNil toggleIndication. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
875 |
panel := anItemOrNil menuPanel. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
876 |
itemIdx := panel findFirst:[:el| el == anItemOrNil ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
877 |
itemAcceptedOrNil := anItemOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
878 |
recv := panel receiver. |
389 | 879 |
]. |
1699 | 880 |
self doUngrab:true. |
389 | 881 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
882 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
883 |
|
510 | 884 |
self isPopUpView ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
885 |
self do:[:el| el updateIndicators]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
886 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
887 |
winGrp processExposeEvents. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
888 |
]. |
524 | 889 |
] ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
890 |
self unmap. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
891 |
self device sync. "/ round trip - all expose events are now received |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
892 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
893 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
894 |
"/ give expose event a chance to arrive |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
895 |
[shown and:[realized]] whileTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
896 |
winGrp processExposeEventsFor:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
897 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
898 |
masterGroup := winGrp previousGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
899 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
900 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
901 |
"/ self destroy. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
902 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
903 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
904 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
905 |
(focusView notNil and:[winGrp notNil]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
906 |
winGrp focusView:focusView. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
907 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
908 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
909 |
itemAcceptedOrNil isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
910 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
911 |
self isPopUpView ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
912 |
lastItem := itemAcceptedOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
913 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
914 |
^ itemAcceptedOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
915 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
916 |
|
4089 | 917 |
"/ using master maingroup, sensor in my current windowgroup |
918 |
"/ flushes its events if the window goes |
|
919 |
winGrp notNil ifTrue:[ |
|
920 |
winGrp mainGroup notNil ifTrue:[ |
|
921 |
sensor := winGrp mainGroup sensor. |
|
922 |
]. |
|
923 |
]. |
|
924 |
sensor isNil ifTrue:[sensor := self sensor ]. |
|
925 |
||
926 |
sensor pushEvent:( |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
927 |
MenuEvent |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
928 |
selectMenuItem:itemAcceptedOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
929 |
index:itemIdx |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
930 |
text:nil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
931 |
value:tgState |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
932 |
inMenu:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
933 |
menuReceiver:recv). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
934 |
|
4053 | 935 |
^ anItemOrNil. "/ stupid convention |
936 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
937 |
"/ acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
938 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
939 |
"/ winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
940 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
941 |
"/ (itemAcceptedOrNil showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
942 |
"/ and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
943 |
"/ ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
944 |
"/ winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
945 |
"/ ] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
946 |
"/ acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
947 |
"/ ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
948 |
|
4053 | 949 |
"Modified: / 07-07-2011 / 18:08:41 / cg" |
524 | 950 |
! |
951 |
||
952 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
953 |
"really accept an item" |
2715 | 954 |
|
3938 | 955 |
|selectorOrBlock argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
956 |
app master fallBack| |
524 | 957 |
|
2253 | 958 |
isValueModel := aReceiver isValueModel. |
959 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
960 |
hasPerformed := isValueModel. |
524 | 961 |
|
3558 | 962 |
(selectorOrBlock := anItem value) isNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
963 |
^ self "/ ^ anIndex |
524 | 964 |
]. |
965 |
||
966 |
(argument := anItem argument) isNil ifTrue:[ |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
967 |
argument := aState ? anItem |
389 | 968 |
]. |
524 | 969 |
|
3558 | 970 |
selectorOrBlock isSymbol ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
971 |
"/ a valueHolder or block |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
972 |
(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
973 |
^ self "/ ^ selectorOrBlock |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
974 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
975 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
976 |
numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
977 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
978 |
numArgs == 0 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
979 |
args := nil |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
980 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
981 |
numArgs == 1 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
982 |
args := Array with:argument |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
983 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
984 |
args := Array with:argument with:self |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
985 |
] |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
986 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
987 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
988 |
selectorOrBlock valueWithArguments:args. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
989 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
990 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
991 |
^ self "/ ^ anIndex |
524 | 992 |
]. |
993 |
||
2331 | 994 |
anItem sendToOriginator ifTrue:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
995 |
rec := self originator. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
996 |
rec isNil ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
997 |
self error:'no originating widget (no target for message)' mayProceed:true. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
998 |
]. |
2331 | 999 |
] ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1000 |
rec := aReceiver |
2331 | 1001 |
]. |
1002 |
||
1003 |
rec isNil ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1004 |
^ self "/ ^ selectorOrBlock |
2253 | 1005 |
]. |
1006 |
||
1007 |
isValueModel ifTrue:[ |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1008 |
rec value:selectorOrBlock |
465 | 1009 |
] ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1010 |
arg2 := self. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1011 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1012 |
"/ support for ST80 style applications |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1013 |
"/ (expecting the message to go to the application |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1014 |
"/ if not understood by the view) |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1015 |
"/ These expect the controller to be passed as argument. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1016 |
"/ sigh. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1017 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1018 |
(rec isView |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1019 |
and:[(rec respondsTo:selectorOrBlock) not |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1020 |
and:[(app := rec application) ~~ rec |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1021 |
and:[app notNil]]]) ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1022 |
arg2 := rec controller. "/ the Views controller |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1023 |
rec := app. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1024 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1025 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1026 |
(numArgs := selectorOrBlock numArgs) == 0 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1027 |
args := nil |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1028 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1029 |
numArgs == 1 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1030 |
args := Array with:argument |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1031 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1032 |
args := Array with:argument with:arg2 |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1033 |
] |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1034 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1035 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1036 |
fallBack := |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1037 |
[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1038 |
|val| |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1039 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1040 |
"/ mhmh - the receiver did not respond to that message; |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1041 |
"/ if there is a master-application, try that one |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1042 |
"/ (recursive) |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1043 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1044 |
master notNil ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1045 |
rec := master. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1046 |
val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1047 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1048 |
self |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1049 |
error:'unimplemented (or error in) menu message: ' , selectorOrBlock |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1050 |
mayProceed:true. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1051 |
val := nil. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1052 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1053 |
val |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1054 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1055 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1056 |
rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack. |
420 | 1057 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1058 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1059 |
^ self "/ ^ selectorOrBlock |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1060 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1061 |
"Modified: / 29-06-2011 / 16:22:08 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1062 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1063 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1064 |
acceptItem:anItemOrNil inMenu:aMenu |
2199 | 1065 |
|tgState topMenu| |
1066 |
||
1067 |
topMenu := self topMenu. |
|
1068 |
topMenu openDelayed:nil. |
|
1670 | 1069 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1070 |
(anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1071 |
topMenu accept:anItemOrNil |
1670 | 1072 |
] ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1073 |
anItemOrNil canAccept ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1074 |
tgState := anItemOrNil toggleIndication. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1075 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1076 |
self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1077 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1078 |
index:(aMenu selectionIndex) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1079 |
toggle:tgState |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1080 |
receiver:(aMenu receiver). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1081 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1082 |
aMenu do:[:el| el updateIndicators]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1083 |
anItemOrNil hideMenuOnActivated ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1084 |
aMenu invalidate |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1085 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1086 |
] |
1670 | 1087 |
] |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1088 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1089 |
"Modified: / 29-06-2011 / 14:34:45 / cg" |
1670 | 1090 |
! |
1091 |
||
389 | 1092 |
lastItemAccepted |
2715 | 1093 |
"returns last item selected or nil" |
1094 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1095 |
^ lastItem |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1096 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1097 |
"Modified: / 29-06-2011 / 16:24:48 / cg" |
389 | 1098 |
! |
1099 |
||
1100 |
lastValueAccepted |
|
2715 | 1101 |
"returns last value accepted or nil" |
1102 |
||
2253 | 1103 |
^ self lastItemAccepted value |
389 | 1104 |
! ! |
1105 |
||
388 | 1106 |
!MenuPanel methodsFor:'accessing'! |
1107 |
||
1108 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1109 |
"get the access character position for a textLabel" |
1110 |
||
2059 | 1111 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1112 |
! |
1113 |
||
1114 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1115 |
"get the access character position for a textLabel" |
1116 |
||
388 | 1117 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1118 |
! |
|
1119 |
||
1120 |
accessCharacterPositions |
|
2715 | 1121 |
"returns a collection of accessCharacterPositions or nil" |
1122 |
||
388 | 1123 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1124 |
! |
|
1125 |
||
1126 |
accessCharacterPositions:something |
|
2715 | 1127 |
"define accessCharacterPositions for each item" |
1128 |
||
388 | 1129 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1130 |
! |
|
1131 |
||
1132 |
args |
|
2715 | 1133 |
"returns a collection of arguments or nil" |
1134 |
||
388 | 1135 |
^ self collect:[:anItem| anItem argument ] |
1136 |
! |
|
1137 |
||
1138 |
args:something |
|
2715 | 1139 |
"define arguments for each item" |
1140 |
||
388 | 1141 |
self onEachPerform:#argument: withArgList:something |
1142 |
! |
|
1143 |
||
1144 |
argsAt:stringOrNumber |
|
2715 | 1145 |
"gets the argument of an item or nil" |
1146 |
||
2059 | 1147 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1148 |
! |
1149 |
||
1150 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1151 |
"sets the argument of an item" |
1152 |
||
388 | 1153 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1154 |
! |
|
1155 |
||
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1156 |
doAccessCharacterTranslation |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1157 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1158 |
Can be set to false to leave accessCharacter unchanged" |
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1159 |
|
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1160 |
^ doAccessCharacterTranslation ? true |
3958 | 1161 |
|
1162 |
"Modified: / 02-11-2010 / 10:19:09 / cg" |
|
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1163 |
! |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1164 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1165 |
doAccessCharacterTranslation:aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1166 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1167 |
Can be set to false to leave accessCharacter unchanged" |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1168 |
|
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1169 |
doAccessCharacterTranslation := aBoolean |
3958 | 1170 |
|
1171 |
"Modified: / 02-11-2010 / 10:19:14 / cg" |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1172 |
! |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1173 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1174 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1175 |
"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
|
1176 |
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
|
1177 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1178 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1179 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1180 |
"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
|
1181 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1182 |
|
388 | 1183 |
groupSizes |
2715 | 1184 |
"gets collection of group sizes" |
1185 |
||
388 | 1186 |
^ groupSizes |
1187 |
! |
|
1188 |
||
1189 |
groupSizes:aGroupSizes |
|
2715 | 1190 |
"sets collection of group sizes" |
1191 |
||
388 | 1192 |
aGroupSizes = groupSizes ifFalse:[ |
3938 | 1193 |
groupSizes := aGroupSizes copy. |
1194 |
self mustRearrange. |
|
388 | 1195 |
]. |
1196 |
! |
|
1197 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1198 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1199 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1200 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1201 |
|
3725 | 1202 |
hideOnRelease:aBoolean |
1203 |
hideOnRelease := aBoolean |
|
1204 |
! |
|
1205 |
||
388 | 1206 |
labelAt:stringOrNumber |
2715 | 1207 |
"gets the label of an item or nil" |
1208 |
||
388 | 1209 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1210 |
! |
|
1211 |
||
1212 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1213 |
"sets the label of an item" |
1214 |
||
388 | 1215 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1216 |
! |
|
1217 |
||
1218 |
labels |
|
2715 | 1219 |
"returns a collection of labels's or nil" |
1220 |
||
388 | 1221 |
^ self collect:[:anItem| anItem label ] |
1222 |
! |
|
1223 |
||
1224 |
labels:labels |
|
2715 | 1225 |
"define labels for each item" |
1226 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1227 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1228 |
|
388 | 1229 |
self disabledRedrawDo:[ |
3938 | 1230 |
self removeAll. |
1231 |
size := labels size. |
|
1232 |
||
1233 |
size > 0 ifTrue:[ |
|
1234 |
items := OrderedCollection new:size. |
|
1235 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1236 |
] |
|
1237 |
]. |
|
1238 |
! |
|
1239 |
||
1240 |
menuPerformer:anObject |
|
1999 | 1241 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1242 |
from all submenus no specific receiver is defined )." |
1243 |
||
1999 | 1244 |
^ self receiver:anObject |
1245 |
! |
|
1246 |
||
388 | 1247 |
nameKeyAt:stringOrNumber |
2715 | 1248 |
"gets the nameKey of an item or nil" |
1249 |
||
1250 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1251 |
! |
1252 |
||
1253 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1254 |
"sets the nameKey of an item" |
1255 |
||
388 | 1256 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1257 |
! |
|
1258 |
||
1259 |
nameKeys |
|
2715 | 1260 |
"returns a collection of nameKeyss or nil" |
1261 |
||
388 | 1262 |
^ self collect:[:anItem| anItem nameKey ] |
1263 |
! |
|
1264 |
||
1265 |
nameKeys:something |
|
2715 | 1266 |
"define nameKeys for each item" |
1267 |
||
388 | 1268 |
self onEachPerform:#nameKey: withArgList:something |
1269 |
! |
|
1270 |
||
1271 |
numberOfItems |
|
2715 | 1272 |
"gets number of items" |
1273 |
||
388 | 1274 |
^ items size |
1275 |
! |
|
1276 |
||
2331 | 1277 |
originator |
1278 |
originator notNil ifTrue:[^ originator]. |
|
1279 |
superMenu notNil ifTrue:[ |
|
3938 | 1280 |
^ superMenu originator |
2331 | 1281 |
]. |
1282 |
^ nil |
|
1283 |
! |
|
1284 |
||
388 | 1285 |
receiver |
1286 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1287 |
from all submenus no specific receiver is defined )." |
1288 |
||
389 | 1289 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
3938 | 1290 |
^ superMenu receiver |
388 | 1291 |
]. |
389 | 1292 |
^ receiver |
388 | 1293 |
! |
1294 |
||
3938 | 1295 |
receiver:anObject |
388 | 1296 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1297 |
from all submenus no specific receiver is defined )." |
1298 |
||
389 | 1299 |
receiver := anObject |
388 | 1300 |
! |
1301 |
||
1302 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1303 |
"gets the shortCutKey of an item or nil" |
1304 |
||
1305 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1306 |
! |
1307 |
||
1308 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1309 |
"sets the shortCutKey of an item" |
1310 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1311 |
self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1312 |
! |
388 | 1313 |
|
1314 |
shortcutKeys |
|
2715 | 1315 |
"returns a collection of shortcutKeys or nil" |
1316 |
||
388 | 1317 |
^ self collect:[:anItem| anItem shortcutKey ] |
1318 |
! |
|
1319 |
||
1320 |
shortcutKeys:something |
|
2715 | 1321 |
"define shortcutKeys for each item" |
1322 |
||
388 | 1323 |
self onEachPerform:#shortcutKey: withArgList:something |
1324 |
! |
|
1325 |
||
1326 |
valueAt:stringOrNumber |
|
2715 | 1327 |
"gets value of an item; a block, valueHolder, ..." |
1328 |
||
1329 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1330 |
! |
1331 |
||
1332 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1333 |
"sets value of an item; a block, valueHolder, ..." |
1334 |
||
388 | 1335 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1336 |
! |
|
1337 |
||
1338 |
values:something |
|
2715 | 1339 |
"define values for each item" |
1340 |
||
388 | 1341 |
self onEachPerform:#value: withArgList:something |
1342 |
! ! |
|
1343 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1344 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1345 |
|
1346 |
disableAll |
|
2715 | 1347 |
"disable all items; not the menu in case of enabled" |
1348 |
||
498 | 1349 |
self do:[:anItem| anItem enabled:false] |
388 | 1350 |
! |
1351 |
||
1352 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1353 |
"disable an collection of items" |
1354 |
||
388 | 1355 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1356 |
! |
|
1357 |
||
1358 |
enableAll |
|
2715 | 1359 |
"enable all items; not the menu in case of disabled" |
1360 |
||
498 | 1361 |
self do:[:anItem| anItem enabled:true] |
388 | 1362 |
! |
1363 |
||
1364 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1365 |
"enable an collection of items" |
1366 |
||
388 | 1367 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1368 |
! |
|
1369 |
||
1370 |
enabled |
|
2715 | 1371 |
"returns enabled state" |
1372 |
||
498 | 1373 |
^ enabled |
388 | 1374 |
! |
1375 |
||
1376 |
enabled:aState |
|
2715 | 1377 |
"change enabled state of menu" |
1378 |
||
545 | 1379 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1380 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1381 |
state := aState ? true. |
388 | 1382 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1383 |
enabled ~~ state ifTrue:[ |
3938 | 1384 |
enabled := state. |
1385 |
self invalidate. |
|
498 | 1386 |
]. |
388 | 1387 |
! |
1388 |
||
1389 |
enabledAt:stringOrNumber |
|
2715 | 1390 |
"gets the enabled state of an item or false" |
1391 |
||
388 | 1392 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1393 |
! |
|
1394 |
||
1395 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1396 |
"sets the enabled state of an item" |
1397 |
||
388 | 1398 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1399 |
! |
|
1400 |
||
3725 | 1401 |
exclusivePointer:aBoolean |
1402 |
"Do nothing here. Compatibility with PopUpListController" |
|
1403 |
||
1404 |
^ self |
|
1405 |
! |
|
1406 |
||
388 | 1407 |
isEnabled:stringOrNumber |
2715 | 1408 |
"gets the enabled state of an item or false" |
1409 |
||
388 | 1410 |
^ self enabledAt:stringOrNumber |
1411 |
! ! |
|
1412 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1413 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1414 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1415 |
enableChannel:aValueHolder |
2715 | 1416 |
"set my enableChannel" |
1417 |
||
498 | 1418 |
enableChannel notNil ifTrue:[ |
3938 | 1419 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1420 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1421 |
|
498 | 1422 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
3938 | 1423 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1424 |
]. |
498 | 1425 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1426 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1427 |
|
3222 | 1428 |
menuChannel |
1429 |
^ self menuHolder |
|
1430 |
||
1431 |
"Created: / 27-03-2007 / 08:38:31 / cg" |
|
1432 |
! |
|
1433 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1434 |
menuHolder:aValueHolder |
2715 | 1435 |
"set my menuHolder" |
1436 |
||
498 | 1437 |
menuHolder notNil ifTrue:[ |
3938 | 1438 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1439 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1440 |
|
498 | 1441 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
3938 | 1442 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1443 |
]. |
498 | 1444 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1445 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1446 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1447 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1448 |
|
616 | 1449 |
activeBackgroundColor |
2715 | 1450 |
"get the background drawing color used to highlight selection" |
1451 |
||
2219 | 1452 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1453 |
! |
1454 |
||
1455 |
activeForegroundColor |
|
2715 | 1456 |
"get the foreground color used to highlight selections" |
1457 |
||
2219 | 1458 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1459 |
! |
1460 |
||
390 | 1461 |
backgroundColor |
2715 | 1462 |
"return the background color" |
1463 |
||
502 | 1464 |
^ super viewBackground |
390 | 1465 |
! |
1466 |
||
1467 |
backgroundColor:aColor |
|
1468 |
"set the background drawing color. You should not use this method; |
|
2715 | 1469 |
instead, leave the value as defined in the styleSheet." |
1470 |
||
1471 |
self backgroundColor ~~ aColor ifTrue:[ |
|
3938 | 1472 |
super viewBackground:aColor. |
1473 |
self invalidate "/ RepairNow:true |
|
616 | 1474 |
] |
1475 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1476 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1477 |
! |
1478 |
||
727 | 1479 |
buttonActiveBackgroundColor |
2715 | 1480 |
"get the background drawing color used to highlight button selection" |
1481 |
||
2219 | 1482 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
3938 | 1483 |
default:(self viewBackground) |
727 | 1484 |
! |
1485 |
||
3441 | 1486 |
buttonActiveForegroundColor |
1487 |
"get the foreground drawing color used to highlight button selection" |
|
1488 |
||
1489 |
^ styleSheet colorAt:#'button.activeForegroundColor' |
|
3938 | 1490 |
default:(self foregroundColor) |
3441 | 1491 |
! |
1492 |
||
730 | 1493 |
buttonEdgeStyle |
2715 | 1494 |
"get the button edge style" |
1495 |
||
2219 | 1496 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1497 |
! |
1498 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1499 |
buttonEnteredBackgroundColor |
2715 | 1500 |
"get the background drawing color used to highlight entered button items" |
1501 |
||
2219 | 1502 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1503 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1504 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1505 |
buttonEnteredLevel |
2715 | 1506 |
"get the 3D-level used to highlight entered button items" |
1507 |
||
2219 | 1508 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1509 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1510 |
|
730 | 1511 |
buttonHalfLightColor |
2715 | 1512 |
"get the background drawing color used to half light button frame" |
1513 |
||
2219 | 1514 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1515 |
! |
1516 |
||
1517 |
buttonHalfShadowColor |
|
2715 | 1518 |
"get the background drawing color used to half shadow button frame" |
1519 |
||
2219 | 1520 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1521 |
! |
1522 |
||
1523 |
buttonLightColor |
|
2715 | 1524 |
"get the background drawing color used to light button frame" |
1525 |
||
2219 | 1526 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1527 |
! |
1528 |
||
1529 |
buttonPassiveBackgroundColor |
|
2715 | 1530 |
"get the background drawing color used for button" |
1531 |
||
2219 | 1532 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1533 |
! |
1534 |
||
1535 |
buttonShadowColor |
|
2715 | 1536 |
"get the background drawing color used to shadow button frame" |
1537 |
||
2219 | 1538 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1539 |
! |
1540 |
||
1541 |
disabledEtchedForegroundColor |
|
1542 |
"return the color used for etching disabled items. |
|
2715 | 1543 |
If nil, no 3D effect is drawn." |
1544 |
||
2219 | 1545 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1546 |
! |
1547 |
||
390 | 1548 |
disabledForegroundColor |
2715 | 1549 |
"return the foreground color used by disabled items" |
1550 |
||
2219 | 1551 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1552 |
! |
1553 |
||
2170 | 1554 |
enteredBackgroundColor |
2715 | 1555 |
"return the background color for entered items" |
1556 |
||
2219 | 1557 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
3938 | 1558 |
default:(self backgroundColor) |
2170 | 1559 |
! |
1560 |
||
1561 |
enteredForegroundColor |
|
2715 | 1562 |
"return the foreground color for entered items" |
1563 |
||
2219 | 1564 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1565 |
! |
1566 |
||
390 | 1567 |
font:aFont |
2715 | 1568 |
"set the font" |
1569 |
||
2614 | 1570 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1571 |
||
1572 |
super font:aFont. |
|
1573 |
self do:[:anItem| anItem fontChanged ]. |
|
1574 |
||
1575 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
3938 | 1576 |
self extent:(self preferredExtent) |
2614 | 1577 |
]. |
1578 |
self mustRearrange. |
|
390 | 1579 |
! |
1580 |
||
1581 |
foregroundColor |
|
2715 | 1582 |
"return the passive foreground color" |
1583 |
||
2059 | 1584 |
^ fgColor |
390 | 1585 |
! |
1586 |
||
1587 |
foregroundColor:aColor |
|
1588 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1589 |
instead leave the value as defined in the styleSheet." |
1590 |
||
2219 | 1591 |
aColor ~= fgColor ifTrue:[ |
3938 | 1592 |
fgColor := aColor onDevice:device. |
1593 |
self invalidate |
|
2219 | 1594 |
]. |
580 | 1595 |
! |
1596 |
||
1699 | 1597 |
maxAbsoluteButtonLevel |
1598 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1599 |
extent of a button" |
1600 |
||
3987 | 1601 |
^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0 |
1602 |
||
1603 |
"Modified: / 19-01-2011 / 21:21:53 / cg" |
|
390 | 1604 |
! |
1605 |
||
730 | 1606 |
selectionFrameBrightColor |
2715 | 1607 |
"get the selection frame bright color" |
1608 |
||
2219 | 1609 |
^ Color white |
730 | 1610 |
! |
1611 |
||
1612 |
selectionFrameDarkColor |
|
2715 | 1613 |
"get the selection frame dark color" |
1614 |
||
2219 | 1615 |
^ Color black |
730 | 1616 |
! |
1617 |
||
1727 | 1618 |
setFont:aFont |
3938 | 1619 |
"set the font if the argument is nonNil; |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1620 |
Return nil, if the font was unchanged; otherwise, return the old font" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1621 |
|
1727 | 1622 |
|currentFont| |
1623 |
||
1624 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
3938 | 1625 |
currentFont := font. |
1626 |
super font:aFont. |
|
1727 | 1627 |
]. |
1628 |
^ currentFont |
|
2761 | 1629 |
! |
1630 |
||
1631 |
viewBackground:aColor |
|
1632 |
super viewBackground:aColor |
|
390 | 1633 |
! ! |
1634 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1635 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1636 |
|
1637 |
height |
|
2715 | 1638 |
"default height" |
1639 |
||
3886 | 1640 |
self hasExplicitExtent ifFalse:[ |
3938 | 1641 |
^ self preferredHeight |
388 | 1642 |
]. |
1643 |
^ super height |
|
1644 |
! |
|
1645 |
||
2016 | 1646 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1647 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1648 |
device notNil ifTrue:[ |
3938 | 1649 |
"/ notice, the position-dependent query: if there is a higher secondary screen, |
1650 |
"/ this makes a difference in where a popUpMenu is allowed... |
|
1651 |
^ device usableWidth @ ((device usableHeightAt:(self origin)) - 2) |
|
1652 |
"/ ^ device usableExtent - 5. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1653 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1654 |
superMenu notNil ifTrue:[ |
3938 | 1655 |
^ superMenu maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1656 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1657 |
"don't know, assume there is no maxExtent" |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1658 |
self error:'don''t know maxExtent'. |
2016 | 1659 |
! |
1660 |
||
388 | 1661 |
preferredExtent |
2715 | 1662 |
"compute and returns my preferred extent" |
1663 |
||
2253 | 1664 |
|maxExtent usedExtent| |
2024 | 1665 |
|
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1666 |
"/ If I have an explicit preferredExtent.. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1667 |
explicitExtent notNil ifTrue:[ |
3938 | 1668 |
^ explicitExtent |
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1669 |
]. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1670 |
"/ If I have a cached preferredExtent value.. |
2016 | 1671 |
preferredExtent notNil ifTrue:[ |
3938 | 1672 |
^ preferredExtent |
2016 | 1673 |
]. |
3837 | 1674 |
|
2024 | 1675 |
usedExtent := self preferredExtentOfItems. |
1676 |
||
1677 |
superView isNil ifTrue:[ |
|
3938 | 1678 |
"/ is standalone |
1679 |
preferredWidth notNil ifTrue:[ |
|
1680 |
usedExtent x < preferredWidth ifTrue:[ |
|
1681 |
usedExtent := preferredWidth @ usedExtent y. |
|
1682 |
] |
|
1683 |
] |
|
1684 |
]. |
|
1685 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1686 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1687 |
maxExtent notNil ifTrue:[ |
3938 | 1688 |
usedExtent := usedExtent min:maxExtent. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1689 |
]. |
3837 | 1690 |
|
1691 |
preferredExtent := usedExtent. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1692 |
^ usedExtent |
2024 | 1693 |
|
1694 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1695 |
! |
1696 |
||
1697 |
preferredExtentOfItems |
|
1698 |
"compute and returns my preferred extent including all items |
|
3938 | 1699 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
2715 | 1700 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1701 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1702 |
x "{ Class:SmallInteger }" |
1703 |
y "{ Class:SmallInteger }" |
|
1704 |
size "{ Class:SmallInteger }" |
|
2883 | 1705 |
buttonInsetX2 "{ Class:SmallInteger }" |
1706 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1707 |
labelInsetX "{ Class:SmallInteger }" |
1708 |
labelInsetY "{ Class:SmallInteger }" |
|
1709 |
itemMargin "{ Class:SmallInteger }" |
|
1710 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1711 |
| |
388 | 1712 |
|
1699 | 1713 |
(size := items size) == 0 ifTrue:[ |
3938 | 1714 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
1715 |
^ 32 @ 32 |
|
2219 | 1716 |
]. |
3131 | 1717 |
stringOffsetX := nil. |
2883 | 1718 |
buttonInsetX2 := 2 * buttonInsetX. |
1719 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1720 |
|
1721 |
self isPopUpView ifFalse:[ |
|
3938 | 1722 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1723 |
] ifTrue:[ |
3938 | 1724 |
labelInsetX := labelInsetY := 0. |
1699 | 1725 |
]. |
1726 |
||
1727 |
x := 0. |
|
1728 |
y := 0. |
|
2219 | 1729 |
groupDividerSize := self groupDividerSize. |
388 | 1730 |
|
1731 |
self verticalLayout ifFalse:[ |
|
3938 | 1732 |
items keysAndValuesDo:[:key :el| |eX eY| |
1733 |
extent := el preferredExtent. |
|
1734 |
||
1735 |
"/ check for visibility (extent x ~~ 0) |
|
1736 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1737 |
eY := extent y. |
|
1738 |
||
1739 |
el isButton ifTrue:[ |
|
1740 |
eX := eX + buttonInsetX2. |
|
1741 |
eY := eY + buttonInsetY2. |
|
1742 |
] ifFalse:[ |
|
1743 |
eX := eX + labelInsetX. |
|
1744 |
eY := eY + labelInsetY. |
|
1745 |
]. |
|
1746 |
key ~~ size ifTrue:[ |
|
1747 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1748 |
x := x + groupDividerSize |
|
1749 |
] ifFalse:[ |
|
1750 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
1751 |
x := x + itemSpace |
|
1752 |
] |
|
1753 |
] |
|
1754 |
]. |
|
1755 |
x := x + eX. |
|
1756 |
y := y max:eY. |
|
1757 |
] |
|
1758 |
] |
|
388 | 1759 |
] ifTrue:[ |
3938 | 1760 |
hasMenu := false. |
1761 |
shCtKey := 0. |
|
1762 |
showAcc := MenuView showAcceleratorKeys == true. |
|
1763 |
y := x. |
|
1764 |
x := 0. |
|
1765 |
itemMargin := 2 * self itemMargin. |
|
1766 |
||
1767 |
items keysAndValuesDo:[:key :el| |eX eY| |
|
1768 |
extent := el preferredExtent. |
|
1769 |
||
1770 |
"/ check for visibility (extent x ~~ 0) |
|
1771 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1772 |
eY := extent y. |
|
1773 |
||
1774 |
el isButton ifTrue:[ |
|
1775 |
eX := eX + buttonInsetX2. |
|
1776 |
eY := eY + buttonInsetY2. |
|
1777 |
] ifFalse:[ |
|
1778 |
eX := eX + labelInsetX. |
|
1779 |
eY := eY + labelInsetY. |
|
1780 |
]. |
|
1781 |
hasMenu ifFalse:[ |
|
1782 |
hasMenu := el hasSubmenu |
|
1783 |
]. |
|
1784 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1785 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1786 |
]. |
|
1787 |
key ~~ size ifTrue:[ |
|
1788 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1789 |
y := y + groupDividerSize |
|
1790 |
] |
|
1791 |
]. |
|
1792 |
y := y + eY. |
|
1793 |
x := x max:eX. |
|
1794 |
]. |
|
1795 |
]. |
|
1796 |
x := x + itemMargin. |
|
1797 |
||
1798 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
|
1799 |
shortKeyInset := x + Item labelRightOffset. |
|
1800 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
|
1801 |
||
1802 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
|
1803 |
x := x + self shortcutKeyOffset. |
|
1804 |
] |
|
1805 |
]. |
|
1699 | 1806 |
"/ to have a small inset |
3938 | 1807 |
y := y + 1. |
1699 | 1808 |
"/ x := x + 1. |
1809 |
]. |
|
1810 |
x := x + margin + margin. |
|
1811 |
y := y + margin + margin. |
|
1812 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1813 |
^ x @ y |
388 | 1814 |
! |
1815 |
||
2253 | 1816 |
preferredWidth:aWidthOrNil |
1817 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1818 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1819 |
If not nil, the width is the maximum from the contained items and the required width." |
1820 |
||
2253 | 1821 |
preferredWidth := aWidthOrNil. |
2024 | 1822 |
! |
1823 |
||
388 | 1824 |
shortKeyInset |
2715 | 1825 |
"left inset of shortcutKey" |
1826 |
||
1827 |
^ shortKeyInset |
|
616 | 1828 |
! |
1829 |
||
3131 | 1830 |
stringOffsetXfor:anItem |
1831 |
"return the x offset for a MenuItem where to draw the text |
|
1832 |
" |
|
1833 |
|label w| |
|
1834 |
||
1835 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
1836 |
||
1837 |
stringOffsetX isNil ifTrue:[ |
|
3938 | 1838 |
stringOffsetX := 0. |
1839 |
||
1840 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
1841 |
self do:[:el| |
|
1842 |
el isVisible ifTrue:[ |
|
1843 |
( (label := el indicatorForm) notNil |
|
1844 |
or:[(label := el choiceForm) notNil] |
|
1845 |
) ifTrue:[ |
|
1846 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
1847 |
] ifFalse:[ |
|
1848 |
label := el displayLabel. |
|
1849 |
label class == LabelAndIcon ifTrue:[ |
|
1850 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
1851 |
]. |
|
1852 |
]. |
|
1853 |
]. |
|
1854 |
]. |
|
1855 |
]. |
|
3131 | 1856 |
]. |
1857 |
w := 0. |
|
1858 |
||
1859 |
( (label := anItem indicatorForm) notNil |
|
1860 |
or:[(label := anItem choiceForm) notNil] |
|
1861 |
) ifTrue:[ |
|
3938 | 1862 |
w := label width + 2. |
3131 | 1863 |
]. |
1864 |
stringOffsetX == 0 ifTrue:[ |
|
3938 | 1865 |
^ w |
3131 | 1866 |
]. |
1867 |
w == 0 ifTrue:[ |
|
3938 | 1868 |
label := anItem displayLabel. |
1869 |
||
1870 |
label class == LabelAndIcon ifTrue:[ |
|
1871 |
^ stringOffsetX - label xOfString |
|
1872 |
]. |
|
3131 | 1873 |
]. |
1874 |
^ stringOffsetX. |
|
1875 |
! |
|
1876 |
||
616 | 1877 |
subMenuIndicationWidth |
2219 | 1878 |
^ self rightArrow width |
388 | 1879 |
! ! |
1880 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1881 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1882 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1883 |
iconIndicationDisabledOff |
2219 | 1884 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1885 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1886 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1887 |
iconIndicationDisabledOn |
2219 | 1888 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1889 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1890 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1891 |
iconIndicationOff |
2219 | 1892 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1893 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1894 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1895 |
iconIndicationOn |
2219 | 1896 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1897 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1898 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1899 |
iconRadioGroupDisabledOff |
2219 | 1900 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1901 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1902 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1903 |
iconRadioGroupDisabledOn |
2219 | 1904 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1905 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1906 |
|
3565 | 1907 |
iconRadioGroupEnteredOff |
1908 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff) |
|
1909 |
! |
|
1910 |
||
1911 |
iconRadioGroupEnteredOn |
|
1912 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn) |
|
1913 |
! |
|
1914 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1915 |
iconRadioGroupOff |
2219 | 1916 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1917 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1918 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1919 |
iconRadioGroupOn |
2219 | 1920 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1921 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1922 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1923 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1924 |
|
1925 |
itemAt:stringOrNumber do:aOneArgBlock |
|
3938 | 1926 |
"evaluate the block for an item and return the result from the block. In case that |
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1927 |
the item does not exist nil is returned" |
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1928 |
|
388 | 1929 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1930 |
! |
|
1931 |
||
1932 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
3938 | 1933 |
"evaluate teh block for an item and return the result from the block. In case that |
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1934 |
the item does not exists the result of the exception block is returned (no arguments)" |
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1935 |
|
388 | 1936 |
|item| |
1937 |
||
1938 |
item := self itemAt:stringOrNumber. |
|
1939 |
item notNil ifTrue:[ ^ aOneArgBlock value:item ]. |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1940 |
^ exceptionBlock value |
706 | 1941 |
! |
1942 |
||
1943 |
itemAtIndex:anIndex |
|
2715 | 1944 |
"returns item at an index or nil" |
1945 |
||
706 | 1946 |
^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1947 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1948 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1949 |
items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1950 |
"returns the list of items or nil. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1951 |
Warning: do not change this list - it is mine !!" |
2715 | 1952 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1953 |
^ items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1954 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1955 |
"Modified: / 09-11-2010 / 10:10:40 / cg" |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1956 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1957 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1958 |
itemsDo:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1959 |
items notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1960 |
items do:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1961 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1962 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1963 |
"Created: / 09-11-2010 / 10:05:54 / cg" |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1964 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1965 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1966 |
itemsDoWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1967 |
items notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1968 |
items doWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1969 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1970 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
1971 |
"Created: / 09-11-2010 / 10:06:02 / cg" |
388 | 1972 |
! ! |
1973 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1974 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1975 |
|
727 | 1976 |
buttonActiveLevel |
2715 | 1977 |
"get the buttons active level" |
1978 |
||
2219 | 1979 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1980 |
! |
1981 |
||
1982 |
buttonPassiveLevel |
|
2715 | 1983 |
"get the buttons passive level" |
1984 |
||
3987 | 1985 |
^ (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0 |
1986 |
||
1987 |
"Modified: / 19-01-2011 / 21:21:26 / cg" |
|
727 | 1988 |
! |
1989 |
||
2337 | 1990 |
centerItems |
1991 |
^ centerItems ? false |
|
1992 |
! |
|
1993 |
||
1994 |
centerItems:aBoolean |
|
1995 |
centerItems := aBoolean |
|
1996 |
! |
|
1997 |
||
390 | 1998 |
fitFirstPanel |
3938 | 1999 |
"gets true if the first panel in the menu hierarchy must be fit |
390 | 2000 |
to the extent of its superView |
1699 | 2001 |
|
2715 | 2002 |
NOT SUPPORTED" |
2003 |
||
2219 | 2004 |
^ false |
388 | 2005 |
! |
2006 |
||
390 | 2007 |
fitFirstPanel:aState |
3938 | 2008 |
"sets true if the first panel in the menu hierarchy must be fit |
390 | 2009 |
to the extent of its superView |
1699 | 2010 |
|
2715 | 2011 |
NOT SUPPORTED" |
616 | 2012 |
! |
2013 |
||
1093 | 2014 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2015 |
anInt ~~ level ifTrue:[ |
3147 | 2016 |
super level:anInt. |
2017 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2018 |
] |
2052 | 2019 |
|
2020 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 2021 |
! |
2022 |
||
616 | 2023 |
rightArrow |
2374 | 2024 |
rightArrow isNil ifTrue:[ |
3938 | 2025 |
device isNil ifTrue:[ |
2026 |
^ SelectionInListView rightArrowFormOn:Display |
|
2027 |
]. |
|
2028 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
2219 | 2029 |
]. |
616 | 2030 |
^ rightArrow |
2031 |
! |
|
2032 |
||
2033 |
rightArrowShadow |
|
2034 |
^ rightArrowShadow |
|
388 | 2035 |
! |
2036 |
||
390 | 2037 |
showGroupDivider |
2715 | 2038 |
"get the enabled flag for showing groupDiveders" |
2039 |
||
2253 | 2040 |
^ showGroupDivider |
388 | 2041 |
! |
2042 |
||
390 | 2043 |
showGroupDivider:aState |
2715 | 2044 |
"set the enabled flag for showing groupDiveders" |
2045 |
||
2253 | 2046 |
showGroupDivider ~~ aState ifTrue:[ |
3938 | 2047 |
showGroupDivider := aState. |
2048 |
self mustRearrange. |
|
653 | 2049 |
] |
388 | 2050 |
! |
2051 |
||
2052 |
showSeparatingLines |
|
2715 | 2053 |
"gets true if drawing of separating lines is enabled." |
2054 |
||
2253 | 2055 |
^ showSeparatingLines |
388 | 2056 |
! |
2057 |
||
390 | 2058 |
showSeparatingLines:aState |
2715 | 2059 |
"turn on/off drawing of separating lines." |
2060 |
||
2253 | 2061 |
aState ~~ showSeparatingLines ifTrue:[ |
3938 | 2062 |
showSeparatingLines := aState. |
2063 |
self mustRearrange |
|
2253 | 2064 |
]. |
388 | 2065 |
! |
2066 |
||
2067 |
verticalLayout |
|
2715 | 2068 |
"get the layout: vertical( true ) or horizontal( false )" |
2069 |
||
2374 | 2070 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 2071 |
|
2072 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
3938 | 2073 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
2374 | 2074 |
^ verticalLayout |
388 | 2075 |
! |
2076 |
||
2077 |
verticalLayout:aState |
|
2715 | 2078 |
"set the layout: vertical( true ) or horizontal( false )" |
2079 |
||
2253 | 2080 |
aState ~~ verticalLayout ifTrue:[ |
3938 | 2081 |
verticalLayout isNil ifTrue:[ |
2082 |
verticalLayout := aState |
|
2083 |
] ifFalse:[ |
|
2084 |
verticalLayout := aState. |
|
2085 |
self mustRearrange. |
|
2086 |
]. |
|
2253 | 2087 |
]. |
388 | 2088 |
! ! |
2089 |
||
2219 | 2090 |
!MenuPanel methodsFor:'accessing-style'! |
2091 |
||
2092 |
buttonInsetX |
|
2715 | 2093 |
"returns the verical button space" |
2094 |
||
2883 | 2095 |
^ buttonInsetX |
2219 | 2096 |
! |
2097 |
||
2098 |
buttonInsetY |
|
2715 | 2099 |
"returns the verical button space" |
2100 |
||
2883 | 2101 |
^ buttonInsetY |
2219 | 2102 |
! |
2103 |
||
3975 | 2104 |
delayInSecondsBeforeOpeningSubmenu |
2105 |
"answer the seconds a submenu will be delayed before |
|
2106 |
open; an already open submenu than will be closed" |
|
2107 |
||
2108 |
^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu' default:0.2 |
|
2109 |
! |
|
2110 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2111 |
drawMenuIndicatorSeparatorLine |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2112 |
^ true. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2113 |
^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine' default:false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2114 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2115 |
|
2219 | 2116 |
enteredLevel |
2715 | 2117 |
"returns the enter-level for an unselected item moved through" |
2118 |
||
2219 | 2119 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
2120 |
! |
|
2121 |
||
2122 |
groupDividerSize |
|
2715 | 2123 |
"returns the width of a group divider" |
2124 |
||
2219 | 2125 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
2126 |
! |
|
2127 |
||
2128 |
itemMargin |
|
2715 | 2129 |
"returns the margin of an item" |
2130 |
||
2219 | 2131 |
^ styleSheet at:#'menu.itemMargin' default:0 |
2132 |
! |
|
2133 |
||
2134 |
itemSpace |
|
2715 | 2135 |
"returns the additional space for an item in a (vertical) panel" |
2136 |
||
2883 | 2137 |
^ itemSpace |
2219 | 2138 |
! |
2139 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2140 |
menuIndicatorVerticalPosition |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2141 |
"#center, #top or #bottom" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2142 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2143 |
^ #center |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2144 |
"/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2145 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2146 |
|
2219 | 2147 |
selectionFollowsMouse |
2715 | 2148 |
"returns true if the selection follows the mouse" |
2149 |
||
2219 | 2150 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
2151 |
! |
|
2152 |
||
2153 |
shortcutKeyOffset |
|
2715 | 2154 |
"returns the offset for a shortcutKey" |
2155 |
||
2219 | 2156 |
^ 5 |
2157 |
! ! |
|
2158 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2159 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 2160 |
|
2161 |
subMenuAt:stringOrNumber |
|
3192 | 2162 |
"gets the current submenu of an item; if the submenu is nil, the |
2163 |
submenu is generated if specified otherwise nil is returned." |
|
2164 |
||
2165 |
|submenu| |
|
2166 |
||
2167 |
self itemAt:stringOrNumber do:[:anItem| |
|
3938 | 2168 |
submenu := anItem currentSubmenu. |
2169 |
submenu isNil ifTrue:[ |
|
2170 |
submenu := anItem setupSubmenu |
|
2171 |
]. |
|
3192 | 2172 |
]. |
2173 |
^ submenu |
|
3934 | 2174 |
|
2175 |
"Modified: / 22-09-2010 / 13:53:21 / cg" |
|
388 | 2176 |
! |
2177 |
||
2178 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2179 |
"sets the submenu of an item" |
2180 |
||
388 | 2181 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2182 |
! |
|
2183 |
||
2184 |
subMenuShown |
|
2715 | 2185 |
"return the currently visible submenu - or nil if there is none" |
2186 |
||
3192 | 2187 |
|item submenu| |
2188 |
||
2189 |
item := self selection. |
|
2190 |
||
2191 |
item notNil ifTrue:[ |
|
3938 | 2192 |
submenu := item currentSubmenu. |
2193 |
||
2194 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2195 |
^ submenu |
|
2196 |
]. |
|
2715 | 2197 |
]. |
2198 |
^ nil |
|
388 | 2199 |
! ! |
2200 |
||
2504 | 2201 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2202 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2203 |
closeMenus |
2715 | 2204 |
"close all menus without accepting" |
2205 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2206 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2207 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2208 |
|
388 | 2209 |
hide |
2715 | 2210 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2211 |
|
2407 | 2212 |
"/ TODO: replace with LeaveSignal raise. |
2213 |
||
388 | 2214 |
self selection:nil. |
2215 |
self unmap. |
|
2216 |
! |
|
2217 |
||
2218 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2219 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2220 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2221 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2222 |
to some performer)" |
2223 |
||
2224 |
^ self showAt:(self origin) resizing:true |
|
388 | 2225 |
! |
2226 |
||
2227 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2228 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2229 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2230 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2231 |
to some performer)" |
2232 |
||
3754 | 2233 |
^ self showAt:aPoint resizing:true |
388 | 2234 |
! |
2235 |
||
2236 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2237 |
"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
|
2238 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2239 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2240 |
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
|
2241 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2242 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2243 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2244 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2245 |
|
2246 |
aBoolean ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2247 |
self fixSize. |
388 | 2248 |
]. |
2249 |
self origin:aPoint. |
|
1459 | 2250 |
"/ self makeFullyVisible. -- done in realize |
388 | 2251 |
self openModal:[true]. "realize " |
2252 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2253 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2254 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2255 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2256 |
self topMenu hasPerformed ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2257 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2258 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2259 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2260 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2261 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2262 |
"Modified: / 29-06-2011 / 16:24:22 / cg" |
388 | 2263 |
! |
2264 |
||
2265 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2266 |
"realize the view at the current pointer position. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2267 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2268 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2269 |
to some performer)" |
2270 |
||
4064
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2271 |
^ self showAt:(device pointerPosition) resizing:true |
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2272 |
|
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2273 |
"Modified (format): / 22-07-2011 / 15:24:48 / cg" |
388 | 2274 |
! |
2275 |
||
2276 |
showCenteredIn:aView |
|
2277 |
"make myself visible at the screen center. |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2278 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2279 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2280 |
to some performer)" |
2281 |
||
388 | 2282 |
|top| |
2283 |
||
2284 |
top := aView topView. |
|
2285 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2286 |
^ 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
|
2287 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2288 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2289 |
! |
2290 |
||
2291 |
startUp |
|
2292 |
"realize the menu at the current pointer position |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2293 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2294 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2295 |
to some performer)" |
2296 |
||
388 | 2297 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2298 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2299 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2300 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2301 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2302 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2303 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2304 |
to some performer)" |
2305 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2306 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2307 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2308 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2309 |
! |
2310 |
||
2332 | 2311 |
startUpFor:originatingWidget |
2312 |
"realize the menu at the current pointer position |
|
2313 |
return the value of the selectedItem or nil, of none was selected |
|
2314 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2315 |
to some performer)" |
2316 |
||
2332 | 2317 |
originator := originatingWidget. |
2318 |
^ self startUp |
|
2319 |
! |
|
2320 |
||
1750 | 2321 |
startUpOrNil |
2322 |
"realize the menu at the current pointer position |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2323 |
return the value of the selectedItem or nil, of none was selected |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2324 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2325 |
to some performer)" |
2326 |
||
1750 | 2327 |
^ self showAtPointer |
388 | 2328 |
! ! |
2329 |
||
2330 |
!MenuPanel methodsFor:'adding & removing'! |
|
2331 |
||
2332 |
createAtIndex:anIndexOrNil |
|
1800 | 2333 |
"create an item and add this item to the index. In case of nil, the item |
2334 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2335 |
otherwise the new created item is returned." |
2336 |
||
4046 | 2337 |
|max item index| |
388 | 2338 |
|
2339 |
max := (items size) + 1. |
|
2340 |
||
4046 | 2341 |
(index := anIndexOrNil) notNil ifTrue:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2342 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
4046 | 2343 |
index := max. |
2344 |
"/ ^ nil |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2345 |
] |
388 | 2346 |
]. |
2347 |
items isNil ifTrue:[ |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2348 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2349 |
] ifFalse:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2350 |
items := items asOrderedCollection |
388 | 2351 |
]. |
2352 |
item := Item in:self. |
|
2353 |
||
4046 | 2354 |
(index isNil or:[index == max]) ifTrue:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2355 |
items add:item |
388 | 2356 |
] ifFalse:[ |
4046 | 2357 |
items add:item beforeIndex:index |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2358 |
]. |
3966 | 2359 |
self mustRearrange. |
388 | 2360 |
^ item |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2361 |
|
4046 | 2362 |
"Modified: / 03-07-2011 / 22:49:47 / cg" |
388 | 2363 |
! |
2364 |
||
2365 |
remove:stringOrNumber |
|
2366 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2367 |
if found, remove and return it" |
2368 |
||
388 | 2369 |
|item| |
2370 |
||
2371 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2372 |
items remove:item. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2373 |
items isEmpty ifTrue:[items := nil]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2374 |
item destroy. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2375 |
self mustRearrange. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2376 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2377 |
^ item |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2378 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2379 |
"Modified: / 09-11-2010 / 10:04:08 / cg" |
388 | 2380 |
! |
2381 |
||
2382 |
removeAll |
|
2715 | 2383 |
"remove all items and submenus" |
2384 |
||
388 | 2385 |
self disabledRedrawDo:[ |
3938 | 2386 |
self selection:nil. |
2387 |
groupSizes := nil. |
|
2388 |
items notNil ifTrue:[ |
|
2389 |
items copy do:[:el| el destroy ]. |
|
2390 |
]. |
|
2391 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2392 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2393 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2394 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2395 |
! ! |
2396 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2397 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2398 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2399 |
update:something with:aParameter from:changedObject |
498 | 2400 |
|
2401 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2402 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2403 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2404 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2405 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2406 |
|
388 | 2407 |
!MenuPanel methodsFor:'converting'! |
2408 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2409 |
asMenu |
3222 | 2410 |
"convert contents to a menu" |
2715 | 2411 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2412 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2413 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2414 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2415 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2416 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2417 |
^ menu |
3222 | 2418 |
|
2419 |
"Modified: / 27-03-2007 / 08:39:48 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2420 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2421 |
|
388 | 2422 |
fromSpec:aMenuSpec |
2715 | 2423 |
"build from spec" |
2424 |
||
3222 | 2425 |
self menu:(Menu decodeFromLiteralArray:aMenuSpec) |
2426 |
||
2427 |
"Modified: / 27-03-2007 / 08:42:43 / cg" |
|
388 | 2428 |
! |
2429 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2430 |
menu:aMenu |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2431 |
"setup from a menu" |
2715 | 2432 |
|
388 | 2433 |
self disabledRedrawDo:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2434 |
|menu newItems menuReceiver| |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2435 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2436 |
self removeAll. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2437 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2438 |
(menu := aMenu) notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2439 |
(aMenu isCollection) ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2440 |
menu := Menu decodeFromLiteralArray:aMenu. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2441 |
] ifFalse:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2442 |
menuReceiver := menu receiver. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2443 |
menuReceiver notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2444 |
self receiver:menuReceiver. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2445 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2446 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2447 |
(newItems := menu menuItems) notEmptyOrNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2448 |
items := newItems collect:[:ni | |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2449 |
|i| |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2450 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2451 |
i:= Item in:self. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2452 |
i menuItem:ni. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2453 |
i. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2454 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2455 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2456 |
self groupSizes:(menu groupSizes). |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2457 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2458 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2459 |
|
3966 | 2460 |
"Modified: / 09-11-2010 / 11:52:28 / cg" |
388 | 2461 |
! ! |
2462 |
||
2681 | 2463 |
!MenuPanel methodsFor:'dependents access'! |
2464 |
||
2465 |
addDependencies |
|
2715 | 2466 |
"add all dependencies" |
2467 |
||
2681 | 2468 |
self do:[:anItem| anItem addDependencies ]. |
2469 |
||
2470 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2471 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2472 |
! |
|
2473 |
||
2474 |
removeDependencies |
|
2715 | 2475 |
"remove all dependencies" |
2476 |
||
2681 | 2477 |
self do:[:anItem| anItem removeDependencies ]. |
2478 |
||
2479 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2480 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2481 |
! ! |
|
2482 |
||
388 | 2483 |
!MenuPanel methodsFor:'drawing'! |
2484 |
||
2485 |
disabledRedrawDo:aBlock |
|
2486 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2487 |
of the block a redraw might be performed" |
2488 |
||
388 | 2489 |
|state| |
2490 |
||
2491 |
state := mustRearrange. |
|
2492 |
mustRearrange := true. |
|
2493 |
aBlock value. |
|
2494 |
mustRearrange := state. |
|
2495 |
self mustRearrange |
|
2496 |
! |
|
2497 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2498 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2499 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2500 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2501 |
aLevel ~~ 0 ifTrue:[ |
3938 | 2502 |
layout := anItem layout. |
2503 |
||
2504 |
styleSheet is3D ifFalse:[ |
|
2505 |
self displayRectangle:layout. |
|
2506 |
] ifTrue:[ |
|
2507 |
self drawEdgesForX:(layout left) |
|
2508 |
y:(layout top) |
|
2509 |
width:(layout width) |
|
2510 |
height:(layout height) |
|
2511 |
level:aLevel |
|
2512 |
shadow:(self buttonShadowColor) |
|
2513 |
light:(self buttonLightColor) |
|
2514 |
halfShadow:(self buttonHalfShadowColor) |
|
2515 |
halfLight:(self buttonHalfLightColor) |
|
2516 |
style:(self buttonEdgeStyle) |
|
2517 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2518 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2519 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2520 |
|
3187 | 2521 |
drawFocusForItem:anItem |
2522 |
|lytItem| |
|
2523 |
||
2524 |
lytItem := anItem layout. |
|
2525 |
self paint:(Color black). |
|
2526 |
||
2527 |
self displayDottedRectangleX:(lytItem left) |
|
3938 | 2528 |
y:(lytItem top) |
2529 |
width:(lytItem width) |
|
2530 |
height:(lytItem height). |
|
3187 | 2531 |
! |
2532 |
||
2016 | 2533 |
drawItemsX:x y:y width:w height:h |
2715 | 2534 |
"redraw items and groups in a damage" |
2535 |
||
2016 | 2536 |
|isVertical item layout prevClip |
2537 |
x1 "{ Class:SmallInteger }" |
|
2538 |
x2 "{ Class:SmallInteger }" |
|
2539 |
y1 "{ Class:SmallInteger }" |
|
2540 |
y2 "{ Class:SmallInteger }" |
|
2541 |
start "{ Class:SmallInteger }" |
|
2542 |
stop "{ Class:SmallInteger }" |
|
2543 |
size "{ Class:SmallInteger }" |
|
2544 |
groupDivInset "{ Class:SmallInteger }" |
|
2545 |
| |
|
2546 |
||
2547 |
size := items size. |
|
2548 |
isVertical := self verticalLayout. |
|
2549 |
||
2550 |
isVertical ifTrue:[ |
|
3938 | 2551 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2552 |
start == 0 ifTrue:[ ^ self ]. |
|
2553 |
y1 := y + h. |
|
2554 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
|
2555 |
startingAt:(start + 1). |
|
2016 | 2556 |
] ifFalse:[ |
3938 | 2557 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2558 |
start == 0 ifTrue:[ ^ self ]. |
|
2559 |
x1 := x + w. |
|
2560 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
|
2561 |
startingAt:(start + 1). |
|
2016 | 2562 |
]. |
2563 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2564 |
||
2253 | 2565 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
3938 | 2566 |
groupDivInset := self groupDividerSize // 2. |
2567 |
||
2568 |
groupDivInset ~~ 0 ifTrue:[ |
|
2569 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2570 |
start := start - 1 |
|
2571 |
] |
|
2572 |
]. |
|
2016 | 2573 |
] ifFalse:[ |
3938 | 2574 |
groupDivInset := 0 |
2016 | 2575 |
]. |
2576 |
||
2577 |
prevClip := clipRect. |
|
2578 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2579 |
||
2580 |
start to:stop do:[:i| |
|
3938 | 2581 |
item := items at:i. |
2582 |
item draw. |
|
2583 |
||
2584 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2585 |
layout := item layout. |
|
2586 |
||
2587 |
isVertical ifTrue:[ |
|
2588 |
x1 := layout left. |
|
2589 |
x2 := layout right. |
|
2590 |
y1 := layout bottom + groupDivInset. |
|
2591 |
y2 := y1. |
|
2592 |
] ifFalse:[ |
|
2593 |
y1 := layout top. |
|
2594 |
y2 := layout bottom. |
|
2595 |
x1 := layout right + groupDivInset. |
|
2596 |
x2 := x1. |
|
2597 |
]. |
|
2598 |
self paint:shadowColor. |
|
2599 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2600 |
self paint:lightColor. |
|
2601 |
||
2602 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2603 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2604 |
||
2605 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2606 |
]. |
|
2607 |
selection == item ifTrue:[ |
|
2608 |
self focusComesByTab ifTrue:[ |
|
2609 |
self drawFocusForItem:item. |
|
2610 |
]. |
|
2611 |
]. |
|
2016 | 2612 |
]. |
2613 |
self clippingRectangle:prevClip. |
|
2614 |
! |
|
2615 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2616 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2617 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2618 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2619 |
isSelected ifTrue:[ |
3938 | 2620 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2621 |
] ifFalse:[ |
3938 | 2622 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2623 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2624 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2625 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2626 |
level ~~ 0 ifTrue:[ |
3938 | 2627 |
layout := anItem layout. |
2628 |
||
2629 |
self drawEdgesForX:(layout left) |
|
2630 |
y:(layout top) |
|
2631 |
width:(layout width) |
|
2632 |
height:(layout height) |
|
2633 |
level:level |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2634 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2635 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2636 |
|
2016 | 2637 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2638 |
"draw a scroller" |
2639 |
||
2016 | 2640 |
|scrolling icon level x y w h| |
2641 |
||
2642 |
x := bounds left. |
|
2643 |
y := bounds top. |
|
2644 |
w := bounds width. |
|
2645 |
h := bounds height. |
|
2646 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2647 |
scrolling := self scrollActivity. |
2016 | 2648 |
|
2649 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
3938 | 2650 |
level := -2 |
2016 | 2651 |
] ifFalse:[ |
3938 | 2652 |
level := 1 |
2016 | 2653 |
]. |
2654 |
||
2655 |
level ~~ 0 ifTrue:[ |
|
3938 | 2656 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2657 |
]. |
2658 |
icon := scrolling iconAt:aDirection on:self. |
|
2659 |
||
2660 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
3938 | 2661 |
y:(y + (h - icon height // 2)). |
2016 | 2662 |
! |
2663 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2664 |
invalidateItem:anItem repairNow:aBool |
2715 | 2665 |
"an item changed; invalidate the items layout" |
2666 |
||
2016 | 2667 |
|layout| |
2668 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2669 |
(mustRearrange not and:[shown]) ifTrue:[ |
3938 | 2670 |
layout := anItem layout. |
2671 |
||
2672 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2673 |
self invalidate:(layout "insetBy:-1") repairNow:aBool |
|
2674 |
] |
|
1728 | 2675 |
]. |
2676 |
||
2677 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2678 |
! |
2679 |
||
388 | 2680 |
mustRearrange |
2715 | 2681 |
"force rearrange (i.e. set the rearrange flag)" |
2682 |
||
2080 | 2683 |
mustRearrange ifFalse:[ |
3938 | 2684 |
mustRearrange := true. |
2685 |
self invalidate "/ RepairNow:true |
|
388 | 2686 |
] |
590 | 2687 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2688 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2689 |
! |
2690 |
||
710 | 2691 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2692 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2693 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2694 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2695 |
|
1699 | 2696 |
|layout point |
710 | 2697 |
dltX "{ Class:SmallInteger }" |
2698 |
start "{ Class:SmallInteger }" |
|
2699 |
| |
|
2700 |
||
2701 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
3938 | 2702 |
^ self |
710 | 2703 |
]. |
2704 |
||
2705 |
layout := items last layout. |
|
3246 | 2706 |
layout notNil ifTrue:[ |
3938 | 2707 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2708 |
^ self "/ no free space |
|
2709 |
]. |
|
710 | 2710 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2711 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2712 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2713 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2714 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2715 |
"/ This allows for groups to be specified as #right under motif, but |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2716 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2717 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
3938 | 2718 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
3148 | 2719 |
] ifFalse:[ |
3938 | 2720 |
start := items findFirst:[:anItem| anItem startGroup == #right or:[ anItem startGroup == #conditionalRight ] ]. |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2721 |
]. |
710 | 2722 |
start == 0 ifTrue:[ |
3938 | 2723 |
^ self "/ no right-group item detected |
1699 | 2724 |
]. |
2725 |
point := dltX @ 0. |
|
2726 |
||
2727 |
"/ move items layout to right |
|
710 | 2728 |
items from:start do:[:anItem| |
3938 | 2729 |
anItem isVisible ifTrue:[ |
2730 |
anItem layout moveBy:point. |
|
2731 |
] |
|
710 | 2732 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2733 |
self updateEnteredItem. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2734 |
|
3246 | 2735 |
"Modified: / 10-10-2007 / 00:29:34 / cg" |
710 | 2736 |
! |
2737 |
||
388 | 2738 |
rearrangeItems |
1699 | 2739 |
"recompute the layout of each item |
3938 | 2740 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2715 | 2741 |
|
1791 | 2742 |
|isVertical extent isPopUpMenu |
2219 | 2743 |
x "{ Class:SmallInteger }" |
2744 |
y "{ Class:SmallInteger }" |
|
2745 |
x0 "{ Class:SmallInteger }" |
|
2746 |
y0 "{ Class:SmallInteger }" |
|
2747 |
x1 "{ Class:SmallInteger }" |
|
2748 |
y1 "{ Class:SmallInteger }" |
|
2749 |
size "{ Class:SmallInteger }" |
|
2750 |
insetX "{ Class:SmallInteger }" |
|
2751 |
insetY "{ Class:SmallInteger }" |
|
2752 |
labelInsetX "{ Class:SmallInteger }" |
|
2753 |
labelInsetY "{ Class:SmallInteger }" |
|
2754 |
itemMargin "{ Class:SmallInteger }" |
|
2755 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2756 |
| |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2757 |
|
1699 | 2758 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
3938 | 2759 |
mustRearrange := false. |
2760 |
^ self |
|
390 | 2761 |
]. |
2219 | 2762 |
|
2080 | 2763 |
"/ DON'T SET THIS!! |
3938 | 2764 |
"/ item layout: below of first item -> item invalidate |
2765 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2080 | 2766 |
"/ -> invalidate:rapairDamage: |
2767 |
"/ -> redrawX:y:width:height: |
|
2768 |
"/ tries to get uninitialized layout from second item. |
|
2769 |
"/ This happens in a modal debugger!! |
|
2770 |
"/ mustRearrange := false. |
|
2219 | 2771 |
isVertical := self verticalLayout. |
2772 |
groupDividerSize := self groupDividerSize. |
|
2773 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2774 |
|
2775 |
isPopUpMenu ifFalse:[ |
|
3938 | 2776 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2777 |
] ifTrue:[ |
3938 | 2778 |
labelInsetX := labelInsetY := 0 |
2779 |
]. |
|
2780 |
||
2781 |
(isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ |
|
2782 |
|saveExtent maxExtent extentToSet| |
|
2783 |
||
2784 |
extent := self preferredExtent. |
|
2785 |
||
2786 |
isPopUpMenu ifTrue:[ |
|
2787 |
maxExtent := self maxExtent. |
|
2788 |
maxExtent notNil ifTrue:[ |
|
2789 |
extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] |
|
2790 |
ifFalse:[(extent x min:(maxExtent x)) @ extent y]. |
|
2791 |
]. |
|
2792 |
] ifFalse:[ |
|
2793 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
|
2794 |
]. |
|
2795 |
self extent:extentToSet. |
|
390 | 2796 |
] ifFalse:[ |
3938 | 2797 |
extent := self computeExtent |
390 | 2798 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2799 |
|
1093 | 2800 |
x := y := margin. |
2801 |
||
1699 | 2802 |
isVertical ifFalse:[ |
3938 | 2803 |
y0 := margin. |
2804 |
y1 := extent y - margin. |
|
2805 |
||
2806 |
items keysAndValuesDo:[:anIndex :el| |
|
2807 |
el isVisible ifFalse:[ |
|
2808 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2809 |
] ifTrue:[ |
|
2810 |
el isButton ifTrue:[ |
|
2811 |
insetX := buttonInsetX. |
|
2812 |
insetY := buttonInsetY. |
|
2813 |
] ifFalse:[ |
|
2814 |
insetX := labelInsetX. |
|
2815 |
insetY := labelInsetY. |
|
2816 |
]. |
|
2817 |
x0 := x + insetX. |
|
2818 |
x1 := x0 + (el preferredWidth). |
|
2819 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
|
2820 |
x := x1 + insetX. |
|
2821 |
||
2822 |
size ~~ anIndex ifTrue:[ |
|
2823 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2824 |
x := x + groupDividerSize |
|
2825 |
] ifFalse:[ |
|
2826 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
2827 |
x := x + itemSpace |
|
2828 |
] |
|
2829 |
] |
|
2830 |
] |
|
2831 |
]. |
|
2832 |
]. |
|
1699 | 2833 |
] ifTrue:[ |
3938 | 2834 |
itemMargin := self itemMargin. |
2835 |
x0 := margin. |
|
2836 |
x1 := extent x - margin - itemMargin. "/ -1 |
|
2837 |
||
2838 |
items keysAndValuesDo:[:anIndex :el| |
|
2839 |
el isVisible ifFalse:[ |
|
2840 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2841 |
] ifTrue:[ |
|
2842 |
el isButton ifTrue:[ |
|
2843 |
insetX := buttonInsetX. |
|
2844 |
insetY := buttonInsetY. |
|
2845 |
] ifFalse:[ |
|
2846 |
insetX := labelInsetX. |
|
2847 |
insetY := labelInsetY. |
|
2848 |
]. |
|
2849 |
y0 := y + insetY. |
|
2850 |
y1 := y0 + el preferredHeight. |
|
2851 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
|
2852 |
y := y1 + insetY. |
|
2853 |
||
2854 |
size ~~ anIndex ifTrue:[ |
|
2855 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2856 |
y := y + groupDividerSize |
|
2857 |
] |
|
2858 |
] |
|
2859 |
] |
|
2860 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2861 |
]. |
710 | 2862 |
self rearrangeGroups. |
2048 | 2863 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2864 |
mustRearrange := false. |
2048 | 2865 |
|
2866 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2867 |
! |
2868 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2869 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2870 |
"check for items which can change its visibility; |
2715 | 2871 |
if at least one item exists, rearrange all items" |
2872 |
||
1464 | 2873 |
items isNil ifTrue:[^ self]. |
1699 | 2874 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2875 |
items do:[:item | |
3938 | 2876 |
item canChangeVisibility ifTrue:[ |
2877 |
mustRearrange := true. |
|
2878 |
self rearrangeItems. |
|
2879 |
^ self |
|
2880 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2881 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2882 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2883 |
|
388 | 2884 |
redrawX:x y:y width:w height:h |
2715 | 2885 |
"redraw a damage" |
2886 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2887 |
|y0 y1 x0 x1 prvBound mustDraw nxtBound| |
388 | 2888 |
|
710 | 2889 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2890 |
|
1699 | 2891 |
mustRearrange ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2892 |
self isPopUpView ifFalse:[ self explicitExtent:true]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2893 |
self rearrangeItems. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2894 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2895 |
^ self |
1699 | 2896 |
]. |
2888 | 2897 |
"/ self paint:(self viewBackground). |
1699 | 2898 |
self clearRectangleX:x y:y width:w height:h. |
2899 |
||
2016 | 2900 |
items size == 0 ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2901 |
^ self |
1699 | 2902 |
]. |
2016 | 2903 |
y0 := y. |
2904 |
y1 := y + h. |
|
2018 | 2905 |
x0 := x. |
2906 |
x1 := x + w. |
|
2016 | 2907 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2908 |
"Draw the scroll handles - especially for Popup-Lists" |
3938 | 2909 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2910 |
self hasScrollers ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2911 |
(self hasScrollerAt:#PREV) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2912 |
prvBound := self scrollerBoundsAt:#PREV. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2913 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2914 |
self verticalLayout ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2915 |
(mustDraw := (prvBound bottom > y)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2916 |
y0 := prvBound bottom. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2917 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2918 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2919 |
(mustDraw := (prvBound right > x)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2920 |
x0 := prvBound right. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2921 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2922 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2923 |
mustDraw ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2924 |
self drawScrollerAt:#PREV bounds:prvBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2925 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2926 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2927 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2928 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2929 |
nxtBound := self scrollerBoundsAt:#NEXT. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2930 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2931 |
self verticalLayout ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2932 |
(mustDraw := (nxtBound top < y1)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2933 |
y1 := nxtBound top. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2934 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2935 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2936 |
(mustDraw := (nxtBound left < x1)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2937 |
x1 := nxtBound left. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2938 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2939 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2940 |
mustDraw ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2941 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2942 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2943 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2944 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2945 |
lastDrawnScrollerNextBounds := nxtBound. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2946 |
|
2018 | 2947 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2948 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2949 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2950 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2951 |
"Modified: / 29-06-2011 / 16:24:34 / cg" |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2952 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2953 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2954 |
updateEnteredItem |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2955 |
|mousePoint| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2956 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2957 |
mousePoint := device translatePoint:(device pointerPosition) |
3938 | 2958 |
fromView:nil |
2959 |
toView:self. |
|
2960 |
||
2961 |
(self containsPoint:mousePoint) ifTrue:[ |
|
2962 |
enteredItem := self itemAtPoint:mousePoint |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2963 |
]. |
388 | 2964 |
! ! |
2965 |
||
2966 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2967 |
||
2968 |
collect:aOneArgBlock |
|
2969 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 2970 |
and return a collection of the results" |
2971 |
||
388 | 2972 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 2973 |
^ nil |
388 | 2974 |
! |
2975 |
||
2976 |
do:aOneArgBlock |
|
2715 | 2977 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
2978 |
||
388 | 2979 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
2980 |
! |
|
2981 |
||
2982 |
findFirst:aOneArgBlock |
|
3206 | 2983 |
"find the index of the first item, for which evaluation of the argument, aOneArgBlock |
2715 | 2984 |
returns true; return its index or 0 if none detected." |
2985 |
||
388 | 2986 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 2987 |
^ 0 |
388 | 2988 |
! |
2989 |
||
2990 |
findLast:aOneArgBlock |
|
2991 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2992 |
returns true; return its index or 0 if none detected." |
2993 |
||
388 | 2994 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 2995 |
^ 0 |
388 | 2996 |
! |
2997 |
||
3187 | 2998 |
firstItemSelectable |
2999 |
"returns the first item which is selectable or nil |
|
3000 |
" |
|
3001 |
items size > 0 ifTrue:[ |
|
3938 | 3002 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
3187 | 3003 |
]. |
3004 |
^ nil |
|
3005 |
! |
|
3006 |
||
390 | 3007 |
indexOf:something |
3008 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 3009 |
If no item match 0 is returned. No range checks are performed on a number argument" |
3010 |
||
390 | 3011 |
|i v| |
3012 |
||
3013 |
something isNumber ifTrue:[ ^ something ]. |
|
3014 |
something isNil ifTrue:[ ^ 0 ]. |
|
3015 |
||
1218 | 3016 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 3017 |
|
3018 |
i ~~ 0 ifTrue:[ |
|
3938 | 3019 |
^ i |
388 | 3020 |
]. |
390 | 3021 |
|
3022 |
something isSymbol ifTrue:[ |
|
3938 | 3023 |
i := self findFirst:[:el| |
3024 |
v := el value. |
|
3025 |
v isSymbol and:[v == something] |
|
3026 |
]. |
|
3027 |
i ~~ 0 ifTrue:[ |
|
3028 |
^ i |
|
3029 |
] |
|
390 | 3030 |
]. |
3031 |
||
3032 |
(something respondsTo:#string) ifTrue:[ |
|
3938 | 3033 |
v := something string. |
1218 | 3034 |
^ self findFirst:[:el | el textLabel = v]. |
3035 |
]. |
|
3036 |
^ 0 |
|
388 | 3037 |
! |
3038 |
||
706 | 3039 |
indexOfItem:anItem |
2715 | 3040 |
"returns the index of the item or 0" |
3041 |
||
706 | 3042 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
3043 |
! |
|
3044 |
||
388 | 3045 |
keysAndValuesDo:aTwoArgBlock |
2715 | 3046 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
3047 |
||
388 | 3048 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
3049 |
! ! |
|
3050 |
||
3051 |
!MenuPanel methodsFor:'event handling'! |
|
3052 |
||
3053 |
buttonMotion:state x:x y:y |
|
2715 | 3054 |
"open or close the corresponding submenu" |
3055 |
||
2046 | 3056 |
|menue motionPoint translatedPoint sensor| |
1699 | 3057 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3058 |
self scrollActivity isActive ifTrue:[ |
3938 | 3059 |
^ self |
2016 | 3060 |
]. |
3061 |
||
1699 | 3062 |
sensor := self sensor. |
3063 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
3938 | 3064 |
^ self |
1699 | 3065 |
]. |
3066 |
menue := self detectGrabMenu. |
|
1841 | 3067 |
|
2046 | 3068 |
motionPoint := x@y. |
3069 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 3070 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 3071 |
|
3780 | 3072 |
"/ hideOnRelease := true. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3073 |
|
1699 | 3074 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
3938 | 3075 |
^ self |
1699 | 3076 |
]. |
3077 |
||
3826 | 3078 |
hideOnRelease ifTrue:[ |
3938 | 3079 |
sensor anyButtonPressed ifFalse:[^ self] |
3826 | 3080 |
] ifFalse:[ |
3938 | 3081 |
sensor anyButtonPressed ifTrue:[^ self] |
3826 | 3082 |
]. |
3083 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3084 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
3938 | 3085 |
"/ selection on grabView without a submenu (Button ...); check whether moving out |
3086 |
(self containsPoint:motionPoint) ifFalse:[ |
|
3087 |
^ self accept:nil |
|
3088 |
] |
|
1699 | 3089 |
]. |
3090 |
||
2048 | 3091 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 3092 |
! |
3093 |
||
3094 |
buttonPress:button x:x y:y |
|
2715 | 3095 |
"any button pressed; open or close the corresponding submenus" |
3096 |
||
3921 | 3097 |
|menu point screen screenPoint targetView targetPoint| |
2016 | 3098 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3099 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3100 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3101 |
self scrollActivity stop. |
2016 | 3102 |
point := x@y. |
3103 |
menu := self detectMenuAtGrabPoint:point. |
|
3104 |
||
3105 |
menu isNil ifTrue:[ |
|
4082 | 3106 |
self accept:nil. |
3107 |
||
3108 |
"/ tell underlying view about the click... |
|
3109 |
(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease]) ifTrue:[ |
|
3110 |
screen := self device. |
|
3111 |
screenPoint := screen translatePointToRoot:point fromView:self. |
|
3112 |
targetView := screen viewFromPoint:screenPoint. |
|
3113 |
targetView notNil ifTrue:[ |
|
3114 |
targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView. |
|
3115 |
targetView buttonPress:button x:targetPoint x y:targetPoint y. |
|
3116 |
] |
|
3117 |
]. |
|
2016 | 3118 |
] ifFalse:[ |
4082 | 3119 |
point := menu translateGrabPoint:point. |
3120 |
menu handleButtonPress:button atPoint:point. |
|
2016 | 3121 |
] |
2046 | 3122 |
|
4082 | 3123 |
"Modified: / 02-10-2011 / 09:20:08 / cg" |
1699 | 3124 |
! |
3125 |
||
3126 |
buttonRelease:button x:x y:y |
|
2715 | 3127 |
"button release action; accept selection and close all views" |
3128 |
||
3938 | 3129 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
3203 | 3130 |
releaseTime menuMapTime| |
2199 | 3131 |
|
3780 | 3132 |
hideOnRelease ifFalse:[ |
3938 | 3133 |
^ self |
3780 | 3134 |
]. |
3135 |
||
2199 | 3136 |
topMenu := self topMenu. |
3137 |
topMenu openDelayed:nil. |
|
1699 | 3138 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3139 |
self scrollActivity stop ifTrue:[ |
3938 | 3140 |
^ self |
2016 | 3141 |
]. |
3142 |
||
1699 | 3143 |
dstMenu := topMenu activeMenu. |
3144 |
||
2679 | 3145 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
3146 |
||
3147 |
hideMenuAndPerformAction ifFalse:[ |
|
3938 | 3148 |
hideOnRelease ifTrue:[ |
3149 |
releaseTime := windowGroup lastEvent timeStamp. |
|
3150 |
menuMapTime := dstMenu mapTime ? releaseTime. |
|
3151 |
||
3152 |
hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime) |
|
3153 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
3154 |
]. |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3155 |
]. |
2679 | 3156 |
hideMenuAndPerformAction ifTrue:[ |
3938 | 3157 |
srcPoint := x@y. |
3158 |
||
3159 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
|
3160 |
and:[(item := dstMenu selection) notNil] |
|
3161 |
) ifTrue:[ |
|
3162 |
item visibleSubmenu notNil ifTrue:[ |
|
3163 |
dstMenu selection:nil. |
|
3164 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
|
3165 |
self accept:nil. |
|
3166 |
]. |
|
3167 |
^ self |
|
3168 |
]. |
|
3169 |
subm := item currentSubmenu. |
|
3170 |
||
3171 |
subm notNil ifTrue:[ |
|
3172 |
subm shown ifTrue:[^ self]. |
|
3173 |
"/ test whether any action is assigned to the menu |
|
3174 |
"/ if not ignorre accept |
|
3175 |
item hasDelayedMenu ifFalse:[^ self]. |
|
3176 |
"/ handle action defined for the delayed menu |
|
3177 |
]. |
|
3178 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
3179 |
||
3180 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
|
3181 |
item := nil |
|
3182 |
]. |
|
3183 |
topMenu acceptItem:item inMenu:dstMenu. |
|
3184 |
^ self |
|
3185 |
]. |
|
3186 |
||
3187 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
|
3188 |
selection visibleSubmenu notNil ifTrue:[ |
|
3189 |
^ self |
|
3190 |
] |
|
3191 |
]. |
|
3192 |
self accept:nil. |
|
1699 | 3193 |
]. |
3194 |
! |
|
3195 |
||
2860 | 3196 |
handleSizeChanged:how |
3197 |
"used to handle the scrollers and groups in a none popUpView |
|
3198 |
" |
|
3199 |
|layouts damage isVertical scrollBound| |
|
3200 |
||
3201 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3202 |
^ self |
2860 | 3203 |
]. |
3204 |
mustRearrange := true. |
|
3205 |
||
3206 |
shown ifFalse:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3207 |
^ self |
2860 | 3208 |
]. |
3209 |
layouts := OrderedCollection new. |
|
3210 |
||
3211 |
items do:[:el| |layout| |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3212 |
(layout := el layout) isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3213 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3214 |
^ self. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3215 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3216 |
layouts add:layout. |
2860 | 3217 |
]. |
3218 |
isVertical := self verticalLayout. |
|
3219 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3220 |
||
3221 |
self rearrangeItems. |
|
3222 |
||
3223 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3224 |
damage isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3225 |
newLyt := el layout. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3226 |
oldLyt := layouts at:i ifAbsent:newLyt. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3227 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3228 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3229 |
start := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3230 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3231 |
i > 1 ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3232 |
isVertical ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3233 |
x := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3234 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3235 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3236 |
y := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3237 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3238 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3239 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3240 |
start <= 20 ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3241 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3242 |
^ self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3243 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3244 |
damage := Rectangle left:x top:y extent:(self extent). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3245 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3246 |
]. |
2860 | 3247 |
]. |
3248 |
damage isNil ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3249 |
damage := scrollBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3250 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3251 |
scrollBound := lastDrawnScrollerNextBounds. |
2860 | 3252 |
scrollBound notNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3253 |
damage := damage merge:scrollBound |
2860 | 3254 |
]. |
3255 |
self invalidate:damage. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3256 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3257 |
"Modified: / 29-06-2011 / 16:24:59 / cg" |
2860 | 3258 |
! |
3259 |
||
1699 | 3260 |
keyPress:key x:x y:y |
2715 | 3261 |
"any key is pressed" |
3262 |
||
2869 | 3263 |
<resource: #keyboard (#Escape |
3938 | 3264 |
#Tab #FocusNext #FocusPrevious |
3265 |
#CursorLeft #CursorRight )> |
|
2869 | 3266 |
|
3267 |
|menu menusSuperMenu sensor| |
|
2251 | 3268 |
|
3269 |
sensor := self sensor. |
|
3158 | 3270 |
|
3271 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3272 |
"/ ^ self "/ ignored while any button is pressed |
|
3273 |
"/ ]. |
|
1699 | 3274 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3275 |
self scrollActivity isActive ifTrue:[ |
3938 | 3276 |
key ~~ #Escape ifTrue:[ |
3277 |
^ self |
|
3278 |
]. |
|
3279 |
self scrollActivity stop |
|
3280 |
]. |
|
3281 |
||
3282 |
(key == #Tab |
|
1699 | 3283 |
or:[key == #FocusNext |
3284 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
3938 | 3285 |
self accept:nil. |
3286 |
^ super keyPress:key x:x y:y |
|
1699 | 3287 |
]. |
3288 |
||
3289 |
menu := self detectGrabMenu. |
|
2869 | 3290 |
menusSuperMenu := menu superMenu. |
1699 | 3291 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
3292 |
(key == #Escape) ifTrue:[ |
3938 | 3293 |
"/ must hide the active menu |
3294 |
(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[ |
|
3295 |
"/ hide active menu but keep the grab |
|
3296 |
menusSuperMenu selection:nil |
|
3297 |
] ifFalse:[ |
|
3298 |
"/ hide active menu and ungrab |
|
3299 |
self accept:nil |
|
3300 |
]. |
|
3301 |
^ self |
|
2251 | 3302 |
]. |
3303 |
||
3304 |
menu isViewWrapper ifFalse:[ |
|
3938 | 3305 |
sensor compressKeyPressEventsWithKey:key. |
3306 |
menu handleKeyPress:key. |
|
3307 |
^ self |
|
2251 | 3308 |
]. |
2869 | 3309 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3310 |
|
3311 |
"/ allow cursor movement |
|
3312 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3938 | 3313 |
(self containsPoint:x@y) ifTrue:[ |
3314 |
self handleKeyPress:key. |
|
3315 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3316 |
]. |
1699 | 3317 |
! |
3318 |
||
3834
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3319 |
mapped |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3320 |
super mapped. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3321 |
|
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3322 |
"/ if I come up with a pressed button, react on release instead. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3323 |
self device anyButtonPressed ifTrue:[ hideOnRelease := true ]. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3324 |
! |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3325 |
|
3415 | 3326 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
3327 |
"mousewheel action" |
|
3328 |
||
3329 |
|menu| |
|
3330 |
||
3331 |
menu := self detectGrabMenu. |
|
3332 |
menu isViewWrapper ifTrue:[ |
|
3938 | 3333 |
menu superMenu ~~ self ifTrue:[ |
3334 |
^ self. |
|
3335 |
]. |
|
3336 |
menu := self. |
|
3415 | 3337 |
]. |
3338 |
amount > 0 ifTrue:[ |
|
3938 | 3339 |
menu handleCursorKey:#CursorUp. |
3415 | 3340 |
] ifFalse:[ |
3938 | 3341 |
menu handleCursorKey:#CursorDown. |
3415 | 3342 |
]. |
3343 |
! |
|
3344 |
||
1699 | 3345 |
pointerLeave:state |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3346 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3347 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3348 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3349 |
|
1699 | 3350 |
self detectGrabMenu handlePointerLeave:state. |
3351 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3352 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
3938 | 3353 |
^ self |
2251 | 3354 |
]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3355 |
|
2374 | 3356 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3357 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3358 |
windowGroup focusView ~~ self ifTrue:[ |
3938 | 3359 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3360 |
] ifFalse:[ |
3938 | 3361 |
selection isButton ifTrue:[ |
3362 |
sensor := self sensor. |
|
3363 |
||
3364 |
sensor isNil ifTrue:[ |
|
3365 |
self accept:nil |
|
3366 |
] ifFalse:[ |
|
3367 |
"/ I'have the focus; if no button pressed, than keep the selection |
|
3368 |
sensor anyButtonPressed ifTrue:[ |
|
3369 |
self selection:nil |
|
3370 |
] |
|
3371 |
]. |
|
3372 |
] |
|
1699 | 3373 |
]. |
3374 |
! |
|
3375 |
||
3376 |
sizeChanged:how |
|
2715 | 3377 |
"redraw #right groups" |
3378 |
||
2860 | 3379 |
"/ self isPopUpView ifFalse:[ |
3380 |
"/ mustRearrange := true. |
|
3381 |
"/ self invalidate |
|
3382 |
"/ ]. |
|
3383 |
"/ ^ super sizeChanged:how. |
|
3384 |
||
3385 |
self handleSizeChanged:how. |
|
3386 |
super sizeChanged:how. |
|
1699 | 3387 |
! ! |
3388 |
||
2503 | 3389 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3390 |
|
1767 | 3391 |
clearImplicitGrab |
2253 | 3392 |
implicitGrabView := lastPointerView := nil. |
1767 | 3393 |
! |
3394 |
||
3395 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3396 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3397 |
|
2253 | 3398 |
|view x y p syntheticEvent menu| |
1767 | 3399 |
|
2658 | 3400 |
ev isDamage ifTrue:[ |
3938 | 3401 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
2658 | 3402 |
]. |
3403 |
||
3142 | 3404 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
3938 | 3405 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
3142 | 3406 |
]. |
3407 |
||
1767 | 3408 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3409 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3410 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3411 |
implicitGrabView notNil ifTrue:[ |
|
3938 | 3412 |
self sensor leftButtonPressed ifFalse:[ |
3413 |
self clearImplicitGrab. |
|
3414 |
]. |
|
1767 | 3415 |
]. |
3416 |
||
3417 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
3938 | 3418 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3419 |
]. |
3420 |
||
3421 |
implicitGrabView notNil ifTrue:[ |
|
3938 | 3422 |
ev isButtonEvent ifTrue:[ |
3423 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3424 |
ev view:implicitGrabView. |
|
3425 |
ev arguments at:2 put:p x. |
|
3426 |
ev arguments at:3 put:p y. |
|
3427 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3428 |
||
3429 |
ev isButtonReleaseEvent ifTrue:[ |
|
3430 |
self clearImplicitGrab. |
|
3431 |
]. |
|
3432 |
^ self |
|
3433 |
] |
|
1767 | 3434 |
]. |
3435 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3436 |
||
2016 | 3437 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
3938 | 3438 |
self clearImplicitGrab. |
3439 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
|
1767 | 3440 |
]. |
3441 |
||
3442 |
p := menu translateGrabPoint:(x@y). |
|
3443 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
3630 | 3444 |
view == self ifTrue:[^self]. "MB:changed - recursion" |
3445 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3446 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3447 |
|
3448 |
ev isButtonPressEvent ifTrue:[ |
|
3938 | 3449 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3450 |
view requestFocus. |
|
3451 |
]. |
|
3452 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3453 |
implicitGrabView := view. |
|
3454 |
] |
|
2253 | 3455 |
]. |
1767 | 3456 |
|
3457 |
ev isButtonMotionEvent ifTrue:[ |
|
3938 | 3458 |
lastPointerView ~~ view ifTrue:[ |
3459 |
"/ must generate enter/leave ... (sigh) |
|
3460 |
lastPointerView notNil ifTrue:[ |
|
3461 |
"/ XXX: should be fixed |
|
3462 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3463 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3464 |
]. |
|
3465 |
view notNil ifTrue:[ |
|
3466 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3467 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3468 |
]. |
|
3469 |
lastPointerView := view. |
|
3470 |
]. |
|
1767 | 3471 |
]. |
3472 |
||
3473 |
ev view:view. |
|
3474 |
ev x:p x. |
|
3475 |
ev y:p y. |
|
3476 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3477 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3478 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3479 |
! |
3480 |
||
2048 | 3481 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3482 |
"open or close the corresponding submenus" |
3483 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3484 |
|menu item translatedPoint containsPoint direction| |
2251 | 3485 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3486 |
containsPoint := self containsPoint:motionPoint. |
3975 | 3487 |
|
3488 |
(containsPoint not and:[items size > 0]) ifTrue:[ |
|
3489 |
"/ check if there is still open a menu which is not assigned to the |
|
3490 |
"/ current selection |
|
3491 |
item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil. |
|
3492 |
||
3493 |
item notNil ifTrue:[ |
|
3494 |
|visibleSubmenu point| |
|
3495 |
||
3496 |
visibleSubmenu := item visibleSubmenu. |
|
3497 |
||
3498 |
visibleSubmenu notNil ifTrue:[ |
|
3499 |
point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu. |
|
3500 |
||
3501 |
(visibleSubmenu containsPoint:point) ifTrue:[ |
|
3502 |
selection notNil ifTrue:[ selection invalidate ]. |
|
3503 |
selection := item. |
|
3504 |
selection invalidate. |
|
3505 |
visibleSubmenu becomesActiveMenu. |
|
3506 |
^ self. |
|
3507 |
]. |
|
3508 |
]. |
|
3509 |
item := nil. |
|
3510 |
]. |
|
3511 |
]. |
|
3512 |
||
3938 | 3513 |
containsPoint ifTrue:[ |
3975 | 3514 |
item := self itemAtPoint:motionPoint |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3515 |
]. |
2251 | 3516 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3517 |
"no aotoscroll, if the mouse pointer is inside the scroll button" |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3518 |
direction := self scrollerDirectionAtPoint:motionPoint. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3519 |
direction notNil ifTrue:[ |
3975 | 3520 |
self pointerEntersItem:nil. |
3521 |
||
3522 |
self sensor anyButtonPressed ifTrue:[ |
|
3523 |
self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false. |
|
3524 |
]. |
|
3525 |
^ self |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3526 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3527 |
|
2251 | 3528 |
self pointerEntersItem:item. |
1699 | 3529 |
|
1910 | 3530 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
3975 | 3531 |
( self selectionFollowsMouse |
3532 |
and:[self topMenu focusComesByTab not] |
|
3533 |
) ifTrue:[ |
|
3534 |
self isPopUpView ifTrue:[ |
|
3535 |
item isNil ifTrue:[ |
|
3536 |
superMenu notNil ifTrue:[ |
|
3537 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3538 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3539 |
] |
|
3540 |
] ifFalse:[ |
|
3541 |
self selectAndOpenDelayed:item. |
|
3542 |
]. |
|
3543 |
] ifFalse:[ "/ processing in the toolbar |
|
3544 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
|
3545 |
self selection:item openMenu:true. |
|
3546 |
]. |
|
3547 |
]. |
|
3548 |
]. |
|
3549 |
^ self |
|
3550 |
]. |
|
2251 | 3551 |
containsPoint ifTrue:[ |
3975 | 3552 |
self selection:item openMenu:true. |
3553 |
^ self |
|
2251 | 3554 |
]. |
3555 |
||
3556 |
menu := self superMenuAtPoint:motionPoint. |
|
3557 |
||
2374 | 3558 |
menu notNil ifTrue:[ |
3975 | 3559 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
3560 |
menu handleButtonMotion:state atPoint:translatedPoint. |
|
3561 |
^ self |
|
2251 | 3562 |
]. |
3563 |
self isPopUpView ifTrue:[ |
|
3975 | 3564 |
self selection:nil |
2251 | 3565 |
]. |
2046 | 3566 |
! |
3567 |
||
3383 | 3568 |
handleButtonPress:button atPoint:aPoint |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3569 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3570 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3571 |
|item scrollerDirectionOrNil wasSelected| |
2016 | 3572 |
|
2046 | 3573 |
item := self itemAtPoint:aPoint. |
2374 | 3574 |
item isNil ifTrue:[ |
3938 | 3575 |
self selection:nil openMenu:false. |
3576 |
^ self |
|
2251 | 3577 |
]. |
3578 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3579 |
"/ is a scroller-button present and hit ? |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3580 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3581 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 3582 |
(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[ |
3583 |
self pointerEntersItem:nil. |
|
3584 |
^ self |
|
3585 |
] |
|
2016 | 3586 |
]. |
2251 | 3587 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3588 |
"/ right button always immediately pulls the delayedMenu |
3383 | 3589 |
button == 2 ifTrue:[ |
3938 | 3590 |
item hasDelayedMenu ifTrue:[ |
3591 |
self selection:item openMenu:false. |
|
3592 |
self openDelayed:item afterSeconds:0. |
|
3593 |
^ self. |
|
3594 |
]. |
|
3383 | 3595 |
]. |
3596 |
||
2251 | 3597 |
wasSelected := (selection == item). |
3598 |
wasSelected ifFalse:[ |
|
3938 | 3599 |
self selection:item openMenu:true |
2251 | 3600 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3601 |
item hasDelayedMenu ifTrue:[ |
3938 | 3602 |
"/ clicked on the arrow icon ? |
3603 |
(item menuIndicatorContains:aPoint) ifTrue:[ |
|
3604 |
self selection:item openMenu:false. |
|
3605 |
self openDelayed:item afterSeconds:0. |
|
3606 |
^ self. |
|
3607 |
]. |
|
3608 |
^ self |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3609 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3610 |
|
2238 | 3611 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
3938 | 3612 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3613 |
item toggleSubmenuVisibility |
|
3614 |
]. |
|
3615 |
^ self |
|
2238 | 3616 |
]. |
3617 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3938 | 3618 |
^ self |
2238 | 3619 |
]. |
3620 |
self invalidateItem:item repairNow:true. |
|
3621 |
self acceptItem:item inMenu:self. |
|
3622 |
||
3233 | 3623 |
[ (device notNil and:[device anyButtonPressed]) ] whileTrue:[ |
3938 | 3624 |
"/ using device - sensor is not updated sometimes |
3625 |
Delay waitForSeconds:0.1. |
|
3233 | 3626 |
]. |
3627 |
self sensor flushUserEvents. |
|
2238 | 3628 |
self selection:nil. |
2046 | 3629 |
|
3630 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3631 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3632 |
! |
3633 |
||
1699 | 3634 |
handleCursorKey:aKey |
2715 | 3635 |
"handle a cursor key" |
3636 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3637 |
|next menu item isVrt backKey p1 p2 |
2354 | 3638 |
idx0 "{ Class:SmallInteger }" |
687 | 3639 |
idx "{ Class:SmallInteger }" |
1705 | 3640 |
size "{ Class:SmallInteger }" |
687 | 3641 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3642 |
(size := items size) == 0 ifTrue:[ |
3938 | 3643 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
3644 |
^ self |
|
388 | 3645 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3646 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3647 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3648 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3649 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3650 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3651 |
) ifTrue:[ |
3938 | 3652 |
selection isNil ifTrue:[ |
3653 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
|
3654 |
^ superMenu handleCursorKey:aKey |
|
3655 |
]. |
|
3656 |
idx := 0. |
|
3657 |
||
3658 |
isVrt ifTrue:[ |
|
3659 |
"/ used because of vertical scrolling |
|
3660 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
3661 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
|
3662 |
]. |
|
3663 |
] ifFalse:[ |
|
3664 |
idx := self indexOf:selection. |
|
3665 |
]. |
|
3666 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
|
3667 |
||
3668 |
idx0 := idx. |
|
3669 |
size timesRepeat:[ |
|
3670 |
|el| |
|
3671 |
||
3672 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3673 |
||
3674 |
idx > size ifTrue:[ |
|
3675 |
idx := 0 "1" |
|
3676 |
] ifFalse:[ |
|
3677 |
idx < 0 ifTrue:[ |
|
3678 |
idx := size |
|
3679 |
] |
|
3680 |
]. |
|
3681 |
||
3682 |
idx == 0 ifTrue:[ |
|
3683 |
self selection:nil. |
|
3684 |
^ self |
|
3685 |
] ifFalse:[ |
|
3686 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3687 |
el canSelect ifTrue:[ |
|
3688 |
el hasDelayedMenu ifTrue:[ |
|
3689 |
"/ do not open menu |
|
3690 |
self selection:el openMenu:false |
|
3691 |
] ifFalse:[ |
|
3692 |
"/ open comes from style-sheet |
|
3693 |
self selection:el. |
|
3694 |
]. |
|
3695 |
^ self |
|
3696 |
]. |
|
3697 |
] |
|
3698 |
]. |
|
3699 |
idx == idx0 ifTrue:[ |
|
3700 |
^ self |
|
3701 |
]. |
|
3702 |
]. |
|
3703 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3704 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3705 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3706 |
superMenu notNil ifTrue:[ |
3938 | 3707 |
p1 := self translateGrabPoint:0. |
3708 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3709 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3710 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3711 |
isVrt ifTrue:[ |
3938 | 3712 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
3713 |
backKey := #CursorRight |
|
3714 |
] ifFalse:[ |
|
3715 |
backKey := #CursorLeft. |
|
3716 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3717 |
] ifFalse:[ |
3938 | 3718 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
3719 |
backKey := #CursorDown |
|
3720 |
] ifFalse:[ |
|
3721 |
backKey := #CursorUp. |
|
3722 |
] |
|
3723 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3724 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3725 |
aKey == backKey ifTrue:[ |
3938 | 3726 |
superMenu isNil ifTrue:[ |
3727 |
self accept:nil |
|
3728 |
] ifFalse:[ |
|
3729 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3730 |
superMenu handleCursorKey:aKey |
|
3731 |
] ifFalse:[ |
|
3732 |
superMenu selection hideSubmenu |
|
3733 |
] |
|
3734 |
]. |
|
3735 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3736 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3737 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3738 |
selection isNil ifTrue:[ |
3938 | 3739 |
superMenu isNil ifTrue:[^ self accept:nil]. |
3740 |
||
3741 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3742 |
superMenu handleCursorKey:aKey |
|
3743 |
] ifFalse:[ |
|
3744 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
|
3745 |
self selectionIndex:item |
|
3746 |
] |
|
3747 |
]. |
|
3748 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3749 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3750 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3751 |
selection hasSubmenu ifTrue:[ |
3938 | 3752 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
3753 |
selection toggleSubmenuVisibility |
|
3754 |
] ifFalse:[ |
|
3755 |
menu selectionIndex:1 |
|
3756 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3757 |
] ifFalse:[ |
3938 | 3758 |
superMenu notNil ifTrue:[ |
3759 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3760 |
superMenu handleCursorKey:aKey |
|
3761 |
] |
|
3762 |
] ifFalse:[ |
|
3763 |
self accept:nil |
|
3764 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3765 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3766 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3767 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3768 |
handleKeyPress:key |
2715 | 3769 |
"any key is pressed" |
3770 |
||
2219 | 3771 |
|item inMenu| |
1699 | 3772 |
|
3773 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
3938 | 3774 |
self handleReturnPressed. |
3775 |
^ true. |
|
3754 | 3776 |
]. |
3777 |
key isCharacter ifTrue:[ |
|
1862 | 3778 |
"/ selection notNil ifTrue:[ |
3779 |
"/ inMenu := self |
|
3780 |
"/ ] ifFalse:[ |
|
3781 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3782 |
"/ ]. |
|
3938 | 3783 |
inMenu := self. |
3784 |
||
3785 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
|
3786 |
inMenu selection:item |
|
3787 |
]. |
|
3788 |
^ true |
|
3789 |
]. |
|
3790 |
(key == #CursorDown |
|
3791 |
or:[key == #CursorUp |
|
3792 |
or:[key == #CursorLeft |
|
3793 |
or:[key == #CursorRight]]]) |
|
3754 | 3794 |
ifTrue:[ |
3938 | 3795 |
self handleCursorKey:key. |
3796 |
^ true |
|
3754 | 3797 |
]. |
3798 |
^ false. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3799 |
! |
1699 | 3800 |
|
3801 |
handlePointerLeave:state |
|
3802 |
self pointerEntersItem:nil. |
|
3803 |
super pointerLeave:state |
|
3804 |
! |
|
3805 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3806 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3807 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3808 |
|
2238 | 3809 |
|sensor subm item| |
3810 |
||
3811 |
(item := selection) isNil ifTrue:[ |
|
4089 | 3812 |
superMenu notNil ifTrue:[ |
3813 |
item := superMenu selection. |
|
3814 |
||
3815 |
item value notNil ifTrue:[ |
|
3816 |
"/ is a delayed menu |
|
3817 |
self accept:item |
|
3818 |
] ifFalse:[ |
|
3819 |
item toggleSubmenuVisibility |
|
3820 |
] |
|
3821 |
] ifFalse:[ |
|
3822 |
self accept |
|
3823 |
]. |
|
3824 |
^ self |
|
1841 | 3825 |
]. |
3826 |
selection hasSubmenu ifTrue:[ |
|
4089 | 3827 |
selection hasDelayedMenu ifFalse:[ |
3828 |
selection toggleSubmenuVisibility. |
|
3829 |
^ self |
|
3830 |
]. |
|
3831 |
subm := selection currentSubmenu. |
|
3832 |
||
3833 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
3834 |
selection toggleSubmenuVisibility. |
|
3835 |
^ self |
|
3836 |
]. |
|
3837 |
self openDelayed:nil |
|
1841 | 3838 |
]. |
3839 |
self accept. |
|
3840 |
||
2238 | 3841 |
" test for toggle " |
3842 |
item isToggle ifTrue:[ |
|
4089 | 3843 |
self selection:item. |
2238 | 3844 |
] ifFalse:[ |
4089 | 3845 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
3846 |
^ self |
|
3847 |
] |
|
3938 | 3848 |
]. |
1841 | 3849 |
|
3850 |
(sensor := self sensor) isNil ifTrue:[ |
|
4089 | 3851 |
^ self |
3938 | 3852 |
]. |
3853 |
||
3854 |
[ |
|
4089 | 3855 |
sensor flushKeyboardFor:nil. |
3856 |
Delay waitForSeconds:0.1. |
|
3857 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3858 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3859 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3860 |
|
1699 | 3861 |
pointerEntersItem:anItemOrNil |
3862 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3863 |
redraw the new item highlighted." |
3864 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3865 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3866 |
|
1699 | 3867 |
( anItemOrNil notNil |
3868 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3869 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3870 |
and:[self isPopUpView not]]]) ifTrue:[ |
3938 | 3871 |
anItemOrNil isButton ifTrue:[ |
3872 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
|
3873 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
3874 |
) ifTrue:[ |
|
3875 |
newItem := anItemOrNil |
|
3876 |
] |
|
3877 |
] ifFalse:[ |
|
3878 |
(self enteredLevel ~~ 0 |
|
3879 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3880 |
) ifTrue:[ |
|
3881 |
newItem := anItemOrNil |
|
3882 |
] |
|
3883 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3884 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3885 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3886 |
newItem ~~ enteredItem ifTrue:[ |
3938 | 3887 |
oldItem := enteredItem. |
3888 |
enteredItem := newItem. |
|
3889 |
||
3890 |
oldItem notNil ifTrue:[ |
|
3891 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
|
3892 |
]. |
|
3893 |
||
3894 |
enteredItem notNil ifTrue:[ |
|
3895 |
self invalidateItem:enteredItem repairNow:true. |
|
3896 |
]. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3897 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3898 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3899 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3900 |
processHideMenuEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3901 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3902 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3903 |
"Modified: / 29-06-2011 / 16:39:36 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3904 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3905 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3906 |
processMenuEnterItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3907 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3908 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3909 |
"Created: / 29-06-2011 / 13:18:05 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3910 |
"Modified: / 29-06-2011 / 16:39:29 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3911 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3912 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3913 |
processMenuSelectItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3914 |
|winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3915 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3916 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3917 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3918 |
masterGroup := winGrp previousGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3919 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3920 |
winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3921 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3922 |
item := ev item. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3923 |
itemIndex := ev itemIndex. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3924 |
itemValue := ev itemValue. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3925 |
menuReceiver := ev menuReceiver. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3926 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3927 |
acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3928 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3929 |
(item showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3930 |
and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3931 |
ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3932 |
winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3933 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3934 |
acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3935 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3936 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3937 |
"Modified: / 29-06-2011 / 16:32:36 / cg" |
388 | 3938 |
! ! |
3939 |
||
2251 | 3940 |
!MenuPanel methodsFor:'focus handling'! |
3941 |
||
3187 | 3942 |
canTab |
3943 |
"depends whether I'am a toolbar and selectable items exists |
|
3944 |
" |
|
3945 |
|selectableItem| |
|
3946 |
||
3947 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3938 | 3948 |
selectableItem := self firstItemSelectable. |
3949 |
^ selectableItem notNil |
|
3187 | 3950 |
]. |
3951 |
^ false |
|
3952 |
! |
|
3953 |
||
3954 |
focusComesByTab |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3955 |
"returns true if focus comes by tab and should be drawn" |
3187 | 3956 |
|
3957 |
focusComesByTab == true ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3958 |
(shown and:[self hasFocus]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3959 |
^ true |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3960 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3961 |
focusComesByTab := false. |
3187 | 3962 |
]. |
3963 |
^ false |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3964 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3965 |
"Modified: / 29-06-2011 / 16:23:09 / cg" |
3187 | 3966 |
! |
3967 |
||
3968 |
focusComesByTab:aBoolean |
|
3969 |
"only handled for toolBars" |
|
3970 |
||
3971 |
|selectableItem| |
|
3972 |
||
3973 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3974 |
focusComesByTab := aBoolean. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3975 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3976 |
self hasSelection ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3977 |
^ self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3978 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3979 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3980 |
aBoolean ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3981 |
selectableItem := self firstItemSelectable. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3982 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3983 |
self selection:selectableItem openMenu:false. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3984 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3985 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3986 |
"Modified: / 29-06-2011 / 16:23:19 / cg" |
3187 | 3987 |
! |
3988 |
||
2251 | 3989 |
hasKeyboardFocus:aBoolean |
2715 | 3990 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3991 |
||
2251 | 3992 |
|focusView| |
3993 |
||
3994 |
self isPopUpView ifTrue:[ |
|
3938 | 3995 |
"/ not visible for popup menus |
3996 |
^ super hasKeyboardFocus:aBoolean |
|
2251 | 3997 |
]. |
3998 |
||
3999 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3938 | 4000 |
hasImplicitGrap ~~ true ifTrue:[ |
4001 |
focusView := windowGroup focusView. |
|
4002 |
||
4003 |
focusView == self ifFalse:[ |
|
4004 |
self selection:nil. |
|
4005 |
] |
|
4006 |
] |
|
4007 |
]. |
|
2251 | 4008 |
super hasKeyboardFocus:aBoolean. |
3142 | 4009 |
! |
4010 |
||
3187 | 4011 |
showFocus:focusComesByTab |
4012 |
self focusComesByTab:focusComesByTab. |
|
4013 |
super showFocus:focusComesByTab. |
|
4014 |
! |
|
4015 |
||
4016 |
showNoFocus:focusByTab |
|
4017 |
self focusComesByTab:false. |
|
4018 |
super showNoFocus:focusByTab. |
|
4019 |
! |
|
4020 |
||
4021 |
supportsFocusOnTab |
|
4022 |
"returns true if focus is supported |
|
4023 |
" |
|
4024 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 4025 |
! |
4026 |
||
4027 |
wantsFocusWithButtonPress |
|
3187 | 4028 |
"needs only the focus if I'am a toolbar; all events are delegated |
4029 |
to my subMenus" |
|
4030 |
||
4031 |
^ self isPopUpView not |
|
2251 | 4032 |
! ! |
4033 |
||
388 | 4034 |
!MenuPanel methodsFor:'grabbing'! |
4035 |
||
1699 | 4036 |
doGrab |
4037 |
relativeGrabOrigin := nil. |
|
4038 |
||
4039 |
superMenu notNil ifTrue:[ |
|
3938 | 4040 |
superMenu doGrab |
1699 | 4041 |
] ifFalse:[ |
3938 | 4042 |
hasImplicitGrap ~~ true ifTrue:[ |
4043 |
self grabMouseAndKeyboard. |
|
4044 |
hasImplicitGrap := true |
|
4045 |
] |
|
1699 | 4046 |
] |
4047 |
! |
|
4048 |
||
4049 |
doUngrab:forceDo |
|
4050 |
||
4051 |
relativeGrabOrigin := nil. |
|
1767 | 4052 |
self clearImplicitGrab. |
1699 | 4053 |
|
4054 |
superMenu notNil ifTrue:[ |
|
3938 | 4055 |
forceDo ifTrue:[ |
4056 |
superMenu doUngrab:true |
|
4057 |
]. |
|
4058 |
^ self |
|
1699 | 4059 |
]. |
4060 |
||
4061 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3938 | 4062 |
^ self |
1699 | 4063 |
]. |
4064 |
||
4065 |
forceDo ifFalse:[ |
|
3938 | 4066 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
4067 |
^ self |
|
4068 |
]. |
|
1699 | 4069 |
]. |
4070 |
self ungrabMouseAndKeyboard. |
|
4071 |
self selection:nil. |
|
4072 |
hasImplicitGrap := nil. |
|
1703 | 4073 |
prevFocusView := nil. |
1699 | 4074 |
! |
4075 |
||
1630 | 4076 |
grabKeyboard |
2715 | 4077 |
"grap the keyboard; keep previous grab" |
4078 |
||
1630 | 4079 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 4080 |
^ super grabKeyboard |
1630 | 4081 |
! |
4082 |
||
388 | 4083 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4084 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4085 |
|
3754 | 4086 |
|winGroup sensor activeGrab| |
3142 | 4087 |
|
4088 |
winGroup := self windowGroup. |
|
4089 |
||
4090 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
3938 | 4091 |
prevFocusView isNil ifTrue:[ |
4092 |
prevFocusView := winGroup focusView. |
|
4093 |
]. |
|
4094 |
sensor := self sensor. |
|
4095 |
||
4096 |
device activePointerGrab ~~ self ifTrue:[ |
|
4097 |
sensor flushMotionEventsFor:nil. |
|
4098 |
||
4099 |
(self grabPointer) ifFalse:[ |
|
4100 |
Delay waitForSeconds:0.1. |
|
4101 |
(self grabPointer) ifFalse:[ |
|
4102 |
"give up" |
|
4103 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
|
4104 |
self unmap |
|
4105 |
] |
|
4106 |
] |
|
4107 |
]. |
|
4108 |
||
4109 |
(activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[ |
|
4110 |
device sync. |
|
4111 |
"/ cg: mhmh - should we flush for all or for the activeGrab only ? |
|
3754 | 4112 |
"/ activeGrab notNil ifTrue:[ |
4113 |
"/ sensor flushKeyboardFor:activeGrab. |
|
4114 |
"/ ]. |
|
3938 | 4115 |
sensor flushKeyboardFor:nil. |
4116 |
self grabKeyboard. |
|
4117 |
] |
|
388 | 4118 |
] |
4119 |
||
3158 | 4120 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4121 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 4122 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 4123 |
! |
4124 |
||
1630 | 4125 |
grabPointerWithCursor:aCursorOrNil |
2715 | 4126 |
"grap the pointer; keep previous grab" |
4127 |
||
1630 | 4128 |
previousPointerGrab := device activePointerGrab. |
1699 | 4129 |
hasImplicitGrap := true. |
2715 | 4130 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 4131 |
! |
4132 |
||
4133 |
ungrabKeyboard |
|
2715 | 4134 |
"ungrap the keyboard; restore previous grab" |
4135 |
||
1630 | 4136 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4137 |
|
2579 | 4138 |
(previousKeyboardGrab notNil |
4139 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3938 | 4140 |
device grabKeyboardInView:previousKeyboardGrab. |
2579 | 4141 |
]. |
1630 | 4142 |
! |
4143 |
||
388 | 4144 |
ungrabMouseAndKeyboard |
2715 | 4145 |
"ungrab resources (mouse and keyboard)" |
4146 |
||
1630 | 4147 |
self ungrabPointer. |
4148 |
self ungrabKeyboard. |
|
4149 |
! |
|
4150 |
||
4151 |
ungrabPointer |
|
2715 | 4152 |
"ungrap the pointer; restore previous grab" |
4153 |
||
1630 | 4154 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4155 |
|
2579 | 4156 |
(previousPointerGrab notNil |
4157 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3938 | 4158 |
device grabPointerInView:previousPointerGrab. |
1630 | 4159 |
]. |
388 | 4160 |
! ! |
4161 |
||
1251 | 4162 |
!MenuPanel methodsFor:'help'! |
4163 |
||
3441 | 4164 |
flyByHelpSpec |
4165 |
"allows subclasses to provide texts" |
|
4166 |
||
4167 |
^ IdentityDictionary new |
|
4168 |
! |
|
4169 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4170 |
flyByHelpTextAt:aPoint |
2058 | 4171 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4172 |
If there is a selection, that items helpText is used (ignoring the given point)." |
4173 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4174 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4175 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4176 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4177 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4178 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4179 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4180 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4181 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4182 |
self withMenuAndItemAt:aPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item]. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4183 |
^ nil |
2058 | 4184 |
! |
4185 |
||
4186 |
flyByHelpTextForItem:anItem |
|
2715 | 4187 |
"returns the helpText for an item (empty if none)" |
4188 |
||
2063 | 4189 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4190 |
^ anItem flyByHelpText. |
2058 | 4191 |
! |
4192 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4193 |
flyByHelpTextForKey:aKey |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4194 |
|app text| |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4195 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4196 |
app := self application. |
3441 | 4197 |
app notNil ifTrue:[ |
3938 | 4198 |
text := self application flyByHelpTextForKey:aKey. |
4199 |
text notNil ifTrue:[^ text]. |
|
3441 | 4200 |
]. |
4201 |
^ self flyByHelpSpec at:aKey ifAbsent:nil |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4202 |
! |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4203 |
|
1251 | 4204 |
helpText |
2715 | 4205 |
"return the helpText for the currently selected item (empty if none)" |
4206 |
||
1613 | 4207 |
^ self helpTextForItem:selection |
1251 | 4208 |
! |
4209 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4210 |
helpTextAt:aPoint |
1252 | 4211 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4212 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
4213 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4214 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4215 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4216 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4217 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4218 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4219 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4220 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4221 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4222 |
self withMenuAndItemAt:aPoint do:[:menu :item | ^ menu helpTextForItem:item]. |
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4223 |
^ nil |
1613 | 4224 |
! |
4225 |
||
4226 |
helpTextForItem:anItem |
|
2715 | 4227 |
"returns the helpText for an item (empty if none)" |
4228 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4229 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4230 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4231 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4232 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4233 |
withMenuAndItemAt:srcPoint do:aBlock |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4234 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4235 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4236 |
dstMenu := self detectMenuAtGrabPoint:srcPoint. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4237 |
dstMenu notNil ifTrue:[ |
3938 | 4238 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
4239 |
item := dstMenu itemAtPoint:dstPoint. |
|
4240 |
aBlock value:dstMenu value:item. |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4241 |
] |
1251 | 4242 |
! ! |
4243 |
||
794 | 4244 |
!MenuPanel methodsFor:'image registration'! |
4245 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
4246 |
imageOnMyDevice:anImage |
2715 | 4247 |
"returns image registered on device" |
4248 |
||
2770 | 4249 |
^ self class image:anImage value onDevice:device |
794 | 4250 |
! |
4251 |
||
4252 |
lightenedImageOnDevice:anImage |
|
2715 | 4253 |
"returns lightened image registered on device" |
4254 |
||
794 | 4255 |
^ self class lightenedImage:anImage onDevice:device |
4256 |
! ! |
|
4257 |
||
1688 | 4258 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 4259 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4260 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4261 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4262 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4263 |
|
388 | 4264 |
create |
2715 | 4265 |
"create the shadow view for a none contained submenu" |
4266 |
||
388 | 4267 |
super create. |
4268 |
||
4269 |
self isPopUpView ifTrue:[ |
|
3938 | 4270 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
4271 |
shadowView isNil ifTrue:[ |
|
4272 |
shadowView := (ShadowView onDevice:device) for:self |
|
4273 |
] ifFalse:[ |
|
4274 |
self saveUnder:true. |
|
4275 |
]. |
|
4276 |
] |
|
388 | 4277 |
] ifFalse:[ |
3938 | 4278 |
self hasExplicitExtent ifTrue:[ |
4279 |
(self width) == (superView width) ifTrue:[ |
|
4280 |
self verticalLayout:false |
|
4281 |
] |
|
4282 |
] |
|
388 | 4283 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4284 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4285 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 4286 |
! |
4287 |
||
4288 |
destroy |
|
2715 | 4289 |
"destroy items and shadowView; remove dependencies" |
4290 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4291 |
self clearLastActiveMenu. |
2051 | 4292 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 4293 |
items := nil. |
4294 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4295 |
|
388 | 4296 |
super destroy. |
3142 | 4297 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4298 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4299 |
|
2051 | 4300 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4301 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4302 |
|
616 | 4303 |
fetchDeviceResources |
2715 | 4304 |
"fetch device colors, to avoid reallocation at redraw time" |
4305 |
||
2219 | 4306 |
|style| |
4307 |
||
2374 | 4308 |
superMenu notNil ifTrue:[ |
3938 | 4309 |
styleSheet := superMenu styleSheet |
2219 | 4310 |
]. |
616 | 4311 |
|
4312 |
super fetchDeviceResources. |
|
4313 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4314 |
"/ 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
|
4315 |
"/ (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
|
4316 |
|
616 | 4317 |
superMenu isNil ifTrue:[ |
3938 | 4318 |
rightArrow isNil ifTrue:[ |
4319 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
|
4320 |
]. |
|
4321 |
fgColor := fgColor onDevice:device. |
|
4322 |
style := styleSheet name. |
|
4323 |
||
4324 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
|
4325 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
4326 |
] ifFalse:[ |
|
4327 |
rightArrowShadow := nil |
|
4328 |
]. |
|
616 | 4329 |
] ifFalse:[ |
3938 | 4330 |
rightArrow := superMenu rightArrow. |
4331 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4332 |
||
4333 |
self foregroundColor:(superMenu foregroundColor). |
|
4334 |
self font:(superMenu font). |
|
2761 | 4335 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4336 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4337 |
|
1829 | 4338 |
items notNil ifTrue:[ |
3938 | 4339 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 4340 |
]. |
4341 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4342 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 4343 |
! |
4344 |
||
580 | 4345 |
initStyle |
4346 |
"initialize style specific stuff" |
|
4347 |
||
2919 | 4348 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
4061 | 4349 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
4350 |
#'menu.itemHorizontalSpace' |
|
4351 |
#'popup.hideOnRelease' |
|
4352 |
)> |
|
2609 | 4353 |
|fn| |
4354 |
||
580 | 4355 |
super initStyle. |
616 | 4356 |
|
2883 | 4357 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
4358 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4359 |
buttonInsetX := buttonInsetX abs. |
|
4360 |
||
4361 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
4362 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4363 |
buttonInsetY := buttonInsetY abs. |
|
4364 |
||
4365 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
4366 |
itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ]. |
|
4367 |
||
4368 |
||
4061 | 4369 |
fgColor := DefaultForegroundColor. |
4370 |
fgColor isNil ifTrue:[ fgColor := Color black ]. |
|
2609 | 4371 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
4372 |
fn := self class defaultFont. |
|
2610 | 4373 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 4374 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4375 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4376 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4377 |
self updateLevelAndBorder. |
4061 | 4378 |
|
4379 |
"Modified: / 18-07-2011 / 09:48:57 / cg" |
|
580 | 4380 |
! |
4381 |
||
388 | 4382 |
initialize |
2715 | 4383 |
"set default configuration" |
4384 |
||
388 | 4385 |
super initialize. |
616 | 4386 |
|
2877 | 4387 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4388 |
enabled := true. |
3881 | 4389 |
self originChangedFlag:false extentChangedFlag:false. |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4390 |
"/ explicitExtent := nil. |
2253 | 4391 |
shortKeyInset := 0. |
4392 |
mustRearrange := false. |
|
4393 |
showSeparatingLines := false. |
|
4394 |
showGroupDivider := true. |
|
3780 | 4395 |
hideOnRelease := defaultHideOnRelease. |
388 | 4396 |
! |
4397 |
||
1573 | 4398 |
map |
3938 | 4399 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4400 |
If the grab fails, try again and unmap myself if that fails too." |
4401 |
||
1791 | 4402 |
|loIndices loItems| |
388 | 4403 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4404 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4405 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4406 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4407 |
self becomesActiveMenu. |
1573 | 4408 |
super map. |
2681 | 4409 |
self addDependencies. |
388 | 4410 |
|
1785 | 4411 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4412 |
loItems := items ? #[]. |
4413 |
||
4414 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4415 |
|
388 | 4416 |
self isPopUpView ifTrue:[ |
3938 | 4417 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4418 |
] ifFalse:[ |
3938 | 4419 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4420 |
]. |
1791 | 4421 |
loItems do:[:el| el updateIndicators ]. |
388 | 4422 |
|
1785 | 4423 |
loIndices size > 0 ifTrue:[ |
3938 | 4424 |
self redrawX:0 y:0 width:width height:height. |
4425 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4426 |
]. |
4427 |
||
1177 | 4428 |
"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
|
4429 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4430 |
! |
4431 |
||
4432 |
realize |
|
2715 | 4433 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4434 |
|
2761 | 4435 |
|bgColor| |
4436 |
||
388 | 4437 |
self isPopUpView ifTrue:[ |
3938 | 4438 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4439 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4440 |
||
4441 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
|
4442 |
shadowView must be realized before self" |
|
4443 |
self hiddenOnRealize:true. |
|
4444 |
super realize. |
|
4445 |
self resize. |
|
4446 |
self makeFullyVisible. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4447 |
"/ self mustRearrange. |
3938 | 4448 |
shadowView notNil ifTrue:[ |
4449 |
shadowView realize. |
|
4450 |
]. |
|
4451 |
self raise. |
|
4452 |
self map. |
|
736 | 4453 |
] ifFalse:[ |
3938 | 4454 |
super realize. |
1767 | 4455 |
]. |
4456 |
self allSubViewsDo:[:aView| aView realize ]. |
|
3780 | 4457 |
"/ hideOnRelease := defaultHideOnRelease. |
388 | 4458 |
! |
4459 |
||
4460 |
recreate |
|
1832 | 4461 |
"this is called after a snapin or a migration. |
2715 | 4462 |
If the image was saved with an active menu, hide the menu" |
4463 |
||
1455 | 4464 |
selection := nil. |
388 | 4465 |
super recreate. |
4466 |
! |
|
4467 |
||
1130 | 4468 |
reinitStyle |
4469 |
"handle style change while being open (win32 only - for now)" |
|
4470 |
||
4471 |
super reinitStyle. |
|
4472 |
||
4473 |
self fetchDeviceResources. |
|
1811 | 4474 |
self mustRearrange. "/ care for changed font sizes etc. |
4475 |
||
4476 |
self do:[:anItem | |
|
3938 | 4477 |
anItem reinitStyle |
1811 | 4478 |
]. |
1130 | 4479 |
|
4480 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4481 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4482 |
! |
4483 |
||
388 | 4484 |
unmap |
1330 | 4485 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4486 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4487 |
|
3203 | 4488 |
mapTime := nil. |
4489 |
||
3975 | 4490 |
"hide all submenus opened within the menu" |
4491 |
self itemsDo:[:eachItem| |
|
4492 |
eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ]. |
|
4493 |
]. |
|
4494 |
||
2681 | 4495 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4496 |
self clearLastActiveMenu. |
1699 | 4497 |
self doUngrab:(superMenu isNil). |
4498 |
"/ self isPopUpView ifTrue:[ |
|
4499 |
"/ self doUngrab:(superMenu isNil) |
|
4500 |
"/ ]. |
|
3142 | 4501 |
prevFocusView := nil. |
388 | 4502 |
super unmap. |
4503 |
shadowView notNil ifTrue:[shadowView unmap]. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4504 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4505 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4506 |
updateLevelAndBorder |
3820 | 4507 |
"update level & border" |
4508 |
||
4509 |
<resource: #style (#'popup.borderWidth' |
|
3938 | 4510 |
#'popup.borderColor' |
4511 |
#'popup.level' |
|
4512 |
#'pullDownMenu.level' |
|
4513 |
)> |
|
3820 | 4514 |
|
4515 |
|bw bc lvl| |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4516 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4517 |
self isPopUpView ifTrue:[ |
3938 | 4518 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
4519 |
lvl := styleSheet at:#'popup.level' default:0. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4520 |
] ifFalse:[ |
3938 | 4521 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
4522 |
lvl := styleSheet at:#'pullDownMenu.level' default:1. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4523 |
]. |
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4524 |
bw ~~ 0 ifTrue:[ |
3938 | 4525 |
bc := styleSheet at:#'popup.borderColor' default:Color black. |
4526 |
self borderColor:bc |
|
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4527 |
]. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4528 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4529 |
self level:lvl. |
388 | 4530 |
! ! |
4531 |
||
1878 | 4532 |
!MenuPanel methodsFor:'keyboard control'! |
4533 |
||
4534 |
mnemonicViewNext:aKeyEvent |
|
4535 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4536 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4537 |
return the topMenu otherwise nil." |
4538 |
||
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4539 |
|menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel| |
2112 | 4540 |
|
4541 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4542 |
shown ifFalse:[^ nil]. |
4543 |
||
4544 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4545 |
lKey := uKey asLowercase. |
|
2112 | 4546 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4547 |
accessCharacterMatchQuery := |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4548 |
[:el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4549 |
|k| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4550 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4551 |
k := el accessCharacter. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4552 |
k == uKey or:[k == lKey] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4553 |
]. |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4554 |
maxShortCutSearchLevel := self class maxShortCutSearchLevel. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4555 |
|
2112 | 4556 |
selection notNil ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4557 |
"first lookup the current grapMenu before starting in the topMenu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4558 |
" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4559 |
menu := self detectGrabMenu. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4560 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4561 |
[ menu ~~ self ] whileTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4562 |
index := menu selectionIndex. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4563 |
list := menu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4564 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4565 |
maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4566 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4567 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4568 |
list size ~~ 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4569 |
"/ has item which responds to the mnemonic |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4570 |
menu processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4571 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4572 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4573 |
menu := menu superMenu. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4574 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4575 |
index := self selectionIndex. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4576 |
list := self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4577 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4578 |
maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4579 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4580 |
|
2112 | 4581 |
] ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4582 |
index := 99999. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4583 |
list := nil. |
3938 | 4584 |
]. |
2112 | 4585 |
|
2374 | 4586 |
list isNil ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4587 |
list := self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4588 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4589 |
maxDepth:maxShortCutSearchLevel from:1 to:index |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4590 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4591 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4592 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4593 |
list isNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4594 |
"/ must clear existing selection |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4595 |
self selection:nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4596 |
^ nil |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4597 |
] |
2112 | 4598 |
]. |
4599 |
||
4600 |
"/ has item which responds to the mnemonic |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4601 |
self processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4602 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4603 |
"Modified: / 06-10-2011 / 16:25:21 / cg" |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4604 |
! |
1878 | 4605 |
|
4606 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4607 |
"open all menus derived from sequence of item indices" |
4608 |
||
1878 | 4609 |
|item| |
4610 |
||
4611 |
anItemIndiceList size == 0 ifTrue:[ |
|
3938 | 4612 |
^ self |
1878 | 4613 |
]. |
4614 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4615 |
||
4616 |
(item notNil and:[item enabled]) ifTrue:[ |
|
3938 | 4617 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4618 |
self selection:item openMenu:true. |
|
4619 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4620 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4621 |
! |
1878 | 4622 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4623 |
processCollectedShortcutIndices:indices |
1878 | 4624 |
|menu item| |
4625 |
||
4626 |
indices size == 0 ifTrue:[ |
|
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4627 |
^ self |
1878 | 4628 |
]. |
4629 |
menu := self. |
|
4630 |
||
3192 | 4631 |
"/ first lookup in current open submenus |
1878 | 4632 |
[menu selectionIndex == indices first] whileTrue:[ |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4633 |
( (item := menu selection) isNil |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4634 |
or:[(menu := item currentSubmenu) isNil] |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4635 |
) ifTrue:[ "/ selected but no submenu open - not handled |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4636 |
^ self |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4637 |
]. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4638 |
indices removeFirst. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4639 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4640 |
indices isEmpty ifTrue:[ |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4641 |
menu selection:nil. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4642 |
^ self |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4643 |
] |
1878 | 4644 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4645 |
menu openMenusFromItemIndices:indices. |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4646 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4647 |
"Modified: / 24-03-2011 / 11:19:38 / cg" |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4648 |
"Created: / 06-10-2011 / 16:19:30 / cg" |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4649 |
! |
1878 | 4650 |
|
4651 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4652 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4653 |
If there is a shortcut-key defined, process it and return true. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4654 |
Otherwise return false." |
2715 | 4655 |
|
3431 | 4656 |
|menu rawKey logicalKey list item selectableItem| |
1878 | 4657 |
|
4658 |
superMenu notNil ifTrue:[ |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4659 |
^ superMenu processShortcut:aKeyEvent |
1878 | 4660 |
]. |
4661 |
shown ifFalse:[^ false]. |
|
4662 |
||
3431 | 4663 |
logicalKey := aKeyEvent key. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4664 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4665 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4666 |
|
3192 | 4667 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
3431 | 4668 |
) includes:logicalKey |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4669 |
) ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4670 |
^ false. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4671 |
]. |
3431 | 4672 |
rawKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4673 |
item := nil. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4674 |
menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu |
1878 | 4675 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4676 |
"/ special for Cmd-only event (i.e. ALT-only) |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4677 |
aKeyEvent isKeyReleaseEvent ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4678 |
selection isNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4679 |
prevFocusView := self windowGroup focusView. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4680 |
self requestFocus. "/ self windowGroup focusView:self. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4681 |
selectableItem := self firstItemSelectable. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4682 |
self selection:selectableItem openMenu:false. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4683 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4684 |
prevFocusView requestFocus. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4685 |
self selection:nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4686 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4687 |
^ true |
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4688 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4689 |
|
1878 | 4690 |
[true] whileTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4691 |
list := menu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4692 |
selectItemIndicesFor:[:el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4693 |
|skey| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4694 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4695 |
item := el. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4696 |
el ignoreShortcutKeys ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4697 |
false |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4698 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4699 |
skey := el shortcutKey. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4700 |
skey == rawKey or:[skey == logicalKey] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4701 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4702 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4703 |
maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4704 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4705 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4706 |
list size ~~ 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4707 |
"/ has item which responds to the shortcut |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4708 |
item hasSubmenu ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4709 |
menu accept:item |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4710 |
] ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4711 |
menu processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4712 |
self requestFocus. "/ self windowGroup focusView:self. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4713 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4714 |
^ true |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4715 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4716 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4717 |
menu == self ifTrue:[ ^ false ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4718 |
menu := self. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4719 |
]. |
2219 | 4720 |
^ false "/ never reached |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4721 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4722 |
"Modified: / 06-10-2011 / 16:19:27 / cg" |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4723 |
! |
1878 | 4724 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4725 |
selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop ignoreSubmenuBlock:ignoreSubmenueBlock |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4726 |
"returns the sequence of indices up to the item for which the block returns true. |
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4727 |
The first entry is the topmenu, the last entry the item for which the block returns |
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4728 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4729 |
If the ignoreSubmenueBlock is not nil, the menu under the item (argument to the block) |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4730 |
is created and passed through if the block returns false. |
2715 | 4731 |
Otherwise the item is not asked for its submenu." |
4732 |
||
2112 | 4733 |
|start stop| |
4734 |
||
4735 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4736 |
||
4737 |
start := aStart max:1. |
|
4738 |
stop := aStop min:(items size). |
|
4739 |
||
3938 | 4740 |
start to:stop do:[:i| |
4741 |
|item menu result| |
|
4742 |
||
4743 |
item := items at:i. |
|
4744 |
(item enabled and:[item isVisible]) ifTrue:[ |
|
4745 |
(aOneArgBlock value:item) ifTrue:[ |
|
4746 |
^ OrderedCollection with:i |
|
4747 |
]. |
|
4748 |
||
4749 |
maxDepth > 1 ifTrue:[ |
|
4750 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
|
4751 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
|
4752 |
menu := item setupSubmenu. |
|
4753 |
||
4754 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
|
4755 |
result := menu |
|
4756 |
selectItemIndicesFor:aOneArgBlock |
|
4757 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
|
4758 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
|
4759 |
||
4760 |
result notNil ifTrue:[ |
|
4761 |
result addFirst:i. |
|
4762 |
^ result |
|
4763 |
]. |
|
4764 |
]. |
|
4765 |
]. |
|
4766 |
]. |
|
4767 |
]. |
|
4768 |
]. |
|
1878 | 4769 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4770 |
^ nil |
3128 | 4771 |
|
4772 |
"Modified: / 18-10-2006 / 10:30:00 / cg" |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4773 |
! ! |
1878 | 4774 |
|
388 | 4775 |
!MenuPanel methodsFor:'misc'! |
4776 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4777 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4778 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4779 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4780 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4781 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4782 |
|
388 | 4783 |
superMenu |
2715 | 4784 |
"returns supermenu or nil" |
4785 |
||
388 | 4786 |
^ superMenu |
4787 |
! |
|
4788 |
||
4789 |
topMenu |
|
2715 | 4790 |
"returns the topMenu; the one having no superMenu" |
4791 |
||
1791 | 4792 |
|menu smenu| |
4793 |
||
4794 |
menu := self. |
|
4795 |
||
4796 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
3938 | 4797 |
menu := smenu |
1791 | 4798 |
]. |
4799 |
^ menu |
|
388 | 4800 |
! ! |
4801 |
||
1825 | 4802 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4803 |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4804 |
printOn:aStream |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4805 |
|label| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4806 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4807 |
aStream nextPutAll:'Menu:'. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4808 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4809 |
self do:[:eachItem| |
3938 | 4810 |
label := eachItem label. |
4811 |
label notEmptyOrNil ifTrue:[ |
|
4812 |
aStream nextPutAll:' '. |
|
4813 |
label printOn:aStream. |
|
4814 |
]. |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4815 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4816 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4817 |
|
388 | 4818 |
!MenuPanel methodsFor:'private'! |
4819 |
||
434 | 4820 |
application |
2715 | 4821 |
"optimize access to retrive the application" |
4822 |
||
2374 | 4823 |
application notNil ifTrue:[^ application ]. |
434 | 4824 |
|
4825 |
superMenu notNil ifTrue:[ |
|
3938 | 4826 |
application := superMenu application. |
4827 |
^ application |
|
2253 | 4828 |
]. |
4829 |
application := super application. |
|
2374 | 4830 |
^ application |
1872 | 4831 |
! |
434 | 4832 |
|
3725 | 4833 |
detectItem:aBlock |
4834 |
"returns the item for which aBlock returns true." |
|
4835 |
||
4836 |
items notNil ifTrue:[ |
|
3938 | 4837 |
items keysAndValuesDo:[:anIndex :anItem| |
4838 |
(aBlock value:anItem) ifTrue:[^ anItem]. |
|
4839 |
]. |
|
3725 | 4840 |
]. |
4841 |
^ nil |
|
4842 |
! |
|
4843 |
||
1572 | 4844 |
detectItemForKey:aKey |
4845 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4846 |
if no item is detected nil is returned." |
4847 |
||
1572 | 4848 |
|cIdx uKey lKey item| |
4849 |
||
1699 | 4850 |
items isNil ifTrue:[^ nil]. |
4851 |
||
1572 | 4852 |
cIdx := self selectionIndex. |
4853 |
uKey := aKey asUppercase. |
|
4854 |
lKey := aKey asLowercase. |
|
4855 |
||
3938 | 4856 |
items keysAndValuesDo:[:anIndex :anItem| |
4857 |
|char label| |
|
4858 |
||
4859 |
( anIndex ~~ cIdx |
|
4860 |
and:[anItem canSelect |
|
4861 |
and:[(label := anItem textLabel) notNil |
|
4862 |
and:[label size ~~ 0]]] |
|
4863 |
) ifTrue:[ |
|
4864 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4865 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4866 |
^ anItem |
|
4867 |
] |
|
4868 |
] ifFalse:[ |
|
4869 |
char := label at:1. |
|
4870 |
||
4871 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4872 |
anIndex > cIdx ifTrue:[ |
|
4873 |
^ anItem |
|
4874 |
]. |
|
4875 |
item isNil ifTrue:[item := anItem] |
|
4876 |
] |
|
4877 |
] |
|
4878 |
] |
|
1572 | 4879 |
]. |
4880 |
^ item |
|
4881 |
! |
|
4882 |
||
3725 | 4883 |
detectItemForLabel:aLabel |
4884 |
^ self detectItem:[:anItem | anItem label = aLabel]. |
|
4885 |
! |
|
4886 |
||
4887 |
detectItemForNameKey:aKey |
|
4888 |
^ self detectItem:[:anItem | anItem nameKey == aKey]. |
|
4889 |
! |
|
4890 |
||
388 | 4891 |
onEachPerform:aSelector withArgList:aList |
2715 | 4892 |
"on each item perform selector with an argument derived from aList" |
4893 |
||
388 | 4894 |
aList isCollection ifTrue:[ |
3938 | 4895 |
items size >= aList size ifTrue:[ |
4896 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4897 |
(items at:anIndex) perform:aSelector with:anArg |
|
4898 |
] |
|
4899 |
] |
|
388 | 4900 |
] ifFalse:[ |
3938 | 4901 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4902 |
] |
4903 |
! |
|
4904 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4905 |
registerImageOnDevice:anImage |
2269 | 4906 |
|
4907 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4908 |
^ self class image:anImage onDevice:device |
|
4909 |
||
4910 |
"/ |image| |
|
4911 |
"/ |
|
4912 |
"/ (image := anImage) notNil ifTrue:[ |
|
4913 |
"/ image device ~~ device ifTrue:[ |
|
4914 |
"/ image := image copy. |
|
4915 |
"/ ]. |
|
4916 |
"/ image := image onDevice:device. |
|
4917 |
"/ image := image clearMaskedPixels. |
|
4918 |
"/ ]. |
|
4919 |
"/ ^ image |
|
2355 | 4920 |
! |
4921 |
||
4922 |
superMenu:aSuperMenu |
|
2715 | 4923 |
"set my supermenu from which i'am activated" |
4924 |
||
2355 | 4925 |
superMenu := aSuperMenu. |
4926 |
||
2374 | 4927 |
superMenu notNil ifTrue:[ |
3938 | 4928 |
styleSheet := superMenu styleSheet. |
4929 |
rightArrow := superMenu rightArrow. |
|
4930 |
rightArrowShadow := superMenu rightArrowShadow. |
|
2355 | 4931 |
]. |
388 | 4932 |
! ! |
4933 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4934 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4935 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4936 |
activeMenu |
2715 | 4937 |
"returns the current active menu or self (the top menu)" |
4938 |
||
687 | 4939 |
^ lastActiveMenu ? self |
4940 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4941 |
"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
|
4942 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4943 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4944 |
activeMenu:aMenu |
2715 | 4945 |
"set the current active menu" |
4946 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4947 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4948 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4949 |
"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
|
4950 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4951 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4952 |
becomesActiveMenu |
2715 | 4953 |
"submenu becomes the active menu" |
4954 |
||
3224 | 4955 |
mapTime isNil ifTrue:[ |
3938 | 4956 |
"/ set the mapTime if not yet done |
4957 |
mapTime := AbsoluteTime now. |
|
3224 | 4958 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4959 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4960 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4961 |
"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
|
4962 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4963 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4964 |
clearLastActiveMenu |
2715 | 4965 |
"reset the current active menu" |
4966 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4967 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4968 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4969 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4970 |
|
2251 | 4971 |
"/ prevFocusView notNil ifTrue:[ |
4972 |
"/ self windowGroup focusView:prevFocusView. |
|
4973 |
"/ prevFocusView := nil. |
|
4974 |
"/ ]. |
|
4975 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4976 |
top activeMenu == self ifTrue:[ |
3938 | 4977 |
top activeMenu:nil |
687 | 4978 |
] |
4979 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4980 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4981 |
! |
4982 |
||
4983 |
mapTime |
|
3203 | 4984 |
"get the time the menu was activated or nil" |
2715 | 4985 |
|
687 | 4986 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4987 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4988 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
3203 | 4989 |
! |
4990 |
||
4991 |
mapTime:aTimestamp |
|
4992 |
"set the time the menu was activated" |
|
4993 |
||
4994 |
mapTime := aTimestamp. |
|
4995 |
||
4996 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
|
687 | 4997 |
! ! |
4998 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4999 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 5000 |
|
5001 |
hasScrollerAt:aDirection |
|
2715 | 5002 |
"returns true if a visible scroller at a direction exists" |
5003 |
||
2016 | 5004 |
|layout| |
5005 |
||
5006 |
self hasScrollers ifFalse:[ |
|
3938 | 5007 |
^ false |
2016 | 5008 |
]. |
5009 |
||
5010 |
aDirection == #PREV ifTrue:[ |
|
3938 | 5011 |
layout := items first layout. |
2016 | 5012 |
|
5013 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
3938 | 5014 |
ifFalse:[ layout left < margin] |
2016 | 5015 |
]. |
5016 |
layout := items last layout. |
|
5017 |
||
5018 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
3938 | 5019 |
ifFalse:[ layout right > (width - margin)] |
2016 | 5020 |
! |
5021 |
||
5022 |
hasScrollers |
|
2715 | 5023 |
"returns true if scrollers are needed" |
5024 |
||
2018 | 5025 |
|maxExtent first last isVert| |
5026 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5027 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 5028 |
|
5029 |
isVert := self verticalLayout. |
|
5030 |
||
5031 |
superView notNil ifTrue:[ |
|
3938 | 5032 |
((first := items first layout) isNil |
5033 |
or:[(last := items last layout) isNil] |
|
5034 |
) ifTrue:[ |
|
5035 |
^ false |
|
5036 |
]. |
|
5037 |
isVert ifTrue:[ |
|
5038 |
^ first top < 0 or:[last bottom > height] |
|
5039 |
]. |
|
5040 |
^ first left < 0 or:[last right > width] |
|
2018 | 5041 |
]. |
5042 |
maxExtent := self maxExtent. |
|
5043 |
isVert ifTrue:[ |
|
3938 | 5044 |
^ (height >= maxExtent y) |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5045 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5046 |
^ (width >= maxExtent x) |
2016 | 5047 |
! |
5048 |
||
5049 |
indexOfItemAtScroller:aDirection |
|
2715 | 5050 |
"returns the index of the item under the scroller or 0" |
5051 |
||
2016 | 5052 |
|bounds min max layout| |
5053 |
||
2860 | 5054 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 5055 |
bounds := self scrollerBoundsAt:aDirection. |
5056 |
||
5057 |
self verticalLayout ifTrue:[ |
|
3938 | 5058 |
min := bounds top. |
5059 |
max := bounds bottom. |
|
5060 |
||
5061 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5062 |
anItem isVisible ifTrue:[ |
|
5063 |
layout := anItem layout. |
|
5064 |
||
5065 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
5066 |
^ anIndex |
|
5067 |
]. |
|
5068 |
]. |
|
5069 |
]. |
|
2016 | 5070 |
] ifFalse:[ |
3938 | 5071 |
min := bounds left. |
5072 |
max := bounds right. |
|
5073 |
||
5074 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5075 |
anItem isVisible ifTrue:[ |
|
5076 |
layout := anItem layout. |
|
5077 |
||
5078 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
5079 |
^ anIndex |
|
5080 |
]. |
|
5081 |
]. |
|
5082 |
] |
|
2016 | 5083 |
]. |
5084 |
^ 0 |
|
5085 |
! |
|
5086 |
||
5087 |
makeItemVisible:anItem |
|
2715 | 5088 |
"make an item visible" |
5089 |
||
2018 | 5090 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
5091 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 5092 |
inv1 inv2| |
2018 | 5093 |
|
5094 |
( anItem notNil |
|
5095 |
and:[self hasScrollers |
|
5096 |
and:[(layout := anItem layout) notNil]] |
|
5097 |
) ifFalse:[ |
|
3938 | 5098 |
^ self |
2016 | 5099 |
]. |
2018 | 5100 |
index := self indexOfItem:anItem. |
2016 | 5101 |
boundsPREV := self scrollerBoundsAt:#PREV. |
5102 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
5103 |
||
2018 | 5104 |
isVertical := self verticalLayout. |
5105 |
||
5106 |
isVertical ifTrue:[ |
|
3938 | 5107 |
boundsMin := boundsPREV bottom. |
5108 |
boundsMax := boundsNEXT top. |
|
5109 |
layoutMin := layout top. |
|
5110 |
layoutMax := layout bottom. |
|
5111 |
windowSz := height. |
|
2018 | 5112 |
] ifFalse:[ |
3938 | 5113 |
boundsMin := boundsPREV right. |
5114 |
boundsMax := boundsNEXT left. |
|
5115 |
layoutMin := layout left. |
|
5116 |
layoutMax := layout right. |
|
5117 |
windowSz := width. |
|
2018 | 5118 |
]. |
5119 |
||
5120 |
||
5121 |
layoutMin < boundsMin ifTrue:[ |
|
3938 | 5122 |
layoutMin >= 0 ifTrue:[ |
5123 |
^ self |
|
5124 |
]. |
|
5125 |
"/ test whether is first visible item |
|
5126 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
5127 |
||
5128 |
index == 0 ifTrue:[ scr0 := margin ] |
|
5129 |
ifFalse:[ scr0 := boundsMin ]. |
|
5130 |
||
5131 |
delta := layoutMin negated + scr0. |
|
2016 | 5132 |
] ifFalse:[ |
3938 | 5133 |
layoutMax > boundsMax ifFalse:[ |
5134 |
^ self |
|
5135 |
]. |
|
5136 |
"/ test whether is last visible item |
|
5137 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
5138 |
||
5139 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
|
5140 |
ifFalse:[ scr0 := boundsMax ]. |
|
5141 |
||
5142 |
delta := scr0 - layoutMax. |
|
2018 | 5143 |
]. |
5144 |
delta == 0 ifTrue:[ ^ self ]. |
|
5145 |
||
2016 | 5146 |
doScroll := false. |
5147 |
||
5148 |
shown ifTrue:[ |
|
3938 | 5149 |
delta abs < (windowSz / 2) ifTrue:[ |
5150 |
doScroll := true. |
|
5151 |
self repairDamage |
|
5152 |
] |
|
2016 | 5153 |
]. |
2018 | 5154 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
5155 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 5156 |
|
5157 |
doScroll ifFalse:[ |
|
3938 | 5158 |
self invalidate. |
5159 |
^ self |
|
2016 | 5160 |
]. |
5161 |
||
2018 | 5162 |
windowSz := windowSz - margin - margin. |
5163 |
||
5164 |
scr0 := boundsMin. |
|
5165 |
scr1 := scr0 + delta abs. |
|
5166 |
scrSz := boundsMax - scr1. |
|
5167 |
||
5168 |
delta < 0 ifTrue:[ |
|
3938 | 5169 |
isVertical ifTrue:[ |
5170 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
5171 |
width:windowSz height:scrSz async:false. |
|
5172 |
||
5173 |
scr1 := scr0 + scrSz. |
|
5174 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
|
5175 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
5176 |
] ifFalse:[ |
|
5177 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
5178 |
width:scrSz height:windowSz async:false. |
|
5179 |
||
5180 |
scr1 := scr0 + scrSz. |
|
5181 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
|
5182 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
5183 |
]. |
|
5184 |
inv1 := boundsPREV. |
|
2016 | 5185 |
] ifFalse:[ |
3938 | 5186 |
isVertical ifTrue:[ |
5187 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
5188 |
width:windowSz height:scrSz async:false. |
|
5189 |
||
5190 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
|
5191 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
5192 |
] ifFalse:[ |
|
5193 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
5194 |
width:scrSz height:windowSz async:false. |
|
5195 |
||
5196 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
|
5197 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
5198 |
]. |
|
5199 |
inv1 := boundsNEXT. |
|
2042 | 5200 |
]. |
5201 |
self invalidate:inv1. |
|
5202 |
self invalidate:inv2. |
|
2048 | 5203 |
|
5204 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 5205 |
! |
5206 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5207 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5208 |
"returns the one and only scrollActivity - data holder |
2715 | 5209 |
for a menu and all contained submenus" |
5210 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5211 |
superMenu notNil ifTrue:[ |
3938 | 5212 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5213 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5214 |
scrollActivity isNil ifTrue:[ |
3938 | 5215 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5216 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5217 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5218 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5219 |
|
2016 | 5220 |
scrollerBoundsAt:aDirection |
2860 | 5221 |
"returns the bounds of the scroller at a direction" |
2715 | 5222 |
|
2016 | 5223 |
|y x w h inset| |
5224 |
||
5225 |
inset := 0. |
|
5226 |
x := y := inset. |
|
5227 |
w := h := 15. |
|
5228 |
||
5229 |
self verticalLayout ifTrue:[ |
|
3938 | 5230 |
aDirection == #NEXT ifTrue:[ |
5231 |
y := height - h - inset. |
|
5232 |
]. |
|
5233 |
w := width - inset - inset. |
|
2016 | 5234 |
] ifFalse:[ |
3938 | 5235 |
aDirection == #NEXT ifTrue:[ |
5236 |
x := width - w - inset. |
|
5237 |
]. |
|
5238 |
h := height - inset - inset. |
|
2016 | 5239 |
]. |
5240 |
^ Rectangle left:x top:y width:w height:h |
|
5241 |
! |
|
5242 |
||
2046 | 5243 |
scrollerDirectionAtPoint:aPoint |
2715 | 5244 |
"returns the scroller-direction at aPoint, or nil" |
5245 |
||
2046 | 5246 |
self hasScrollers ifTrue:[ |
3938 | 5247 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
5248 |
bounds := self scrollerBoundsAt:aDirection. |
|
5249 |
||
5250 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
5251 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
5252 |
] |
|
5253 |
] |
|
2046 | 5254 |
]. |
5255 |
^ nil |
|
5256 |
||
5257 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 5258 |
! ! |
5259 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5260 |
!MenuPanel methodsFor:'private-searching'! |
388 | 5261 |
|
1699 | 5262 |
detectGrabMenu |
2715 | 5263 |
"returns the menu which is responsible for the grap; the last opened menu" |
5264 |
||
1699 | 5265 |
|subMenu| |
5266 |
||
5267 |
selection notNil ifTrue:[ |
|
3938 | 5268 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
5269 |
^ subMenu detectGrabMenu |
|
5270 |
] |
|
1699 | 5271 |
]. |
5272 |
^ self |
|
5273 |
! |
|
5274 |
||
5275 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 5276 |
"returns the menu which contains the grab-point" |
5277 |
||
1699 | 5278 |
|dstMenu dstPoint firstMenu| |
5279 |
||
5280 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
5281 |
||
5282 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
3938 | 5283 |
firstMenu := self. |
1699 | 5284 |
]. |
5285 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5286 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
3938 | 5287 |
^ firstMenu |
1699 | 5288 |
]. |
5289 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 5290 |
^ dstMenu ? firstMenu |
1699 | 5291 |
! |
5292 |
||
1767 | 5293 |
detectViewAtX:x y:y in:aTopView |
2715 | 5294 |
"detect view at x@y" |
5295 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5296 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5297 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5298 |
"/ cg: old code was (refactored to use common code) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5299 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5300 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5301 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5302 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5303 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5304 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5305 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5306 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5307 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5308 |
"/ p := device translatePoint:(x@y) from:(aTopView id) to:(v id). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5309 |
"/ ^ self detectViewAtX:p x y:p y in:v. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5310 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5311 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5312 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5313 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5314 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5315 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5316 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 5317 |
! |
5318 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5319 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5320 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 5321 |
If no item match nil is returned." |
5322 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5323 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5324 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5325 |
stringOrNumberOrPoint isPoint ifTrue:[ |
3938 | 5326 |
^ self itemAtPoint:stringOrNumberOrPoint |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5327 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5328 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5329 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 5330 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5331 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5332 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5333 |
itemAtPoint:aPoint |
2715 | 5334 |
"returns the item at aPoint or nil if none detected" |
5335 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5336 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5337 |
|
1699 | 5338 |
items notNil ifTrue:[ |
3938 | 5339 |
x := aPoint x. |
5340 |
y := aPoint y. |
|
5341 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
|
1699 | 5342 |
]. |
5343 |
^ nil |
|
388 | 5344 |
! |
5345 |
||
2048 | 5346 |
superMenuAtPoint:aPoint |
2715 | 5347 |
"returns the superMenu which contains aPoint, or nil if none detected" |
5348 |
||
1699 | 5349 |
|grabPoint superMenu| |
5350 |
||
2048 | 5351 |
(self containsPoint:aPoint) ifTrue:[ |
3938 | 5352 |
^ self |
1699 | 5353 |
]. |
5354 |
||
2048 | 5355 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 5356 |
superMenu := self. |
5357 |
||
5358 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
3938 | 5359 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
5360 |
^ superMenu |
|
5361 |
] |
|
2715 | 5362 |
]. |
5363 |
^ nil |
|
1699 | 5364 |
|
2048 | 5365 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 5366 |
! ! |
5367 |
||
5368 |
!MenuPanel methodsFor:'queries'! |
|
5369 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5370 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5371 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5372 |
aView notNil ifTrue:[ |
3147 | 5373 |
"/ I am no longer a popUpView |
5374 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5375 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5376 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5377 |
|
388 | 5378 |
containsPoint:aPoint |
2715 | 5379 |
"returns true if the argument, aPoint is contained by the view" |
5380 |
||
388 | 5381 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
5382 |
! |
|
5383 |
||
5384 |
containsPointX:x y:y |
|
2715 | 5385 |
"returns true if point is contained by the view" |
5386 |
||
708 | 5387 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 5388 |
! |
5389 |
||
390 | 5390 |
hasGroupDividerAt:anIndex |
2715 | 5391 |
"returns true if a divider is defined at an index" |
5392 |
||
388 | 5393 |
|i| |
5394 |
||
5395 |
groupSizes size ~~ 0 ifTrue:[ |
|
3938 | 5396 |
i := 0. |
5397 |
||
5398 |
groupSizes do:[:t| |
|
5399 |
(i := i + t) == anIndex ifTrue:[ |
|
5400 |
^ true |
|
5401 |
] |
|
5402 |
] |
|
2715 | 5403 |
]. |
5404 |
^ false |
|
388 | 5405 |
! |
5406 |
||
390 | 5407 |
hasGroupDividers |
2715 | 5408 |
"returns true if any group divider exists" |
5409 |
||
5410 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 5411 |
! |
5412 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5413 |
hasPerformed |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5414 |
^ hasPerformed ? false |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5415 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5416 |
"Created: / 29-06-2011 / 16:24:14 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5417 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5418 |
|
3457
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5419 |
isActive |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5420 |
"true, if I have the focus (w.r.t the windowing system); |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5421 |
i.e. if one of my subViews actually has the real focus. |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5422 |
With click-to-focus behavior, this is obviously the current application. |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5423 |
Use this query with caution, for example, to suppress tooltips for inactive apps. |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5424 |
|
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5425 |
This should be only in TowView, but apparently MenuPanel is used as a TopView" |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5426 |
|
3938 | 5427 |
^ windowGroup notNil and:[windowGroup anyViewHasFocus] |
3457
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5428 |
! |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5429 |
|
390 | 5430 |
isFitPanel |
5431 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 5432 |
be fit to the extent of its superView; |
2715 | 5433 |
NOT SUPPORTED" |
5434 |
||
1699 | 5435 |
^ false |
390 | 5436 |
! |
5437 |
||
388 | 5438 |
isPopUpView |
5439 |
"return true if view is a popup view; without decoration |
|
2715 | 5440 |
and popUp to top immediately" |
5441 |
||
388 | 5442 |
^ superView isNil |
5443 |
! |
|
5444 |
||
5445 |
isVerticalLayout |
|
2715 | 5446 |
"returns true if vertical layout otherwise false( horizontal layout )" |
5447 |
||
1699 | 5448 |
^ self verticalLayout |
416 | 5449 |
! |
5450 |
||
1793 | 5451 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
5452 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 5453 |
! |
5454 |
||
416 | 5455 |
type |
428 | 5456 |
^ nil. |
416 | 5457 |
|
388 | 5458 |
! ! |
5459 |
||
5460 |
!MenuPanel methodsFor:'selection'! |
|
5461 |
||
5462 |
hasSelection |
|
2715 | 5463 |
"returns true if a selection exists" |
5464 |
||
388 | 5465 |
^ self selection notNil |
5466 |
! |
|
5467 |
||
2199 | 5468 |
openDelayed:anItem |
3187 | 5469 |
self openDelayed:anItem afterSeconds:0.5. |
5470 |
! |
|
5471 |
||
5472 |
openDelayed:anItem afterSeconds:seconds |
|
2199 | 5473 |
|
2374 | 5474 |
superMenu notNil ifTrue:[ |
3938 | 5475 |
superMenu openDelayed:anItem afterSeconds:seconds. |
5476 |
^ self |
|
2374 | 5477 |
]. |
5478 |
openDelayedMenuBlock notNil ifTrue:[ |
|
3938 | 5479 |
Processor removeTimedBlock:openDelayedMenuBlock. |
5480 |
openDelayedMenuBlock := nil. |
|
2253 | 5481 |
]. |
3187 | 5482 |
(anItem notNil and:[anItem hasSubmenu]) ifFalse:[ |
3938 | 5483 |
openDelayedMenuBlock := nil. |
5484 |
^ self |
|
2253 | 5485 |
]. |
5486 |
openDelayedMenuBlock := [ |
|
3938 | 5487 |
openDelayedMenuBlock := nil. |
5488 |
anItem openDelayedSubmenu |
|
2253 | 5489 |
]. |
5490 |
||
3187 | 5491 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
2199 | 5492 |
! |
5493 |
||
3975 | 5494 |
selectAndOpenDelayed:anItemOrNil |
5495 |
"change selection to an item or nil" |
|
5496 |
||
5497 |
|helpListener oldSelect delayedOpenSeconds| |
|
5498 |
||
5499 |
delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu. |
|
5500 |
||
5501 |
anItemOrNil == selection ifTrue:[ ^ self ]. |
|
5502 |
self openDelayed:nil. |
|
5503 |
||
5504 |
oldSelect := selection. |
|
5505 |
selection := nil. |
|
5506 |
delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu. |
|
5507 |
||
5508 |
oldSelect notNil ifTrue:[ |
|
5509 |
"/ clear current selection |
|
5510 |
|oldSubmenu| |
|
5511 |
oldSubmenu := oldSelect visibleSubmenu. |
|
5512 |
||
5513 |
oldSubmenu notNil ifTrue:[ |
|
5514 |
Processor addTimedBlock:[ |
|
5515 |
selection ~~ oldSelect ifTrue:[ |
|
5516 |
"cancels the current delayed opertion" |
|
5517 |
oldSelect hideSubmenu. |
|
5518 |
||
5519 |
( selection notNil |
|
5520 |
and:[selection hasSubmenu |
|
5521 |
and:[selection visibleSubmenu isNil]] |
|
5522 |
) ifTrue:[ |
|
5523 |
"setup new delayed opertion.." |
|
5524 |
self openDelayed:selection afterSeconds:0.1 |
|
5525 |
]. |
|
5526 |
]. |
|
5527 |
] afterSeconds:delayedOpenSeconds. |
|
5528 |
]. |
|
5529 |
oldSelect invalidate. |
|
5530 |
]. |
|
5531 |
||
5532 |
anItemOrNil notNil ifTrue:[ |
|
5533 |
self makeItemVisible:anItemOrNil. |
|
5534 |
anItemOrNil canSelect ifTrue:[ |
|
5535 |
selection := anItemOrNil |
|
5536 |
]. |
|
5537 |
]. |
|
5538 |
selection isNil ifTrue:[^ self]. |
|
5539 |
||
5540 |
ActiveHelp isActive ifTrue:[ |
|
5541 |
helpListener := ActiveHelp currentHelpListener. |
|
5542 |
helpListener initiateHelpFor:self at:nil now:true. |
|
5543 |
]. |
|
5544 |
shown ifTrue:[ |
|
5545 |
"/ self rearrangeItems. |
|
5546 |
selection invalidate. |
|
5547 |
||
5548 |
selection hasSubmenu ifTrue:[ |
|
5549 |
self openDelayed:selection afterSeconds:delayedOpenSeconds. |
|
5550 |
]. |
|
5551 |
]. |
|
5552 |
! |
|
5553 |
||
388 | 5554 |
selection |
2715 | 5555 |
"returns current selected item or nil" |
5556 |
||
388 | 5557 |
^ selection |
5558 |
! |
|
5559 |
||
5560 |
selection:anItemOrNil |
|
2016 | 5561 |
"change selection to an item or nil |
2715 | 5562 |
if the item has a submenu the first item might be selected (style-sheet)" |
5563 |
||
2249 | 5564 |
|openMenu openOnSelect submenu item| |
5565 |
||
5566 |
selection == anItemOrNil ifTrue:[^ self]. |
|
5567 |
||
5568 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
3938 | 5569 |
self selection:anItemOrNil openMenu:false. |
5570 |
^ self |
|
2249 | 5571 |
]. |
5572 |
||
5573 |
openMenu := self isPopUpView not. |
|
5574 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
5575 |
||
5576 |
openMenu ifFalse:[ |
|
3938 | 5577 |
openMenu := openOnSelect. |
2249 | 5578 |
]. |
5579 |
self selection:anItemOrNil openMenu:openMenu. |
|
5580 |
||
5581 |
openOnSelect ifFalse:[ |
|
3938 | 5582 |
"/ select first item in submenu |
5583 |
||
5584 |
submenu := anItemOrNil currentSubmenu. |
|
5585 |
||
5586 |
submenu notNil ifTrue:[ |
|
5587 |
item := submenu itemAt:1. |
|
5588 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
|
5589 |
submenu selection:item openMenu:false |
|
5590 |
] |
|
5591 |
]. |
|
2249 | 5592 |
]. |
5593 |
! |
|
5594 |
||
5595 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 5596 |
"change selection to an item or nil" |
5597 |
||
2251 | 5598 |
|helpListener oldSelect| |
2249 | 5599 |
|
5600 |
anItemOrNil == selection ifTrue:[ |
|
3938 | 5601 |
^ self |
2016 | 5602 |
]. |
2199 | 5603 |
self openDelayed:nil. |
388 | 5604 |
|
2251 | 5605 |
oldSelect := selection. |
5606 |
selection := nil. |
|
2249 | 5607 |
|
2374 | 5608 |
anItemOrNil notNil ifTrue:[ |
3938 | 5609 |
self makeItemVisible:anItemOrNil. |
5610 |
anItemOrNil canSelect ifTrue:[ |
|
5611 |
selection := anItemOrNil |
|
5612 |
] ifFalse:[ |
|
5613 |
oldSelect isNil ifTrue:[^ self]. |
|
5614 |
]. |
|
2249 | 5615 |
]. |
2374 | 5616 |
oldSelect notNil ifTrue:[ |
3938 | 5617 |
"/ clear current selection |
5618 |
oldSelect isSelected:false. |
|
2251 | 5619 |
]. |
2374 | 5620 |
selection isNil ifTrue:[^ self]. |
2251 | 5621 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5622 |
"/ selection == enteredItem ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5623 |
"/ enteredItem := nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5624 |
"/ ] ifFalse:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5625 |
"/ self pointerEntersItem:nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5626 |
"/ ]. |
2016 | 5627 |
ActiveHelp isActive ifTrue:[ |
3938 | 5628 |
helpListener := ActiveHelp currentHelpListener. |
5629 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 5630 |
]. |
5631 |
shown ifTrue:[ |
|
3938 | 5632 |
"/ self rearrangeItems. |
5633 |
||
5634 |
openMenu ifFalse:[ |
|
5635 |
selection invalidate. |
|
5636 |
] |
|
2249 | 5637 |
]. |
5638 |
openMenu ifTrue:[ |
|
3938 | 5639 |
selection isSelected:true. |
2249 | 5640 |
]. |
388 | 5641 |
! |
5642 |
||
5643 |
selectionIndex |
|
2715 | 5644 |
"returns index of current selection or 0" |
5645 |
||
388 | 5646 |
|item| |
5647 |
||
5648 |
(item := self selection) notNil ifTrue:[ |
|
3938 | 5649 |
^ self findFirst:[:el| el == item ] |
388 | 5650 |
]. |
5651 |
^ 0 |
|
5652 |
! |
|
5653 |
||
5654 |
selectionIndex:anIndex |
|
2715 | 5655 |
"set selection at an index" |
5656 |
||
388 | 5657 |
self selection:(self itemAt:anIndex) |
5658 |
! ! |
|
5659 |
||
1791 | 5660 |
!MenuPanel methodsFor:'translation'! |
5661 |
||
5662 |
translateGrabPoint:aGrabPoint |
|
2715 | 5663 |
"translate the grab point into self" |
5664 |
||
1791 | 5665 |
superMenu isNil ifTrue:[ |
3938 | 5666 |
"I am the grabView" |
5667 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5668 |
^ aGrabPoint |
|
1791 | 5669 |
]. |
5670 |
||
5671 |
relativeGrabOrigin isNil ifTrue:[ |
|
3938 | 5672 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
5673 |
relativeGrabOrigin isNil ifTrue:[ |
|
5674 |
"I am the grabView" |
|
5675 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5676 |
^ aGrabPoint |
|
5677 |
]. |
|
1791 | 5678 |
]. |
5679 |
^ relativeGrabOrigin + aGrabPoint |
|
5680 |
! |
|
5681 |
||
5682 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 5683 |
"translate a point into another menu its point" |
5684 |
||
1791 | 5685 |
|grapPoint| |
5686 |
||
5687 |
aMenu == self ifTrue:[ |
|
3938 | 5688 |
^ aPoint |
1791 | 5689 |
]. |
5690 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
5691 |
||
2715 | 5692 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 5693 |
! |
5694 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5695 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 5696 |
"translate a point in my window to anotherWindowOrNilForScreen (or root window if nil)" |
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5697 |
|
3938 | 5698 |
^ device |
5699 |
translatePoint:aPoint asPoint |
|
5700 |
fromView:self |
|
5701 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5702 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5703 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 5704 |
! ! |
5705 |
||
388 | 5706 |
!MenuPanel::Item class methodsFor:'accessing'! |
5707 |
||
689 | 5708 |
horizontalInset |
5709 |
^ HorizontalInset |
|
5710 |
! |
|
5711 |
||
388 | 5712 |
labelRightOffset |
5713 |
^ LabelRightOffset |
|
5714 |
! |
|
5715 |
||
689 | 5716 |
verticalInset |
5717 |
^ VerticalInset |
|
1765 | 5718 |
! |
5719 |
||
5720 |
verticalPopUpInset |
|
5721 |
^ VerticalPopUpInset |
|
388 | 5722 |
! ! |
5723 |
||
616 | 5724 |
!MenuPanel::Item class methodsFor:'defaults'! |
5725 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5726 |
halfSeparatorSize |
2870 | 5727 |
"returns the size of a space-separator" |
5728 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5729 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5730 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5731 |
|
1699 | 5732 |
separatorSize |
2870 | 5733 |
"returns the size of a separator" |
5734 |
||
1699 | 5735 |
^ 10 |
616 | 5736 |
! |
5737 |
||
5738 |
updateStyleCache |
|
2777 | 5739 |
"extract values from the styleSheet and cache them in class variables" |
5740 |
||
1765 | 5741 |
<resource: #style (#'menuPanel.verticalInset')> |
5742 |
||
1699 | 5743 |
HorizontalInset := 2. |
1765 | 5744 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5745 |
VerticalPopUpInset := 2. |
|
727 | 5746 |
|
5747 |
HorizontalButtonInset := 3. |
|
5748 |
VerticalButtonInset := 3. |
|
5749 |
||
681 | 5750 |
LabelRightOffset := 15. |
1765 | 5751 |
|
2777 | 5752 |
" |
5753 |
self updateStyleCache |
|
5754 |
" |
|
1124 | 5755 |
! ! |
1078 | 5756 |
|
388 | 5757 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5758 |
||
5759 |
in:aSuperMenu |
|
5760 |
^ self in:aSuperMenu label:nil |
|
5761 |
! |
|
5762 |
||
5763 |
in:aSuperMenu label:aLabel |
|
5764 |
|item| |
|
5765 |
||
5766 |
item := self new in:aSuperMenu. |
|
5767 |
item label:aLabel. |
|
2870 | 5768 |
^ item |
388 | 5769 |
! |
5770 |
||
5771 |
in:aSuperMenu menuItem:aMenuItem |
|
5772 |
|item| |
|
5773 |
||
5774 |
item := self in:aSuperMenu. |
|
5775 |
item menuItem:aMenuItem. |
|
2870 | 5776 |
^ item. |
2359 | 5777 |
! |
5778 |
||
5779 |
new |
|
5780 |
^ self basicNew initialize |
|
388 | 5781 |
! ! |
5782 |
||
1808 | 5783 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5784 |
|
420 | 5785 |
canAccept |
2870 | 5786 |
"returns true if item is acceptable" |
5787 |
||
2199 | 5788 |
self enabled ifFalse:[ ^ false]. |
5789 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5790 |
||
5791 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
3558 | 5792 |
^ subMenu isNil or:[subMenu shown not] |
524 | 5793 |
! |
5794 |
||
5795 |
toggleIndication |
|
2870 | 5796 |
"toggle indication or choice" |
5797 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5798 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5799 |
|
3938 | 5800 |
indication notNil ifTrue:[ |
5801 |
arg := self indicationValue not. |
|
5802 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5803 |
] ifFalse:[ |
3938 | 5804 |
choice notNil ifTrue:[ |
5805 |
choice value:(menuItem choiceValue). |
|
5806 |
^ true |
|
5807 |
] |
|
524 | 5808 |
]. |
5809 |
^ arg |
|
389 | 5810 |
! ! |
5811 |
||
388 | 5812 |
!MenuPanel::Item methodsFor:'accessing'! |
5813 |
||
5814 |
accessCharacter |
|
2870 | 5815 |
"returns my accessCharacter or nil" |
5816 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5817 |
^ accessCharacter |
388 | 5818 |
! |
5819 |
||
5820 |
accessCharacterPosition |
|
2870 | 5821 |
"get the access character position or nil" |
5822 |
||
2359 | 5823 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5824 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5825 |
|
3938 | 5826 |
accessCharacterPosition:anIndex |
2870 | 5827 |
"set the access character position or nil" |
5828 |
||
2359 | 5829 |
menuItem accessCharacterPosition:anIndex. |
388 | 5830 |
! |
5831 |
||
5832 |
argument |
|
2870 | 5833 |
"gets the argument" |
5834 |
||
2359 | 5835 |
^ menuItem argument |
388 | 5836 |
! |
5837 |
||
5838 |
argument:anArgument |
|
2870 | 5839 |
"sets the argument" |
5840 |
||
2359 | 5841 |
menuItem argument:anArgument. |
389 | 5842 |
! |
5843 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5844 |
displayLabel |
2870 | 5845 |
"returns my printable Label" |
5846 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5847 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5848 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5849 |
|
2614 | 5850 |
displayLabelExtent |
2870 | 5851 |
"returns the labels extent" |
5852 |
||
3837 | 5853 |
|myFont prevFont w h| |
2614 | 5854 |
|
5855 |
displayLabelExtent notNil ifTrue:[ |
|
3938 | 5856 |
^ displayLabelExtent |
2614 | 5857 |
]. |
5858 |
||
5859 |
displayLabel isNil ifTrue:[ |
|
3938 | 5860 |
displayLabelExtent := 0@0. |
5861 |
^ displayLabelExtent |
|
2614 | 5862 |
]. |
3837 | 5863 |
|
5864 |
myFont := self font. |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5865 |
myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ]. |
3837 | 5866 |
myFont := myFont onDevice:menuPanel device. |
5867 |
||
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5868 |
prevFont := menuPanel setFont:myFont. |
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5869 |
|
3837 | 5870 |
displayLabel isString ifTrue:[ |
3938 | 5871 |
w := displayLabel widthOn:menuPanel. |
5872 |
h := displayLabel heightOn:menuPanel. |
|
5873 |
"/ w := myFont widthOf:displayLabel. |
|
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5874 |
"/ h := myFont heightOf:displayLabel. |
3938 | 5875 |
] ifFalse:[ |
5876 |
displayLabel isArray ifTrue:[ |
|
5877 |
w := h := 0. |
|
5878 |
||
5879 |
displayLabel do:[:aSubLabel| |
|
5880 |
aSubLabel notNil ifTrue:[ |
|
5881 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5882 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5883 |
] ifFalse:[ |
|
5884 |
h := h + (self spaceBetweenEmptyLines) |
|
5885 |
] |
|
5886 |
] |
|
5887 |
] ifFalse:[ |
|
5888 |
w := displayLabel widthOn:menuPanel. |
|
5889 |
h := displayLabel heightOn:menuPanel. |
|
5890 |
]. |
|
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5891 |
]. |
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5892 |
|
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5893 |
menuPanel setFont:prevFont. "/ restore previous font |
3837 | 5894 |
|
2614 | 5895 |
"/ care for italic fonts - give a few more pixels at the end |
3837 | 5896 |
myFont italic ifTrue:[ |
3938 | 5897 |
w := w + 2. |
2614 | 5898 |
]. |
5899 |
displayLabelExtent := w@h. |
|
5900 |
^ displayLabelExtent |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5901 |
|
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5902 |
"Modified: / 17-08-2010 / 10:46:06 / cg" |
2614 | 5903 |
! |
5904 |
||
1727 | 5905 |
font |
2870 | 5906 |
"returns the user configured font or nil (default menu font)" |
5907 |
||
2373 | 5908 |
|font| |
5909 |
||
5910 |
menuPanel isNil ifTrue:[^ nil]. |
|
5911 |
||
5912 |
font := menuItem font. |
|
5913 |
||
5914 |
font notNil ifTrue:[ |
|
3938 | 5915 |
font := font onDevice:(menuPanel device). |
5916 |
menuItem font:font. |
|
2373 | 5917 |
]. |
1727 | 5918 |
^ font |
5919 |
! |
|
5920 |
||
5921 |
font:aFont |
|
2870 | 5922 |
"returns the user configured font or nil (default menu font)" |
5923 |
||
2373 | 5924 |
menuItem font:aFont. |
1727 | 5925 |
! |
5926 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5927 |
ignoreMnemonicKeys |
4076 | 5928 |
"if true, mnemonic (access character) in the submenus under the item are ignored. |
5929 |
Set this to speedup accelerator key processing for slow dynamci menus" |
|
2870 | 5930 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5931 |
^ menuItem ignoreMnemonicKeys |
4076 | 5932 |
|
5933 |
"Modified (comment): / 08-09-2011 / 04:29:47 / cg" |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5934 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5935 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5936 |
ignoreMnemonicKeys:aBoolean |
2870 | 5937 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5938 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5939 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5940 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5941 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5942 |
ignoreShortcutKeys |
2870 | 5943 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5944 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5945 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5946 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5947 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5948 |
ignoreShortcutKeys:aBoolean |
2870 | 5949 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5950 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5951 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5952 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5953 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5954 |
itemValue |
2870 | 5955 |
"gets the items value" |
5956 |
||
2360 | 5957 |
^ menuItem itemValue |
5958 |
! |
|
5959 |
||
5960 |
itemValue:aValue |
|
2870 | 5961 |
"argument could be a value holder, an action or selector" |
5962 |
||
2360 | 5963 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5964 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5965 |
|
388 | 5966 |
label |
2870 | 5967 |
"returns the label" |
5968 |
||
388 | 5969 |
^ label |
5970 |
! |
|
5971 |
||
5972 |
label:aLabel |
|
399 | 5973 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 5974 |
handle characters $& (ST-80 compatibility)" |
5975 |
||
2614 | 5976 |
|size char oldExtent| |
5977 |
||
5978 |
oldExtent := displayLabelExtent. |
|
5979 |
displayLabelExtent := nil. "/ force a recomputation |
|
5980 |
accessCharacter := disabledDisplayLabel := nil. |
|
3454
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
5981 |
|
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
5982 |
"Stefan: Why do we use #value two times??" |
2614 | 5983 |
label := aLabel value. |
5984 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5985 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5986 |
displayLabel isString ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5987 |
"CHECK FOR SEPARATOR" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5988 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5989 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5990 |
size := displayLabel size. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5991 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5992 |
size == 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5993 |
displayLabel := nil. "blank separator" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5994 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5995 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5996 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5997 |
size == 1 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5998 |
char := displayLabel first. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5999 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6000 |
(char == $- or:[char == $=]) ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6001 |
label := displayLabel. "line separator" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6002 |
displayLabel := nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6003 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6004 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6005 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6006 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6007 |
] ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6008 |
displayLabel isCollection ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6009 |
displayLabel := displayLabel asArray. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6010 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6011 |
]. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
6012 |
menuPanel doAccessCharacterTranslation ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6013 |
displayLabel notNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6014 |
displayLabel isArray ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6015 |
displayLabel keysAndValuesDo:[:i :el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6016 |
el notNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6017 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6018 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6019 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6020 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6021 |
displayLabel isImageOrForm ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6022 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6023 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6024 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6025 |
]. |
2614 | 6026 |
]. |
6027 |
||
6028 |
menuPanel shown ifTrue:[ |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6029 |
self fetchImages. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6030 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6031 |
oldExtent = self displayLabelExtent ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6032 |
self invalidate |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6033 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6034 |
menuPanel mustRearrange |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6035 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6036 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6037 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6038 |
"Modified: / 06-10-2011 / 16:36:53 / cg" |
388 | 6039 |
! |
6040 |
||
6041 |
menuPanel |
|
2870 | 6042 |
"returns my menuPanel" |
6043 |
||
399 | 6044 |
^ menuPanel |
388 | 6045 |
! |
6046 |
||
6047 |
nameKey |
|
2870 | 6048 |
"gets the nameKey" |
6049 |
||
2359 | 6050 |
^ menuItem nameKey |
388 | 6051 |
! |
6052 |
||
6053 |
nameKey:aNameKey |
|
2870 | 6054 |
"sets the nameKey" |
6055 |
||
2359 | 6056 |
menuItem nameKey:aNameKey. |
388 | 6057 |
! |
6058 |
||
6059 |
rawLabel |
|
2870 | 6060 |
"returns my raw, unprocessed label" |
6061 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6062 |
^ menuItem rawLabel |
388 | 6063 |
! |
6064 |
||
6065 |
shortcutKey |
|
6066 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 6067 |
no submenu exists evaluate the action assigned to the item (accept)." |
6068 |
||
2359 | 6069 |
^ menuItem shortcutKey |
388 | 6070 |
! |
6071 |
||
6072 |
shortcutKey:aKey |
|
6073 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 6074 |
no submenu exists evaluate the action assigned to the item (accept)." |
6075 |
||
2359 | 6076 |
menuItem shortcutKey ~= aKey ifTrue:[ |
3938 | 6077 |
menuItem shortcutKey:aKey. |
6078 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6079 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6080 |
! |
388 | 6081 |
|
710 | 6082 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6083 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6084 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6085 |
|
2359 | 6086 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6087 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6088 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 6089 |
! |
6090 |
||
6091 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6092 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6093 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6094 |
|
2359 | 6095 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6096 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6097 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 6098 |
! |
6099 |
||
388 | 6100 |
submenu |
3133 | 6101 |
"returns my submenu or creates it if its defined via a selector or channel. |
6102 |
May return nil, if there is really no menu" |
|
6103 |
||
6104 |
subMenu isNil ifTrue:[ |
|
3938 | 6105 |
self setupSubmenu |
3133 | 6106 |
]. |
6107 |
^ subMenu |
|
6108 |
||
6109 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 6110 |
! |
6111 |
||
6112 |
submenu:aSubMenu |
|
3938 | 6113 |
"set a new submenu; an existing submenu will be destroyed. |
2870 | 6114 |
This might lead to a redraw if 'hasSubmenu' changed" |
6115 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6116 |
|widget| |
1767 | 6117 |
|
6118 |
aSubMenu isNil ifTrue:[ |
|
3938 | 6119 |
subMenu notNil ifTrue:[ |
6120 |
subMenu destroy. |
|
6121 |
subMenu := nil. |
|
6122 |
]. |
|
6123 |
^ self |
|
1767 | 6124 |
]. |
6125 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6126 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
3938 | 6127 |
subMenu := MenuPanel new. |
6128 |
||
6129 |
menuPanel notNil ifTrue:[ |
|
6130 |
subMenu receiver:menuPanel receiver. |
|
6131 |
]. |
|
6132 |
subMenu superMenu:menuPanel. |
|
6133 |
||
6134 |
menuItem horizontalLayout == true ifTrue:[ |
|
6135 |
subMenu verticalLayout:false |
|
6136 |
]. |
|
6137 |
subMenu menu:aSubMenu. |
|
1767 | 6138 |
] ifFalse:[ |
3938 | 6139 |
aSubMenu isView ifFalse:[ |
6140 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
6141 |
"/ ... mhhhh .... |
|
6142 |
^ menuItem submenuChannel:aSubMenu |
|
6143 |
]. |
|
6144 |
widget := SimpleView new. |
|
6145 |
widget client:aSubMenu. |
|
6146 |
] ifTrue:[ |
|
6147 |
widget := aSubMenu. |
|
6148 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
6149 |
]. |
|
6150 |
||
6151 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
6152 |
subMenu := widget. |
|
6153 |
||
6154 |
menuItem horizontalLayout == true ifTrue:[ |
|
6155 |
subMenu verticalLayout:false |
|
6156 |
]. |
|
6157 |
] ifFalse:[ |
|
6158 |
subMenu := MenuPanel new. |
|
6159 |
subMenu receiver:menuPanel receiver. |
|
6160 |
subMenu addSubView:widget. |
|
6161 |
subMenu extent:(widget preferredExtent). |
|
6162 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
6163 |
]. |
|
6164 |
subMenu superMenu:menuPanel. |
|
2360 | 6165 |
]. |
389 | 6166 |
! |
6167 |
||
3133 | 6168 |
submenuOrNil |
6169 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
6170 |
||
6171 |
^ subMenu |
|
6172 |
||
6173 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
6174 |
! |
|
6175 |
||
390 | 6176 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6177 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6178 |
Used internally to select items via initial-character, for example." |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6179 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6180 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6181 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6182 |
displayLabel notNil ifTrue:[ |
3938 | 6183 |
displayLabel isArray ifFalse:[ |
6184 |
^ displayLabel perform:#string ifNotUnderstood:nil |
|
6185 |
]. |
|
6186 |
||
6187 |
displayLabel do:[:el| |
|
6188 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
|
6189 |
^ txt |
|
6190 |
] |
|
6191 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6192 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6193 |
^ nil |
390 | 6194 |
! |
6195 |
||
1841 | 6196 |
triggerOnDown |
2870 | 6197 |
"return true if triggering the action if pressed" |
6198 |
||
2359 | 6199 |
menuItem triggerOnDown ifTrue:[ |
3938 | 6200 |
self hasSubmenu ifFalse:[^ true]. |
1841 | 6201 |
]. |
6202 |
^ false |
|
6203 |
! |
|
6204 |
||
6205 |
triggerOnDown:aBool |
|
2870 | 6206 |
"setup to trigger the action if pressed" |
6207 |
||
2359 | 6208 |
menuItem triggerOnDown:aBool. |
1841 | 6209 |
! |
6210 |
||
389 | 6211 |
value |
2870 | 6212 |
"gets the items value |
6213 |
Left here for ST80 compatibility - value is a bad name" |
|
6214 |
||
2360 | 6215 |
^ menuItem itemValue |
6216 |
! |
|
6217 |
||
6218 |
value:aValue |
|
389 | 6219 |
"could be a value holder, an action or selector |
2870 | 6220 |
Left here for ST80 compatibility - value: is a bad name" |
6221 |
||
2360 | 6222 |
menuItem itemValue:aValue. |
502 | 6223 |
! |
6224 |
||
6225 |
value:aValue argument:anArgument |
|
2870 | 6226 |
"set the value and an argument" |
6227 |
||
2360 | 6228 |
menuItem itemValue:aValue. |
6229 |
menuItem argument:anArgument. |
|
388 | 6230 |
! ! |
6231 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6232 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 6233 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6234 |
choice |
2870 | 6235 |
"implements a radio group; the field" |
6236 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6237 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6238 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6239 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6240 |
choice:something |
2870 | 6241 |
"set choice indication" |
6242 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6243 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6244 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6245 |
choice isValueModel ifTrue:[ |
3938 | 6246 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6247 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6248 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6249 |
(choice := something) notNil ifTrue:[ |
3938 | 6250 |
choice isSymbol ifTrue:[ |
6251 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
6252 |
choice := something |
|
6253 |
] |
|
6254 |
]. |
|
6255 |
choice isValueModel ifTrue:[ |
|
6256 |
choice addDependent:self |
|
6257 |
] |
|
1699 | 6258 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6259 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6260 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6261 |
choiceValue |
2870 | 6262 |
"implements a radio group; the value writen to the choice if selected" |
6263 |
||
2359 | 6264 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6265 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6266 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6267 |
choiceValue:something |
2870 | 6268 |
"implements a radio group; the value writen to the choice if selected" |
6269 |
||
2359 | 6270 |
menuItem choiceValue ~= something ifTrue:[ |
3938 | 6271 |
menuItem choiceValue:something. |
6272 |
choice notNil ifTrue:[ self invalidate ]. |
|
2359 | 6273 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6274 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6275 |
|
388 | 6276 |
enabled |
2870 | 6277 |
"returns the enabled state" |
6278 |
||
524 | 6279 |
|state| |
6280 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6281 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6282 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6283 |
enableChannel isSymbol ifTrue:[ |
3938 | 6284 |
state := self aspectAt:enableChannel. |
6285 |
||
6286 |
state isNil ifTrue:[ |
|
6287 |
self ifNotInUIBuilderInfoPrintCR: |
|
6288 |
('MenuPanel::Item [info]: no aspect for %1 (in %2)' |
|
6289 |
bindWith:enableChannel |
|
6290 |
with:label). |
|
6291 |
^ true |
|
6292 |
]. |
|
6293 |
||
6294 |
state isValueModel ifTrue:[ |
|
6295 |
enableChannel := state. |
|
6296 |
enableChannel addDependent:self. |
|
6297 |
state := enableChannel value. |
|
6298 |
] ifFalse:[ |
|
6299 |
state := state value |
|
6300 |
] |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6301 |
] ifFalse:[ |
3938 | 6302 |
state := enableChannel value |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6303 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6304 |
^ state ~~ false |
388 | 6305 |
! |
6306 |
||
389 | 6307 |
enabled:something |
2870 | 6308 |
"change the enabled state; if the state changed, a redraw is performed" |
6309 |
||
390 | 6310 |
|oldState newState| |
6311 |
||
6312 |
enableChannel isNil ifTrue:[ |
|
3938 | 6313 |
oldState := true |
390 | 6314 |
] ifFalse:[ |
3938 | 6315 |
oldState := enableChannel value. |
6316 |
enableChannel isValueModel ifTrue:[ |
|
6317 |
enableChannel removeDependent:self |
|
6318 |
] |
|
388 | 6319 |
]. |
390 | 6320 |
enableChannel := something. |
6321 |
||
6322 |
enableChannel isNil ifTrue:[ |
|
3938 | 6323 |
menuPanel shown ifFalse:[^ self]. |
6324 |
newState := true |
|
390 | 6325 |
] ifFalse:[ |
3938 | 6326 |
enableChannel isValueModel ifTrue:[ |
6327 |
enableChannel addDependent:self |
|
6328 |
] ifFalse:[ |
|
6329 |
enableChannel isSymbol ifTrue:[^ self] |
|
6330 |
]. |
|
6331 |
menuPanel shown ifFalse:[^ self]. |
|
6332 |
newState := enableChannel value. |
|
390 | 6333 |
]. |
6334 |
||
6335 |
newState ~~ oldState ifTrue:[ |
|
3938 | 6336 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6337 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6338 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6339 |
|
1670 | 6340 |
hideMenuOnActivated |
2870 | 6341 |
"hide the menu when the item was activated; the default is true" |
6342 |
||
2359 | 6343 |
^ menuItem hideMenuOnActivated |
1670 | 6344 |
! |
6345 |
||
6346 |
hideMenuOnActivated:aBool |
|
2870 | 6347 |
"hide the menu when the item was activated; the default is true" |
6348 |
||
2359 | 6349 |
menuItem hideMenuOnActivated:aBool. |
1670 | 6350 |
! |
6351 |
||
2216 | 6352 |
ifNotInUIBuilderInfoPrintCR:aMessage |
6353 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
6354 |
||
3732 | 6355 |
|app| |
6356 |
||
6357 |
app := menuPanel application. |
|
6358 |
||
2216 | 6359 |
(menuPanel receiver isNil |
3732 | 6360 |
and:[ app notNil |
6361 |
and:[ app askFor:#isUIPainter]]) |
|
2216 | 6362 |
ifTrue:[ |
3938 | 6363 |
^ self "/ suppressed |
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6364 |
]. |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6365 |
aMessage infoPrint. |
3833 | 6366 |
"/ app notNil ifTrue:[ |
6367 |
"/ ' Application: ' infoPrint. app infoPrint |
|
6368 |
"/ ]. |
|
3444
b7d2f3fe5055
avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents:
3441
diff
changeset
|
6369 |
'' infoPrintCR. |
2216 | 6370 |
! |
6371 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6372 |
indication |
2870 | 6373 |
"get on/off indication" |
6374 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6375 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6376 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6377 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6378 |
indication:something |
2870 | 6379 |
"set on/off indication" |
6380 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6381 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6382 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6383 |
indication isValueModel ifTrue:[ |
3938 | 6384 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6385 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6386 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6387 |
(indication := something) notNil ifTrue:[ |
3938 | 6388 |
indication isValueModel ifTrue:[ |
6389 |
indication addDependent:self |
|
6390 |
] ifFalse:[ |
|
6391 |
"/ to force an update of the value |
|
6392 |
self indicationValue |
|
6393 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6394 |
]. |
464 | 6395 |
! |
6396 |
||
1767 | 6397 |
keepLinkedMenu |
2870 | 6398 |
"get the keepLinkedMenu flag" |
6399 |
||
2359 | 6400 |
^ menuItem keepLinkedMenu |
6401 |
! |
|
6402 |
||
6403 |
keepLinkedMenu:aBool |
|
2870 | 6404 |
"get the keepLinkedMenu flag" |
6405 |
||
2359 | 6406 |
menuItem keepLinkedMenu:aBool. |
1767 | 6407 |
! |
6408 |
||
2331 | 6409 |
sendToOriginator |
6410 |
"if true, the message is sent to the originating widget; |
|
6411 |
otherwise (the default), it it sent to the receiver/application." |
|
6412 |
||
2359 | 6413 |
^ menuItem sendToOriginator |
2331 | 6414 |
! |
6415 |
||
6416 |
sendToOriginator:aBoolean |
|
6417 |
"if true, the message is sent to the originating widget; |
|
6418 |
otherwise (the default), it it sent to the receiver/application." |
|
6419 |
||
2359 | 6420 |
menuItem sendToOriginator:aBoolean. |
2331 | 6421 |
! |
6422 |
||
464 | 6423 |
submenuChannel |
2870 | 6424 |
"get the submenu channel" |
6425 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6426 |
^ menuItem submenuChannel |
464 | 6427 |
! |
6428 |
||
6429 |
submenuChannel:aSelectorOrNil |
|
2870 | 6430 |
"returns the submenu channel" |
6431 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6432 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 6433 |
! ! |
6434 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6435 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 6436 |
|
2016 | 6437 |
moveBy:aPoint |
2870 | 6438 |
"move the layouts origin" |
6439 |
||
2016 | 6440 |
layout moveBy:aPoint. |
6441 |
! |
|
6442 |
||
1699 | 6443 |
preferredExtent |
2870 | 6444 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
6445 |
||
2614 | 6446 |
|isVertical icon wIcon isButton labelExtent |
1699 | 6447 |
x "{ Class:SmallInteger }" |
6448 |
y "{ Class:SmallInteger }" |
|
6449 |
s "{ Class:SmallInteger }" |
|
6450 |
| |
|
6451 |
self isVisible ifFalse:[^ 0@0 ]. |
|
6452 |
||
2359 | 6453 |
isButton := menuItem isButton. |
6454 |
||
1699 | 6455 |
isButton ifTrue:[ |
3987 | 6456 |
s := menuPanel maxAbsoluteButtonLevel ? 0. |
6457 |
x := s + HorizontalButtonInset. |
|
6458 |
y := s + VerticalButtonInset. |
|
1699 | 6459 |
] ifFalse:[ |
3987 | 6460 |
x := HorizontalInset. |
6461 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
|
1699 | 6462 |
]. |
6463 |
x := x * 2. |
|
6464 |
y := y * 2. |
|
6465 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6466 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6467 |
|
2362 | 6468 |
self isSeparator ifTrue:[ |
3987 | 6469 |
s := self class separatorSize. |
6470 |
label = '' ifTrue:[ |
|
6471 |
s := self class halfSeparatorSize. |
|
6472 |
]. |
|
6473 |
||
6474 |
"width of doubleSeparator is 5 !!!!" |
|
6475 |
isVertical ifFalse:[ |
|
6476 |
x := x max:s. |
|
6477 |
y := y + 5. |
|
6478 |
] ifTrue:[ |
|
6479 |
y := y max:s. |
|
6480 |
x := x + 5. |
|
6481 |
]. |
|
1699 | 6482 |
] ifFalse:[ |
3987 | 6483 |
labelExtent := self displayLabelExtent. |
6484 |
||
6485 |
x := x + labelExtent x. |
|
6486 |
y := y + labelExtent y. |
|
6487 |
x := x + (menuPanel stringOffsetXfor:self). |
|
6488 |
||
6489 |
isButton ifFalse:[ |
|
6490 |
menuPanel showSeparatingLines ifTrue:[ |
|
6491 |
"width of separator is 2 plus right offset 1 := 3" |
|
6492 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
|
6493 |
]. |
|
6494 |
]. |
|
6495 |
wIcon := 0. |
|
6496 |
self hasMenuIndicator ifTrue:[ |
|
6497 |
icon := MenuPanel menuIndicator. |
|
6498 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
|
6499 |
] ifFalse:[ |
|
6500 |
self hasDelayedMenuIndicator ifTrue:[ |
|
6501 |
icon := MenuPanel delayedMenuIndicator. |
|
6502 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
|
6503 |
] |
|
6504 |
]. |
|
6505 |
x := x + wIcon. |
|
1699 | 6506 |
]. |
6507 |
^ x@y |
|
3987 | 6508 |
|
6509 |
"Modified: / 19-01-2011 / 21:20:35 / cg" |
|
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6510 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6511 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6512 |
preferredHeight |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6513 |
^ self preferredExtent y |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6514 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6515 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6516 |
preferredWidth |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6517 |
^ self preferredExtent x |
388 | 6518 |
! ! |
6519 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6520 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 6521 |
|
6522 |
activeHelpKey |
|
2870 | 6523 |
"get the active helpKey; the key to retrieve the helpText from the application" |
6524 |
||
2359 | 6525 |
^ menuItem activeHelpKey |
1613 | 6526 |
! |
6527 |
||
6528 |
activeHelpKey:aHelpKey |
|
2870 | 6529 |
"set the active helpKey; the key to retrieve the helpText from the application" |
6530 |
||
2359 | 6531 |
menuItem activeHelpKey:aHelpKey. |
6532 |
activeHelpText := nil. |
|
1613 | 6533 |
! |
6534 |
||
6535 |
activeHelpText |
|
2870 | 6536 |
"get the active helpText or nil if not yet resolved" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6537 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6538 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6539 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6540 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6541 |
|
3938 | 6542 |
((key := self activeHelpKey) notNil |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6543 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
3938 | 6544 |
^ app helpTextForKey:key. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6545 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6546 |
^ nil |
1613 | 6547 |
! |
6548 |
||
6549 |
activeHelpText:aText |
|
2870 | 6550 |
"set the active helpText" |
6551 |
||
1613 | 6552 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6553 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6554 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6555 |
flyByHelpText |
2870 | 6556 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6557 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6558 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6559 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6560 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6561 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6562 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6563 |
|
2471 | 6564 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
6565 |
"/ (if you have an argument for that let us know..) |
|
6566 |
"/ self isButton ifFalse:[^ nil]. |
|
6567 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6568 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6569 |
"/ if an activeHelpKey was explicitely given, use that one |
3938 | 6570 |
key := self activeHelpKey. |
2895 | 6571 |
app := menuPanel application. |
6572 |
||
6573 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
6574 |
(key isAssociation) ifTrue:[ |
|
3938 | 6575 |
app := key key. |
6576 |
key := key value. |
|
2895 | 6577 |
]. |
6578 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6579 |
key notNil ifTrue:[ |
3938 | 6580 |
app notNil ifTrue:[ |
6581 |
text := app flyByHelpTextForKey:key. |
|
6582 |
]. |
|
6583 |
text isNil ifTrue:[ |
|
6584 |
text := menuPanel flyByHelpTextForKey:key. |
|
6585 |
]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6586 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6587 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6588 |
"/ otherwise, construct from the label; but only if I do not have a submenu |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6589 |
text isNil ifTrue:[ |
3938 | 6590 |
self hasSubmenu ifTrue:[ |
6591 |
^ key |
|
6592 |
]. |
|
6593 |
||
6594 |
text := key. |
|
6595 |
text isNil ifTrue:[ |
|
6596 |
displayLabel isString ifTrue:[ |
|
6597 |
text := displayLabel string. |
|
6598 |
]. |
|
6599 |
]. |
|
6600 |
text isNil ifTrue:[ |
|
6601 |
text := self rawLabel. |
|
6602 |
text isString ifFalse:[ |
|
6603 |
text := menuItem rawLabel. |
|
6604 |
text isString ifFalse:[ |
|
6605 |
text := nil. |
|
6606 |
] |
|
6607 |
]. |
|
6608 |
text notNil ifTrue:[ |
|
6609 |
(text includes:$&) ifTrue:[ |
|
6610 |
text := (self updateAccessCharacterFor:text) string. |
|
6611 |
]. |
|
6612 |
]. |
|
6613 |
]. |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6614 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6615 |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6616 |
(text isString and:[text isBlank]) ifTrue:[ text := nil ]. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6617 |
text = displayLabel ifTrue:[ |
3938 | 6618 |
"for text menus: it does not make sense to show the labels string again |
6619 |
(i.e. in a pull down menu)" |
|
6620 |
^ nil |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6621 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6622 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6623 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6624 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6625 |
flyByHelpText:aText |
2870 | 6626 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
6627 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6628 |
flyByHelpText := aText. |
1613 | 6629 |
! ! |
6630 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6631 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6632 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6633 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6634 |
"on default submenus has a vertical layout; |
2870 | 6635 |
true, the submenu has a horizontal layout." |
6636 |
||
2360 | 6637 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6638 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6639 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6640 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6641 |
"on default submenus has a vertical layout; |
2870 | 6642 |
true, the submenu has a horizontal layout." |
6643 |
||
2360 | 6644 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6645 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6646 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6647 |
isButton |
2870 | 6648 |
"returns whether the item looks like a Button" |
6649 |
||
2359 | 6650 |
^ menuItem isButton |
6651 |
! |
|
6652 |
||
6653 |
isButton:aBool |
|
2870 | 6654 |
"set/clear the item to look like a Button" |
6655 |
||
2359 | 6656 |
menuItem isButton ~~ aBool ifTrue:[ |
3938 | 6657 |
menuItem isButton:aBool. |
6658 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6659 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6660 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6661 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6662 |
layout |
2870 | 6663 |
"returns my layout ( Rectangle )" |
6664 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6665 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6666 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6667 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6668 |
layout:aLayout |
2870 | 6669 |
"set a new layout ( Rectangle )" |
6670 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6671 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6672 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6673 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6674 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6675 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6676 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 6677 |
while performing the menu action. Defaults to false." |
6678 |
||
2359 | 6679 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6680 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6681 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6682 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6683 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 6684 |
while performing the menu action. Defaults to false." |
6685 |
||
2359 | 6686 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6687 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6688 |
|
2504 | 6689 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 6690 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6691 |
currentSubmenu |
2870 | 6692 |
"returns the current submenu or nil" |
6693 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6694 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6695 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6696 |
|
1705 | 6697 |
hideSubmenu |
2870 | 6698 |
"hide submenu" |
6699 |
||
2199 | 6700 |
self hideSubmenu:subMenu. |
6701 |
! |
|
6702 |
||
6703 |
hideSubmenu:aSubmenu |
|
2870 | 6704 |
"hide submenu" |
6705 |
||
2871 | 6706 |
|id wg| |
1705 | 6707 |
|
2374 | 6708 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 6709 |
aSubmenu removeDependencies. |
2199 | 6710 |
|
6711 |
aSubmenu realized ifFalse:[ |
|
3938 | 6712 |
id := aSubmenu id. |
6713 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
|
2199 | 6714 |
] ifTrue:[ |
3938 | 6715 |
aSubmenu hide |
2199 | 6716 |
]. |
6717 |
||
2870 | 6718 |
aSubmenu windowGroup:nil. |
2871 | 6719 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
3938 | 6720 |
wg removeView:aSubmenu. |
2871 | 6721 |
]. |
2199 | 6722 |
|
6723 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6724 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
3938 | 6725 |
menuItem keepLinkedMenu ifFalse:[ |
6726 |
subMenu := nil |
|
6727 |
] |
|
2199 | 6728 |
]. |
6729 |
! |
|
6730 |
||
6731 |
openDelayedSubmenu |
|
2870 | 6732 |
"called to open now my delayed submenu" |
6733 |
||
3133 | 6734 |
|subMenuBeforeOpening| |
2199 | 6735 |
|
6736 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
6737 |
||
2374 | 6738 |
subMenu notNil ifTrue:[ |
3938 | 6739 |
subMenu realized ifTrue:[ |
6740 |
"/ already open |
|
6741 |
^ self |
|
6742 |
]. |
|
2199 | 6743 |
]. |
3133 | 6744 |
self setupSubmenu. |
6745 |
subMenu isNil ifTrue:[^ self]. |
|
6746 |
subMenuBeforeOpening := subMenu. |
|
2199 | 6747 |
self openSubmenu. |
6748 |
||
3133 | 6749 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
3938 | 6750 |
"/ closed during building or opening the submenu |
6751 |
self hideSubmenu:subMenuBeforeOpening. |
|
3133 | 6752 |
]. |
6753 |
||
6754 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 6755 |
! |
1701 | 6756 |
|
6757 |
openSubmenu |
|
6758 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
6759 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 6760 |
nescessary." |
6761 |
||
3203 | 6762 |
|p o device isVertical topMenu windGrp prefExtent lastEvent |
1701 | 6763 |
devBot "{ Class:SmallInteger }" |
6764 |
devRight "{ Class:SmallInteger }" |
|
6765 |
width "{ Class:SmallInteger }" |
|
6766 |
height "{ Class:SmallInteger }" |
|
6767 |
top "{ Class:SmallInteger }" |
|
6768 |
left "{ Class:SmallInteger }" |
|
6769 |
| |
|
6770 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
6771 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
3975 | 6772 |
^ self |
6773 |
]. |
|
6774 |
"close all other open submenus assigned to the menuPanel I'am located in" |
|
6775 |
||
6776 |
menuPanel itemsDo:[:eachItem| |
|
6777 |
(eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[ |
|
6778 |
eachItem hideSubmenu. |
|
6779 |
]. |
|
6780 |
]. |
|
1701 | 6781 |
topMenu := menuPanel topMenu. |
1829 | 6782 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
3975 | 6783 |
subMenu releaseDeviceResources. |
6784 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
6785 |
subMenu recreate. |
|
1829 | 6786 |
]. |
6787 |
||
1701 | 6788 |
windGrp := topMenu windowGroup. |
3203 | 6789 |
windGrp notNil ifTrue:[ |
3975 | 6790 |
lastEvent := windGrp lastEvent. |
6791 |
||
6792 |
(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[ |
|
6793 |
subMenu mapTime:(lastEvent timeStamp). |
|
6794 |
]. |
|
3203 | 6795 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6796 |
subMenu superMenu:menuPanel. |
1701 | 6797 |
subMenu becomesActiveMenu. |
6798 |
subMenu cursor:Cursor hand. |
|
6799 |
||
6800 |
windGrp notNil ifTrue:[ |
|
3975 | 6801 |
subMenu windowGroup:windGrp. |
6802 |
windGrp addTopView:subMenu. |
|
1701 | 6803 |
]. |
6804 |
||
2111 | 6805 |
"Q&D kludge - test whether the layout is nil; |
3975 | 6806 |
if true recompute the layouts |
2111 | 6807 |
" |
2374 | 6808 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6809 |
|
1701 | 6810 |
" Q&D kludge - if any visibility attributes are blocks; |
6811 |
TODO: only invoke mustRearrange if any are blocks |
|
3975 | 6812 |
(since I react correctly on valueHolder changes) |
1701 | 6813 |
" |
6814 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6815 |
subMenu fixSize. |
|
6816 |
||
6817 |
"compute origin of subMenu |
|
6818 |
" |
|
6819 |
isVertical := menuPanel verticalLayout. |
|
6820 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6821 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6822 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6823 |
width := prefExtent x. |
1701 | 6824 |
devBot := device usableHeight. |
6825 |
devRight := device usableWidth. |
|
6826 |
||
6827 |
p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6828 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6829 |
menuPanel isPopUpView ifTrue:[ |
3975 | 6830 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6831 |
] ifFalse:[ |
3975 | 6832 |
o := menuPanel translatePoint:p to:nil. "/ translate to root window |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6833 |
]. |
1701 | 6834 |
left := o x. |
6835 |
top := o y. |
|
6836 |
||
2016 | 6837 |
top + height > devBot ifTrue:[ |
3975 | 6838 |
top := isVertical ifTrue:[devBot - height] |
6839 |
ifFalse:[top - layout height - height + 2] |
|
3938 | 6840 |
]. |
2016 | 6841 |
|
6842 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6843 |
"/ top < menuPanel bottom ifTrue:[ |
|
6844 |
"/ left := left + layout width. |
|
6845 |
"/ ]. |
|
6846 |
"/ left + width > devRight ifTrue:[ |
|
6847 |
"/ left := o x - width - 2 |
|
6848 |
"/ ]. |
|
6849 |
"/ ]. |
|
3938 | 6850 |
|
1701 | 6851 |
left + width > devRight ifTrue:[ |
3975 | 6852 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6853 |
ifFalse:[devRight - width] |
|
3938 | 6854 |
]. |
6855 |
||
6856 |
"/ ***** MULTI SCREEN |
|
6857 |
"/ top := top max:0. |
|
6858 |
"/ left := left max:0. |
|
1701 | 6859 |
|
6860 |
subMenu origin:(left@top). |
|
6861 |
||
6862 |
subMenu realized ifFalse:[ |
|
3975 | 6863 |
subMenu realize. |
1701 | 6864 |
] ifTrue:[ |
3975 | 6865 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6866 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6867 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6868 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6869 |
toggleSubmenuVisibility |
2870 | 6870 |
"toggle the visibility of the submenu" |
6871 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6872 |
subMenu notNil ifTrue:[ |
3938 | 6873 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6874 |
] ifFalse:[ |
3938 | 6875 |
self setupSubmenu. |
6876 |
subMenu isNil ifTrue:[ |
|
6877 |
"/ cannot open a submenu |
|
6878 |
^ self |
|
6879 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6880 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6881 |
self openSubmenu. |
3133 | 6882 |
|
6883 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6884 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6885 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6886 |
visibleSubmenu |
2870 | 6887 |
"returns the current visible submenu or nil" |
6888 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6889 |
subMenu notNil ifTrue:[ |
3938 | 6890 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6891 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6892 |
^ nil |
1701 | 6893 |
! ! |
6894 |
||
524 | 6895 |
!MenuPanel::Item methodsFor:'building'! |
6896 |
||
6897 |
aspectAt:aKey |
|
3092 | 6898 |
"returns the value assigned to key or nil" |
2870 | 6899 |
|
524 | 6900 |
|appl value| |
6901 |
||
6902 |
appl := menuPanel receiver. |
|
6903 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6904 |
(appl isValueModel) ifTrue:[ |
3938 | 6905 |
^ appl value:aKey |
524 | 6906 |
]. |
6907 |
||
2123 | 6908 |
appl isNil ifTrue:[ |
3938 | 6909 |
appl := menuPanel application. |
2123 | 6910 |
]. |
6911 |
appl isNil ifTrue:[ ^ nil]. |
|
6912 |
||
6913 |
MessageNotUnderstood handle:[:ex| |
|
3938 | 6914 |
ex selector == aKey ifFalse:[ |
6915 |
ex reject |
|
6916 |
]. |
|
6917 |
self ifNotInUIBuilderInfoPrintCR: |
|
6918 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' |
|
6919 |
bindWith:appl classNameWithArticle |
|
6920 |
with:aKey). |
|
2123 | 6921 |
] do:[ |
3938 | 6922 |
aKey numArgs == 1 ifTrue:[ |
6923 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6924 |
] ifFalse:[ |
|
6925 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6926 |
value := appl aspectFor:aKey |
|
6927 |
] ifFalse:[ |
|
6928 |
value := appl perform:aKey |
|
6929 |
] |
|
6930 |
] |
|
524 | 6931 |
]. |
6932 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6933 |
|
3092 | 6934 |
"Modified: / 05-10-2006 / 03:10:20 / cg" |
524 | 6935 |
! ! |
6936 |
||
390 | 6937 |
!MenuPanel::Item methodsFor:'change & update'! |
6938 |
||
2614 | 6939 |
fontChanged |
2870 | 6940 |
"called whenever the font changed" |
6941 |
||
2614 | 6942 |
displayLabel notNil ifTrue:[ |
3938 | 6943 |
displayLabelExtent := nil. |
6944 |
||
6945 |
subMenu notNil ifTrue:[ |
|
6946 |
subMenu font:(menuPanel font). |
|
6947 |
]. |
|
2614 | 6948 |
]. |
6949 |
! |
|
6950 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6951 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6952 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6953 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6954 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6955 |
(menuPanel isNil or:[layout isNil]) ifTrue:[^ self]. "/ not yet realized or computed |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6956 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6957 |
self isSeparator ifFalse:[ |
3938 | 6958 |
"/ NOT A SEPARATOR |
6959 |
||
6960 |
menuPanel shown ifTrue:[ |
|
6961 |
changedObject == enableChannel ifTrue:[ |
|
6962 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6963 |
^ menuPanel selection:nil. |
|
6964 |
]. |
|
6965 |
^ self invalidate |
|
6966 |
]. |
|
6967 |
||
6968 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6969 |
menuItem isButton ifTrue:[ |
|
6970 |
self invalidate |
|
6971 |
] ifFalse:[ |
|
6972 |
"/ invalidate the interactor only |
|
6973 |
"/ take any interactor; interactors has the same extent |
|
6974 |
form := menuPanel iconIndicationOff. |
|
6975 |
||
6976 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6977 |
top:(layout top) |
|
6978 |
width:(form width) |
|
6979 |
height:(layout height). |
|
6980 |
||
6981 |
menuPanel invalidate:rect repairNow:false |
|
6982 |
]. |
|
6983 |
^ self |
|
6984 |
]. |
|
6985 |
self invalidate. |
|
6986 |
]. |
|
498 | 6987 |
]. |
712 | 6988 |
|
6989 |
changedObject == isVisible ifTrue:[ |
|
3938 | 6990 |
menuPanel mustRearrange. |
6991 |
menuPanel rearrangeItems. |
|
6992 |
^ self. |
|
712 | 6993 |
]. |
6994 |
||
498 | 6995 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6996 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6997 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6998 |
updateIndicators |
2870 | 6999 |
"update indicators " |
7000 |
||
2934 | 7001 |
indication notNil ifTrue:[ |
3938 | 7002 |
(indication isSymbol |
7003 |
or:[menuItem hideMenuOnActivated not]) |
|
7004 |
ifTrue:[ |
|
7005 |
"indication is a selector; |
|
7006 |
otherwise no need to redraw, because |
|
7007 |
a change notification is raised from the model !!!!" |
|
7008 |
self update:nil with:nil from:indication |
|
7009 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
7010 |
] |
390 | 7011 |
! ! |
7012 |
||
388 | 7013 |
!MenuPanel::Item methodsFor:'converting'! |
7014 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7015 |
asMenuItem |
2870 | 7016 |
"convert to a MenuItem" |
7017 |
||
2359 | 7018 |
^ menuItem |
388 | 7019 |
! |
7020 |
||
2827 | 7021 |
menuItem |
7022 |
^ menuItem |
|
7023 |
! |
|
7024 |
||
388 | 7025 |
menuItem:aMenuItem |
2870 | 7026 |
"setup attributes from a MenuItem" |
7027 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7028 |
|lbl| |
389 | 7029 |
|
388 | 7030 |
menuPanel disabledRedrawDo:[ |
3938 | 7031 |
menuItem := aMenuItem. |
7032 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
7033 |
||
7034 |
label := displayLabel := activeHelpText := nil. |
|
7035 |
||
7036 |
self enabled:(menuItem enabled). |
|
7037 |
self indication:(menuItem indication). |
|
7038 |
self choice:(menuItem choice). |
|
7039 |
self isVisible:(menuItem isVisible ? true). |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7040 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7041 |
"/ we should call the resourceRetriever here instead of labelImage |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7042 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7043 |
|
3938 | 7044 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
7045 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
7046 |
]. |
|
7047 |
||
7048 |
self submenu:(menuItem submenu). |
|
7049 |
self label:lbl. |
|
388 | 7050 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
7051 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
7052 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 7053 |
! ! |
7054 |
||
2681 | 7055 |
!MenuPanel::Item methodsFor:'dependents access'! |
7056 |
||
7057 |
addDependencies |
|
2870 | 7058 |
"add all dependencies" |
7059 |
||
2681 | 7060 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
7061 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
7062 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
7063 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
7064 |
! |
|
7065 |
||
7066 |
removeDependencies |
|
2870 | 7067 |
"remove all dependencies" |
7068 |
||
2681 | 7069 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
7070 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
7071 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
7072 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
7073 |
! ! |
|
7074 |
||
388 | 7075 |
!MenuPanel::Item methodsFor:'drawing'! |
7076 |
||
2768 | 7077 |
choiceForm |
2870 | 7078 |
"returns choice form or nil" |
7079 |
||
2768 | 7080 |
|isOn| |
7081 |
||
7082 |
choice isNil ifTrue:[^ nil]. |
|
7083 |
||
7084 |
isOn := (choice value = menuItem choiceValue). |
|
7085 |
self enabled ifFalse:[ |
|
3938 | 7086 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
7087 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
2768 | 7088 |
]. |
3565 | 7089 |
self isSelected ifTrue:[ |
3938 | 7090 |
^ isOn == true |
7091 |
ifTrue:[menuPanel iconRadioGroupEnteredOn] |
|
7092 |
ifFalse:[menuPanel iconRadioGroupEnteredOff] |
|
3565 | 7093 |
]. |
2768 | 7094 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
3938 | 7095 |
ifFalse:[menuPanel iconRadioGroupOff] |
2768 | 7096 |
! |
7097 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7098 |
draw |
2870 | 7099 |
"redraw this item" |
7100 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7101 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7102 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7103 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7104 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7105 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7106 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7107 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7108 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7109 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7110 |
self isSeparator ifTrue:[ |
3938 | 7111 |
self drawSeparator. |
7112 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7113 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7114 |
menuItem isButton ifTrue:[ |
3938 | 7115 |
self drawButton. |
7116 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7117 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7118 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7119 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7120 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7121 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7122 |
bgColor := menuPanel backgroundColor. |
3938 | 7123 |
paint := isSelected |
7124 |
ifTrue:[self activeBackgroundColor] |
|
7125 |
ifFalse:[ |
|
7126 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
|
7127 |
menuPanel enteredBackgroundColor |
|
7128 |
] ifFalse:[ |
|
7129 |
bgColor |
|
7130 |
]]. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7131 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7132 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
3938 | 7133 |
paint := ownBgCol |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7134 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7135 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7136 |
paint ~= bgColor ifTrue:[ |
3938 | 7137 |
menuPanel paint:paint. |
7138 |
menuPanel fillRectangle:layout. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7139 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7140 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7141 |
menuPanel showSeparatingLines ifTrue:[ |
3938 | 7142 |
self drawSeparatingLines |
7143 |
]. |
|
7144 |
||
7145 |
self drawLabel. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7146 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7147 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
3938 | 7148 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
7149 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
|
7150 |
||
7151 |
x := layout left. |
|
7152 |
y := layout top. |
|
7153 |
w := layout width. |
|
7154 |
h := layout height. |
|
7155 |
||
7156 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
|
7157 |
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4). |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7158 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7159 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7160 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7161 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7162 |
drawButton |
2870 | 7163 |
"draw as button" |
7164 |
||
2362 | 7165 |
|drawObject fg etchFg level isEnabled isSelected bg ownBgCol showSelected |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7166 |
x "{ Class:SmallInteger }" |
2143 | 7167 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7168 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7169 |
drawObject := displayLabel. |
2362 | 7170 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7171 |
isSelected := self isSelected. |
2362 | 7172 |
|
7173 |
isSelected ifFalse:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7174 |
"/ test whether button has pressed toggle behaviour |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7175 |
showSelected := (self isToggle and:[self indicationValue]). |
2362 | 7176 |
] ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7177 |
showSelected := isSelected |
2362 | 7178 |
]. |
7179 |
||
7180 |
showSelected ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7181 |
bg := self activeBackgroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7182 |
fg := self activeForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7183 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7184 |
self isEntered ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7185 |
bg := self buttonEnteredBackgroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7186 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7187 |
bg := self backgroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7188 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7189 |
isEnabled ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7190 |
fg := menuPanel foregroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7191 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7192 |
fg := menuPanel disabledForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7193 |
etchFg := menuPanel disabledEtchedForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7194 |
drawObject := self disabledRawLabel |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7195 |
] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7196 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7197 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7198 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7199 |
bg := ownBgCol |
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7200 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7201 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7202 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7203 |
bg ~= menuPanel backgroundColor ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7204 |
menuPanel paint:bg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7205 |
menuPanel fillRectangle:layout. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7206 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7207 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7208 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 7209 |
|
7210 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7211 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
2337 | 7212 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7213 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7214 |
isSelected ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7215 |
"check whether button should be drawn selected; indicator or radio button" |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7216 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7217 |
indication notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7218 |
"button is indicator and set" |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7219 |
isSelected := self indicationValue |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7220 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7221 |
isSelected := (choice notNil and:[choice value = menuItem choiceValue]). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7222 |
] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7223 |
]. |
2143 | 7224 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7225 |
|
3938 | 7226 |
isSelected ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7227 |
level := menuPanel buttonActiveLevel. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7228 |
x := x + 1 "level abs". |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7229 |
y := y + 1 "level abs". |
3938 | 7230 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7231 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7232 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 7233 |
]. |
7234 |
||
2817 | 7235 |
drawObject notEmptyOrNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7236 |
etchFg notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7237 |
"/ donot draw images twice.. images are shown lightened |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7238 |
drawObject isImageOrForm ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7239 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7240 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7241 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7242 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
2362 | 7243 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7244 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7245 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7246 |
level ~~ 0 ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7247 |
menuPanel drawButtonEdgesFor:self level:level |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7248 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7249 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7250 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7251 |
drawLabel |
2870 | 7252 |
"draw a labeled entry; no button, no separator." |
7253 |
||
3938 | 7254 |
|scKey cLb cLa drawObject fg etchFg arrow |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7255 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7256 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7257 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7258 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7259 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7260 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7261 |
drawObject := displayLabel. |
2362 | 7262 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7263 |
isSelected := self isSelected. |
2362 | 7264 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7265 |
isSelected ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7266 |
fg := self activeForegroundColor |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7267 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7268 |
isEnabled ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7269 |
self isEntered ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7270 |
fg := menuPanel enteredForegroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7271 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7272 |
fg := menuPanel foregroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7273 |
] |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7274 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7275 |
fg := menuPanel disabledForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7276 |
etchFg := menuPanel disabledEtchedForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7277 |
drawObject := self disabledRawLabel |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7278 |
] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7279 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7280 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7281 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7282 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7283 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7284 |
|
3131 | 7285 |
( (form := self indicatorForm) notNil |
7286 |
or:[(form := self choiceForm) notNil] |
|
7287 |
) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7288 |
y := t + ((h - form height) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7289 |
form displayOn:menuPanel x:x y:y. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7290 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7291 |
|
2817 | 7292 |
drawObject notEmptyOrNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7293 |
x := x + (menuPanel stringOffsetXfor:self). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7294 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7295 |
etchFg notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7296 |
"/ donot draw images twice.. images are shown lightened |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7297 |
drawObject isImageOrForm ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7298 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7299 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7300 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7301 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
2362 | 7302 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7303 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7304 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7305 |
"/ DRAW SHORTCUT KEY |
2359 | 7306 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7307 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7308 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7309 |
) ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7310 |
x := layout left + x. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7311 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7312 |
y := y + menuPanel font ascent. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7313 |
scKey displayOn:menuPanel x:x y:y. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7314 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7315 |
|
3403 | 7316 |
"/ DRAW SUBMENU INDICATION (if a vertical menu with submenu) |
7317 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7318 |
arrow := menuPanel rightArrow. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7319 |
x := layout right - arrow width - HorizontalInset. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7320 |
y := t + ((h - arrow height) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7321 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7322 |
(menuPanel styleSheet is3D not |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7323 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7324 |
menuPanel displayForm:arrow x:x y:y. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7325 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7326 |
cLa := menuPanel shadowColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7327 |
cLb := menuPanel lightColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7328 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7329 |
isSelected ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7330 |
fg := cLa. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7331 |
cLa := cLb. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7332 |
cLb := fg |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7333 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7334 |
menuPanel paint:cLa. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7335 |
menuPanel displayForm:arrow x:x y:y. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7336 |
menuPanel paint:cLb. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7337 |
menuPanel displayForm:drawObject x:x y:y. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7338 |
]. |
3403 | 7339 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7340 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7341 |
"Modified: / 6.9.1998 / 21:48:53 / cg" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7342 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7343 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7344 |
drawMenuIndicator |
2870 | 7345 |
"draw a menu indicator if the item has a menu or delayed menu." |
7346 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7347 |
|x y icon bAbsLevel verticalPosition| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7348 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7349 |
icon := self menuIndicatorIcon. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7350 |
icon isNil ifTrue:[ |
3938 | 7351 |
^ self |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7352 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7353 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7354 |
x := layout right - icon width. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7355 |
verticalPosition := menuPanel menuIndicatorVerticalPosition. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7356 |
verticalPosition == #center ifTrue:[ |
3938 | 7357 |
y := (layout height - icon height) // 2 + layout top. |
2220 | 7358 |
] ifFalse:[ |
3938 | 7359 |
verticalPosition == #top ifTrue:[ |
7360 |
y := layout top + 2. |
|
7361 |
] ifFalse:[ |
|
7362 |
y := layout bottom - icon height - 2. |
|
7363 |
] |
|
2220 | 7364 |
]. |
7365 |
||
7366 |
bAbsLevel := 0. |
|
2359 | 7367 |
menuItem isButton ifTrue:[ |
3938 | 7368 |
self isSelected ifTrue:[ |
7369 |
x := x + 1. |
|
7370 |
y := y + 1. |
|
7371 |
]. |
|
7372 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
7373 |
x := x - bAbsLevel. |
|
7374 |
y := y - bAbsLevel. |
|
2220 | 7375 |
]. |
7376 |
x := x - 1 "- HorizontalInset". |
|
7377 |
||
7378 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
3938 | 7379 |
icon := menuPanel lightenedImageOnDevice:icon |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7380 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7381 |
icon displayOn:menuPanel x:x y:y. |
2220 | 7382 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7383 |
(menuPanel drawMenuIndicatorSeparatorLine |
3938 | 7384 |
and:[ self isEntered |
7385 |
and:[ menuPanel buttonEnteredLevel ~~ 0] ]) |
|
7386 |
ifTrue:[ |
|
7387 |
menuPanel paint:menuPanel buttonShadowColor. |
|
7388 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
7389 |
menuPanel paint:menuPanel buttonLightColor. |
|
7390 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
2220 | 7391 |
]. |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7392 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7393 |
|
2059 | 7394 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 7395 |
"draw a labeled entry; no button, no separator." |
7396 |
||
3486 | 7397 |
|oldFont labelExtent |
1727 | 7398 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7399 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7400 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7401 |
| |
2059 | 7402 |
|
3486 | 7403 |
oldFont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7404 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7405 |
menuPanel paint:fg. |
2614 | 7406 |
labelExtent := self displayLabelExtent. |
7407 |
||
7408 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 7409 |
"/ menuPanel centerItems ifTrue:[self halt]. |
3938 | 7410 |
aLabel isArray ifFalse:[ |
7411 |
|printLabel| |
|
7412 |
||
7413 |
aLabel isText ifTrue:[ |
|
7414 |
"/ background of label has already been drawn |
|
7415 |
printLabel := aLabel withoutBackgroundColorEmphasis. |
|
7416 |
] ifFalse:[ |
|
7417 |
printLabel := aLabel. |
|
7418 |
]. |
|
7419 |
y := y + (printLabel ascentOn:menuPanel). |
|
7420 |
printLabel displayOn:menuPanel x:x y:y. |
|
1727 | 7421 |
] ifTrue:[ |
3938 | 7422 |
aLabel do:[:el| |
7423 |
el notNil ifTrue:[ |
|
7424 |
y0 := y + (el ascentOn:menuPanel). |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7425 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7426 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7427 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7428 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7429 |
"/ ]. |
3938 | 7430 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
7431 |
el displayOn:menuPanel x:x0 y:y0. |
|
7432 |
y := y + 1 + (el heightOn:menuPanel) |
|
7433 |
] ifFalse:[ |
|
7434 |
y := y + (self spaceBetweenEmptyLines) |
|
7435 |
] |
|
7436 |
]. |
|
1727 | 7437 |
]. |
3486 | 7438 |
menuPanel setFont:oldFont |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7439 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7440 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7441 |
drawSeparatingLines |
2870 | 7442 |
"draw separating lines" |
7443 |
||
2059 | 7444 |
|myIndex lfSep rtSep items prevItem nextItem |
7445 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7446 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7447 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7448 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7449 |
b "{ Class:SmallInteger }" |
706 | 7450 |
| |
2059 | 7451 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7452 |
items := menuPanel items. |
2059 | 7453 |
myIndex := items identityIndexOf:self. |
7454 |
||
7455 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
7456 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
7457 |
||
7458 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
7459 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
7460 |
||
7461 |
(lfSep or:[rtSep]) ifFalse:[ |
|
3938 | 7462 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7463 |
]. |
2059 | 7464 |
|
7465 |
lightColor := menuPanel lightColor. |
|
7466 |
shadowColor := menuPanel shadowColor. |
|
7467 |
||
7468 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7469 |
|
608 | 7470 |
l := layout left. |
7471 |
t := layout top. |
|
7472 |
r := layout right. |
|
7473 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7474 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7475 |
menuPanel verticalLayout ifTrue:[ |
3938 | 7476 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
7477 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
7478 |
||
7479 |
menuPanel paint:shadowColor. |
|
7480 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
7481 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-2 toX:r y:b-2]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7482 |
] ifFalse:[ |
3938 | 7483 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
7484 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
7485 |
||
7486 |
menuPanel paint:shadowColor. |
|
7487 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
7488 |
rtSep ifTrue:[menuPanel displayLineFromX:r-2 y:t toX:r-2 y:b]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7489 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7490 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7491 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7492 |
drawSeparator |
2870 | 7493 |
"draw as separator" |
7494 |
||
2059 | 7495 |
|type lightColor shadowColor isDouble |
7496 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7497 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7498 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7499 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7500 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7501 |
| |
2059 | 7502 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7503 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7504 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
3938 | 7505 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7506 |
]. |
2059 | 7507 |
|
7508 |
isDouble := type == #doubleLine. |
|
7509 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7510 |
lightColor := menuPanel lightColor. |
2059 | 7511 |
shadowColor := menuPanel shadowColor. |
7512 |
menuPanel paint:shadowColor. |
|
7513 |
||
7514 |
left := layout left. |
|
7515 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7516 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7517 |
menuPanel verticalLayout ifTrue:[ |
3938 | 7518 |
x0 := left + HorizontalInset. |
7519 |
x1 := layout right - HorizontalInset. |
|
7520 |
y0 := top - 1 + (layout height // 2). |
|
7521 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
7522 |
||
7523 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
7524 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
7525 |
||
7526 |
menuPanel paint:lightColor. |
|
7527 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
7528 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+5 toX:x1 y:y0+5]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7529 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7530 |
] ifFalse:[ |
3938 | 7531 |
y1 := layout bottom. |
7532 |
x0 := left - 1 + (layout width // 2). |
|
7533 |
y0 := top. |
|
7534 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
7535 |
||
7536 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
7537 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
7538 |
||
7539 |
menuPanel paint:lightColor. |
|
7540 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
7541 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+5 y:y0 toX:x0+5 y:y1]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7542 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7543 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7544 |
|
2768 | 7545 |
indicatorForm |
2870 | 7546 |
"returns indication form or nil" |
7547 |
||
3565 | 7548 |
|isOn| |
2768 | 7549 |
|
7550 |
indication isNil ifTrue:[^ nil]. |
|
7551 |
||
3565 | 7552 |
isOn := self indicationValue. |
2768 | 7553 |
self enabled ifFalse:[ |
3938 | 7554 |
^ isOn == true |
7555 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
7556 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 7557 |
]. |
3565 | 7558 |
"/ self isSelected ifTrue:[ |
3938 | 7559 |
"/ ^ isOn == true |
3565 | 7560 |
"/ ifTrue:[menuPanel iconIndicationEnteredOn] |
7561 |
"/ ifFalse:[menuPanel iconIndicationEnteredOff] |
|
7562 |
"/ ]. |
|
7563 |
||
3938 | 7564 |
^ isOn == true |
7565 |
ifTrue:[menuPanel iconIndicationOn] |
|
7566 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 7567 |
! |
7568 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7569 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7570 |
|
2362 | 7571 |
layout isNil ifTrue:[^ self]. |
7572 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7573 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
3938 | 7574 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7575 |
] |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7576 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7577 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7578 |
menuIndicatorIcon |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7579 |
"return a menu indicator icon used if the item has a menu or delayed menu." |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7580 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7581 |
self hasDelayedMenuIndicator ifTrue:[ |
3938 | 7582 |
^ MenuPanel delayedMenuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7583 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7584 |
self hasMenuIndicator ifTrue:[ |
3938 | 7585 |
^ MenuPanel menuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7586 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7587 |
^ nil |
388 | 7588 |
! ! |
7589 |
||
7590 |
!MenuPanel::Item methodsFor:'initialization'! |
|
7591 |
||
7592 |
destroy |
|
2870 | 7593 |
"destroy submenus, remove dependencies" |
7594 |
||
616 | 7595 |
self submenu:nil. |
2681 | 7596 |
self removeDependencies. |
616 | 7597 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7598 |
menuPanel := nil. |
616 | 7599 |
! |
7600 |
||
794 | 7601 |
in:aPanel |
2870 | 7602 |
"create item in a menuPanel" |
7603 |
||
794 | 7604 |
menuPanel := aPanel. |
2359 | 7605 |
|
7606 |
menuItem isNil ifTrue:[ |
|
3938 | 7607 |
self breakPoint:#ca. |
7608 |
menuItem := MenuItem new |
|
2359 | 7609 |
]. |
7610 |
! |
|
7611 |
||
7612 |
initialize |
|
7613 |
menuItem := MenuItem new. |
|
1811 | 7614 |
! |
7615 |
||
7616 |
reinitStyle |
|
7617 |
||
7618 |
subMenu notNil ifTrue:[ |
|
3147 | 7619 |
subMenu reinitStyle |
1811 | 7620 |
]. |
7621 |
||
7622 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
7623 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 7624 |
! ! |
7625 |
||
7626 |
!MenuPanel::Item methodsFor:'label basics'! |
|
7627 |
||
7628 |
disabledRawLabel |
|
2870 | 7629 |
"returns the label used if the item is disabled" |
7630 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7631 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7632 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7633 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7634 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7635 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7636 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7637 |
disabledDisplayLabel isString ifTrue:[ |
3938 | 7638 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7639 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7640 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7641 |
block := [:el| |rslt| |
3938 | 7642 |
(rslt := el) notNil ifTrue:[ |
7643 |
el isImageOrForm ifTrue:[ |
|
7644 |
el colorMap notNil ifTrue:[ |
|
7645 |
rslt := menuPanel lightenedImageOnDevice:el |
|
7646 |
] |
|
7647 |
] ifFalse:[ |
|
7648 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
|
7649 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
|
7650 |
form := menuPanel lightenedImageOnDevice:form |
|
7651 |
]. |
|
7652 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
|
7653 |
image := menuPanel lightenedImageOnDevice:image |
|
7654 |
]. |
|
7655 |
rslt := LabelAndIcon form:form image:image string:(el string). |
|
7656 |
] |
|
7657 |
] |
|
7658 |
]. |
|
7659 |
rslt |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7660 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7661 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7662 |
displayLabel isArray ifTrue:[ |
3938 | 7663 |
disabledDisplayLabel := Array new:(displayLabel size). |
7664 |
||
7665 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
|
7666 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
|
7667 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7668 |
] ifFalse:[ |
3938 | 7669 |
disabledDisplayLabel := block value:displayLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7670 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7671 |
^ disabledDisplayLabel |
794 | 7672 |
! |
7673 |
||
1829 | 7674 |
fetchDeviceResources |
2373 | 7675 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7676 |
disabledDisplayLabel := nil. |
1829 | 7677 |
self fetchImages. |
7678 |
! |
|
7679 |
||
616 | 7680 |
fetchImages |
2870 | 7681 |
"fetch my icon images" |
7682 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7683 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7684 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7685 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
3938 | 7686 |
^ self |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7687 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7688 |
displayLabel isImageOrForm ifTrue:[ |
3938 | 7689 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
7690 |
^ self. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7691 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7692 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7693 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
3938 | 7694 |
(icon := displayLabel image) notNil ifTrue:[ |
7695 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
|
7696 |
]. |
|
7697 |
(icon := displayLabel icon) notNil ifTrue:[ |
|
7698 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
|
7699 |
]. |
|
7700 |
^ self |
|
7701 |
]. |
|
7702 |
||
7703 |
displayLabel isArray ifFalse:[^ self]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7704 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7705 |
displayLabel keysAndValuesDo:[:i :el| |
3938 | 7706 |
(el notNil and:[el isString not]) ifTrue:[ |
7707 |
el isImageOrForm ifTrue:[ |
|
7708 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
|
7709 |
] ifFalse:[ |
|
7710 |
el class == LabelAndIcon ifTrue:[ |
|
7711 |
(icon := el image) notNil ifTrue:[ |
|
7712 |
el image:(menuPanel imageOnMyDevice:icon) |
|
7713 |
]. |
|
7714 |
(icon := el icon) notNil ifTrue:[ |
|
7715 |
el icon:(menuPanel imageOnMyDevice:icon) |
|
7716 |
] |
|
7717 |
] |
|
7718 |
] |
|
7719 |
] |
|
1078 | 7720 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7721 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7722 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7723 |
updateAccessCharacterFor:aLabel |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7724 |
"replace &x by the short-key attribute (i.e. remove & and underline x)" |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7725 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7726 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7727 |
|
3192 | 7728 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7729 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7730 |
aLabel isString ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7731 |
aLabel class == LabelAndIcon ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7732 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7733 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7734 |
^ aLabel |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7735 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7736 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7737 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7738 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7739 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7740 |
label := aLabel. |
2359 | 7741 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7742 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7743 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7744 |
rest := label copyFrom:(i+1). |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7745 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7746 |
i == 1 ifTrue:[label := rest] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7747 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7748 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7749 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7750 |
s := s - 1. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7751 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7752 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7753 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7754 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7755 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7756 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7757 |
label isText ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7758 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7759 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7760 |
label emphasisAt:pos add:#underline. |
2359 | 7761 |
^ label |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7762 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7763 |
"Modified: / 06-10-2011 / 16:46:22 / cg" |
388 | 7764 |
! ! |
7765 |
||
1573 | 7766 |
!MenuPanel::Item methodsFor:'printing & storing'! |
7767 |
||
7768 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7769 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7770 |
|
1573 | 7771 |
! ! |
7772 |
||
388 | 7773 |
!MenuPanel::Item methodsFor:'private'! |
7774 |
||
650 | 7775 |
activeBackgroundColor |
2870 | 7776 |
"returns the active background color derived from menuPanel" |
7777 |
||
2359 | 7778 |
menuItem isButton ifTrue:[ |
3938 | 7779 |
^ menuPanel buttonActiveBackgroundColor |
2359 | 7780 |
]. |
7781 |
^ menuPanel activeBackgroundColor |
|
650 | 7782 |
! |
7783 |
||
7784 |
activeForegroundColor |
|
2870 | 7785 |
"returns the active foreground color derived from menuPanel" |
650 | 7786 |
|
3441 | 7787 |
menuItem isButton ifTrue:[ |
3938 | 7788 |
^ menuPanel buttonActiveForegroundColor |
3441 | 7789 |
]. |
650 | 7790 |
^menuPanel activeForegroundColor |
7791 |
! |
|
7792 |
||
727 | 7793 |
backgroundColor |
2870 | 7794 |
"returns the background color derived from menuPanel" |
7795 |
||
2359 | 7796 |
menuItem isButton ifTrue:[ |
3938 | 7797 |
^ menuPanel buttonPassiveBackgroundColor |
2359 | 7798 |
]. |
7799 |
^ menuPanel backgroundColor |
|
727 | 7800 |
! |
7801 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7802 |
backgroundColorFromLabel |
2870 | 7803 |
"returns the background color derived from label or nil" |
7804 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7805 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7806 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7807 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7808 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7809 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7810 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7811 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7812 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7813 |
run size == 0 ifTrue:[ |
3938 | 7814 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
7815 |
^ run value |
|
7816 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7817 |
] ifFalse:[ |
3938 | 7818 |
run do:[:r| |
7819 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
7820 |
^ r value |
|
7821 |
] |
|
7822 |
] |
|
388 | 7823 |
]. |
7824 |
^ nil |
|
7825 |
! |
|
7826 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7827 |
buttonEnteredBackgroundColor |
3938 | 7828 |
"returns the background color to use when thhe mouse has entered |
2870 | 7829 |
derived from menuPanel" |
7830 |
||
2359 | 7831 |
menuItem isButton ifTrue:[ |
3938 | 7832 |
^ menuPanel buttonEnteredBackgroundColor |
2359 | 7833 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7834 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7835 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7836 |
|
663 | 7837 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7838 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7839 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7840 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7841 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7842 |
|
3866
fbdbf71489d8
show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
7843 |
|subm sel numArgs gotMenu| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7844 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7845 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7846 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7847 |
sel := menuItem submenuChannel. |
3934 | 7848 |
(sel isString or:[sel isSymbol]) ifFalse:[^ nil]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7849 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7850 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7851 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7852 |
numArgs == 0 ifTrue:[ |
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7853 |
gotMenu := false. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7854 |
MessageNotUnderstood handle:[:ex | |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7855 |
|selector| |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7856 |
|
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7857 |
((selector := ex selector) == sel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7858 |
or:[selector == #aspectFor:]) ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7859 |
ex reject |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7860 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7861 |
] do:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7862 |
subm := aRecv aspectFor:sel. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7863 |
gotMenu := true. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7864 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7865 |
"/ used to be subm notNil; however, this is a bad test, |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7866 |
"/ as it does not allow for the app to return nil for no-menu. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7867 |
gotMenu ifTrue:[^ subm]. |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7868 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7869 |
|
2043 | 7870 |
(Array with:(aRecv) with:(aRecv class)) |
7871 |
do:[:aPossibleReceiver | |
|
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7872 |
MessageNotUnderstood handle:[:ex| |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7873 |
ex message selector == sel ifFalse:[ ex reject ] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7874 |
] do:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7875 |
numArgs == 0 ifTrue:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7876 |
subm := aPossibleReceiver perform:sel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7877 |
] ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7878 |
numArgs == 1 ifTrue:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7879 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7880 |
] ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7881 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7882 |
] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7883 |
] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7884 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7885 |
subm notNil ifTrue:[^ subm]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7886 |
Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
4027 | 7887 |
"/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR. |
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7888 |
] |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7889 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7890 |
|
663 | 7891 |
^ subm |
2043 | 7892 |
|
4027 | 7893 |
"Modified: / 24-03-2011 / 11:20:24 / cg" |
663 | 7894 |
! |
7895 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7896 |
indicationValue |
2870 | 7897 |
"returns indication value or nil in case of no indication" |
7898 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7899 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7900 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7901 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7902 |
|
3938 | 7903 |
indication isSymbol ifFalse:[ |
7904 |
^ indication value == true "block or model" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7905 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7906 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7907 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
3938 | 7908 |
recv := menuPanel receiver. |
7909 |
||
7910 |
(recv isValueModel) ifFalse:[ |
|
7911 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
7912 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
7913 |
sel := sel asSymbol. |
|
7914 |
||
7915 |
MessageNotUnderstood handle:[:ex| |
|
7916 |
ex selector == sel ifFalse:[ |
|
7917 |
ex reject |
|
7918 |
]. |
|
7919 |
] do:[ |
|
7920 |
sel := recv perform:sel with:(menuItem argument) |
|
7921 |
] |
|
7922 |
]. |
|
7923 |
]. |
|
7924 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7925 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7926 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7927 |
numArgs ~~ 0 ifTrue:[ |
3938 | 7928 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7929 |
] ifFalse:[ |
3938 | 7930 |
sel := indication |
7931 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7932 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7933 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7934 |
sel isValueModel ifTrue:[ |
3938 | 7935 |
indication := sel. |
7936 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7937 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7938 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7939 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7940 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7941 |
indicationValue:aValue |
2870 | 7942 |
"set the indication value" |
7943 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7944 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7945 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7946 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7947 |
|
3938 | 7948 |
indication isSymbol ifFalse:[ |
7949 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
|
7950 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7951 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7952 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7953 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
3938 | 7954 |
^ self |
1218 | 7955 |
]. |
7956 |
||
524 | 7957 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7958 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7959 |
|
1218 | 7960 |
recv isNil ifTrue:[ |
3938 | 7961 |
recv := menuPanel application. |
7962 |
recv isNil ifTrue:[^ self]. |
|
7963 |
]. |
|
7964 |
||
7965 |
MessageNotUnderstood handle:[:ex| |
|
7966 |
(ex selector ~~ indication) ifTrue:[ |
|
7967 |
ex reject |
|
7968 |
]. |
|
7969 |
self ifNotInUIBuilderInfoPrintCR: |
|
7970 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
|
7971 |
bindWith:recv classNameWithArticle with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7972 |
] do:[ |
3938 | 7973 |
numArgs == 1 ifTrue:[ |
7974 |
recv perform:indication with:aValue |
|
7975 |
] ifFalse:[ |
|
7976 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
7977 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7978 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7979 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7980 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7981 |
isEntered |
2870 | 7982 |
"returns true if the mouse pointer is over the item" |
7983 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7984 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7985 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7986 |
"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
|
7987 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7988 |
|
464 | 7989 |
separatorType |
2870 | 7990 |
"returns type of separator line or nil" |
7991 |
||
390 | 7992 |
|c lbl| |
388 | 7993 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7994 |
self isSeparator ifFalse:[ |
3938 | 7995 |
^ nil |
388 | 7996 |
]. |
7997 |
||
390 | 7998 |
(lbl := label value) isNil ifTrue:[ |
3938 | 7999 |
^ #singleLine |
388 | 8000 |
]. |
8001 |
||
390 | 8002 |
lbl size == 1 ifTrue:[ |
3938 | 8003 |
c := lbl first. |
8004 |
c == $- ifTrue:[^ #singleLine]. |
|
8005 |
c == $= ifTrue:[^ #doubleLine]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8006 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8007 |
^ #blankLine |
1130 | 8008 |
! |
8009 |
||
8010 |
setupSubmenu |
|
3938 | 8011 |
|appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding |
3934 | 8012 |
channel whoProvidedMenu t| |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8013 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8014 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8015 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8016 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8017 |
subMenu notNil ifTrue:[ |
3938 | 8018 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8019 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8020 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8021 |
channel isSymbol ifFalse:[ |
3938 | 8022 |
submenuHolder := channel |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8023 |
] ifTrue:[ |
3938 | 8024 |
"/ submenu is specified by a selector in submenuChannel. |
8025 |
"/ who gets me the menu: |
|
8026 |
"/ 1) submenuProvider (if not nil) |
|
8027 |
"/ 2) menuPanel application |
|
8028 |
"/ 3) menuPanel receiver |
|
8029 |
"/ 4) menuPanel application master-chain |
|
8030 |
"/ 5) menuPanel receiver master-chain |
|
8031 |
||
8032 |
(submenuProvider := menuItem submenuProvider) notNil ifTrue:[ |
|
8033 |
submenuHolder := self findSubMenuIn:submenuProvider. |
|
8034 |
whoProvidedMenu := submenuProvider. |
|
8035 |
]. |
|
8036 |
submenuHolder isNil ifTrue:[ |
|
8037 |
appl := menuPanel application. |
|
8038 |
(appl notNil and:[appl ~~ submenuProvider]) ifTrue:[ |
|
8039 |
submenuHolder := self findSubMenuIn:appl. |
|
8040 |
whoProvidedMenu := appl. |
|
8041 |
]. |
|
8042 |
submenuHolder isNil ifTrue:[ |
|
8043 |
recv := menuPanel receiver. |
|
8044 |
(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[ |
|
8045 |
submenuHolder := self findSubMenuIn:recv. |
|
8046 |
whoProvidedMenu := recv. |
|
8047 |
]. |
|
8048 |
(submenuHolder isNil and:[appl notNil]) ifTrue:[ |
|
8049 |
t := appl. |
|
8050 |
[ submenuHolder isNil |
|
8051 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8052 |
] whileTrue:[ |
|
8053 |
( master ~~ appl |
|
8054 |
and:[ master ~~ recv |
|
8055 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8056 |
submenuHolder := self findSubMenuIn:master. |
|
8057 |
]. |
|
8058 |
t := master. |
|
8059 |
whoProvidedMenu := master. |
|
8060 |
] |
|
8061 |
]. |
|
8062 |
(submenuHolder isNil and:[recv notNil]) ifTrue:[ |
|
8063 |
t := recv. |
|
8064 |
[ submenuHolder isNil |
|
8065 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8066 |
] whileTrue:[ |
|
8067 |
( master ~~ appl |
|
8068 |
and:[ master ~~ recv |
|
8069 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8070 |
submenuHolder := self findSubMenuIn:master. |
|
8071 |
]. |
|
8072 |
t := master. |
|
8073 |
whoProvidedMenu := master. |
|
8074 |
] |
|
8075 |
]. |
|
8076 |
]. |
|
8077 |
]. |
|
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8078 |
"/ submenuHolder isNil ifTrue:[ |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8079 |
"/ self halt:'did not find any menu' |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8080 |
"/ ]. |
3934 | 8081 |
|
8082 |
"/ appl := menuPanel application. |
|
8083 |
"/ appl isNil ifTrue:[ |
|
8084 |
"/ appl := menuPanel receiver. |
|
8085 |
"/ appl notNil ifTrue:[ |
|
8086 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
|
3938 | 8087 |
"/ [submenuHolder isNil |
3934 | 8088 |
"/ and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
8089 |
"/ and:[master ~~ appl]]] whileTrue:[ |
|
8090 |
"/ appl := master. |
|
8091 |
"/ submenuHolder := self findSubMenuIn:appl. |
|
8092 |
"/ ]. |
|
8093 |
"/ ] |
|
8094 |
"/ ]. |
|
8095 |
"/ ]. |
|
3938 | 8096 |
"/ submenuHolder isNil ifTrue:[ |
3934 | 8097 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
8098 |
"/ (recv := menuPanel receiver) ~~ appl ifTrue:[ |
|
8099 |
"/ appl := recv. |
|
8100 |
"/ submenuHolder := self findSubMenuIn:appl |
|
8101 |
"/ ] |
|
8102 |
"/ ] |
|
8103 |
"/ ] |
|
8104 |
]. |
|
8105 |
||
8106 |
(newSubmenu := submenuHolder value) isArray ifTrue:[ |
|
3938 | 8107 |
submenuEncoding := newSubmenu. |
8108 |
newSubmenu := Menu decodeFromLiteralArray:submenuEncoding. |
|
8109 |
"/ cg: linked menus also may contain translations ... |
|
8110 |
newSubmenu notNil ifTrue:[ |
|
8111 |
whoProvidedMenu "appl" notNil ifTrue:[ |
|
8112 |
newSubmenu findGuiResourcesIn:whoProvidedMenu "appl". |
|
8113 |
] |
|
8114 |
]. |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8115 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8116 |
"/ appl notNil ifTrue:[submenu application:appl]. |
3934 | 8117 |
self submenu:newSubmenu. |
1130 | 8118 |
^ subMenu |
8119 |
||
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8120 |
"Modified: / 22-09-2010 / 14:37:46 / cg" |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8121 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8122 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8123 |
spaceBetweenEmptyLines |
3938 | 8124 |
^ 3 |
388 | 8125 |
! ! |
8126 |
||
8127 |
!MenuPanel::Item methodsFor:'queries'! |
|
8128 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8129 |
canChangeVisibility |
1699 | 8130 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 8131 |
otherwise there is a change notification raised if the model changed" |
8132 |
||
3122 | 8133 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 8134 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 8135 |
|
8136 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 8137 |
"Modified: / 12-10-2006 / 09:30:48 / User" |
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8138 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8139 |
|
388 | 8140 |
canSelect |
1699 | 8141 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 8142 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
8143 |
||
2362 | 8144 |
self isSeparator ifTrue:[^ false]. |
8145 |
||
8146 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
3938 | 8147 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
8148 |
^ true |
|
8149 |
]. |
|
1078 | 8150 |
]. |
8151 |
^ false |
|
388 | 8152 |
! |
8153 |
||
2046 | 8154 |
containsPoint:aPoint |
2870 | 8155 |
"returns true if aPoint is contained in my layout" |
8156 |
||
2046 | 8157 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8158 |
^ layout containsPoint:aPoint |
2046 | 8159 |
]. |
8160 |
^ false |
|
8161 |
||
8162 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
8163 |
! |
|
8164 |
||
388 | 8165 |
containsPointX:x y:y |
2870 | 8166 |
"returns true if point is contained in my layout" |
8167 |
||
712 | 8168 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8169 |
^ layout containsPointX:x y:y |
505 | 8170 |
]. |
8171 |
^ false |
|
388 | 8172 |
! |
8173 |
||
2199 | 8174 |
hasDelayedMenu |
2870 | 8175 |
"returns true if a delayed menu exists" |
8176 |
||
2360 | 8177 |
self hasSubmenu ifFalse:[ |
3938 | 8178 |
^ false |
2199 | 8179 |
]. |
2360 | 8180 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
8181 |
||
8182 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
3938 | 8183 |
^ false |
2199 | 8184 |
]. |
8185 |
^ true |
|
8186 |
! |
|
8187 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8188 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8189 |
"returns true if the item has a delayed menu |
2870 | 8190 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8191 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8192 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8193 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8194 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8195 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8196 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8197 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8198 |
hasIndication |
2870 | 8199 |
"returns true if on/off indication exists" |
8200 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8201 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8202 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8203 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8204 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8205 |
"returns true if the item has a delayed menu |
2870 | 8206 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8207 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8208 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8209 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8210 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8211 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8212 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8213 |
|
388 | 8214 |
hasSubmenu |
2870 | 8215 |
"returns true if the item is configured as an subMenu entry" |
3938 | 8216 |
|
2870 | 8217 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
388 | 8218 |
! |
8219 |
||
8220 |
isEnabled |
|
2870 | 8221 |
"returns the enabled state" |
8222 |
||
388 | 8223 |
^ self enabled |
8224 |
! |
|
8225 |
||
608 | 8226 |
isSeparator |
2870 | 8227 |
"returns true if item is a separator" |
8228 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8229 |
^ displayLabel isNil |
608 | 8230 |
! |
8231 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8232 |
isToggle |
2870 | 8233 |
"returns true if on/off indication exists" |
8234 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8235 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8236 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8237 |
|
712 | 8238 |
isVisible |
2870 | 8239 |
"returns the visibility state" |
8240 |
||
712 | 8241 |
|state| |
8242 |
||
8243 |
isVisible isSymbol ifTrue:[ |
|
3938 | 8244 |
state := self aspectAt:isVisible. |
8245 |
||
8246 |
state isValueModel ifTrue:[ |
|
8247 |
isVisible := state. |
|
8248 |
isVisible addDependent:self. |
|
8249 |
state := isVisible. |
|
8250 |
] |
|
712 | 8251 |
] ifFalse:[ |
3938 | 8252 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8253 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8254 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8255 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8256 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 8257 |
! |
8258 |
||
8259 |
isVisible:something |
|
2870 | 8260 |
"change the visibility state; if the state changed, a redraw is performed" |
8261 |
||
712 | 8262 |
|oldState newState| |
8263 |
||
8264 |
isVisible isNil ifTrue:[ |
|
3938 | 8265 |
oldState := true |
712 | 8266 |
] ifFalse:[ |
3938 | 8267 |
oldState := isVisible value. |
8268 |
isVisible isValueModel ifTrue:[ |
|
8269 |
isVisible removeDependent:self |
|
8270 |
] |
|
712 | 8271 |
]. |
8272 |
isVisible := something. |
|
8273 |
||
8274 |
isVisible isNil ifTrue:[ |
|
3938 | 8275 |
newState := true |
712 | 8276 |
] ifFalse:[ |
3938 | 8277 |
isVisible isValueModel ifTrue:[ |
8278 |
isVisible addDependent:self |
|
8279 |
] ifFalse:[ |
|
8280 |
isVisible isSymbol ifTrue:[^ self] |
|
8281 |
]. |
|
8282 |
menuPanel shown ifFalse:[^ self]. |
|
8283 |
newState := isVisible value. |
|
712 | 8284 |
]. |
8285 |
||
8286 |
newState ~~ oldState ifTrue:[ |
|
3938 | 8287 |
menuPanel mustRearrange |
712 | 8288 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8289 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8290 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 8291 |
! |
8292 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8293 |
menuIndicatorContains:aPoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8294 |
"returns true if the items delayed menu is hit by a button-press" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8295 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8296 |
|icon xSep| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8297 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8298 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8299 |
(layout containsPoint:aPoint) ifTrue:[ |
8300 |
icon := self menuIndicatorIcon. |
|
8301 |
icon notNil ifTrue:[ |
|
8302 |
xSep := layout right - icon width. |
|
8303 |
^ aPoint x >= xSep |
|
8304 |
] |
|
8305 |
] |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8306 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8307 |
^ false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8308 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8309 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8310 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8311 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8312 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8313 |
|
388 | 8314 |
shortcutKeyAsString |
3601 | 8315 |
"converts shortcutKey to a text object for the menu-label-hint. |
8316 |
returns nil, if the key has no assignment." |
|
2870 | 8317 |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8318 |
|shortcutKey| |
2359 | 8319 |
|
8320 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 8321 |
|
8322 |
shortcutKey isNil ifTrue:[ |
|
3938 | 8323 |
^ nil |
1609 | 8324 |
]. |
8325 |
shortcutKey isCharacter ifTrue:[ |
|
3938 | 8326 |
shortcutKey == Character space ifFalse:[ |
8327 |
^ 'Space' |
|
8328 |
]. |
|
8329 |
^ shortcutKey asString |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8330 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8331 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8332 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8333 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 8334 |
! ! |
8335 |
||
8336 |
!MenuPanel::Item methodsFor:'selection'! |
|
8337 |
||
8338 |
isSelected |
|
2870 | 8339 |
"returns true if item is selected" |
1998 | 8340 |
|
8341 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 8342 |
! |
8343 |
||
2249 | 8344 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
8345 |
"change selection to a state. Dependant on the state open or hide an existing |
2870 | 8346 |
submenu and perform a redraw" |
8347 |
||
2249 | 8348 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
3938 | 8349 |
self invalidate. |
8350 |
self hideSubmenu. |
|
8351 |
^ self |
|
2249 | 8352 |
]. |
8353 |
||
2199 | 8354 |
menuPanel realized ifFalse:[ ^ self ]. |
8355 |
||
2359 | 8356 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
3938 | 8357 |
self invalidate |
2199 | 8358 |
]. |
8359 |
self hasSubmenu ifFalse:[ ^ self]. |
|
8360 |
||
8361 |
self hasDelayedMenu ifTrue:[ |
|
3938 | 8362 |
menuPanel openDelayed:self |
2199 | 8363 |
] ifFalse:[ |
3938 | 8364 |
self setupSubmenu. |
8365 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
|
1701 | 8366 |
]. |
3133 | 8367 |
|
8368 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 8369 |
! ! |
8370 |
||
2692 | 8371 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
8372 |
||
8373 |
argument2 |
|
8374 |
||
8375 |
^ argument2 |
|
8376 |
! |
|
8377 |
||
8378 |
argument2:anArgumentOrNil |
|
8379 |
||
8380 |
argument2 := anArgumentOrNil |
|
8381 |
! ! |
|
8382 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8383 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 8384 |
|
2018 | 8385 |
icon |
2016 | 8386 |
"This resource specification was automatically generated |
8387 |
by the ImageEditor of ST/X." |
|
8388 |
||
8389 |
"Do not manually edit this!! If it is corrupted, |
|
8390 |
the ImageEditor may not be able to read the specification." |
|
8391 |
||
8392 |
" |
|
2018 | 8393 |
self icon inspect |
8394 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 8395 |
" |
8396 |
||
8397 |
<resource: #image> |
|
8398 |
||
8399 |
^Icon |
|
3938 | 8400 |
constantNamed:#'MenuPanel::ScrollActivity class icon' |
8401 |
ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a') ; yourself); yourself] |
|
2016 | 8402 |
! ! |
8403 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8404 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 8405 |
|
8406 |
new |
|
8407 |
^ self basicNew initialize |
|
8408 |
! ! |
|
8409 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8410 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 8411 |
|
8412 |
activeMenu |
|
8413 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 8414 |
is returned if scrolling is deactivated" |
8415 |
||
2016 | 8416 |
^ activeMenu |
8417 |
! |
|
8418 |
||
8419 |
direction |
|
2870 | 8420 |
"returns the scroll-direction" |
8421 |
||
2016 | 8422 |
^ direction |
8423 |
! |
|
8424 |
||
8425 |
iconAt:aDirection on:aMenu |
|
2018 | 8426 |
|icon device index| |
2016 | 8427 |
|
8428 |
device := aMenu device. |
|
8429 |
||
8430 |
aDirection == #PREV ifTrue:[ |
|
3147 | 8431 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
3938 | 8432 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
2018 | 8433 |
] ifFalse:[ |
3147 | 8434 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
8435 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 8436 |
]. |
8437 |
||
8438 |
icon := icons at:index. |
|
8439 |
||
8440 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
3147 | 8441 |
icon := self class icon. |
8442 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
8443 |
ifFalse:[ icon := icon copy ]. |
|
8444 |
||
8445 |
icon := icon onDevice:device. |
|
8446 |
icon clearMaskedPixels. |
|
8447 |
icons at:index put:icon |
|
2018 | 8448 |
]. |
8449 |
^ icon |
|
2016 | 8450 |
! ! |
8451 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8452 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 8453 |
|
8454 |
initialize |
|
8455 |
||
8456 |
semaLock := RecursionLock new. |
|
2018 | 8457 |
icons := Array new:4. |
2016 | 8458 |
! ! |
8459 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8460 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 8461 |
|
8462 |
isActive |
|
2870 | 8463 |
"returns true if scrolling is activated" |
8464 |
||
2016 | 8465 |
^ activeMenu notNil |
8466 |
! ! |
|
8467 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8468 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 8469 |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8470 |
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress |
2870 | 8471 |
"start scrolling; returns true if scrolling is activated" |
8472 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8473 |
|bounds index isScrolledMenu boundsOnRoot| |
2860 | 8474 |
|
8475 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 8476 |
|
8477 |
semaLock critical:[ |
|
3938 | 8478 |
self stop. |
8479 |
||
8480 |
isScrolledMenu ifTrue:[ |
|
8481 |
bounds := aMenu scrollerBoundsAt:aDirection. |
|
8482 |
||
8483 |
comesViaButtonPress ifFalse:[ |
|
8484 |
boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu) |
|
8485 |
extent:(bounds extent). |
|
8486 |
]. |
|
8487 |
||
8488 |
activeMenu := aMenu. |
|
8489 |
direction := aDirection. |
|
8490 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
8491 |
||
8492 |
index ~~ 0 ifTrue:[ |
|
8493 |
scrollTask := |
|
8494 |
[ |
|
8495 |
|item step continue| |
|
8496 |
||
8497 |
[ |
|
8498 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
8499 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
8500 |
aMenu makeItemVisible:item. |
|
8501 |
index := index + step. |
|
8502 |
]. |
|
8503 |
||
8504 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
8505 |
||
8506 |
[ |
|
8507 |
continue := (aMenu shown and:[(item := aMenu itemAt:index) notNil]). |
|
8508 |
||
8509 |
boundsOnRoot notNil ifTrue:[ |
|
8510 |
continue ifTrue:[ |
|
8511 |
continue := boundsOnRoot containsPoint:aMenu sensor mousePoint. |
|
8512 |
] ifFalse:[ |
|
8513 |
boundsOnRoot := nil. |
|
8514 |
] |
|
8515 |
]. |
|
8516 |
continue |
|
8517 |
] whileTrue:[ |
|
8518 |
aMenu makeItemVisible:item. |
|
8519 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
8520 |
index := index + step. |
|
8521 |
]. |
|
8522 |
item := nil. |
|
8523 |
] ensure:[ |
|
8524 |
activeMenu := direction := scrollTask := nil. |
|
8525 |
||
8526 |
item notNil ifTrue:[ |
|
8527 |
"/ process was killed |
|
8528 |
aMenu invalidate:bounds |
|
8529 |
] |
|
8530 |
]. |
|
8531 |
boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ]. |
|
8532 |
] forkAt:8. |
|
8533 |
] |
|
8534 |
] |
|
2016 | 8535 |
]. |
8536 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
8537 |
|
2048 | 8538 |
"Created: ca" |
8539 |
||
8540 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 8541 |
! |
8542 |
||
8543 |
stop |
|
2870 | 8544 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
8545 |
||
2016 | 8546 |
|task resp| |
8547 |
||
8548 |
activeMenu isNil ifTrue:[ |
|
3938 | 8549 |
^ false |
2016 | 8550 |
]. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8551 |
|
2016 | 8552 |
semaLock critical:[ |
3938 | 8553 |
resp := activeMenu notNil. |
8554 |
||
8555 |
(task := scrollTask) notNil ifTrue:[ |
|
8556 |
scrollTask := nil. |
|
8557 |
||
8558 |
Error handle:[:ex| |
|
8559 |
] do:[ |
|
8560 |
task terminateWithAllSubprocessesInGroup. |
|
8561 |
task waitUntilTerminated. |
|
8562 |
]. |
|
8563 |
]. |
|
8564 |
activeMenu := direction := nil. |
|
2016 | 8565 |
]. |
8566 |
^ resp |
|
8567 |
! ! |
|
8568 |
||
388 | 8569 |
!MenuPanel class methodsFor:'documentation'! |
8570 |
||
3780 | 8571 |
version_CVS |
4089 | 8572 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.528 2011-11-09 15:34:36 ca Exp $' |
388 | 8573 |
! ! |
2199 | 8574 |
|
388 | 8575 |
MenuPanel initialize! |