author | Claus Gittinger <cg@exept.de> |
Mon, 19 May 2008 15:10:25 +0200 | |
changeset 3402 | 5941cc1ff429 |
parent 3394 | 90e7bc4402b5 |
child 3403 | e7e2d3ba54b9 |
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 |
3147 | 15 |
instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu |
16 |
shortKeyInset selection items groupSizes receiver enabled |
|
17 |
lastActiveMenu enteredItem prevFocusView previousPointerGrab |
|
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 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
24 |
stringOffsetX doAccessCharacterTranslation' |
3147 | 25 |
classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages |
26 |
DefaultForegroundColor DefaultBackgroundColor IconIndicationOn |
|
27 |
IconIndicationOff IconRadioOn IconRadioOff |
|
28 |
IconDisabledIndicationOn IconDisabledIndicationOff |
|
29 |
IconDisabledRadioOn IconDisabledRadioOff' |
|
30 |
poolDictionaries:'' |
|
31 |
category:'Views-Menus' |
|
388 | 32 |
! |
33 |
||
34 |
Object subclass:#Item |
|
3147 | 35 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
36 |
disabledDisplayLabel enableChannel label activeHelpText |
|
37 |
flyByHelpText isVisible indication choice accessCharacter' |
|
38 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
|
39 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:MenuPanel |
|
388 | 42 |
! |
43 |
||
2692 | 44 |
Object subclass:#Adornment |
3147 | 45 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
46 |
choice choiceValue' |
|
47 |
classVariableNames:'' |
|
48 |
poolDictionaries:'' |
|
49 |
privateIn:MenuPanel::Item |
|
2692 | 50 |
! |
51 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
52 |
Object subclass:#ScrollActivity |
3147 | 53 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
54 |
classVariableNames:'' |
|
55 |
poolDictionaries:'' |
|
56 |
privateIn:MenuPanel |
|
2016 | 57 |
! |
58 |
||
388 | 59 |
!MenuPanel class methodsFor:'documentation'! |
60 |
||
2005 | 61 |
copyright |
62 |
" |
|
63 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 64 |
All Rights Reserved |
2005 | 65 |
|
66 |
This software is furnished under a license and may be used |
|
67 |
only in accordance with the terms of that license and with the |
|
68 |
inclusion of the above copyright notice. This software may not |
|
69 |
be provided or otherwise made available to, or used by, any |
|
70 |
other person. No title to or ownership of the software is |
|
71 |
hereby transferred. |
|
72 |
" |
|
73 |
||
388 | 74 |
! |
75 |
||
76 |
documentation |
|
77 |
" |
|
78 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
79 |
||
2170 | 80 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 81 |
(and hopefully be ST-80 compatible ...) |
82 |
||
502 | 83 |
To create a menu, there exists a MenuEditor which will generate |
84 |
a menu specification. |
|
85 |
||
86 |
||
2061 | 87 |
Notice: |
88 |
This is going to replace the obsolete MenuView. |
|
89 |
||
388 | 90 |
[author:] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
91 |
Claus Atzkern |
388 | 92 |
|
93 |
[see also:] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
94 |
Menu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
95 |
MenuItem |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
96 |
MenuEditor |
2170 | 97 |
|
98 |
cg: this code is so ugly - needs a complete rewrite... |
|
99 |
||
388 | 100 |
" |
101 |
! |
|
102 |
||
103 |
examples |
|
104 |
||
105 |
" |
|
106 |
start as PullDownMenu |
|
3147 | 107 |
[exBegin] |
388 | 108 |
|top subView mview desc s1 s2 s3 img lbs labels| |
109 |
||
110 |
top := StandardSystemView new. |
|
111 |
||
436 | 112 |
mview := MenuPanel in:top. |
388 | 113 |
|
502 | 114 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 115 |
mview level:2. |
116 |
mview verticalLayout:false. |
|
117 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 118 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 119 |
mview labels:lbs. |
120 |
mview shortcutKeyAt:2 put:#Cut. |
|
121 |
mview accessCharacterPositionAt:1 put:1. |
|
122 |
mview accessCharacterPositionAt:2 put:2. |
|
123 |
||
124 |
mview enabledAt:5 put:false. |
|
125 |
mview groupSizes:#( 2 2 ). |
|
436 | 126 |
s1 := MenuPanel labels:labels. |
388 | 127 |
s1 accessCharacterPositionAt:1 put:1. |
128 |
s1 accessCharacterPositionAt:2 put:2. |
|
129 |
s1 groupSizes:#( 2 2 ). |
|
436 | 130 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
131 |
s3 := MenuPanel labels:lbs. |
|
388 | 132 |
|
133 |
s1 subMenuAt:2 put:s2. |
|
436 | 134 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 135 |
s2 subMenuAt:3 put:s3. |
436 | 136 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 137 |
s3 shortcutKeyAt:3 put:$q. |
138 |
||
139 |
mview subMenuAt:1 put:s1. |
|
436 | 140 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 141 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
142 |
s1 shortcutKeyAt:1 put:#Copy. |
|
143 |
s1 shortcutKeyAt:3 put:#Paste. |
|
144 |
||
436 | 145 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 146 |
top extent:(mview preferredExtent). |
388 | 147 |
top open. |
3147 | 148 |
[exEnd] |
149 |
||
150 |
[exBegin] |
|
1767 | 151 |
|top menu view item| |
152 |
||
153 |
top := StandardSystemView extent:240@100. |
|
154 |
menu := MenuPanel in:top. |
|
155 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
156 |
menu verticalLayout:false. |
|
157 |
||
158 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
159 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
160 |
||
161 |
view := ClockView new. |
|
162 |
view preferredExtent:100@100. |
|
163 |
item := menu itemAt:3. |
|
164 |
item submenu:view. |
|
165 |
||
166 |
view := SimpleView new. |
|
167 |
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new). |
|
168 |
view preferredExtent:(400@50). |
|
169 |
item := menu itemAt:2. |
|
170 |
item submenu:view. |
|
171 |
||
172 |
menu origin:0@0 corner:1.0@30. |
|
173 |
top open. |
|
3147 | 174 |
[exEnd] |
388 | 175 |
|
176 |
||
177 |
start as PopUpMenu |
|
3147 | 178 |
[exBegin] |
388 | 179 |
|subView mview desc s1 s2 s3 img lbs labels| |
180 |
||
436 | 181 |
mview := MenuPanel new. |
502 | 182 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 183 |
mview level:2. |
184 |
||
185 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 186 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 187 |
mview labels:lbs. |
188 |
||
436 | 189 |
s1 := MenuPanel labels:labels. |
190 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
191 |
s3 := MenuPanel labels:lbs. |
|
388 | 192 |
s1 subMenuAt:2 put:s2. |
436 | 193 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 194 |
s2 subMenuAt:3 put:s3. |
436 | 195 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 196 |
s3 shortcutKeyAt:3 put:$q. |
197 |
||
198 |
mview subMenuAt:1 put:s1. |
|
436 | 199 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 200 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
201 |
s1 shortcutKeyAt:1 put:#Copy. |
|
202 |
s1 shortcutKeyAt:3 put:#Paste. |
|
203 |
||
436 | 204 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 205 |
mview startUp |
3147 | 206 |
[exEnd] |
388 | 207 |
|
208 |
||
209 |
start from menu spec |
|
3147 | 210 |
[exBegin] |
388 | 211 |
|menu| |
212 |
||
436 | 213 |
menu := MenuPanel menu: |
3147 | 214 |
#(#Menu #( #(#MenuItem |
215 |
#label: 'File' |
|
216 |
#submenu: |
|
217 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
218 |
(#MenuItem |
|
219 |
#label: 'edit' |
|
220 |
#submenu: |
|
221 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
222 |
#(#MenuItem #label: 'close' #value:#close) |
|
223 |
) |
|
224 |
nil |
|
225 |
nil |
|
226 |
) |
|
227 |
) |
|
228 |
#(#MenuItem #label: 'help' #value:#help ) |
|
229 |
) |
|
230 |
nil |
|
231 |
nil |
|
232 |
) |
|
233 |
) |
|
234 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
235 |
#(#MenuItem #label: 'Bar' |
|
236 |
#submenu: |
|
237 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
238 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
239 |
) |
|
240 |
nil |
|
241 |
nil |
|
242 |
) |
|
243 |
) |
|
244 |
) |
|
245 |
#( 2 ) |
|
246 |
nil |
|
247 |
) decodeAsLiteralArray. |
|
388 | 248 |
|
249 |
menu verticalLayout:false. |
|
250 |
Transcript showCR:(menu startUp). |
|
3147 | 251 |
[exEnd] |
388 | 252 |
|
253 |
" |
|
254 |
||
255 |
! ! |
|
256 |
||
257 |
!MenuPanel class methodsFor:'instance creation'! |
|
258 |
||
259 |
fromSpec:aSpec |
|
260 |
^ self fromSpec:aSpec receiver:nil |
|
261 |
! |
|
262 |
||
263 |
fromSpec:aSpec receiver:aReceiver |
|
264 |
|menu| |
|
265 |
||
266 |
aSpec notNil ifTrue:[ |
|
3147 | 267 |
menu := Menu new. |
268 |
menu receiver:aReceiver. |
|
269 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 270 |
]. |
271 |
^ self menu:menu receiver:aReceiver |
|
272 |
! |
|
273 |
||
274 |
labels:labels |
|
275 |
^ self labels:labels nameKeys:nil receiver:nil |
|
276 |
! |
|
277 |
||
278 |
labels:labels nameKeys:nameKeys |
|
279 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
280 |
! |
|
281 |
||
282 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
283 |
|mview| |
|
284 |
||
285 |
mview := self menu:nil receiver:aReceiver. |
|
286 |
mview labels:labels. |
|
287 |
mview nameKeys:nameKeys. |
|
288 |
^ mview |
|
289 |
||
290 |
! |
|
291 |
||
502 | 292 |
labels:labels receiver:aReceiver |
293 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
294 |
! |
|
295 |
||
388 | 296 |
menu:aMenu |
297 |
^ self menu:aMenu receiver:nil |
|
298 |
! |
|
299 |
||
300 |
menu:aMenu receiver:aReceiver |
|
301 |
|mview| |
|
302 |
||
303 |
mview := self new. |
|
1955 | 304 |
|
305 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
3147 | 306 |
"/ no receiver specified in the menu; thus set the receiver immediately |
307 |
mview receiver:aReceiver |
|
1955 | 308 |
]. |
309 |
||
388 | 310 |
mview menu:aMenu. |
311 |
||
1955 | 312 |
|
388 | 313 |
"/ a menu itself may contain a receiver |
314 |
"/ thus we do not overwrite the receiver |
|
315 |
||
316 |
aReceiver notNil ifTrue:[ |
|
3147 | 317 |
mview receiver:aReceiver |
388 | 318 |
]. |
319 |
^ mview |
|
320 |
! ! |
|
321 |
||
322 |
!MenuPanel class methodsFor:'class initialization'! |
|
323 |
||
324 |
initialize |
|
325 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
2253 | 326 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 327 |
]. |
328 |
||
2715 | 329 |
" |
330 |
self initialize |
|
331 |
" |
|
332 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
333 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 334 |
! |
335 |
||
336 |
preSnapshot |
|
2715 | 337 |
"remove all resources" |
338 |
||
794 | 339 |
Images := nil. |
340 |
LigthenedImages := nil. |
|
616 | 341 |
! ! |
342 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
343 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
344 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
345 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
346 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
347 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
348 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
349 |
"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
|
350 |
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
|
351 |
|
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 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
355 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
356 |
" |
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 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
359 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
360 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
361 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
362 |
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] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
363 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
364 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
365 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
366 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
367 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
368 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
369 |
"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
|
370 |
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
|
371 |
|
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 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
375 |
" |
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 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
378 |
|
2755 | 379 |
IconDisabledIndicationOff isNil ifTrue:[ |
380 |
IconDisabledIndicationOff := Icon |
|
381 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
|
382 |
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] |
|
383 |
]. |
|
384 |
^ IconDisabledIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
385 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
386 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
387 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
388 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
390 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
391 |
"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
|
392 |
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
|
393 |
|
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 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
396 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
397 |
" |
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 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
400 |
|
2755 | 401 |
IconDisabledIndicationOn isNil ifTrue:[ |
402 |
IconDisabledIndicationOn := Icon |
|
403 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
|
404 |
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] |
|
405 |
]. |
|
406 |
^ IconDisabledIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
407 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
408 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
409 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
410 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
411 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
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
|
415 |
|
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 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
418 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
419 |
" |
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 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
422 |
|
2752 | 423 |
IconIndicationOff isNil ifTrue:[ |
424 |
IconIndicationOff := Icon |
|
425 |
constantNamed:#'MenuPanel iconIndicationOff' |
|
426 |
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] |
|
427 |
]. |
|
428 |
^ IconIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
429 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
430 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
431 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
432 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
433 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
434 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
435 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
436 |
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
|
437 |
|
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 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
440 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
441 |
" |
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 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
444 |
|
2752 | 445 |
IconIndicationOn isNil ifTrue:[ |
446 |
IconIndicationOn := Icon |
|
447 |
constantNamed:#'MenuPanel iconIndicationOn' |
|
448 |
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] |
|
449 |
]. |
|
450 |
^ IconIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
451 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
452 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
453 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
454 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
455 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
456 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
457 |
"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
|
458 |
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
|
459 |
|
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 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
462 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
463 |
" |
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 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
466 |
|
2755 | 467 |
IconDisabledRadioOff isNil ifTrue:[ |
468 |
IconDisabledRadioOff := Icon |
|
469 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
|
470 |
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] |
|
471 |
]. |
|
472 |
^ IconDisabledRadioOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
473 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
474 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
475 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
476 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
477 |
by the ImageEditor of ST/X." |
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 |
"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
|
480 |
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
|
481 |
|
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 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
484 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 485 |
Icon flushCachedIcons |
1798
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
488 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
489 |
|
2755 | 490 |
IconDisabledRadioOn isNil ifTrue:[ |
491 |
IconDisabledRadioOn := Icon |
|
492 |
constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
493 |
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] |
|
494 |
]. |
|
495 |
^ IconDisabledRadioOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
496 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
497 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
498 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
499 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
500 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
501 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
502 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
503 |
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
|
504 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
505 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
506 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
507 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
508 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
509 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
510 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
511 |
|
2754 | 512 |
IconRadioOff isNil ifTrue:[ |
513 |
IconRadioOff := Icon |
|
514 |
constantNamed:#'MenuPanel iconRadioGroupOff' |
|
515 |
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] |
|
516 |
]. |
|
517 |
^ IconRadioOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
518 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
519 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
520 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
521 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
522 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
523 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
524 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
525 |
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
|
526 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
527 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
528 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
529 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
530 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
531 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
532 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
533 |
|
2754 | 534 |
IconRadioOn isNil ifTrue:[ |
535 |
IconRadioOn := Icon |
|
536 |
constantNamed:#'MenuPanel iconRadioGroupOn' |
|
537 |
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] |
|
538 |
]. |
|
539 |
^ IconRadioOn |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
540 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
541 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
542 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
543 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
544 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
545 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
546 |
"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
|
547 |
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
|
548 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
549 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
550 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
551 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
552 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
553 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
554 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
555 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
556 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
557 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
558 |
constantNamed:#'MenuPanel::Item class menuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
559 |
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
|
560 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
561 |
|
616 | 562 |
!MenuPanel class methodsFor:'defaults'! |
450 | 563 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
564 |
defaultBackgroundColor |
2609 | 565 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 566 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
567 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
568 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
569 |
defaultLevel |
2372 | 570 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
571 |
" |
|
572 |
self defaultLevel |
|
573 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
574 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
575 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
576 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
577 |
"returns an additional offset between the label and the |
2715 | 578 |
delayedMenu indication (i.e. the down-arrow icon)" |
579 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
580 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
581 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
582 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
583 |
maxShortCutSearchLevel |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
584 |
"1 means: only search in top items. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
585 |
2 means: search one level of menus. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
586 |
used to be 10" |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
587 |
|
3384 | 588 |
MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.]. |
589 |
^ MaxShortCutSearchLevel |
|
590 |
! |
|
591 |
||
592 |
maxShortCutSearchLevel: anInteger |
|
593 |
"1 means: only search in top items. |
|
594 |
2 means: search one level of menus." |
|
595 |
||
596 |
MaxShortCutSearchLevel := anInteger |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
597 |
! |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
598 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
599 |
menuIndicatorOffset |
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 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
606 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
607 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
608 |
ex: |
2715 | 609 |
&File mnemonic := Cmdf |
610 |
F&ile mnemonic := Cmdi |
|
611 |
....." |
|
612 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
613 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
614 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
615 |
|
450 | 616 |
updateStyleCache |
2777 | 617 |
"extract values from the styleSheet and cache them in class variables" |
657 | 618 |
|
2219 | 619 |
<resource: #style ( |
620 |
#'popup.borderWidth' #'popup.level' |
|
621 |
#'selection.disabledForegroundColor' |
|
622 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
623 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
2883 | 624 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
2219 | 625 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
626 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
627 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
628 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
629 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
630 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
631 |
#'menu.selectionFollowsMouse' |
|
632 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
633 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
634 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
635 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
2752 | 636 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
2754 | 637 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
638 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
|
639 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
|
2755 | 640 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
641 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
|
642 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
|
643 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
|
2219 | 644 |
)> |
645 |
||
646 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 647 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 648 |
|
2611 | 649 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
650 |
which returns the default cashed DefaultBackgroundColor |
|
651 |
" |
|
652 |
DefaultBackgroundColor := nil. |
|
653 |
||
2219 | 654 |
MenuView updateStyleCache. |
655 |
SelectionInListView updateStyleCache. |
|
1699 | 656 |
|
2372 | 657 |
styleSheet := StyleSheet. |
658 |
style := styleSheet name. |
|
659 |
||
2607 | 660 |
DefaultFont := MenuView defaultFont. |
2883 | 661 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
662 |
default:[styleSheet |
|
663 |
colorAt:#'menu.foregroundColor' |
|
664 |
default:Color black]. |
|
2609 | 665 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 666 |
|
667 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 668 |
var isNil ifTrue:[ |
2219 | 669 |
style == #motif ifTrue:[ var := backgroundColor ] |
670 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
671 |
]. |
|
672 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
673 |
||
674 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 675 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 676 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
677 |
||
678 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 679 |
var isNil ifTrue:[ |
2219 | 680 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 681 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 682 |
]. |
683 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
684 |
||
685 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 686 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 687 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
688 |
||
689 |
||
690 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 691 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 692 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
693 |
||
694 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 695 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 696 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
697 |
||
698 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
699 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
700 |
||
701 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
702 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
703 |
||
704 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 705 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 706 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
707 |
]. |
|
708 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
709 |
||
710 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 711 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 712 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
713 |
||
714 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 715 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 716 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
717 |
||
718 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 719 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 720 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
721 |
||
722 |
Item updateStyleCache. |
|
2607 | 723 |
|
2754 | 724 |
getBitmapOrFile := [:key :fileKey | |
725 |
|var| |
|
726 |
||
727 |
var := styleSheet at:key ifAbsent:nil. |
|
728 |
var isNil ifTrue:[ |
|
729 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
2752 | 730 |
var notNil ifTrue:[ |
2754 | 731 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
2752 | 732 |
]. |
733 |
]. |
|
2754 | 734 |
var |
735 |
]. |
|
736 |
||
2883 | 737 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
738 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
739 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
740 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
741 |
||
742 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
743 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
744 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
745 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 746 |
|
2607 | 747 |
" |
748 |
self updateStyleCache |
|
749 |
" |
|
388 | 750 |
! ! |
751 |
||
794 | 752 |
!MenuPanel class methodsFor:'image registration'! |
753 |
||
754 |
image:anImage onDevice:aDevice |
|
755 |
" |
|
756 |
Images := nil |
|
757 |
" |
|
2269 | 758 |
|deviceImages| |
794 | 759 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
760 |
anImage device == aDevice ifTrue:[ |
2269 | 761 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
762 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
763 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
764 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 765 |
|
1097 | 766 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 767 |
Images at:aDevice put:(deviceImages := Dictionary new) |
768 |
]. |
|
769 |
||
770 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
771 |
image := anImage copy onDevice:aDevice. |
|
772 |
image clearMaskedPixels. |
|
773 |
deviceImages at:anImage put:image. |
|
774 |
image |
|
775 |
]. |
|
794 | 776 |
! |
777 |
||
778 |
lightenedImage:anImage onDevice:aDevice |
|
779 |
" |
|
780 |
LigthenedImages := nil |
|
781 |
" |
|
2374 | 782 |
|deviceImages image colorMap| |
794 | 783 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
784 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 785 |
|
1097 | 786 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 787 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 788 |
]. |
789 |
||
790 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 791 |
^ image |
792 |
]. |
|
793 |
||
794 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
795 |
||
796 |
colorMap notNil ifTrue:[ |
|
797 |
image := anImage copy lightened onDevice:aDevice. |
|
798 |
image clearMaskedPixels. |
|
794 | 799 |
] ifFalse:[ |
2374 | 800 |
image := self image:anImage onDevice:aDevice |
794 | 801 |
]. |
1097 | 802 |
deviceImages at:anImage put:image. |
794 | 803 |
^ image |
804 |
! ! |
|
805 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
806 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
807 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
808 |
subMenu:aSubMenu |
2715 | 809 |
"create a submenu; can be redifined in derived classes" |
810 |
||
811 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
812 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
813 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
814 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
815 |
|
1808 | 816 |
!MenuPanel methodsFor:'accepting'! |
389 | 817 |
|
818 |
accept |
|
2715 | 819 |
"accept current selected item" |
820 |
||
1670 | 821 |
^ self acceptItem:(self selection) inMenu:self |
389 | 822 |
! |
823 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
824 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
825 |
"this is the topMenu: accept item " |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
826 |
|
3142 | 827 |
|item tgState itemIdx recv panel masterGroup winGrp acceptAction focusView| |
1630 | 828 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
829 |
self superMenu notNil ifTrue:[ |
2253 | 830 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
831 |
]. |
3142 | 832 |
prevFocusView ~~ self ifTrue:[ |
833 |
focusView := prevFocusView. |
|
834 |
]. |
|
835 |
prevFocusView := nil. |
|
836 |
||
2199 | 837 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
838 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
839 |
self selection:nil. |
420 | 840 |
|
841 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 842 |
tgState := anItem toggleIndication. |
843 |
panel := anItem menuPanel. |
|
844 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
845 |
item := anItem. |
|
846 |
recv := panel receiver. |
|
389 | 847 |
]. |
1699 | 848 |
self doUngrab:true. |
389 | 849 |
|
510 | 850 |
self isPopUpView ifFalse:[ |
2253 | 851 |
self do:[:el| el updateIndicators]. |
3143 | 852 |
(winGrp := self windowGroup) notNil ifTrue:[ |
3142 | 853 |
winGrp processExposeEvents. |
854 |
]. |
|
524 | 855 |
] ifTrue:[ |
2253 | 856 |
self unmap. |
2712 | 857 |
self device sync. "/ round trip - all expose events are now received |
3143 | 858 |
|
859 |
(winGrp := self windowGroup) notNil ifTrue:[ |
|
2253 | 860 |
"/ give expose event a chance to arrive |
861 |
[shown and:[realized]] whileTrue:[ |
|
862 |
winGrp processExposeEventsFor:self |
|
863 |
]. |
|
864 |
masterGroup := winGrp previousGroup. |
|
865 |
]. |
|
866 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
867 |
"/ self destroy. |
|
868 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 869 |
]. |
1710 | 870 |
|
3144 | 871 |
acceptAction := [ |
872 |
|winGrp| |
|
873 |
||
3189 | 874 |
(focusView notNil and:[(winGrp := self windowGroup) notNil]) ifTrue:[ |
875 |
winGrp focusView:focusView. |
|
3142 | 876 |
]. |
3187 | 877 |
self accept:item index:itemIdx toggle:tgState receiver:recv. |
3189 | 878 |
|
2826 | 879 |
]. |
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
880 |
|
1710 | 881 |
(item notNil |
882 |
and:[item showBusyCursorWhilePerforming |
|
883 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
884 |
ifTrue:[ |
|
2253 | 885 |
winGrp withWaitCursorDo:acceptAction |
3144 | 886 |
] ifFalse:[ |
887 |
acceptAction value |
|
888 |
]. |
|
524 | 889 |
|
890 |
self isPopUpView ifTrue:[ |
|
2253 | 891 |
self menuAdornmentAt:#item put:item. |
524 | 892 |
]. |
1699 | 893 |
^ item. |
524 | 894 |
|
3144 | 895 |
"Modified: / 08-11-2006 / 17:14:06 / cg" |
524 | 896 |
! |
897 |
||
898 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
2715 | 899 |
"accept an item" |
900 |
||
2253 | 901 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
902 |
app master fallBack| |
524 | 903 |
|
904 |
anItem isNil ifTrue:[ |
|
2253 | 905 |
self menuAdornmentAt:#hasPerformed put:true. |
906 |
^ nil |
|
907 |
]. |
|
908 |
||
909 |
isValueModel := aReceiver isValueModel. |
|
910 |
||
911 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 912 |
|
913 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 914 |
^ anIndex |
524 | 915 |
]. |
916 |
||
917 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 918 |
argument := aState ? anItem |
389 | 919 |
]. |
524 | 920 |
|
921 |
value isSymbol ifFalse:[ |
|
2253 | 922 |
"/ a valueHolder or block |
923 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
924 |
^ value |
|
925 |
]. |
|
926 |
||
927 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
928 |
||
929 |
numArgs == 0 ifTrue:[ |
|
930 |
args := nil |
|
931 |
] ifFalse:[ |
|
932 |
numArgs == 1 ifTrue:[ |
|
933 |
args := Array with:argument |
|
934 |
] ifFalse:[ |
|
935 |
args := Array with:argument with:self |
|
936 |
] |
|
937 |
]. |
|
938 |
||
939 |
value valueWithArguments:args. |
|
940 |
||
941 |
self menuAdornmentAt:#hasPerformed put:true. |
|
942 |
^ anIndex |
|
524 | 943 |
]. |
944 |
||
2331 | 945 |
anItem sendToOriginator ifTrue:[ |
2473 | 946 |
rec := self originator. |
947 |
rec isNil ifTrue:[ |
|
2844 | 948 |
self error:'no originating widget (no target for message)' mayProceed:true. |
2473 | 949 |
]. |
2331 | 950 |
] ifFalse:[ |
951 |
rec := aReceiver |
|
952 |
]. |
|
953 |
||
954 |
rec isNil ifTrue:[ |
|
2253 | 955 |
^ value |
956 |
]. |
|
957 |
||
958 |
isValueModel ifTrue:[ |
|
2331 | 959 |
rec value:value |
465 | 960 |
] ifFalse:[ |
2253 | 961 |
arg2 := self. |
962 |
||
963 |
"/ support for ST80 style applications |
|
964 |
"/ (expecting the message to go to the application |
|
965 |
"/ if not understood by the view) |
|
966 |
"/ These expect the controller to be passed as argument. |
|
967 |
"/ sigh. |
|
968 |
||
2331 | 969 |
(rec isView |
970 |
and:[(rec respondsTo:value) not |
|
971 |
and:[(app := rec application) ~~ rec |
|
2253 | 972 |
and:[app notNil]]]) ifTrue:[ |
2331 | 973 |
arg2 := rec controller. "/ the Views controller |
2253 | 974 |
rec := app. |
975 |
]. |
|
976 |
||
977 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
978 |
args := nil |
|
979 |
] ifFalse:[ |
|
980 |
numArgs == 1 ifTrue:[ |
|
981 |
args := Array with:argument |
|
982 |
] ifFalse:[ |
|
983 |
args := Array with:argument with:arg2 |
|
984 |
] |
|
985 |
]. |
|
986 |
||
987 |
fallBack := |
|
988 |
[ |
|
989 |
"/ mhmh - the receiver did not respond to that message; |
|
990 |
"/ if there is a master-application, try that one |
|
991 |
"/ (recursive) |
|
992 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
993 |
master notNil ifTrue:[ |
|
994 |
rec := master. |
|
995 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
996 |
] ifFalse:[ |
|
997 |
self |
|
998 |
error:'unimplemented (or error in) menu message: ' , value |
|
999 |
mayProceed:true |
|
1000 |
]. |
|
1001 |
]. |
|
1002 |
||
1003 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 1004 |
]. |
524 | 1005 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
1006 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1007 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
1008 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 1009 |
! |
1010 |
||
1670 | 1011 |
acceptItem:anItem inMenu:aMenu |
2199 | 1012 |
|tgState topMenu| |
1013 |
||
1014 |
topMenu := self topMenu. |
|
1015 |
topMenu openDelayed:nil. |
|
1670 | 1016 |
|
1841 | 1017 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2934 | 1018 |
topMenu accept:anItem |
1670 | 1019 |
] ifFalse:[ |
2934 | 1020 |
anItem canAccept ifTrue:[ |
1021 |
tgState := anItem toggleIndication. |
|
1022 |
||
1023 |
self accept:anItem |
|
1024 |
index:(aMenu selectionIndex) |
|
1025 |
toggle:tgState |
|
1026 |
receiver:(aMenu receiver). |
|
1027 |
||
1028 |
aMenu do:[:el| el updateIndicators]. |
|
1029 |
anItem hideMenuOnActivated ifFalse:[ |
|
1030 |
aMenu invalidate |
|
1031 |
]. |
|
1032 |
] |
|
1670 | 1033 |
] |
1034 |
! |
|
1035 |
||
389 | 1036 |
lastItemAccepted |
2715 | 1037 |
"returns last item selected or nil" |
1038 |
||
390 | 1039 |
^ self topMenu menuAdornmentAt:#item |
389 | 1040 |
! |
1041 |
||
1042 |
lastValueAccepted |
|
2715 | 1043 |
"returns last value accepted or nil" |
1044 |
||
2253 | 1045 |
^ self lastItemAccepted value |
389 | 1046 |
! ! |
1047 |
||
388 | 1048 |
!MenuPanel methodsFor:'accessing'! |
1049 |
||
1050 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1051 |
"get the access character position for a textLabel" |
1052 |
||
2059 | 1053 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1054 |
! |
1055 |
||
1056 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1057 |
"get the access character position for a textLabel" |
1058 |
||
388 | 1059 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1060 |
! |
|
1061 |
||
1062 |
accessCharacterPositions |
|
2715 | 1063 |
"returns a collection of accessCharacterPositions or nil" |
1064 |
||
388 | 1065 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1066 |
! |
|
1067 |
||
1068 |
accessCharacterPositions:something |
|
2715 | 1069 |
"define accessCharacterPositions for each item" |
1070 |
||
388 | 1071 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1072 |
! |
|
1073 |
||
1074 |
args |
|
2715 | 1075 |
"returns a collection of arguments or nil" |
1076 |
||
388 | 1077 |
^ self collect:[:anItem| anItem argument ] |
1078 |
! |
|
1079 |
||
1080 |
args:something |
|
2715 | 1081 |
"define arguments for each item" |
1082 |
||
388 | 1083 |
self onEachPerform:#argument: withArgList:something |
1084 |
! |
|
1085 |
||
1086 |
argsAt:stringOrNumber |
|
2715 | 1087 |
"gets the argument of an item or nil" |
1088 |
||
2059 | 1089 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1090 |
! |
1091 |
||
1092 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1093 |
"sets the argument of an item" |
1094 |
||
388 | 1095 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1096 |
! |
|
1097 |
||
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1098 |
doAccessCharacterTranslation |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1099 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1100 |
Can be set to false to leave labels unchanged" |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1101 |
|
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1102 |
^ doAccessCharacterTranslation ? true |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1103 |
! |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1104 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1105 |
doAccessCharacterTranslation:aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1106 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1107 |
Can be set to false to leave labels unchanged" |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1108 |
|
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1109 |
doAccessCharacterTranslation := aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1110 |
! |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1111 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1112 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1113 |
"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
|
1114 |
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
|
1115 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1116 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1117 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1118 |
"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
|
1119 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1120 |
|
388 | 1121 |
groupSizes |
2715 | 1122 |
"gets collection of group sizes" |
1123 |
||
388 | 1124 |
^ groupSizes |
1125 |
! |
|
1126 |
||
1127 |
groupSizes:aGroupSizes |
|
2715 | 1128 |
"sets collection of group sizes" |
1129 |
||
388 | 1130 |
aGroupSizes = groupSizes ifFalse:[ |
2715 | 1131 |
groupSizes := aGroupSizes copy. |
1132 |
self mustRearrange. |
|
388 | 1133 |
]. |
1134 |
! |
|
1135 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1136 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1137 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1138 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1139 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1140 |
hideOnRelease:something |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1141 |
hideOnRelease := something. |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1142 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1143 |
|
388 | 1144 |
labelAt:stringOrNumber |
2715 | 1145 |
"gets the label of an item or nil" |
1146 |
||
388 | 1147 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1148 |
! |
|
1149 |
||
1150 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1151 |
"sets the label of an item" |
1152 |
||
388 | 1153 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1154 |
! |
|
1155 |
||
1156 |
labels |
|
2715 | 1157 |
"returns a collection of labels's or nil" |
1158 |
||
388 | 1159 |
^ self collect:[:anItem| anItem label ] |
1160 |
! |
|
1161 |
||
1162 |
labels:labels |
|
2715 | 1163 |
"define labels for each item" |
1164 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1165 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1166 |
|
388 | 1167 |
self disabledRedrawDo:[ |
2715 | 1168 |
self removeAll. |
1169 |
size := labels size. |
|
1170 |
||
1171 |
size > 0 ifTrue:[ |
|
1172 |
items := OrderedCollection new:size. |
|
1173 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1174 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1175 |
]. |
388 | 1176 |
! |
1177 |
||
1999 | 1178 |
menuPerformer:anObject |
1179 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1180 |
from all submenus no specific receiver is defined )." |
1181 |
||
1999 | 1182 |
^ self receiver:anObject |
1183 |
! |
|
1184 |
||
388 | 1185 |
nameKeyAt:stringOrNumber |
2715 | 1186 |
"gets the nameKey of an item or nil" |
1187 |
||
1188 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1189 |
! |
1190 |
||
1191 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1192 |
"sets the nameKey of an item" |
1193 |
||
388 | 1194 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1195 |
! |
|
1196 |
||
1197 |
nameKeys |
|
2715 | 1198 |
"returns a collection of nameKeyss or nil" |
1199 |
||
388 | 1200 |
^ self collect:[:anItem| anItem nameKey ] |
1201 |
! |
|
1202 |
||
1203 |
nameKeys:something |
|
2715 | 1204 |
"define nameKeys for each item" |
1205 |
||
388 | 1206 |
self onEachPerform:#nameKey: withArgList:something |
1207 |
! |
|
1208 |
||
1209 |
numberOfItems |
|
2715 | 1210 |
"gets number of items" |
1211 |
||
388 | 1212 |
^ items size |
1213 |
! |
|
1214 |
||
2331 | 1215 |
originator |
1216 |
originator notNil ifTrue:[^ originator]. |
|
1217 |
superMenu notNil ifTrue:[ |
|
1218 |
^ superMenu originator |
|
1219 |
]. |
|
1220 |
^ nil |
|
1221 |
! |
|
1222 |
||
388 | 1223 |
receiver |
1224 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1225 |
from all submenus no specific receiver is defined )." |
1226 |
||
389 | 1227 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2715 | 1228 |
^ superMenu receiver |
388 | 1229 |
]. |
389 | 1230 |
^ receiver |
388 | 1231 |
! |
1232 |
||
1233 |
receiver:anObject |
|
1234 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1235 |
from all submenus no specific receiver is defined )." |
1236 |
||
389 | 1237 |
receiver := anObject |
388 | 1238 |
! |
1239 |
||
1240 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1241 |
"gets the shortCutKey of an item or nil" |
1242 |
||
1243 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1244 |
! |
1245 |
||
1246 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1247 |
"sets the shortCutKey of an item" |
1248 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1249 |
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
|
1250 |
! |
388 | 1251 |
|
1252 |
shortcutKeys |
|
2715 | 1253 |
"returns a collection of shortcutKeys or nil" |
1254 |
||
388 | 1255 |
^ self collect:[:anItem| anItem shortcutKey ] |
1256 |
! |
|
1257 |
||
1258 |
shortcutKeys:something |
|
2715 | 1259 |
"define shortcutKeys for each item" |
1260 |
||
388 | 1261 |
self onEachPerform:#shortcutKey: withArgList:something |
1262 |
! |
|
1263 |
||
1264 |
valueAt:stringOrNumber |
|
2715 | 1265 |
"gets value of an item; a block, valueHolder, ..." |
1266 |
||
1267 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1268 |
! |
1269 |
||
1270 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1271 |
"sets value of an item; a block, valueHolder, ..." |
1272 |
||
388 | 1273 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1274 |
! |
|
1275 |
||
1276 |
values:something |
|
2715 | 1277 |
"define values for each item" |
1278 |
||
388 | 1279 |
self onEachPerform:#value: withArgList:something |
1280 |
! ! |
|
1281 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1282 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1283 |
|
1284 |
disableAll |
|
2715 | 1285 |
"disable all items; not the menu in case of enabled" |
1286 |
||
498 | 1287 |
self do:[:anItem| anItem enabled:false] |
388 | 1288 |
! |
1289 |
||
1290 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1291 |
"disable an collection of items" |
1292 |
||
388 | 1293 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1294 |
! |
|
1295 |
||
1296 |
enableAll |
|
2715 | 1297 |
"enable all items; not the menu in case of disabled" |
1298 |
||
498 | 1299 |
self do:[:anItem| anItem enabled:true] |
388 | 1300 |
! |
1301 |
||
1302 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1303 |
"enable an collection of items" |
1304 |
||
388 | 1305 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1306 |
! |
|
1307 |
||
1308 |
enabled |
|
2715 | 1309 |
"returns enabled state" |
1310 |
||
498 | 1311 |
^ enabled |
388 | 1312 |
! |
1313 |
||
1314 |
enabled:aState |
|
2715 | 1315 |
"change enabled state of menu" |
1316 |
||
545 | 1317 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1318 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1319 |
state := aState ? true. |
388 | 1320 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1321 |
enabled ~~ state ifTrue:[ |
2715 | 1322 |
enabled := state. |
1323 |
self invalidate. |
|
498 | 1324 |
]. |
388 | 1325 |
! |
1326 |
||
1327 |
enabledAt:stringOrNumber |
|
2715 | 1328 |
"gets the enabled state of an item or false" |
1329 |
||
388 | 1330 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1331 |
! |
|
1332 |
||
1333 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1334 |
"sets the enabled state of an item" |
1335 |
||
388 | 1336 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1337 |
! |
|
1338 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1339 |
exclusivePointer:aBoolean |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1340 |
"Do nothing here. Compatibility with PopUpListController" |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1341 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1342 |
^ self |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1343 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1344 |
|
388 | 1345 |
isEnabled:stringOrNumber |
2715 | 1346 |
"gets the enabled state of an item or false" |
1347 |
||
388 | 1348 |
^ self enabledAt:stringOrNumber |
1349 |
! ! |
|
1350 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1351 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1352 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1353 |
enableChannel:aValueHolder |
2715 | 1354 |
"set my enableChannel" |
1355 |
||
498 | 1356 |
enableChannel notNil ifTrue:[ |
2715 | 1357 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1358 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1359 |
|
498 | 1360 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2715 | 1361 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1362 |
]. |
498 | 1363 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1364 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1365 |
|
3222 | 1366 |
menuChannel |
1367 |
^ self menuHolder |
|
1368 |
||
1369 |
"Created: / 27-03-2007 / 08:38:31 / cg" |
|
1370 |
! |
|
1371 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1372 |
menuHolder:aValueHolder |
2715 | 1373 |
"set my menuHolder" |
1374 |
||
498 | 1375 |
menuHolder notNil ifTrue:[ |
2715 | 1376 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1377 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1378 |
|
498 | 1379 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2715 | 1380 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1381 |
]. |
498 | 1382 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1383 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1384 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1385 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1386 |
|
616 | 1387 |
activeBackgroundColor |
2715 | 1388 |
"get the background drawing color used to highlight selection" |
1389 |
||
2219 | 1390 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1391 |
! |
1392 |
||
1393 |
activeForegroundColor |
|
2715 | 1394 |
"get the foreground color used to highlight selections" |
1395 |
||
2219 | 1396 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1397 |
! |
1398 |
||
390 | 1399 |
backgroundColor |
2715 | 1400 |
"return the background color" |
1401 |
||
502 | 1402 |
^ super viewBackground |
390 | 1403 |
! |
1404 |
||
1405 |
backgroundColor:aColor |
|
1406 |
"set the background drawing color. You should not use this method; |
|
2715 | 1407 |
instead, leave the value as defined in the styleSheet." |
1408 |
||
1409 |
self backgroundColor ~~ aColor ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1410 |
super viewBackground:aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1411 |
self invalidate "/ RepairNow:true |
616 | 1412 |
] |
1413 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1414 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1415 |
! |
1416 |
||
727 | 1417 |
buttonActiveBackgroundColor |
2715 | 1418 |
"get the background drawing color used to highlight button selection" |
1419 |
||
2219 | 1420 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1421 |
default:(self viewBackground) |
|
727 | 1422 |
! |
1423 |
||
730 | 1424 |
buttonEdgeStyle |
2715 | 1425 |
"get the button edge style" |
1426 |
||
2219 | 1427 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1428 |
! |
1429 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1430 |
buttonEnteredBackgroundColor |
2715 | 1431 |
"get the background drawing color used to highlight entered button items" |
1432 |
||
2219 | 1433 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1434 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1435 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1436 |
buttonEnteredLevel |
2715 | 1437 |
"get the 3D-level used to highlight entered button items" |
1438 |
||
2219 | 1439 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1440 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1441 |
|
730 | 1442 |
buttonHalfLightColor |
2715 | 1443 |
"get the background drawing color used to half light button frame" |
1444 |
||
2219 | 1445 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1446 |
! |
1447 |
||
1448 |
buttonHalfShadowColor |
|
2715 | 1449 |
"get the background drawing color used to half shadow button frame" |
1450 |
||
2219 | 1451 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1452 |
! |
1453 |
||
1454 |
buttonLightColor |
|
2715 | 1455 |
"get the background drawing color used to light button frame" |
1456 |
||
2219 | 1457 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1458 |
! |
1459 |
||
1460 |
buttonPassiveBackgroundColor |
|
2715 | 1461 |
"get the background drawing color used for button" |
1462 |
||
2219 | 1463 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1464 |
! |
1465 |
||
1466 |
buttonShadowColor |
|
2715 | 1467 |
"get the background drawing color used to shadow button frame" |
1468 |
||
2219 | 1469 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1470 |
! |
1471 |
||
1472 |
disabledEtchedForegroundColor |
|
1473 |
"return the color used for etching disabled items. |
|
2715 | 1474 |
If nil, no 3D effect is drawn." |
1475 |
||
2219 | 1476 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1477 |
! |
1478 |
||
390 | 1479 |
disabledForegroundColor |
2715 | 1480 |
"return the foreground color used by disabled items" |
1481 |
||
2219 | 1482 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1483 |
! |
1484 |
||
2170 | 1485 |
enteredBackgroundColor |
2715 | 1486 |
"return the background color for entered items" |
1487 |
||
2219 | 1488 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1489 |
default:(self backgroundColor) |
|
2170 | 1490 |
! |
1491 |
||
1492 |
enteredForegroundColor |
|
2715 | 1493 |
"return the foreground color for entered items" |
1494 |
||
2219 | 1495 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1496 |
! |
1497 |
||
390 | 1498 |
font:aFont |
2715 | 1499 |
"set the font" |
1500 |
||
2614 | 1501 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1502 |
||
1503 |
super font:aFont. |
|
1504 |
self do:[:anItem| anItem fontChanged ]. |
|
1505 |
||
1506 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1507 |
self extent:(self preferredExtent) |
|
1508 |
]. |
|
1509 |
self mustRearrange. |
|
390 | 1510 |
! |
1511 |
||
1512 |
foregroundColor |
|
2715 | 1513 |
"return the passive foreground color" |
1514 |
||
2059 | 1515 |
^ fgColor |
390 | 1516 |
! |
1517 |
||
1518 |
foregroundColor:aColor |
|
1519 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1520 |
instead leave the value as defined in the styleSheet." |
1521 |
||
2219 | 1522 |
aColor ~= fgColor ifTrue:[ |
1478 | 1523 |
fgColor := aColor onDevice:device. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1524 |
self invalidate |
2219 | 1525 |
]. |
580 | 1526 |
! |
1527 |
||
1699 | 1528 |
maxAbsoluteButtonLevel |
1529 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1530 |
extent of a button" |
1531 |
||
2219 | 1532 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1533 |
! |
1534 |
||
730 | 1535 |
selectionFrameBrightColor |
2715 | 1536 |
"get the selection frame bright color" |
1537 |
||
2219 | 1538 |
^ Color white |
730 | 1539 |
! |
1540 |
||
1541 |
selectionFrameDarkColor |
|
2715 | 1542 |
"get the selection frame dark color" |
1543 |
||
2219 | 1544 |
^ Color black |
730 | 1545 |
! |
1546 |
||
1727 | 1547 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1548 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1549 |
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
|
1550 |
|
1727 | 1551 |
|currentFont| |
1552 |
||
1553 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1554 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1555 |
super font:aFont. |
1727 | 1556 |
]. |
1557 |
^ currentFont |
|
2761 | 1558 |
! |
1559 |
||
1560 |
viewBackground:aColor |
|
1561 |
super viewBackground:aColor |
|
390 | 1562 |
! ! |
1563 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1564 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1565 |
|
1566 |
height |
|
2715 | 1567 |
"default height" |
1568 |
||
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
1569 |
(self hasExplicitExtent not) ifTrue:[ |
2715 | 1570 |
^ self preferredExtent y |
388 | 1571 |
]. |
1572 |
^ super height |
|
1573 |
! |
|
1574 |
||
2016 | 1575 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1576 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1577 |
device notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1578 |
^ device usableExtent - 2. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1579 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1580 |
superMenu notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1581 |
^ superMenu maxExtent |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1582 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1583 |
"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
|
1584 |
self error:'don''t know maxExtent'. |
2016 | 1585 |
! |
1586 |
||
388 | 1587 |
preferredExtent |
2715 | 1588 |
"compute and returns my preferred extent" |
1589 |
||
2253 | 1590 |
|maxExtent usedExtent| |
2024 | 1591 |
|
2016 | 1592 |
preferredExtent notNil ifTrue:[ |
2253 | 1593 |
^ preferredExtent |
2016 | 1594 |
]. |
2024 | 1595 |
usedExtent := self preferredExtentOfItems. |
1596 |
||
1597 |
superView isNil ifTrue:[ |
|
2253 | 1598 |
"/ is standalone |
2374 | 1599 |
preferredWidth notNil ifTrue:[ |
2253 | 1600 |
usedExtent x < preferredWidth ifTrue:[ |
1601 |
usedExtent := preferredWidth @ usedExtent y. |
|
1602 |
] |
|
1603 |
] |
|
2024 | 1604 |
]. |
1605 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1606 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1607 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1608 |
usedExtent := usedExtent min:maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1609 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1610 |
^ usedExtent |
2024 | 1611 |
|
1612 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1613 |
! |
1614 |
||
1615 |
preferredExtentOfItems |
|
1616 |
"compute and returns my preferred extent including all items |
|
2715 | 1617 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
1618 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1619 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1620 |
x "{ Class:SmallInteger }" |
1621 |
y "{ Class:SmallInteger }" |
|
1622 |
size "{ Class:SmallInteger }" |
|
2883 | 1623 |
buttonInsetX2 "{ Class:SmallInteger }" |
1624 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1625 |
labelInsetX "{ Class:SmallInteger }" |
1626 |
labelInsetY "{ Class:SmallInteger }" |
|
1627 |
itemMargin "{ Class:SmallInteger }" |
|
1628 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1629 |
| |
388 | 1630 |
|
1699 | 1631 |
(size := items size) == 0 ifTrue:[ |
2219 | 1632 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1633 |
^ 32 @ 32 |
2219 | 1634 |
]. |
3131 | 1635 |
stringOffsetX := nil. |
2883 | 1636 |
buttonInsetX2 := 2 * buttonInsetX. |
1637 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1638 |
|
1639 |
self isPopUpView ifFalse:[ |
|
2219 | 1640 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1641 |
] ifTrue:[ |
2145 | 1642 |
labelInsetX := labelInsetY := 0. |
1699 | 1643 |
]. |
1644 |
||
1645 |
x := 0. |
|
1646 |
y := 0. |
|
2219 | 1647 |
groupDividerSize := self groupDividerSize. |
388 | 1648 |
|
1649 |
self verticalLayout ifFalse:[ |
|
1699 | 1650 |
items keysAndValuesDo:[:key :el| |eX eY| |
1651 |
extent := el preferredExtent. |
|
1652 |
||
1653 |
"/ check for visibility (extent x ~~ 0) |
|
1654 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1655 |
eY := extent y. |
|
1656 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1657 |
el isButton ifTrue:[ |
2883 | 1658 |
eX := eX + buttonInsetX2. |
1659 |
eY := eY + buttonInsetY2. |
|
1699 | 1660 |
] ifFalse:[ |
2145 | 1661 |
eX := eX + labelInsetX. |
1662 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1663 |
]. |
1699 | 1664 |
key ~~ size ifTrue:[ |
1665 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1666 |
x := x + groupDividerSize |
|
1667 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1668 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1669 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1670 |
] |
1699 | 1671 |
] |
1672 |
]. |
|
1673 |
x := eX + x. |
|
1674 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1675 |
] |
1699 | 1676 |
] |
388 | 1677 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1678 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1679 |
shCtKey := 0. |
1699 | 1680 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1681 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1682 |
x := 0. |
2219 | 1683 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1684 |
|
1699 | 1685 |
items keysAndValuesDo:[:key :el| |eX eY| |
1686 |
extent := el preferredExtent. |
|
1687 |
||
1688 |
"/ check for visibility (extent x ~~ 0) |
|
1689 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1690 |
eY := extent y. |
|
1691 |
||
1692 |
el isButton ifTrue:[ |
|
2883 | 1693 |
eX := eX + buttonInsetX2. |
1694 |
eY := eY + buttonInsetY2. |
|
1699 | 1695 |
] ifFalse:[ |
2145 | 1696 |
eX := eX + labelInsetX. |
1697 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1698 |
]. |
1699 | 1699 |
hasMenu ifFalse:[ |
1700 |
hasMenu := el hasSubmenu |
|
1701 |
]. |
|
1702 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1703 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1704 |
]. |
|
1705 |
key ~~ size ifTrue:[ |
|
1706 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1707 |
y := y + groupDividerSize |
|
1708 |
] |
|
1709 |
]. |
|
1710 |
y := eY + y. |
|
1711 |
x := eX max:x. |
|
1712 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1713 |
]. |
2219 | 1714 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1715 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1716 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1717 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1718 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1719 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1720 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1721 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1722 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1723 |
]. |
1699 | 1724 |
"/ to have a small inset |
1725 |
y := y + 1. |
|
1726 |
"/ x := x + 1. |
|
1727 |
]. |
|
1728 |
x := x + margin + margin. |
|
1729 |
y := y + margin + margin. |
|
1730 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1731 |
^ x @ y |
388 | 1732 |
! |
1733 |
||
2253 | 1734 |
preferredWidth:aWidthOrNil |
1735 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1736 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1737 |
If not nil, the width is the maximum from the contained items and the required width." |
1738 |
||
2253 | 1739 |
preferredWidth := aWidthOrNil. |
2024 | 1740 |
! |
1741 |
||
388 | 1742 |
shortKeyInset |
2715 | 1743 |
"left inset of shortcutKey" |
1744 |
||
1745 |
^ shortKeyInset |
|
616 | 1746 |
! |
1747 |
||
3131 | 1748 |
stringOffsetXfor:anItem |
1749 |
"return the x offset for a MenuItem where to draw the text |
|
1750 |
" |
|
1751 |
|label w| |
|
1752 |
||
1753 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
1754 |
||
1755 |
stringOffsetX isNil ifTrue:[ |
|
1756 |
stringOffsetX := 0. |
|
1757 |
||
1758 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
1759 |
self do:[:el| |
|
1760 |
el isVisible ifTrue:[ |
|
1761 |
( (label := el indicatorForm) notNil |
|
1762 |
or:[(label := el choiceForm) notNil] |
|
1763 |
) ifTrue:[ |
|
1764 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
1765 |
] ifFalse:[ |
|
1766 |
label := el displayLabel. |
|
1767 |
label class == LabelAndIcon ifTrue:[ |
|
1768 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
1769 |
]. |
|
1770 |
]. |
|
1771 |
]. |
|
1772 |
]. |
|
1773 |
]. |
|
1774 |
]. |
|
1775 |
w := 0. |
|
1776 |
||
1777 |
( (label := anItem indicatorForm) notNil |
|
1778 |
or:[(label := anItem choiceForm) notNil] |
|
1779 |
) ifTrue:[ |
|
1780 |
w := label width + 2. |
|
1781 |
]. |
|
1782 |
stringOffsetX == 0 ifTrue:[ |
|
1783 |
^ w |
|
1784 |
]. |
|
1785 |
w == 0 ifTrue:[ |
|
1786 |
label := anItem displayLabel. |
|
1787 |
||
1788 |
label class == LabelAndIcon ifTrue:[ |
|
1789 |
^ stringOffsetX - label xOfString |
|
1790 |
]. |
|
1791 |
]. |
|
1792 |
^ stringOffsetX. |
|
1793 |
! |
|
1794 |
||
616 | 1795 |
subMenuIndicationWidth |
2219 | 1796 |
^ self rightArrow width |
388 | 1797 |
! ! |
1798 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1799 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1800 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1801 |
iconIndicationDisabledOff |
2219 | 1802 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1803 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1804 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1805 |
iconIndicationDisabledOn |
2219 | 1806 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1807 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1808 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1809 |
iconIndicationOff |
2219 | 1810 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1811 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1812 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1813 |
iconIndicationOn |
2219 | 1814 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1815 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1816 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1817 |
iconRadioGroupDisabledOff |
2219 | 1818 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1819 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1820 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1821 |
iconRadioGroupDisabledOn |
2219 | 1822 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1823 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1824 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1825 |
iconRadioGroupOff |
2219 | 1826 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1827 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1828 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1829 |
iconRadioGroupOn |
2219 | 1830 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1831 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1832 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1833 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1834 |
|
1835 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1836 |
"evaluate the block for an item and return the result from the block. In case that |
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1837 |
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
|
1838 |
|
388 | 1839 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1840 |
! |
|
1841 |
||
1842 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1843 |
"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
|
1844 |
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
|
1845 |
|
388 | 1846 |
|item| |
1847 |
||
1848 |
item := self itemAt:stringOrNumber. |
|
1849 |
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
|
1850 |
^ exceptionBlock value |
706 | 1851 |
! |
1852 |
||
1853 |
itemAtIndex:anIndex |
|
2715 | 1854 |
"returns item at an index or nil" |
1855 |
||
706 | 1856 |
^ 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
|
1857 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1858 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1859 |
items |
2715 | 1860 |
"returns list of items or nil" |
1861 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1862 |
^ items |
388 | 1863 |
! ! |
1864 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1865 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1866 |
|
727 | 1867 |
buttonActiveLevel |
2715 | 1868 |
"get the buttons active level" |
1869 |
||
2219 | 1870 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1871 |
! |
1872 |
||
1873 |
buttonPassiveLevel |
|
2715 | 1874 |
"get the buttons passive level" |
1875 |
||
2219 | 1876 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
727 | 1877 |
! |
1878 |
||
2337 | 1879 |
centerItems |
1880 |
^ centerItems ? false |
|
1881 |
! |
|
1882 |
||
1883 |
centerItems:aBoolean |
|
1884 |
centerItems := aBoolean |
|
1885 |
! |
|
1886 |
||
390 | 1887 |
fitFirstPanel |
1888 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1889 |
to the extent of its superView |
|
1699 | 1890 |
|
2715 | 1891 |
NOT SUPPORTED" |
1892 |
||
2219 | 1893 |
^ false |
388 | 1894 |
! |
1895 |
||
390 | 1896 |
fitFirstPanel:aState |
1897 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1898 |
to the extent of its superView |
|
1699 | 1899 |
|
2715 | 1900 |
NOT SUPPORTED" |
616 | 1901 |
! |
1902 |
||
1093 | 1903 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1904 |
anInt ~~ level ifTrue:[ |
3147 | 1905 |
super level:anInt. |
1906 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1907 |
] |
2052 | 1908 |
|
1909 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1910 |
! |
1911 |
||
616 | 1912 |
rightArrow |
2374 | 1913 |
rightArrow isNil ifTrue:[ |
1914 |
device isNil ifTrue:[ |
|
2219 | 1915 |
^ SelectionInListView rightArrowFormOn:Display |
1916 |
]. |
|
1917 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1918 |
]. |
|
616 | 1919 |
^ rightArrow |
1920 |
! |
|
1921 |
||
1922 |
rightArrowShadow |
|
1923 |
^ rightArrowShadow |
|
388 | 1924 |
! |
1925 |
||
390 | 1926 |
showGroupDivider |
2715 | 1927 |
"get the enabled flag for showing groupDiveders" |
1928 |
||
2253 | 1929 |
^ showGroupDivider |
388 | 1930 |
! |
1931 |
||
390 | 1932 |
showGroupDivider:aState |
2715 | 1933 |
"set the enabled flag for showing groupDiveders" |
1934 |
||
2253 | 1935 |
showGroupDivider ~~ aState ifTrue:[ |
1936 |
showGroupDivider := aState. |
|
1937 |
self mustRearrange. |
|
653 | 1938 |
] |
388 | 1939 |
! |
1940 |
||
1941 |
showSeparatingLines |
|
2715 | 1942 |
"gets true if drawing of separating lines is enabled." |
1943 |
||
2253 | 1944 |
^ showSeparatingLines |
388 | 1945 |
! |
1946 |
||
390 | 1947 |
showSeparatingLines:aState |
2715 | 1948 |
"turn on/off drawing of separating lines." |
1949 |
||
2253 | 1950 |
aState ~~ showSeparatingLines ifTrue:[ |
1951 |
showSeparatingLines := aState. |
|
1952 |
self mustRearrange |
|
1953 |
]. |
|
388 | 1954 |
! |
1955 |
||
1956 |
verticalLayout |
|
2715 | 1957 |
"get the layout: vertical( true ) or horizontal( false )" |
1958 |
||
2374 | 1959 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 1960 |
|
1961 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1962 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
2374 | 1963 |
^ verticalLayout |
388 | 1964 |
! |
1965 |
||
1966 |
verticalLayout:aState |
|
2715 | 1967 |
"set the layout: vertical( true ) or horizontal( false )" |
1968 |
||
2253 | 1969 |
aState ~~ verticalLayout ifTrue:[ |
1970 |
verticalLayout isNil ifTrue:[ |
|
1971 |
verticalLayout := aState |
|
1972 |
] ifFalse:[ |
|
1973 |
verticalLayout := aState. |
|
1974 |
self mustRearrange. |
|
1975 |
]. |
|
1976 |
]. |
|
388 | 1977 |
! ! |
1978 |
||
2219 | 1979 |
!MenuPanel methodsFor:'accessing-style'! |
1980 |
||
1981 |
buttonInsetX |
|
2715 | 1982 |
"returns the verical button space" |
1983 |
||
2883 | 1984 |
^ buttonInsetX |
2219 | 1985 |
! |
1986 |
||
1987 |
buttonInsetY |
|
2715 | 1988 |
"returns the verical button space" |
1989 |
||
2883 | 1990 |
^ buttonInsetY |
2219 | 1991 |
! |
1992 |
||
1993 |
enteredLevel |
|
2715 | 1994 |
"returns the enter-level for an unselected item moved through" |
1995 |
||
2219 | 1996 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
1997 |
! |
|
1998 |
||
1999 |
groupDividerSize |
|
2715 | 2000 |
"returns the width of a group divider" |
2001 |
||
2219 | 2002 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
2003 |
! |
|
2004 |
||
2005 |
itemMargin |
|
2715 | 2006 |
"returns the margin of an item" |
2007 |
||
2219 | 2008 |
^ styleSheet at:#'menu.itemMargin' default:0 |
2009 |
! |
|
2010 |
||
2011 |
itemSpace |
|
2715 | 2012 |
"returns the additional space for an item in a (vertical) panel" |
2013 |
||
2883 | 2014 |
^ itemSpace |
2219 | 2015 |
! |
2016 |
||
2017 |
selectionFollowsMouse |
|
2715 | 2018 |
"returns true if the selection follows the mouse" |
2019 |
||
2219 | 2020 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
2021 |
! |
|
2022 |
||
2023 |
shortcutKeyOffset |
|
2715 | 2024 |
"returns the offset for a shortcutKey" |
2025 |
||
2219 | 2026 |
^ 5 |
2027 |
! ! |
|
2028 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2029 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 2030 |
|
2031 |
subMenuAt:stringOrNumber |
|
3192 | 2032 |
"gets the current submenu of an item; if the submenu is nil, the |
2033 |
submenu is generated if specified otherwise nil is returned." |
|
2034 |
||
2035 |
|submenu| |
|
2036 |
||
2037 |
||
2038 |
self itemAt:stringOrNumber do:[:anItem| |
|
2039 |
submenu := anItem currentSubmenu. |
|
2040 |
submenu isNil ifTrue:[ |
|
2041 |
submenu := anItem setupSubmenu |
|
2042 |
]. |
|
2043 |
]. |
|
2044 |
^ submenu |
|
388 | 2045 |
! |
2046 |
||
2047 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2048 |
"sets the submenu of an item" |
2049 |
||
388 | 2050 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2051 |
! |
|
2052 |
||
2053 |
subMenuShown |
|
2715 | 2054 |
"return the currently visible submenu - or nil if there is none" |
2055 |
||
3192 | 2056 |
|item submenu| |
2057 |
||
2058 |
item := self selection. |
|
2059 |
||
2060 |
item notNil ifTrue:[ |
|
2061 |
submenu := item currentSubmenu. |
|
2062 |
||
2063 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2064 |
^ submenu |
|
2065 |
]. |
|
2715 | 2066 |
]. |
2067 |
^ nil |
|
388 | 2068 |
! ! |
2069 |
||
2504 | 2070 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2071 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2072 |
closeMenus |
2715 | 2073 |
"close all menus without accepting" |
2074 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2075 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2076 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2077 |
|
388 | 2078 |
hide |
2715 | 2079 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2080 |
|
2407 | 2081 |
"/ TODO: replace with LeaveSignal raise. |
2082 |
||
388 | 2083 |
self selection:nil. |
2084 |
self unmap. |
|
2085 |
! |
|
2086 |
||
2087 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2088 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2089 |
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
|
2090 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2091 |
to some performer)" |
2092 |
||
2093 |
^ self showAt:(self origin) resizing:true |
|
388 | 2094 |
! |
2095 |
||
2096 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2097 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2098 |
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
|
2099 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2100 |
to some performer)" |
2101 |
||
388 | 2102 |
^ self showAt:aPoint resizing:true |
2103 |
! |
|
2104 |
||
2105 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2106 |
"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
|
2107 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2108 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2109 |
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
|
2110 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2111 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2112 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2113 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2114 |
|
2115 |
aBoolean ifTrue:[ |
|
2715 | 2116 |
self fixSize. |
388 | 2117 |
]. |
2118 |
self origin:aPoint. |
|
1459 | 2119 |
"/ self makeFullyVisible. -- done in realize |
388 | 2120 |
self openModal:[true]. "realize " |
2121 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2122 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2123 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2124 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2125 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2715 | 2126 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2127 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2128 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2129 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2130 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2131 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 2132 |
! |
2133 |
||
2134 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2135 |
"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
|
2136 |
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
|
2137 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2138 |
to some performer)" |
2139 |
||
388 | 2140 |
^ self showAt:(device pointerPosition) resizing:true |
2141 |
! |
|
2142 |
||
2143 |
showCenteredIn:aView |
|
2144 |
"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
|
2145 |
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
|
2146 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2147 |
to some performer)" |
2148 |
||
388 | 2149 |
|top| |
2150 |
||
2151 |
top := aView topView. |
|
2152 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2153 |
^ 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
|
2154 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2155 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2156 |
! |
2157 |
||
2158 |
startUp |
|
2159 |
"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
|
2160 |
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
|
2161 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2162 |
to some performer)" |
2163 |
||
388 | 2164 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2165 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2166 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2167 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2168 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2169 |
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
|
2170 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2171 |
to some performer)" |
2172 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2173 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2174 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2175 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2176 |
! |
2177 |
||
2332 | 2178 |
startUpFor:originatingWidget |
2179 |
"realize the menu at the current pointer position |
|
2180 |
return the value of the selectedItem or nil, of none was selected |
|
2181 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2182 |
to some performer)" |
2183 |
||
2332 | 2184 |
originator := originatingWidget. |
2185 |
^ self startUp |
|
2186 |
! |
|
2187 |
||
1750 | 2188 |
startUpOrNil |
2189 |
"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
|
2190 |
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
|
2191 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2192 |
to some performer)" |
2193 |
||
1750 | 2194 |
^ self showAtPointer |
388 | 2195 |
! ! |
2196 |
||
2197 |
!MenuPanel methodsFor:'adding & removing'! |
|
2198 |
||
2199 |
createAtIndex:anIndexOrNil |
|
1800 | 2200 |
"create an item and add this item to the index. In case of nil, the item |
2201 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2202 |
otherwise the new created item is returned." |
2203 |
||
388 | 2204 |
|max item| |
2205 |
||
2206 |
max := (items size) + 1. |
|
2207 |
||
2208 |
anIndexOrNil notNil ifTrue:[ |
|
2715 | 2209 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2210 |
^ nil |
|
2211 |
] |
|
388 | 2212 |
]. |
2213 |
items isNil ifTrue:[ |
|
2715 | 2214 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2215 |
] ifFalse:[ |
2715 | 2216 |
items := items asOrderedCollection |
388 | 2217 |
]. |
2218 |
item := Item in:self. |
|
2219 |
||
2220 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2715 | 2221 |
items add:item |
388 | 2222 |
] ifFalse:[ |
2715 | 2223 |
items add:item beforeIndex:anIndexOrNil |
388 | 2224 |
]. |
2225 |
^ item |
|
2226 |
! |
|
2227 |
||
2228 |
remove:stringOrNumber |
|
2229 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2230 |
if found, remove and return it" |
2231 |
||
388 | 2232 |
|item| |
2233 |
||
2234 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2715 | 2235 |
items remove:item. |
2236 |
item destroy. |
|
2237 |
items isEmpty ifTrue:[items := nil]. |
|
2238 |
self mustRearrange. |
|
388 | 2239 |
]. |
2240 |
^ item |
|
2241 |
! |
|
2242 |
||
2243 |
removeAll |
|
2715 | 2244 |
"remove all items and submenus" |
2245 |
||
388 | 2246 |
self disabledRedrawDo:[ |
2715 | 2247 |
self selection:nil. |
2248 |
groupSizes := nil. |
|
2249 |
items notNil ifTrue:[ |
|
2250 |
items copy do:[:el| el destroy ]. |
|
2251 |
]. |
|
2252 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2253 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2254 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2255 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2256 |
! ! |
2257 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2258 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2259 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2260 |
update:something with:aParameter from:changedObject |
498 | 2261 |
|
2262 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2263 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2264 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2265 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2266 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2267 |
|
388 | 2268 |
!MenuPanel methodsFor:'converting'! |
2269 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2270 |
asMenu |
3222 | 2271 |
"convert contents to a menu" |
2715 | 2272 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2273 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2274 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2275 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2276 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2277 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2278 |
^ menu |
3222 | 2279 |
|
2280 |
"Modified: / 27-03-2007 / 08:39:48 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2281 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2282 |
|
388 | 2283 |
fromSpec:aMenuSpec |
2715 | 2284 |
"build from spec" |
2285 |
||
3222 | 2286 |
self menu:(Menu decodeFromLiteralArray:aMenuSpec) |
2287 |
||
2288 |
"Modified: / 27-03-2007 / 08:42:43 / cg" |
|
388 | 2289 |
! |
2290 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2291 |
menu:aMenu |
2715 | 2292 |
"convert to Menu" |
2293 |
||
388 | 2294 |
self disabledRedrawDo:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2295 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2296 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2297 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2298 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2299 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2300 |
(aMenu isCollection) ifTrue:[ |
3222 | 2301 |
menu := Menu decodeFromLiteralArray:aMenu. |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2302 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2303 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2304 |
menuReceiver notNil ifTrue:[ |
2793 | 2305 |
self receiver:menuReceiver. |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2306 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2307 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2308 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2309 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2310 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2311 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2312 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2313 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2314 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2315 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2316 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2317 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2318 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2319 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2320 |
|
3222 | 2321 |
"Modified: / 27-03-2007 / 08:42:28 / cg" |
388 | 2322 |
! ! |
2323 |
||
2681 | 2324 |
!MenuPanel methodsFor:'dependents access'! |
2325 |
||
2326 |
addDependencies |
|
2715 | 2327 |
"add all dependencies" |
2328 |
||
2681 | 2329 |
self do:[:anItem| anItem addDependencies ]. |
2330 |
||
2331 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2332 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2333 |
! |
|
2334 |
||
2335 |
removeDependencies |
|
2715 | 2336 |
"remove all dependencies" |
2337 |
||
2681 | 2338 |
self do:[:anItem| anItem removeDependencies ]. |
2339 |
||
2340 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2341 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2342 |
! ! |
|
2343 |
||
388 | 2344 |
!MenuPanel methodsFor:'drawing'! |
2345 |
||
2346 |
disabledRedrawDo:aBlock |
|
2347 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2348 |
of the block a redraw might be performed" |
2349 |
||
388 | 2350 |
|state| |
2351 |
||
2352 |
state := mustRearrange. |
|
2353 |
mustRearrange := true. |
|
2354 |
aBlock value. |
|
2355 |
mustRearrange := state. |
|
2356 |
self mustRearrange |
|
2357 |
! |
|
2358 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2359 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2360 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2361 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2362 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2363 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2364 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2365 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2366 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2367 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2368 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2369 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2370 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2371 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2372 |
level:aLevel |
2219 | 2373 |
shadow:(self buttonShadowColor) |
2374 |
light:(self buttonLightColor) |
|
2375 |
halfShadow:(self buttonHalfShadowColor) |
|
2376 |
halfLight:(self buttonHalfLightColor) |
|
2377 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2378 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2379 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2380 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2381 |
|
3187 | 2382 |
drawFocusForItem:anItem |
2383 |
|lytItem| |
|
2384 |
||
2385 |
lytItem := anItem layout. |
|
2386 |
self paint:(Color black). |
|
2387 |
||
2388 |
self displayDottedRectangleX:(lytItem left) |
|
2389 |
y:(lytItem top) |
|
2390 |
width:(lytItem width) |
|
2391 |
height:(lytItem height). |
|
2392 |
! |
|
2393 |
||
2016 | 2394 |
drawItemsX:x y:y width:w height:h |
2715 | 2395 |
"redraw items and groups in a damage" |
2396 |
||
2016 | 2397 |
|isVertical item layout prevClip |
2398 |
x1 "{ Class:SmallInteger }" |
|
2399 |
x2 "{ Class:SmallInteger }" |
|
2400 |
y1 "{ Class:SmallInteger }" |
|
2401 |
y2 "{ Class:SmallInteger }" |
|
2402 |
start "{ Class:SmallInteger }" |
|
2403 |
stop "{ Class:SmallInteger }" |
|
2404 |
size "{ Class:SmallInteger }" |
|
2405 |
groupDivInset "{ Class:SmallInteger }" |
|
2406 |
| |
|
2407 |
||
2408 |
size := items size. |
|
2409 |
isVertical := self verticalLayout. |
|
2410 |
||
2411 |
isVertical ifTrue:[ |
|
2064 | 2412 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2413 |
start == 0 ifTrue:[ ^ self ]. |
2414 |
y1 := y + h. |
|
2064 | 2415 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2416 |
startingAt:(start + 1). |
|
2016 | 2417 |
] ifFalse:[ |
2064 | 2418 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2419 |
start == 0 ifTrue:[ ^ self ]. |
2420 |
x1 := x + w. |
|
2064 | 2421 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2422 |
startingAt:(start + 1). |
|
2016 | 2423 |
]. |
2424 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2425 |
||
2253 | 2426 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2427 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2428 |
|
2429 |
groupDivInset ~~ 0 ifTrue:[ |
|
2430 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2431 |
start := start - 1 |
|
2432 |
] |
|
2433 |
]. |
|
2434 |
] ifFalse:[ |
|
2435 |
groupDivInset := 0 |
|
2436 |
]. |
|
2437 |
||
2438 |
prevClip := clipRect. |
|
2439 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2440 |
||
2441 |
start to:stop do:[:i| |
|
2442 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2443 |
item draw. |
2016 | 2444 |
|
2445 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2446 |
layout := item layout. |
|
2447 |
||
2448 |
isVertical ifTrue:[ |
|
2449 |
x1 := layout left. |
|
2450 |
x2 := layout right. |
|
2451 |
y1 := layout bottom + groupDivInset. |
|
2452 |
y2 := y1. |
|
2453 |
] ifFalse:[ |
|
2454 |
y1 := layout top. |
|
2455 |
y2 := layout bottom. |
|
2456 |
x1 := layout right + groupDivInset. |
|
2457 |
x2 := x1. |
|
2458 |
]. |
|
2459 |
self paint:shadowColor. |
|
2460 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2461 |
self paint:lightColor. |
|
2462 |
||
2463 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2464 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2465 |
||
2466 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
3187 | 2467 |
]. |
2468 |
selection == item ifTrue:[ |
|
2469 |
self focusComesByTab ifTrue:[ |
|
2470 |
self drawFocusForItem:item. |
|
2471 |
]. |
|
2472 |
]. |
|
2016 | 2473 |
]. |
2474 |
self clippingRectangle:prevClip. |
|
2475 |
! |
|
2476 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2477 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2478 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2479 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2480 |
isSelected ifTrue:[ |
2219 | 2481 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2482 |
] ifFalse:[ |
2219 | 2483 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2484 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2485 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2486 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2487 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2488 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2489 |
|
1691 | 2490 |
self drawEdgesForX:(layout left) |
2491 |
y:(layout top) |
|
2492 |
width:(layout width) |
|
2493 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2494 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2495 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2496 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2497 |
|
2016 | 2498 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2499 |
"draw a scroller" |
2500 |
||
2016 | 2501 |
|scrolling icon level x y w h| |
2502 |
||
2503 |
x := bounds left. |
|
2504 |
y := bounds top. |
|
2505 |
w := bounds width. |
|
2506 |
h := bounds height. |
|
2507 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2508 |
scrolling := self scrollActivity. |
2016 | 2509 |
|
2510 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2715 | 2511 |
level := -2 |
2016 | 2512 |
] ifFalse:[ |
2715 | 2513 |
level := 1 |
2016 | 2514 |
]. |
2515 |
||
2516 |
level ~~ 0 ifTrue:[ |
|
2715 | 2517 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2518 |
]. |
2519 |
icon := scrolling iconAt:aDirection on:self. |
|
2520 |
||
2521 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2715 | 2522 |
y:(y + (h - icon height // 2)). |
2016 | 2523 |
! |
2524 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2525 |
invalidateItem:anItem repairNow:aBool |
2715 | 2526 |
"an item changed; invalidate the items layout" |
2527 |
||
2016 | 2528 |
|layout| |
2529 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2530 |
(mustRearrange not and:[shown]) ifTrue:[ |
2715 | 2531 |
layout := anItem layout. |
2532 |
||
2533 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2534 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2535 |
] |
|
1728 | 2536 |
]. |
2537 |
||
2538 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2539 |
! |
2540 |
||
388 | 2541 |
mustRearrange |
2715 | 2542 |
"force rearrange (i.e. set the rearrange flag)" |
2543 |
||
2080 | 2544 |
mustRearrange ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2545 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2546 |
self invalidate "/ RepairNow:true |
388 | 2547 |
] |
590 | 2548 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2549 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2550 |
! |
2551 |
||
710 | 2552 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2553 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2554 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2555 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2556 |
|
1699 | 2557 |
|layout point |
710 | 2558 |
dltX "{ Class:SmallInteger }" |
2559 |
start "{ Class:SmallInteger }" |
|
2560 |
| |
|
2561 |
||
2562 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2715 | 2563 |
^ self |
710 | 2564 |
]. |
2565 |
||
2566 |
layout := items last layout. |
|
3246 | 2567 |
layout notNil ifTrue:[ |
2568 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
|
2569 |
^ self "/ no free space |
|
2570 |
]. |
|
710 | 2571 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2572 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2573 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2574 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2575 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2576 |
"/ 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
|
2577 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2578 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
2579 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2580 |
] ifFalse:[ |
|
2581 |
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
|
2582 |
]. |
710 | 2583 |
start == 0 ifTrue:[ |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2584 |
^ self "/ no right-group item detected |
1699 | 2585 |
]. |
2586 |
point := dltX @ 0. |
|
2587 |
||
2588 |
"/ move items layout to right |
|
710 | 2589 |
items from:start do:[:anItem| |
2715 | 2590 |
anItem isVisible ifTrue:[ |
2591 |
anItem layout moveBy:point. |
|
2592 |
] |
|
710 | 2593 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2594 |
|
3246 | 2595 |
"Modified: / 10-10-2007 / 00:29:34 / cg" |
710 | 2596 |
! |
2597 |
||
388 | 2598 |
rearrangeItems |
1699 | 2599 |
"recompute the layout of each item |
2715 | 2600 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2601 |
||
1791 | 2602 |
|isVertical extent isPopUpMenu |
2219 | 2603 |
x "{ Class:SmallInteger }" |
2604 |
y "{ Class:SmallInteger }" |
|
2605 |
x0 "{ Class:SmallInteger }" |
|
2606 |
y0 "{ Class:SmallInteger }" |
|
2607 |
x1 "{ Class:SmallInteger }" |
|
2608 |
y1 "{ Class:SmallInteger }" |
|
2609 |
size "{ Class:SmallInteger }" |
|
2610 |
insetX "{ Class:SmallInteger }" |
|
2611 |
insetY "{ Class:SmallInteger }" |
|
2612 |
labelInsetX "{ Class:SmallInteger }" |
|
2613 |
labelInsetY "{ Class:SmallInteger }" |
|
2614 |
itemMargin "{ Class:SmallInteger }" |
|
2615 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2616 |
| |
1699 | 2617 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2618 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2619 |
^ self |
390 | 2620 |
]. |
2219 | 2621 |
|
2080 | 2622 |
"/ DON'T SET THIS!! |
2623 |
"/ item layout: below of first item -> item invalidate |
|
2624 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2625 |
"/ -> invalidate:rapairDamage: |
|
2626 |
"/ -> redrawX:y:width:height: |
|
2627 |
"/ tries to get uninitialized layout from second item. |
|
2628 |
"/ This happens in a modal debugger!! |
|
2629 |
"/ mustRearrange := false. |
|
2219 | 2630 |
isVertical := self verticalLayout. |
2631 |
groupDividerSize := self groupDividerSize. |
|
2632 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2633 |
|
2634 |
isPopUpMenu ifFalse:[ |
|
2219 | 2635 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2636 |
] ifTrue:[ |
2145 | 2637 |
labelInsetX := labelInsetY := 0 |
388 | 2638 |
]. |
390 | 2639 |
|
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2640 |
(isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ |
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2641 |
|saveExtent maxExtent extentToSet| |
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2642 |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2643 |
extent := self preferredExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2644 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2645 |
isPopUpMenu ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2646 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2647 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2648 |
extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2649 |
ifFalse:[(extent x min:(maxExtent x)) @ extent y]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2650 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2651 |
] ifFalse:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2652 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
1478 | 2653 |
]. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2654 |
self extent:extentToSet. |
390 | 2655 |
] ifFalse:[ |
1699 | 2656 |
extent := self computeExtent |
390 | 2657 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2658 |
|
1093 | 2659 |
x := y := margin. |
2660 |
||
1699 | 2661 |
isVertical ifFalse:[ |
2662 |
y0 := margin. |
|
2663 |
y1 := extent y - margin. |
|
2664 |
||
2665 |
items keysAndValuesDo:[:anIndex :el| |
|
2666 |
el isVisible ifFalse:[ |
|
2667 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2668 |
] ifTrue:[ |
|
1478 | 2669 |
el isButton ifTrue:[ |
2145 | 2670 |
insetX := buttonInsetX. |
2671 |
insetY := buttonInsetY. |
|
2062 | 2672 |
] ifFalse:[ |
2145 | 2673 |
insetX := labelInsetX. |
2674 |
insetY := labelInsetY. |
|
1478 | 2675 |
]. |
2145 | 2676 |
x0 := x + insetX. |
2171 | 2677 |
x1 := x0 + (el preferredExtent x). |
2145 | 2678 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2679 |
x := x1 + insetX. |
|
1699 | 2680 |
|
2681 |
size ~~ anIndex ifTrue:[ |
|
2682 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2683 |
x := x + groupDividerSize |
|
2684 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2685 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2686 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2687 |
] |
1699 | 2688 |
] |
2689 |
] |
|
1478 | 2690 |
]. |
1699 | 2691 |
]. |
2692 |
] ifTrue:[ |
|
2219 | 2693 |
itemMargin := self itemMargin. |
1699 | 2694 |
x0 := margin. |
2219 | 2695 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2696 |
|
2697 |
items keysAndValuesDo:[:anIndex :el| |
|
2698 |
el isVisible ifFalse:[ |
|
2699 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2700 |
] ifTrue:[ |
|
2701 |
el isButton ifTrue:[ |
|
2145 | 2702 |
insetX := buttonInsetX. |
2703 |
insetY := buttonInsetY. |
|
1699 | 2704 |
] ifFalse:[ |
2145 | 2705 |
insetX := labelInsetX. |
2706 |
insetY := labelInsetY. |
|
1699 | 2707 |
]. |
2145 | 2708 |
y0 := y + insetY. |
1699 | 2709 |
y1 := y0 + el preferredExtent y. |
2219 | 2710 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2711 |
y := y1 + insetY. |
1699 | 2712 |
|
2713 |
size ~~ anIndex ifTrue:[ |
|
2714 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2715 |
y := y + groupDividerSize |
|
2716 |
] |
|
2717 |
] |
|
1478 | 2718 |
] |
2719 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2720 |
]. |
710 | 2721 |
self rearrangeGroups. |
2048 | 2722 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2723 |
mustRearrange := false. |
2048 | 2724 |
|
2725 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2726 |
! |
2727 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2728 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2729 |
"check for items which can change its visibility; |
2715 | 2730 |
if at least one item exists, rearrange all items" |
2731 |
||
1464 | 2732 |
items isNil ifTrue:[^ self]. |
1699 | 2733 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2734 |
items do:[:item | |
2715 | 2735 |
item canChangeVisibility ifTrue:[ |
2736 |
mustRearrange := true. |
|
2737 |
self rearrangeItems. |
|
2738 |
^ self |
|
2739 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2740 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2741 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2742 |
|
388 | 2743 |
redrawX:x y:y width:w height:h |
2715 | 2744 |
"redraw a damage" |
2745 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2746 |
|y0 y1 x0 x1 prvBound mustDraw nxtBound| |
388 | 2747 |
|
710 | 2748 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2749 |
|
1699 | 2750 |
mustRearrange ifTrue:[ |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2751 |
self isPopUpView ifFalse:[ self explicitExtent:true]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2752 |
self rearrangeItems. |
2569 | 2753 |
self invalidate. |
2754 |
^ self |
|
1699 | 2755 |
]. |
2888 | 2756 |
"/ self paint:(self viewBackground). |
1699 | 2757 |
self clearRectangleX:x y:y width:w height:h. |
2758 |
||
2016 | 2759 |
items size == 0 ifTrue:[ |
1699 | 2760 |
^ self |
2761 |
]. |
|
2016 | 2762 |
y0 := y. |
2763 |
y1 := y + h. |
|
2018 | 2764 |
x0 := x. |
2765 |
x1 := x + w. |
|
2016 | 2766 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2767 |
"Draw the scroll handles - especially for Popup-Lists" |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2768 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2769 |
self hasScrollers ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2770 |
(self hasScrollerAt:#PREV) ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2771 |
prvBound := self scrollerBoundsAt:#PREV. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2772 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2773 |
self verticalLayout ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2774 |
(mustDraw := (prvBound bottom > y)) ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2775 |
y0 := prvBound bottom. |
2018 | 2776 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2777 |
] ifFalse:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2778 |
(mustDraw := (prvBound right > x)) ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2779 |
x0 := prvBound right. |
2018 | 2780 |
]. |
2052 | 2781 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2782 |
mustDraw ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2783 |
self drawScrollerAt:#PREV bounds:prvBound. |
2052 | 2784 |
]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2785 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2786 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2787 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2788 |
nxtBound := self scrollerBoundsAt:#NEXT. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2789 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2790 |
self verticalLayout ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2791 |
(mustDraw := (nxtBound top < y1)) ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2792 |
y1 := nxtBound top. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2793 |
] |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2794 |
] ifFalse:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2795 |
(mustDraw := (nxtBound left < x1)) ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2796 |
x1 := nxtBound left. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2797 |
] |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2798 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2799 |
mustDraw ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2800 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2801 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2802 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2803 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2804 |
self menuAdornmentAt:#lastDrawnScrollerNextBounds put:nxtBound. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2805 |
|
2018 | 2806 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2807 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2808 |
]. |
2052 | 2809 |
|
2810 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2811 |
! ! |
2812 |
||
2813 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2814 |
||
2815 |
collect:aOneArgBlock |
|
2816 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 2817 |
and return a collection of the results" |
2818 |
||
388 | 2819 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 2820 |
^ nil |
388 | 2821 |
! |
2822 |
||
2823 |
do:aOneArgBlock |
|
2715 | 2824 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
2825 |
||
388 | 2826 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
2827 |
! |
|
2828 |
||
2829 |
findFirst:aOneArgBlock |
|
3206 | 2830 |
"find the index of the first item, for which evaluation of the argument, aOneArgBlock |
2715 | 2831 |
returns true; return its index or 0 if none detected." |
2832 |
||
388 | 2833 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 2834 |
^ 0 |
388 | 2835 |
! |
2836 |
||
2837 |
findLast:aOneArgBlock |
|
2838 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2839 |
returns true; return its index or 0 if none detected." |
2840 |
||
388 | 2841 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 2842 |
^ 0 |
388 | 2843 |
! |
2844 |
||
3187 | 2845 |
firstItemSelectable |
2846 |
"returns the first item which is selectable or nil |
|
2847 |
" |
|
2848 |
items size > 0 ifTrue:[ |
|
2849 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
|
2850 |
]. |
|
2851 |
^ nil |
|
2852 |
! |
|
2853 |
||
390 | 2854 |
indexOf:something |
2855 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 2856 |
If no item match 0 is returned. No range checks are performed on a number argument" |
2857 |
||
390 | 2858 |
|i v| |
2859 |
||
2860 |
something isNumber ifTrue:[ ^ something ]. |
|
2861 |
something isNil ifTrue:[ ^ 0 ]. |
|
2862 |
||
1218 | 2863 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2864 |
|
2865 |
i ~~ 0 ifTrue:[ |
|
2715 | 2866 |
^ i |
388 | 2867 |
]. |
390 | 2868 |
|
2869 |
something isSymbol ifTrue:[ |
|
2715 | 2870 |
i := self findFirst:[:el| |
2871 |
v := el value. |
|
2872 |
v isSymbol and:[v == something] |
|
2873 |
]. |
|
2874 |
i ~~ 0 ifTrue:[ |
|
2875 |
^ i |
|
2876 |
] |
|
390 | 2877 |
]. |
2878 |
||
2879 |
(something respondsTo:#string) ifTrue:[ |
|
2715 | 2880 |
v := something string. |
1218 | 2881 |
^ self findFirst:[:el | el textLabel = v]. |
2882 |
]. |
|
2883 |
^ 0 |
|
388 | 2884 |
! |
2885 |
||
706 | 2886 |
indexOfItem:anItem |
2715 | 2887 |
"returns the index of the item or 0" |
2888 |
||
706 | 2889 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
2890 |
! |
|
2891 |
||
388 | 2892 |
keysAndValuesDo:aTwoArgBlock |
2715 | 2893 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
2894 |
||
388 | 2895 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
2896 |
! ! |
|
2897 |
||
2898 |
!MenuPanel methodsFor:'event handling'! |
|
2899 |
||
2900 |
buttonMotion:state x:x y:y |
|
2715 | 2901 |
"open or close the corresponding submenu" |
2902 |
||
2046 | 2903 |
|menue motionPoint translatedPoint sensor| |
1699 | 2904 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2905 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2906 |
^ self |
2016 | 2907 |
]. |
2908 |
||
1699 | 2909 |
sensor := self sensor. |
2910 |
||
2911 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2912 |
^ self |
1699 | 2913 |
]. |
2914 |
menue := self detectGrabMenu. |
|
1841 | 2915 |
|
2046 | 2916 |
motionPoint := x@y. |
2917 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2918 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2919 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2920 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2921 |
|
1699 | 2922 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2923 |
^ self |
1699 | 2924 |
]. |
2925 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2926 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
3321 | 2927 |
"/ selection on grabView without a submenu (Button ...); check whether moving out |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2928 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2929 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2930 |
] |
1699 | 2931 |
]. |
2932 |
||
2048 | 2933 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2934 |
! |
2935 |
||
2936 |
buttonPress:button x:x y:y |
|
2715 | 2937 |
"any button pressed; open or close the corresponding submenus" |
2938 |
||
2016 | 2939 |
|menu point| |
2940 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2941 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2942 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2943 |
self scrollActivity stop. |
2016 | 2944 |
point := x@y. |
2945 |
menu := self detectMenuAtGrabPoint:point. |
|
2946 |
||
2947 |
menu isNil ifTrue:[ |
|
3203 | 2948 |
self accept:nil |
2016 | 2949 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2950 |
point := menu translateGrabPoint:point. |
3383 | 2951 |
menu handleButtonPress:button atPoint:point. |
2016 | 2952 |
] |
2046 | 2953 |
|
2954 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2955 |
! |
2956 |
||
2957 |
buttonRelease:button x:x y:y |
|
2715 | 2958 |
"button release action; accept selection and close all views" |
2959 |
||
2679 | 2960 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
3203 | 2961 |
releaseTime menuMapTime| |
2199 | 2962 |
|
2963 |
topMenu := self topMenu. |
|
2964 |
topMenu openDelayed:nil. |
|
1699 | 2965 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2966 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2967 |
^ self |
2016 | 2968 |
]. |
2969 |
||
1699 | 2970 |
dstMenu := topMenu activeMenu. |
2971 |
||
2679 | 2972 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
2973 |
||
2974 |
hideMenuAndPerformAction ifFalse:[ |
|
2975 |
hideOnRelease ifTrue:[ |
|
3203 | 2976 |
releaseTime := windowGroup lastEvent timeStamp. |
2977 |
menuMapTime := dstMenu mapTime ? releaseTime. |
|
2978 |
||
2979 |
hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime) |
|
2679 | 2980 |
> (PopUpMenu maxClickTimeToStayOpen). |
2981 |
]. |
|
2982 |
]. |
|
2983 |
||
2984 |
hideMenuAndPerformAction ifTrue:[ |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2985 |
srcPoint := x@y. |
1699 | 2986 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2987 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2988 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2989 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2990 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2991 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2992 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2993 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2994 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2995 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2996 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2997 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2998 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2999 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3000 |
|
2374 | 3001 |
subm notNil ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3002 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3003 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3004 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3005 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3006 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3007 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3008 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3009 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3010 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3011 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3012 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3013 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3014 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3015 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3016 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3017 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3018 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3019 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3020 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3021 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3022 |
self accept:nil. |
1699 | 3023 |
]. |
3024 |
! |
|
3025 |
||
2860 | 3026 |
handleSizeChanged:how |
3027 |
"used to handle the scrollers and groups in a none popUpView |
|
3028 |
" |
|
3029 |
|layouts damage isVertical scrollBound| |
|
3030 |
||
3031 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
3032 |
^ self |
|
3033 |
]. |
|
3034 |
mustRearrange := true. |
|
3035 |
||
3036 |
shown ifFalse:[ |
|
3037 |
^ self |
|
3038 |
]. |
|
3039 |
layouts := OrderedCollection new. |
|
3040 |
||
3041 |
items do:[:el| |layout| |
|
3042 |
(layout := el layout) isNil ifTrue:[ |
|
3043 |
self invalidate. |
|
3044 |
^ self. |
|
3045 |
]. |
|
3046 |
layouts add:layout. |
|
3047 |
]. |
|
3048 |
isVertical := self verticalLayout. |
|
3049 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3050 |
||
3051 |
self rearrangeItems. |
|
3052 |
||
3053 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
3054 |
damage isNil ifTrue:[ |
|
3055 |
newLyt := el layout. |
|
3056 |
oldLyt := layouts at:i ifAbsent:newLyt. |
|
3057 |
||
3058 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
|
3059 |
start := 0. |
|
3060 |
||
3061 |
i > 1 ifTrue:[ |
|
3062 |
isVertical ifTrue:[ |
|
3063 |
x := 0. |
|
3064 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
|
3065 |
] ifFalse:[ |
|
3066 |
y := 0. |
|
3067 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
|
3068 |
]. |
|
3069 |
]. |
|
3070 |
start <= 20 ifTrue:[ |
|
3071 |
self invalidate. |
|
3072 |
^ self |
|
3073 |
]. |
|
3074 |
damage := Rectangle left:x top:y extent:(self extent). |
|
3075 |
]. |
|
3076 |
]. |
|
3077 |
]. |
|
3078 |
damage isNil ifTrue:[ |
|
3079 |
damage := scrollBound. |
|
3080 |
]. |
|
3081 |
scrollBound := self menuAdornmentAt:#lastDrawnScrollerNextBounds. |
|
3082 |
||
3083 |
scrollBound notNil ifTrue:[ |
|
3084 |
damage := damage merge:scrollBound |
|
3085 |
]. |
|
3086 |
self invalidate:damage. |
|
3087 |
! |
|
3088 |
||
1699 | 3089 |
keyPress:key x:x y:y |
2715 | 3090 |
"any key is pressed" |
3091 |
||
2869 | 3092 |
<resource: #keyboard (#Escape |
3093 |
#Tab #FocusNext #FocusPrevious |
|
3094 |
#CursorLeft #CursorRight )> |
|
3095 |
||
3096 |
|menu menusSuperMenu sensor| |
|
2251 | 3097 |
|
3098 |
sensor := self sensor. |
|
3158 | 3099 |
|
3100 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3101 |
"/ ^ self "/ ignored while any button is pressed |
|
3102 |
"/ ]. |
|
1699 | 3103 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3104 |
self scrollActivity isActive ifTrue:[ |
2016 | 3105 |
key ~~ #Escape ifTrue:[ |
3106 |
^ self |
|
3107 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3108 |
self scrollActivity stop |
2016 | 3109 |
]. |
3110 |
||
1699 | 3111 |
(key == #Tab |
3112 |
or:[key == #FocusNext |
|
3113 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
3114 |
self accept:nil. |
|
2374 | 3115 |
^ super keyPress:key x:x y:y |
1699 | 3116 |
]. |
3117 |
||
3118 |
menu := self detectGrabMenu. |
|
2869 | 3119 |
menusSuperMenu := menu superMenu. |
1699 | 3120 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
3121 |
(key == #Escape) ifTrue:[ |
1699 | 3122 |
"/ must hide the active menu |
2869 | 3123 |
(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[ |
1703 | 3124 |
"/ hide active menu but keep the grab |
2869 | 3125 |
menusSuperMenu selection:nil |
1699 | 3126 |
] ifFalse:[ |
1703 | 3127 |
"/ hide active menu and ungrab |
1699 | 3128 |
self accept:nil |
2251 | 3129 |
]. |
3130 |
^ self |
|
3131 |
]. |
|
3132 |
||
3133 |
menu isViewWrapper ifFalse:[ |
|
3134 |
sensor compressKeyPressEventsWithKey:key. |
|
3135 |
menu handleKeyPress:key. |
|
2374 | 3136 |
^ self |
2251 | 3137 |
]. |
2869 | 3138 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3139 |
|
3140 |
"/ allow cursor movement |
|
3141 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3142 |
(self containsPoint:x@y) ifTrue:[ |
|
3143 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3144 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3145 |
]. |
1699 | 3146 |
! |
3147 |
||
3148 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3149 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3150 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3151 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3152 |
|
1699 | 3153 |
self detectGrabMenu handlePointerLeave:state. |
3154 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3155 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 3156 |
^ self |
3157 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3158 |
|
2374 | 3159 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3160 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3161 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3162 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3163 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3164 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3165 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3166 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3167 |
sensor isNil ifTrue:[ |
2251 | 3168 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3169 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3170 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3171 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3172 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3173 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3174 |
]. |
2251 | 3175 |
] |
1699 | 3176 |
]. |
3177 |
! |
|
3178 |
||
3179 |
sizeChanged:how |
|
2715 | 3180 |
"redraw #right groups" |
3181 |
||
2860 | 3182 |
"/ self isPopUpView ifFalse:[ |
3183 |
"/ mustRearrange := true. |
|
3184 |
"/ self invalidate |
|
3185 |
"/ ]. |
|
3186 |
"/ ^ super sizeChanged:how. |
|
3187 |
||
3188 |
self handleSizeChanged:how. |
|
3189 |
super sizeChanged:how. |
|
1699 | 3190 |
! ! |
3191 |
||
2503 | 3192 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3193 |
|
1767 | 3194 |
clearImplicitGrab |
2253 | 3195 |
implicitGrabView := lastPointerView := nil. |
1767 | 3196 |
! |
3197 |
||
3198 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3199 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3200 |
|
2253 | 3201 |
|view x y p syntheticEvent menu| |
1767 | 3202 |
|
2658 | 3203 |
ev isDamage ifTrue:[ |
3204 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3205 |
]. |
|
3206 |
||
3142 | 3207 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
3208 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
|
3209 |
]. |
|
3210 |
||
1767 | 3211 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3212 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3213 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3214 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3215 |
self sensor leftButtonPressed ifFalse:[ |
3216 |
self clearImplicitGrab. |
|
3217 |
]. |
|
1767 | 3218 |
]. |
3219 |
||
3220 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 3221 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3222 |
]. |
3223 |
||
3224 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3225 |
ev isButtonEvent ifTrue:[ |
3226 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3227 |
ev view:implicitGrabView. |
|
3228 |
ev arguments at:2 put:p x. |
|
3229 |
ev arguments at:3 put:p y. |
|
3230 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3231 |
||
3232 |
ev isButtonReleaseEvent ifTrue:[ |
|
3233 |
self clearImplicitGrab. |
|
3234 |
]. |
|
3235 |
^ self |
|
3236 |
] |
|
1767 | 3237 |
]. |
3238 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3239 |
||
2016 | 3240 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 3241 |
self clearImplicitGrab. |
1767 | 3242 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
3243 |
]. |
|
3244 |
||
3245 |
p := menu translateGrabPoint:(x@y). |
|
3246 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3247 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3248 |
|
3249 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 3250 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3251 |
view requestFocus. |
|
3252 |
]. |
|
3253 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3254 |
implicitGrabView := view. |
|
3255 |
] |
|
3256 |
]. |
|
1767 | 3257 |
|
3258 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 3259 |
lastPointerView ~~ view ifTrue:[ |
3260 |
"/ must generate enter/leave ... (sigh) |
|
3261 |
lastPointerView notNil ifTrue:[ |
|
3262 |
"/ XXX: should be fixed |
|
3263 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3264 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3265 |
]. |
|
3266 |
view notNil ifTrue:[ |
|
3267 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3268 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3269 |
]. |
|
3270 |
lastPointerView := view. |
|
3271 |
]. |
|
1767 | 3272 |
]. |
3273 |
||
3274 |
ev view:view. |
|
3275 |
ev x:p x. |
|
3276 |
ev y:p y. |
|
3277 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3278 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3279 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3280 |
! |
3281 |
||
2048 | 3282 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3283 |
"open or close the corresponding submenus" |
3284 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3285 |
|menu item translatedPoint containsPoint direction| |
2251 | 3286 |
|
3287 |
containsPoint := self containsPoint:motionPoint. |
|
3187 | 3288 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ]. |
2251 | 3289 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3290 |
"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
|
3291 |
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
|
3292 |
direction notNil ifTrue:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3293 |
self pointerEntersItem:nil. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3294 |
|
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3295 |
self sensor anyButtonPressed ifTrue:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3296 |
self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3297 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3298 |
^ self |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3299 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3300 |
|
2251 | 3301 |
self pointerEntersItem:item. |
1699 | 3302 |
|
1910 | 3303 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
3187 | 3304 |
( self selectionFollowsMouse |
3305 |
and:[self topMenu focusComesByTab not] |
|
3306 |
) ifTrue:[ |
|
3307 |
self isPopUpView ifTrue:[ |
|
3308 |
item isNil ifTrue:[ |
|
3309 |
superMenu notNil ifTrue:[ |
|
3310 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3311 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3312 |
] |
|
3313 |
] ifFalse:[ |
|
3314 |
self selection:item openMenu:false. |
|
3315 |
self openDelayed:item afterSeconds:0.1. |
|
3316 |
]. |
|
3317 |
] ifFalse:[ "/ processing in the toolbar |
|
3318 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
|
3319 |
self selection:item openMenu:true. |
|
3320 |
]. |
|
3321 |
]. |
|
3322 |
]. |
|
2048 | 3323 |
^ self |
3324 |
]. |
|
3325 |
||
2251 | 3326 |
containsPoint ifTrue:[ |
3327 |
self selection:item openMenu:true. |
|
2374 | 3328 |
^ self |
2251 | 3329 |
]. |
3330 |
||
3331 |
menu := self superMenuAtPoint:motionPoint. |
|
3332 |
||
2374 | 3333 |
menu notNil ifTrue:[ |
2046 | 3334 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3335 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3336 |
^ self |
2251 | 3337 |
]. |
3338 |
self isPopUpView ifTrue:[ |
|
3339 |
self selection:nil |
|
3340 |
]. |
|
2046 | 3341 |
! |
3342 |
||
3383 | 3343 |
handleButtonPress:button atPoint:aPoint |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3344 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3345 |
|
3233 | 3346 |
| item direction wasSelected| |
2016 | 3347 |
|
2046 | 3348 |
item := self itemAtPoint:aPoint. |
2374 | 3349 |
item isNil ifTrue:[ |
2251 | 3350 |
self selection:nil openMenu:false. |
2374 | 3351 |
^ self |
2251 | 3352 |
]. |
3353 |
||
3354 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3355 |
direction notNil ifTrue:[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3356 |
(self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:true) ifTrue:[ |
2251 | 3357 |
self pointerEntersItem:nil. |
3358 |
^ self |
|
2238 | 3359 |
] |
2016 | 3360 |
]. |
2251 | 3361 |
|
3383 | 3362 |
button == 2 ifTrue:[ |
3363 |
item hasDelayedMenu ifTrue:[ |
|
3364 |
self selection:item openMenu:false. |
|
3365 |
self openDelayed:item afterSeconds:0. |
|
3366 |
^ self. |
|
3367 |
]. |
|
3368 |
]. |
|
3369 |
||
2251 | 3370 |
wasSelected := (selection == item). |
3371 |
wasSelected ifFalse:[ |
|
3372 |
self selection:item openMenu:true |
|
3373 |
]. |
|
2199 | 3374 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3375 |
|
2238 | 3376 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3377 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3378 |
item toggleSubmenuVisibility |
|
3379 |
]. |
|
2238 | 3380 |
^ self |
3381 |
]. |
|
3382 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3383 |
^ self |
|
3384 |
]. |
|
3385 |
self invalidateItem:item repairNow:true. |
|
3386 |
self acceptItem:item inMenu:self. |
|
3387 |
||
3233 | 3388 |
[ (device notNil and:[device anyButtonPressed]) ] whileTrue:[ |
3389 |
"/ using device - sensor is not updated sometimes |
|
3390 |
Delay waitForSeconds:0.1. |
|
3391 |
]. |
|
3392 |
self sensor flushUserEvents. |
|
2238 | 3393 |
self selection:nil. |
2046 | 3394 |
|
3395 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3396 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3397 |
! |
3398 |
||
1699 | 3399 |
handleCursorKey:aKey |
2715 | 3400 |
"handle a cursor key" |
3401 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3402 |
|next menu item isVrt backKey p1 p2 |
2354 | 3403 |
idx0 "{ Class:SmallInteger }" |
687 | 3404 |
idx "{ Class:SmallInteger }" |
1705 | 3405 |
size "{ Class:SmallInteger }" |
687 | 3406 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3407 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3408 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3409 |
^ self |
388 | 3410 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3411 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3412 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3413 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3414 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3415 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3416 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3417 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3418 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3419 |
^ superMenu handleCursorKey:aKey |
1699 | 3420 |
]. |
2016 | 3421 |
idx := 0. |
3422 |
||
3423 |
isVrt ifTrue:[ |
|
3424 |
"/ used because of vertical scrolling |
|
3425 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3426 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3427 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3428 |
] ifFalse:[ |
2016 | 3429 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3430 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3431 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3432 |
|
2354 | 3433 |
idx0 := idx. |
3434 |
size timesRepeat:[ |
|
3435 |
|el| |
|
3436 |
||
3437 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3438 |
||
3439 |
idx > size ifTrue:[ |
|
3440 |
idx := 0 "1" |
|
3441 |
] ifFalse:[ |
|
3442 |
idx < 0 ifTrue:[ |
|
3443 |
idx := size |
|
3444 |
] |
|
3445 |
]. |
|
3446 |
||
3447 |
idx == 0 ifTrue:[ |
|
3448 |
self selection:nil. |
|
3449 |
^ self |
|
3450 |
] ifFalse:[ |
|
3451 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3452 |
el canSelect ifTrue:[ |
|
3453 |
el hasDelayedMenu ifTrue:[ |
|
3454 |
"/ do not open menu |
|
3455 |
self selection:el openMenu:false |
|
3456 |
] ifFalse:[ |
|
3457 |
"/ open comes from style-sheet |
|
3458 |
self selection:el. |
|
3459 |
]. |
|
3460 |
^ self |
|
2249 | 3461 |
]. |
2354 | 3462 |
] |
3463 |
]. |
|
3464 |
idx == idx0 ifTrue:[ |
|
3465 |
^ self |
|
3466 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3467 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3468 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3469 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3470 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3471 |
superMenu notNil ifTrue:[ |
1791 | 3472 |
p1 := self translateGrabPoint:0. |
3473 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3474 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3475 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3476 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3477 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3478 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3479 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3480 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3481 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3482 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3483 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3484 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3485 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3486 |
backKey := #CursorUp. |
1699 | 3487 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3488 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3489 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3490 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3491 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3492 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3493 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3494 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3495 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3496 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3497 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3498 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3499 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3500 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3501 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3502 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3503 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3504 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3505 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3506 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3507 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3508 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3509 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3510 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3511 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3512 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3513 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3514 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3515 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3516 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3517 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3518 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3519 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3520 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3521 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3522 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3523 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3524 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3525 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3526 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3527 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3528 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3529 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3530 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3531 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3532 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3533 |
handleKeyPress:key |
2715 | 3534 |
"any key is pressed" |
3535 |
||
2219 | 3536 |
|item inMenu| |
1699 | 3537 |
|
3538 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3539 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3540 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3541 |
key isCharacter ifTrue:[ |
1862 | 3542 |
"/ selection notNil ifTrue:[ |
3543 |
"/ inMenu := self |
|
3544 |
"/ ] ifFalse:[ |
|
3545 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3546 |
"/ ]. |
|
3547 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3548 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3549 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3550 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3551 |
] |
1699 | 3552 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3553 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3554 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3555 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3556 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3557 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3558 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3559 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3560 |
! |
1699 | 3561 |
|
3562 |
handlePointerLeave:state |
|
3563 |
self pointerEntersItem:nil. |
|
3564 |
super pointerLeave:state |
|
3565 |
! |
|
3566 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3567 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3568 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3569 |
|
2238 | 3570 |
|sensor subm item| |
3571 |
||
3572 |
(item := selection) isNil ifTrue:[ |
|
3573 |
superMenu notNil ifTrue:[ |
|
2249 | 3574 |
item := superMenu selection. |
3575 |
||
3576 |
item value notNil ifTrue:[ |
|
3577 |
"/ is a delayed menu |
|
3578 |
self accept:item |
|
3579 |
] ifFalse:[ |
|
3580 |
item toggleSubmenuVisibility |
|
3581 |
] |
|
2238 | 3582 |
] ifFalse:[ |
3583 |
self accept |
|
3584 |
]. |
|
3585 |
^ self |
|
1841 | 3586 |
]. |
3587 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3588 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3589 |
selection toggleSubmenuVisibility. |
3590 |
^ self |
|
2238 | 3591 |
]. |
3592 |
subm := selection currentSubmenu. |
|
3593 |
||
3594 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3595 |
selection toggleSubmenuVisibility. |
3596 |
^ self |
|
2238 | 3597 |
]. |
3598 |
self openDelayed:nil |
|
1841 | 3599 |
]. |
3600 |
self accept. |
|
3601 |
||
2238 | 3602 |
" test for toggle " |
3603 |
item isToggle ifTrue:[ |
|
3604 |
self selection:item. |
|
3605 |
] ifFalse:[ |
|
3606 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3607 |
^ self |
|
3608 |
] |
|
3609 |
]. |
|
1841 | 3610 |
|
3611 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3612 |
^ self |
1841 | 3613 |
]. |
3614 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3615 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3616 |
sensor flushKeyboardFor:nil. |
2238 | 3617 |
Delay waitForSeconds:0.1. |
3618 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3619 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3620 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3621 |
|
1699 | 3622 |
pointerEntersItem:anItemOrNil |
3623 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3624 |
redraw the new item highlighted." |
3625 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3626 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3627 |
|
1699 | 3628 |
( anItemOrNil notNil |
3629 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3630 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3631 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3632 |
anItemOrNil isButton ifTrue:[ |
2219 | 3633 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3634 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3635 |
) ifTrue:[ |
1699 | 3636 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3637 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3638 |
] ifFalse:[ |
2219 | 3639 |
(self enteredLevel ~~ 0 |
3640 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3641 |
) ifTrue:[ |
|
1699 | 3642 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3643 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3644 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3645 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3646 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3647 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3648 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3649 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3650 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3651 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3652 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3653 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3654 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3655 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3656 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3657 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3658 |
]. |
388 | 3659 |
! ! |
3660 |
||
2251 | 3661 |
!MenuPanel methodsFor:'focus handling'! |
3662 |
||
3187 | 3663 |
canTab |
3664 |
"depends whether I'am a toolbar and selectable items exists |
|
3665 |
" |
|
3666 |
|selectableItem| |
|
3667 |
||
3668 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3669 |
selectableItem := self firstItemSelectable. |
|
3670 |
^ selectableItem notNil |
|
3671 |
]. |
|
3672 |
^ false |
|
3673 |
! |
|
3674 |
||
3675 |
focusComesByTab |
|
3676 |
"returns true if focus comes by tab and should be drawn |
|
3677 |
" |
|
3678 |
|focusComesByTab| |
|
3679 |
||
3680 |
focusComesByTab := self menuAdornmentAt:#focusComesByTab. |
|
3681 |
||
3682 |
focusComesByTab == true ifTrue:[ |
|
3683 |
(shown and:[self hasFocus]) ifTrue:[ |
|
3684 |
^ true |
|
3685 |
]. |
|
3686 |
self menuAdornmentAt:#focusComesByTab put:false. |
|
3687 |
]. |
|
3688 |
^ false |
|
3689 |
! |
|
3690 |
||
3691 |
focusComesByTab:aBoolean |
|
3692 |
"only handled for toolBars" |
|
3693 |
||
3694 |
|selectableItem| |
|
3695 |
||
3696 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
3697 |
self menuAdornmentAt:#focusComesByTab put:aBoolean. |
|
3698 |
||
3699 |
self hasSelection ifTrue:[ |
|
3700 |
^ self |
|
3701 |
]. |
|
3702 |
||
3703 |
aBoolean ifTrue:[ |
|
3704 |
selectableItem := self firstItemSelectable. |
|
3705 |
]. |
|
3706 |
self selection:selectableItem openMenu:false. |
|
3707 |
]. |
|
3708 |
! |
|
3709 |
||
2251 | 3710 |
hasKeyboardFocus:aBoolean |
2715 | 3711 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3712 |
||
2251 | 3713 |
|focusView| |
3714 |
||
3715 |
self isPopUpView ifTrue:[ |
|
3716 |
"/ not visible for popup menus |
|
3717 |
^ super hasKeyboardFocus:aBoolean |
|
3718 |
]. |
|
3719 |
||
3720 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3721 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3722 |
focusView := windowGroup focusView. |
|
3723 |
||
3724 |
focusView == self ifFalse:[ |
|
3725 |
self selection:nil. |
|
3726 |
] |
|
3727 |
] |
|
3728 |
]. |
|
3729 |
super hasKeyboardFocus:aBoolean. |
|
3142 | 3730 |
! |
3731 |
||
3187 | 3732 |
showFocus:focusComesByTab |
3733 |
self focusComesByTab:focusComesByTab. |
|
3734 |
super showFocus:focusComesByTab. |
|
3735 |
! |
|
3736 |
||
3737 |
showNoFocus:focusByTab |
|
3738 |
self focusComesByTab:false. |
|
3739 |
super showNoFocus:focusByTab. |
|
3740 |
! |
|
3741 |
||
3742 |
supportsFocusOnTab |
|
3743 |
"returns true if focus is supported |
|
3744 |
" |
|
3745 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 3746 |
! |
3747 |
||
3748 |
wantsFocusWithButtonPress |
|
3187 | 3749 |
"needs only the focus if I'am a toolbar; all events are delegated |
3750 |
to my subMenus" |
|
3751 |
||
3752 |
^ self isPopUpView not |
|
2251 | 3753 |
! ! |
3754 |
||
388 | 3755 |
!MenuPanel methodsFor:'grabbing'! |
3756 |
||
1699 | 3757 |
doGrab |
3758 |
relativeGrabOrigin := nil. |
|
3759 |
||
3760 |
superMenu notNil ifTrue:[ |
|
3158 | 3761 |
superMenu doGrab |
1699 | 3762 |
] ifFalse:[ |
3158 | 3763 |
hasImplicitGrap ~~ true ifTrue:[ |
3764 |
self grabMouseAndKeyboard. |
|
3765 |
hasImplicitGrap := true |
|
3766 |
] |
|
1699 | 3767 |
] |
3768 |
! |
|
3769 |
||
3770 |
doUngrab:forceDo |
|
3771 |
||
3772 |
relativeGrabOrigin := nil. |
|
1767 | 3773 |
self clearImplicitGrab. |
1699 | 3774 |
|
3775 |
superMenu notNil ifTrue:[ |
|
3158 | 3776 |
forceDo ifTrue:[ |
3777 |
superMenu doUngrab:true |
|
3778 |
]. |
|
3779 |
^ self |
|
1699 | 3780 |
]. |
3781 |
||
3782 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3158 | 3783 |
^ self |
1699 | 3784 |
]. |
3785 |
||
3786 |
forceDo ifFalse:[ |
|
3158 | 3787 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3788 |
^ self |
|
3789 |
]. |
|
1699 | 3790 |
]. |
3791 |
self ungrabMouseAndKeyboard. |
|
3792 |
self selection:nil. |
|
3793 |
hasImplicitGrap := nil. |
|
1703 | 3794 |
prevFocusView := nil. |
1699 | 3795 |
! |
3796 |
||
1630 | 3797 |
grabKeyboard |
2715 | 3798 |
"grap the keyboard; keep previous grab" |
3799 |
||
1630 | 3800 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 3801 |
^ super grabKeyboard |
1630 | 3802 |
! |
3803 |
||
388 | 3804 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3805 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3806 |
|
3142 | 3807 |
|winGroup sensor| |
3808 |
||
3809 |
winGroup := self windowGroup. |
|
3810 |
||
3811 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
3812 |
prevFocusView isNil ifTrue:[ |
|
3813 |
prevFocusView := winGroup focusView. |
|
3814 |
]. |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3815 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3816 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3817 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3818 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3819 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3820 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3821 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3822 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3823 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3824 |
self unmap |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3825 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3826 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3827 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3828 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3829 |
device activeKeyboardGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3830 |
device sync. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3831 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3832 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3833 |
] |
388 | 3834 |
] |
3835 |
||
3158 | 3836 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3837 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3838 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3839 |
! |
3840 |
||
1630 | 3841 |
grabPointerWithCursor:aCursorOrNil |
2715 | 3842 |
"grap the pointer; keep previous grab" |
3843 |
||
1630 | 3844 |
previousPointerGrab := device activePointerGrab. |
1699 | 3845 |
hasImplicitGrap := true. |
2715 | 3846 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3847 |
! |
3848 |
||
3849 |
ungrabKeyboard |
|
2715 | 3850 |
"ungrap the keyboard; restore previous grab" |
3851 |
||
1630 | 3852 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3853 |
|
2579 | 3854 |
(previousKeyboardGrab notNil |
3855 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3856 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3857 |
]. |
|
1630 | 3858 |
! |
3859 |
||
388 | 3860 |
ungrabMouseAndKeyboard |
2715 | 3861 |
"ungrab resources (mouse and keyboard)" |
3862 |
||
1630 | 3863 |
self ungrabPointer. |
3864 |
self ungrabKeyboard. |
|
3865 |
! |
|
3866 |
||
3867 |
ungrabPointer |
|
2715 | 3868 |
"ungrap the pointer; restore previous grab" |
3869 |
||
1630 | 3870 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3871 |
|
2579 | 3872 |
(previousPointerGrab notNil |
3873 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3874 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3875 |
]. |
388 | 3876 |
! ! |
3877 |
||
1251 | 3878 |
!MenuPanel methodsFor:'help'! |
3879 |
||
2058 | 3880 |
flyByHelpTextAt:srcPoint |
3881 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2715 | 3882 |
If there is a selection, that items helpText is used (ignoring the given point)." |
3883 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3884 |
self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3885 |
^ nil |
2058 | 3886 |
! |
3887 |
||
3888 |
flyByHelpTextForItem:anItem |
|
2715 | 3889 |
"returns the helpText for an item (empty if none)" |
3890 |
||
2063 | 3891 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3892 |
^ anItem flyByHelpText. |
2058 | 3893 |
! |
3894 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3895 |
flyByHelpTextForKey:aKey |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3896 |
|app text| |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3897 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3898 |
app := self application. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3899 |
app isNil ifTrue:[^ nil]. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3900 |
text := self application flyByHelpTextForKey:aKey. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3901 |
text notNil ifTrue:[^ text]. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3902 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3903 |
^ nil. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3904 |
! |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3905 |
|
1251 | 3906 |
helpText |
2715 | 3907 |
"return the helpText for the currently selected item (empty if none)" |
3908 |
||
1613 | 3909 |
^ self helpTextForItem:selection |
1251 | 3910 |
! |
3911 |
||
1699 | 3912 |
helpTextAt:srcPoint |
1252 | 3913 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 3914 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
3915 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3916 |
self withMenuAndItemAt:srcPoint 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
|
3917 |
^ nil |
1613 | 3918 |
! |
3919 |
||
3920 |
helpTextForItem:anItem |
|
2715 | 3921 |
"returns the helpText for an item (empty if none)" |
3922 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
3923 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3924 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3925 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3926 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3927 |
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
|
3928 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3929 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3930 |
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
|
3931 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3932 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3933 |
item := dstMenu itemAtPoint:dstPoint. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3934 |
aBlock value:dstMenu value:item. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3935 |
] |
1251 | 3936 |
! ! |
3937 |
||
794 | 3938 |
!MenuPanel methodsFor:'image registration'! |
3939 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
3940 |
imageOnMyDevice:anImage |
2715 | 3941 |
"returns image registered on device" |
3942 |
||
2770 | 3943 |
^ self class image:anImage value onDevice:device |
794 | 3944 |
! |
3945 |
||
3946 |
lightenedImageOnDevice:anImage |
|
2715 | 3947 |
"returns lightened image registered on device" |
3948 |
||
794 | 3949 |
^ self class lightenedImage:anImage onDevice:device |
3950 |
! ! |
|
3951 |
||
1688 | 3952 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3953 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3954 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3955 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3956 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3957 |
|
388 | 3958 |
create |
2715 | 3959 |
"create the shadow view for a none contained submenu" |
3960 |
||
388 | 3961 |
super create. |
3962 |
||
3963 |
self isPopUpView ifTrue:[ |
|
2715 | 3964 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3965 |
shadowView isNil ifTrue:[ |
|
3966 |
shadowView := (ShadowView onDevice:device) for:self |
|
3967 |
] ifFalse:[ |
|
3968 |
self saveUnder:true. |
|
3969 |
]. |
|
3970 |
] |
|
388 | 3971 |
] ifFalse:[ |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
3972 |
self hasExplicitExtent ifTrue:[ |
2715 | 3973 |
(self width) == (superView width) ifTrue:[ |
3974 |
self verticalLayout:false |
|
3975 |
] |
|
3976 |
] |
|
388 | 3977 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3978 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3979 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3980 |
! |
3981 |
||
3982 |
destroy |
|
2715 | 3983 |
"destroy items and shadowView; remove dependencies" |
3984 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3985 |
self clearLastActiveMenu. |
2051 | 3986 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 3987 |
items := nil. |
3988 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3989 |
|
388 | 3990 |
super destroy. |
3142 | 3991 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3992 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3993 |
|
2051 | 3994 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3995 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3996 |
|
616 | 3997 |
fetchDeviceResources |
2715 | 3998 |
"fetch device colors, to avoid reallocation at redraw time" |
3999 |
||
2219 | 4000 |
|style| |
4001 |
||
2374 | 4002 |
superMenu notNil ifTrue:[ |
2219 | 4003 |
styleSheet := superMenu styleSheet |
4004 |
]. |
|
616 | 4005 |
|
4006 |
super fetchDeviceResources. |
|
4007 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4008 |
"/ 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
|
4009 |
"/ (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
|
4010 |
|
616 | 4011 |
superMenu isNil ifTrue:[ |
2374 | 4012 |
rightArrow isNil ifTrue:[ |
2219 | 4013 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 4014 |
]. |
2219 | 4015 |
fgColor := fgColor onDevice:device. |
4016 |
style := styleSheet name. |
|
4017 |
||
2761 | 4018 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
2219 | 4019 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
4020 |
] ifFalse:[ |
|
4021 |
rightArrowShadow := nil |
|
4022 |
]. |
|
616 | 4023 |
] ifFalse:[ |
2219 | 4024 |
rightArrow := superMenu rightArrow. |
4025 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4026 |
||
4027 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 4028 |
self font:(superMenu font). |
2761 | 4029 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4030 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4031 |
|
1829 | 4032 |
items notNil ifTrue:[ |
2219 | 4033 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 4034 |
]. |
4035 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4036 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 4037 |
! |
4038 |
||
580 | 4039 |
initStyle |
4040 |
"initialize style specific stuff" |
|
4041 |
||
2919 | 4042 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
4043 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
|
4044 |
#'menu.itemHorizontalSpace' |
|
4045 |
#'popup.hideOnRelease' |
|
4046 |
)> |
|
2609 | 4047 |
|fn| |
4048 |
||
580 | 4049 |
super initStyle. |
616 | 4050 |
|
2883 | 4051 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
4052 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4053 |
buttonInsetX := buttonInsetX abs. |
|
4054 |
||
4055 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
4056 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4057 |
buttonInsetY := buttonInsetY abs. |
|
4058 |
||
4059 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
4060 |
itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ]. |
|
4061 |
||
4062 |
||
2609 | 4063 |
fgColor := DefaultForegroundColor ? Color black. |
4064 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
4065 |
fn := self class defaultFont. |
|
2610 | 4066 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 4067 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4068 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4069 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4070 |
self updateLevelAndBorder. |
580 | 4071 |
! |
4072 |
||
388 | 4073 |
initialize |
2715 | 4074 |
"set default configuration" |
4075 |
||
388 | 4076 |
super initialize. |
616 | 4077 |
|
2877 | 4078 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4079 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
4080 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
4081 |
self originChangedFlag:false. |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4082 |
"/ explicitExtent := nil. |
2253 | 4083 |
shortKeyInset := 0. |
4084 |
mustRearrange := false. |
|
4085 |
showSeparatingLines := false. |
|
4086 |
showGroupDivider := true. |
|
388 | 4087 |
! |
4088 |
||
1573 | 4089 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4090 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4091 |
If the grab fails, try again and unmap myself if that fails too." |
4092 |
||
1791 | 4093 |
|loIndices loItems| |
388 | 4094 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4095 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4096 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4097 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4098 |
self becomesActiveMenu. |
1573 | 4099 |
super map. |
2681 | 4100 |
self addDependencies. |
388 | 4101 |
|
1785 | 4102 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4103 |
loItems := items ? #[]. |
4104 |
||
4105 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4106 |
|
388 | 4107 |
self isPopUpView ifTrue:[ |
2681 | 4108 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4109 |
] ifFalse:[ |
2681 | 4110 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4111 |
]. |
1791 | 4112 |
loItems do:[:el| el updateIndicators ]. |
388 | 4113 |
|
1785 | 4114 |
loIndices size > 0 ifTrue:[ |
2681 | 4115 |
self redrawX:0 y:0 width:width height:height. |
4116 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4117 |
]. |
4118 |
||
1177 | 4119 |
"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
|
4120 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4121 |
! |
4122 |
||
4123 |
realize |
|
2715 | 4124 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4125 |
|
2761 | 4126 |
|bgColor| |
4127 |
||
388 | 4128 |
self isPopUpView ifTrue:[ |
2761 | 4129 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4130 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4131 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4132 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4133 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4134 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4135 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4136 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4137 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4138 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4139 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4140 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4141 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4142 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4143 |
self map. |
736 | 4144 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4145 |
super realize. |
1767 | 4146 |
]. |
4147 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4148 |
hideOnRelease := defaultHideOnRelease. |
388 | 4149 |
! |
4150 |
||
4151 |
recreate |
|
1832 | 4152 |
"this is called after a snapin or a migration. |
2715 | 4153 |
If the image was saved with an active menu, hide the menu" |
4154 |
||
1455 | 4155 |
selection := nil. |
388 | 4156 |
super recreate. |
4157 |
! |
|
4158 |
||
1130 | 4159 |
reinitStyle |
4160 |
"handle style change while being open (win32 only - for now)" |
|
4161 |
||
4162 |
super reinitStyle. |
|
4163 |
||
4164 |
self fetchDeviceResources. |
|
1811 | 4165 |
self mustRearrange. "/ care for changed font sizes etc. |
4166 |
||
4167 |
self do:[:anItem | |
|
4168 |
anItem reinitStyle |
|
4169 |
]. |
|
1130 | 4170 |
|
4171 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4172 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4173 |
! |
4174 |
||
388 | 4175 |
unmap |
1330 | 4176 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4177 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4178 |
|
3203 | 4179 |
mapTime := nil. |
4180 |
||
2681 | 4181 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4182 |
self clearLastActiveMenu. |
1699 | 4183 |
self doUngrab:(superMenu isNil). |
4184 |
"/ self isPopUpView ifTrue:[ |
|
4185 |
"/ self doUngrab:(superMenu isNil) |
|
4186 |
"/ ]. |
|
3142 | 4187 |
prevFocusView := nil. |
388 | 4188 |
super unmap. |
4189 |
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
|
4190 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4191 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4192 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4193 |
"update level & border, when it is known if I am a popUpView" |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4194 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4195 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4196 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4197 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4198 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4199 |
lvl := styleSheet at:#'popup.level' default:0. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4200 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4201 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 4202 |
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
|
4203 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4204 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4205 |
self level:lvl. |
388 | 4206 |
! ! |
4207 |
||
1878 | 4208 |
!MenuPanel methodsFor:'keyboard control'! |
4209 |
||
4210 |
mnemonicViewNext:aKeyEvent |
|
4211 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4212 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4213 |
return the topMenu otherwise nil." |
4214 |
||
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4215 |
|menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel| |
2112 | 4216 |
|
4217 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4218 |
shown ifFalse:[^ nil]. |
4219 |
||
4220 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4221 |
lKey := uKey asLowercase. |
|
2112 | 4222 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4223 |
accessCharacterMatchQuery := [:el| |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4224 |
|k| |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4225 |
k := el accessCharacter. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4226 |
k == uKey or:[k == lKey] |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4227 |
]. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4228 |
maxShortCutSearchLevel := self class maxShortCutSearchLevel. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4229 |
|
2112 | 4230 |
selection notNil ifTrue:[ |
2374 | 4231 |
"first lookup the current grapMenu before starting in the topMenu |
4232 |
" |
|
4233 |
menu := self detectGrabMenu. |
|
4234 |
||
4235 |
[ menu ~~ self ] whileTrue:[ |
|
4236 |
index := menu selectionIndex. |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4237 |
list := menu |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4238 |
selectItemIndicesFor:accessCharacterMatchQuery |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4239 |
maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999 |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4240 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 4241 |
|
2374 | 4242 |
list size ~~ 0 ifTrue:[ |
4243 |
"/ has item which responds to the mnemonic |
|
4244 |
menu processCollectedIndices:list. |
|
4245 |
^ self |
|
4246 |
]. |
|
4247 |
menu := menu superMenu. |
|
4248 |
]. |
|
4249 |
index := self selectionIndex. |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4250 |
list := self |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4251 |
selectItemIndicesFor:accessCharacterMatchQuery |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4252 |
maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999 |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4253 |
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
|
4254 |
|
2112 | 4255 |
] ifFalse:[ |
2374 | 4256 |
index := 99999. |
4257 |
list := nil. |
|
2112 | 4258 |
]. |
4259 |
||
2374 | 4260 |
list isNil ifTrue:[ |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4261 |
list := self |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4262 |
selectItemIndicesFor:accessCharacterMatchQuery |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4263 |
maxDepth:maxShortCutSearchLevel from:1 to:index |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4264 |
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
|
4265 |
|
2374 | 4266 |
|
4267 |
list isNil ifTrue:[ |
|
4268 |
"/ must clear existing selection |
|
4269 |
self selection:nil. |
|
4270 |
^ nil |
|
4271 |
] |
|
2112 | 4272 |
]. |
4273 |
||
4274 |
"/ has item which responds to the mnemonic |
|
4275 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4276 |
! |
1878 | 4277 |
|
4278 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4279 |
"open all menus derived from sequence of item indices" |
4280 |
||
1878 | 4281 |
|item| |
4282 |
||
4283 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 4284 |
^ self |
1878 | 4285 |
]. |
4286 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4287 |
||
4288 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 4289 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4290 |
self selection:item openMenu:true. |
|
4291 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4292 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4293 |
! |
1878 | 4294 |
|
4295 |
processCollectedIndices:indices |
|
4296 |
|menu item| |
|
4297 |
||
4298 |
indices size == 0 ifTrue:[ |
|
3192 | 4299 |
^ self |
1878 | 4300 |
]. |
4301 |
menu := self. |
|
4302 |
||
3192 | 4303 |
"/ first lookup in current open submenus |
1878 | 4304 |
[menu selectionIndex == indices first] whileTrue:[ |
3192 | 4305 |
( (item := menu selection) isNil |
4306 |
or:[(menu := item currentSubmenu) isNil] |
|
4307 |
) ifTrue:[ "/ selected but no submenu open - not handled |
|
4308 |
^ self |
|
4309 |
]. |
|
4310 |
indices removeFirst. |
|
4311 |
||
4312 |
indices isEmpty ifTrue:[ |
|
4313 |
menu selection:nil. |
|
4314 |
^ self |
|
4315 |
] |
|
1878 | 4316 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4317 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4318 |
! |
1878 | 4319 |
|
4320 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4321 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4322 |
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
|
4323 |
Otherwise return false." |
2715 | 4324 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4325 |
|menu rKey lKey list item selectableItem| |
1878 | 4326 |
|
4327 |
superMenu notNil ifTrue:[ |
|
4328 |
^ superMenu processShortcut:aKeyEvent |
|
4329 |
]. |
|
4330 |
shown ifFalse:[^ false]. |
|
4331 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4332 |
lKey := aKeyEvent key. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4333 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4334 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4335 |
|
3192 | 4336 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4337 |
) includes:lKey |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4338 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4339 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4340 |
]. |
1878 | 4341 |
rKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4342 |
item := nil. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4343 |
menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu |
1878 | 4344 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4345 |
"/ 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
|
4346 |
aKeyEvent isKeyReleaseEvent ifTrue:[ |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4347 |
selection isNil ifTrue:[ |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4348 |
prevFocusView := self windowGroup focusView. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4349 |
self requestFocus. "/ self windowGroup focusView:self. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4350 |
selectableItem := self firstItemSelectable. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4351 |
self selection:selectableItem openMenu:false. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4352 |
] ifFalse:[ |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4353 |
prevFocusView requestFocus. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4354 |
self selection:nil. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4355 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4356 |
^ true |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4357 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4358 |
|
1878 | 4359 |
[true] whileTrue:[ |
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4360 |
list := menu |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4361 |
selectItemIndicesFor:[:el| |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4362 |
|skey| |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4363 |
|
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4364 |
item := el. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4365 |
el ignoreShortcutKeys ifTrue:[ |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4366 |
false |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4367 |
] ifFalse:[ |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4368 |
skey := el shortcutKey. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4369 |
skey == rKey or:[skey == lKey] |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4370 |
] |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4371 |
] |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4372 |
maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999 |
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4373 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
1878 | 4374 |
|
4375 |
list size ~~ 0 ifTrue:[ |
|
4376 |
"/ has item which responds to the shortcut |
|
4377 |
item hasSubmenu ifFalse:[ |
|
4378 |
menu accept:item |
|
4379 |
] ifTrue:[ |
|
4380 |
menu processCollectedIndices:list. |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4381 |
self requestFocus. "/ self windowGroup focusView:self. |
1878 | 4382 |
]. |
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4383 |
^ true |
1878 | 4384 |
]. |
4385 |
||
4386 |
menu == self ifTrue:[ ^ false ]. |
|
4387 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4388 |
]. |
2219 | 4389 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4390 |
! |
1878 | 4391 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4392 |
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
|
4393 |
"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
|
4394 |
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
|
4395 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4396 |
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
|
4397 |
is created and passed through if the block returns false. |
2715 | 4398 |
Otherwise the item is not asked for its submenu." |
4399 |
||
2112 | 4400 |
|start stop| |
4401 |
||
4402 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4403 |
||
4404 |
start := aStart max:1. |
|
4405 |
stop := aStop min:(items size). |
|
4406 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4407 |
start to:stop do:[:i| |item menu result| |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4408 |
item := items at:i. |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4409 |
(item enabled and:[item isVisible]) ifTrue:[ |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4410 |
(aOneArgBlock value:item) ifTrue:[ |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4411 |
^ OrderedCollection with:i |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4412 |
]. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4413 |
|
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4414 |
maxDepth > 1 ifTrue:[ |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4415 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4416 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
3192 | 4417 |
menu := item setupSubmenu. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4418 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4419 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4420 |
result := menu |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4421 |
selectItemIndicesFor:aOneArgBlock |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4422 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4423 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4424 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4425 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4426 |
result addFirst:i. |
3128 | 4427 |
^ result |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4428 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4429 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4430 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4431 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4432 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4433 |
]. |
1878 | 4434 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4435 |
^ nil |
3128 | 4436 |
|
4437 |
"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
|
4438 |
! ! |
1878 | 4439 |
|
388 | 4440 |
!MenuPanel methodsFor:'misc'! |
4441 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4442 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4443 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4444 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4445 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4446 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4447 |
|
388 | 4448 |
superMenu |
2715 | 4449 |
"returns supermenu or nil" |
4450 |
||
388 | 4451 |
^ superMenu |
4452 |
! |
|
4453 |
||
4454 |
topMenu |
|
2715 | 4455 |
"returns the topMenu; the one having no superMenu" |
4456 |
||
1791 | 4457 |
|menu smenu| |
4458 |
||
4459 |
menu := self. |
|
4460 |
||
4461 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2715 | 4462 |
menu := smenu |
1791 | 4463 |
]. |
4464 |
^ menu |
|
388 | 4465 |
! ! |
4466 |
||
1825 | 4467 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4468 |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4469 |
printOn:aStream |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4470 |
|label| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4471 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4472 |
aStream nextPutAll:'Menu:'. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4473 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4474 |
self do:[:eachItem| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4475 |
label := eachItem label. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4476 |
label notEmptyOrNil ifTrue:[ |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4477 |
aStream nextPutAll:' '. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4478 |
label printOn:aStream. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4479 |
]. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4480 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4481 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4482 |
|
388 | 4483 |
!MenuPanel methodsFor:'private'! |
4484 |
||
434 | 4485 |
application |
2715 | 4486 |
"optimize access to retrive the application" |
4487 |
||
2374 | 4488 |
application notNil ifTrue:[^ application ]. |
434 | 4489 |
|
4490 |
superMenu notNil ifTrue:[ |
|
2253 | 4491 |
application := superMenu application. |
2374 | 4492 |
^ application |
2253 | 4493 |
]. |
4494 |
application := super application. |
|
2374 | 4495 |
^ application |
1872 | 4496 |
! |
434 | 4497 |
|
1572 | 4498 |
detectItemForKey:aKey |
4499 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4500 |
if no item is detected nil is returned." |
4501 |
||
1572 | 4502 |
|cIdx uKey lKey item| |
4503 |
||
1699 | 4504 |
items isNil ifTrue:[^ nil]. |
4505 |
||
1572 | 4506 |
cIdx := self selectionIndex. |
4507 |
uKey := aKey asUppercase. |
|
4508 |
lKey := aKey asLowercase. |
|
4509 |
||
1699 | 4510 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2715 | 4511 |
( anIndex ~~ cIdx |
4512 |
and:[anItem canSelect |
|
4513 |
and:[(label := anItem textLabel) notNil |
|
4514 |
and:[label size ~~ 0]]] |
|
4515 |
) ifTrue:[ |
|
4516 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4517 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4518 |
^ anItem |
|
4519 |
] |
|
4520 |
] ifFalse:[ |
|
4521 |
char := label at:1. |
|
4522 |
||
4523 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4524 |
anIndex > cIdx ifTrue:[ |
|
4525 |
^ anItem |
|
4526 |
]. |
|
4527 |
item isNil ifTrue:[item := anItem] |
|
4528 |
] |
|
4529 |
] |
|
4530 |
] |
|
1572 | 4531 |
]. |
4532 |
^ item |
|
4533 |
! |
|
4534 |
||
390 | 4535 |
menuAdornmentAt:aSymbol |
2715 | 4536 |
"returns a value derived from adornment" |
4537 |
||
2374 | 4538 |
adornment isNil ifTrue:[^ nil]. |
4539 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4540 |
! |
4541 |
||
390 | 4542 |
menuAdornmentAt:aSymbol put:something |
2715 | 4543 |
"sets a value for the specific menu" |
4544 |
||
2253 | 4545 |
|oldValue| |
4546 |
||
653 | 4547 |
adornment isNil ifTrue:[ |
2374 | 4548 |
something isNil ifTrue:[^ self]. |
2253 | 4549 |
adornment := IdentityDictionary new. |
4550 |
] ifFalse:[ |
|
4551 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4552 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4553 |
]. |
4554 |
adornment at:aSymbol put:something. |
|
388 | 4555 |
! |
4556 |
||
4557 |
onEachPerform:aSelector withArgList:aList |
|
2715 | 4558 |
"on each item perform selector with an argument derived from aList" |
4559 |
||
388 | 4560 |
aList isCollection ifTrue:[ |
2715 | 4561 |
items size >= aList size ifTrue:[ |
4562 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4563 |
(items at:anIndex) perform:aSelector with:anArg |
|
4564 |
] |
|
4565 |
] |
|
388 | 4566 |
] ifFalse:[ |
2715 | 4567 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4568 |
] |
4569 |
! |
|
4570 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4571 |
registerImageOnDevice:anImage |
2269 | 4572 |
|
4573 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4574 |
^ self class image:anImage onDevice:device |
|
4575 |
||
4576 |
"/ |image| |
|
4577 |
"/ |
|
4578 |
"/ (image := anImage) notNil ifTrue:[ |
|
4579 |
"/ image device ~~ device ifTrue:[ |
|
4580 |
"/ image := image copy. |
|
4581 |
"/ ]. |
|
4582 |
"/ image := image onDevice:device. |
|
4583 |
"/ image := image clearMaskedPixels. |
|
4584 |
"/ ]. |
|
4585 |
"/ ^ image |
|
2355 | 4586 |
! |
4587 |
||
4588 |
superMenu:aSuperMenu |
|
2715 | 4589 |
"set my supermenu from which i'am activated" |
4590 |
||
2355 | 4591 |
superMenu := aSuperMenu. |
4592 |
||
2374 | 4593 |
superMenu notNil ifTrue:[ |
2355 | 4594 |
styleSheet := superMenu styleSheet. |
4595 |
rightArrow := superMenu rightArrow. |
|
4596 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4597 |
]. |
|
388 | 4598 |
! ! |
4599 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4600 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4601 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4602 |
activeMenu |
2715 | 4603 |
"returns the current active menu or self (the top menu)" |
4604 |
||
687 | 4605 |
^ lastActiveMenu ? self |
4606 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4607 |
"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
|
4608 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4609 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4610 |
activeMenu:aMenu |
2715 | 4611 |
"set the current active menu" |
4612 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4613 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4614 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4615 |
"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
|
4616 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4617 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4618 |
becomesActiveMenu |
2715 | 4619 |
"submenu becomes the active menu" |
4620 |
||
3224 | 4621 |
mapTime isNil ifTrue:[ |
4622 |
"/ set the mapTime if not yet done |
|
4623 |
mapTime := AbsoluteTime now. |
|
4624 |
]. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4625 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4626 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4627 |
"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
|
4628 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4629 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4630 |
clearLastActiveMenu |
2715 | 4631 |
"reset the current active menu" |
4632 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4633 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4634 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4635 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4636 |
|
2251 | 4637 |
"/ prevFocusView notNil ifTrue:[ |
4638 |
"/ self windowGroup focusView:prevFocusView. |
|
4639 |
"/ prevFocusView := nil. |
|
4640 |
"/ ]. |
|
4641 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4642 |
top activeMenu == self ifTrue:[ |
2251 | 4643 |
top activeMenu:nil |
687 | 4644 |
] |
4645 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4646 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4647 |
! |
4648 |
||
4649 |
mapTime |
|
3203 | 4650 |
"get the time the menu was activated or nil" |
2715 | 4651 |
|
687 | 4652 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4653 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4654 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
3203 | 4655 |
! |
4656 |
||
4657 |
mapTime:aTimestamp |
|
4658 |
"set the time the menu was activated" |
|
4659 |
||
4660 |
mapTime := aTimestamp. |
|
4661 |
||
4662 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
|
687 | 4663 |
! ! |
4664 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4665 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4666 |
|
4667 |
hasScrollerAt:aDirection |
|
2715 | 4668 |
"returns true if a visible scroller at a direction exists" |
4669 |
||
2016 | 4670 |
|layout| |
4671 |
||
4672 |
self hasScrollers ifFalse:[ |
|
2715 | 4673 |
^ false |
2016 | 4674 |
]. |
4675 |
||
4676 |
aDirection == #PREV ifTrue:[ |
|
2715 | 4677 |
layout := items first layout. |
2016 | 4678 |
|
4679 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2715 | 4680 |
ifFalse:[ layout left < margin] |
2016 | 4681 |
]. |
4682 |
layout := items last layout. |
|
4683 |
||
4684 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2715 | 4685 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4686 |
! |
4687 |
||
4688 |
hasScrollers |
|
2715 | 4689 |
"returns true if scrollers are needed" |
4690 |
||
2018 | 4691 |
|maxExtent first last isVert| |
4692 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4693 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 4694 |
|
4695 |
isVert := self verticalLayout. |
|
4696 |
||
4697 |
superView notNil ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4698 |
((first := items first layout) isNil |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4699 |
or:[(last := items last layout) isNil] |
2715 | 4700 |
) ifTrue:[ |
4701 |
^ false |
|
4702 |
]. |
|
4703 |
isVert ifTrue:[ |
|
4704 |
^ first top < 0 or:[last bottom > height] |
|
4705 |
]. |
|
4706 |
^ first left < 0 or:[last right > width] |
|
2018 | 4707 |
]. |
4708 |
maxExtent := self maxExtent. |
|
4709 |
isVert ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4710 |
^ (height >= maxExtent y) |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4711 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4712 |
^ (width >= maxExtent x) |
2016 | 4713 |
! |
4714 |
||
4715 |
indexOfItemAtScroller:aDirection |
|
2715 | 4716 |
"returns the index of the item under the scroller or 0" |
4717 |
||
2016 | 4718 |
|bounds min max layout| |
4719 |
||
2860 | 4720 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 4721 |
bounds := self scrollerBoundsAt:aDirection. |
4722 |
||
4723 |
self verticalLayout ifTrue:[ |
|
2715 | 4724 |
min := bounds top. |
4725 |
max := bounds bottom. |
|
4726 |
||
4727 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4728 |
anItem isVisible ifTrue:[ |
|
4729 |
layout := anItem layout. |
|
4730 |
||
4731 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4732 |
^ anIndex |
|
4733 |
]. |
|
4734 |
]. |
|
4735 |
]. |
|
2016 | 4736 |
] ifFalse:[ |
2715 | 4737 |
min := bounds left. |
4738 |
max := bounds right. |
|
4739 |
||
4740 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4741 |
anItem isVisible ifTrue:[ |
|
4742 |
layout := anItem layout. |
|
4743 |
||
4744 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4745 |
^ anIndex |
|
4746 |
]. |
|
4747 |
]. |
|
4748 |
] |
|
2016 | 4749 |
]. |
4750 |
^ 0 |
|
4751 |
! |
|
4752 |
||
4753 |
makeItemVisible:anItem |
|
2715 | 4754 |
"make an item visible" |
4755 |
||
2018 | 4756 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4757 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4758 |
inv1 inv2| |
2018 | 4759 |
|
4760 |
( anItem notNil |
|
4761 |
and:[self hasScrollers |
|
4762 |
and:[(layout := anItem layout) notNil]] |
|
4763 |
) ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4764 |
^ self |
2016 | 4765 |
]. |
2018 | 4766 |
index := self indexOfItem:anItem. |
2016 | 4767 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4768 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4769 |
||
2018 | 4770 |
isVertical := self verticalLayout. |
4771 |
||
4772 |
isVertical ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4773 |
boundsMin := boundsPREV bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4774 |
boundsMax := boundsNEXT top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4775 |
layoutMin := layout top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4776 |
layoutMax := layout bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4777 |
windowSz := height. |
2018 | 4778 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4779 |
boundsMin := boundsPREV right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4780 |
boundsMax := boundsNEXT left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4781 |
layoutMin := layout left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4782 |
layoutMax := layout right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4783 |
windowSz := width. |
2018 | 4784 |
]. |
4785 |
||
4786 |
||
4787 |
layoutMin < boundsMin ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4788 |
layoutMin >= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4789 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4790 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4791 |
"/ test whether is first visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4792 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4793 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4794 |
index == 0 ifTrue:[ scr0 := margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4795 |
ifFalse:[ scr0 := boundsMin ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4796 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4797 |
delta := layoutMin negated + scr0. |
2016 | 4798 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4799 |
layoutMax > boundsMax ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4800 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4801 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4802 |
"/ test whether is last visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4803 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4804 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4805 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4806 |
ifFalse:[ scr0 := boundsMax ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4807 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4808 |
delta := scr0 - layoutMax. |
2018 | 4809 |
]. |
4810 |
delta == 0 ifTrue:[ ^ self ]. |
|
4811 |
||
2016 | 4812 |
doScroll := false. |
4813 |
||
4814 |
shown ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4815 |
delta abs < (windowSz / 2) ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4816 |
doScroll := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4817 |
self repairDamage |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4818 |
] |
2016 | 4819 |
]. |
2018 | 4820 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4821 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4822 |
|
4823 |
doScroll ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4824 |
self invalidate. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4825 |
^ self |
2016 | 4826 |
]. |
4827 |
||
2018 | 4828 |
windowSz := windowSz - margin - margin. |
4829 |
||
4830 |
scr0 := boundsMin. |
|
4831 |
scr1 := scr0 + delta abs. |
|
4832 |
scrSz := boundsMax - scr1. |
|
4833 |
||
4834 |
delta < 0 ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4835 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4836 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4837 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4838 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4839 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4840 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4841 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4842 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4843 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4844 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4845 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4846 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4847 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4848 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4849 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4850 |
inv1 := boundsPREV. |
2016 | 4851 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4852 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4853 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4854 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4855 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4856 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4857 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4858 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4859 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4860 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4861 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4862 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4863 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4864 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4865 |
inv1 := boundsNEXT. |
2042 | 4866 |
]. |
4867 |
self invalidate:inv1. |
|
4868 |
self invalidate:inv2. |
|
2048 | 4869 |
|
4870 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4871 |
! |
4872 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4873 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4874 |
"returns the one and only scrollActivity - data holder |
2715 | 4875 |
for a menu and all contained submenus" |
4876 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4877 |
superMenu notNil ifTrue:[ |
2715 | 4878 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4879 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4880 |
scrollActivity isNil ifTrue:[ |
2715 | 4881 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4882 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4883 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4884 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4885 |
|
2016 | 4886 |
scrollerBoundsAt:aDirection |
2860 | 4887 |
"returns the bounds of the scroller at a direction" |
2715 | 4888 |
|
2016 | 4889 |
|y x w h inset| |
4890 |
||
4891 |
inset := 0. |
|
4892 |
x := y := inset. |
|
4893 |
w := h := 15. |
|
4894 |
||
4895 |
self verticalLayout ifTrue:[ |
|
2715 | 4896 |
aDirection == #NEXT ifTrue:[ |
4897 |
y := height - h - inset. |
|
4898 |
]. |
|
4899 |
w := width - inset - inset. |
|
2016 | 4900 |
] ifFalse:[ |
2715 | 4901 |
aDirection == #NEXT ifTrue:[ |
4902 |
x := width - w - inset. |
|
4903 |
]. |
|
4904 |
h := height - inset - inset. |
|
2016 | 4905 |
]. |
4906 |
^ Rectangle left:x top:y width:w height:h |
|
4907 |
! |
|
4908 |
||
2046 | 4909 |
scrollerDirectionAtPoint:aPoint |
2715 | 4910 |
"returns the scroller-direction at aPoint, or nil" |
4911 |
||
2046 | 4912 |
self hasScrollers ifTrue:[ |
2715 | 4913 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
2860 | 4914 |
bounds := self scrollerBoundsAt:aDirection. |
4915 |
||
4916 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
2715 | 4917 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
4918 |
] |
|
4919 |
] |
|
2046 | 4920 |
]. |
4921 |
^ nil |
|
4922 |
||
4923 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4924 |
! ! |
4925 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4926 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4927 |
|
1699 | 4928 |
detectGrabMenu |
2715 | 4929 |
"returns the menu which is responsible for the grap; the last opened menu" |
4930 |
||
1699 | 4931 |
|subMenu| |
4932 |
||
4933 |
selection notNil ifTrue:[ |
|
2715 | 4934 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4935 |
^ subMenu detectGrabMenu |
|
4936 |
] |
|
1699 | 4937 |
]. |
4938 |
^ self |
|
4939 |
! |
|
4940 |
||
4941 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 4942 |
"returns the menu which contains the grab-point" |
4943 |
||
1699 | 4944 |
|dstMenu dstPoint firstMenu| |
4945 |
||
4946 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4947 |
||
4948 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2715 | 4949 |
firstMenu := self. |
1699 | 4950 |
]. |
4951 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4952 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2715 | 4953 |
^ firstMenu |
1699 | 4954 |
]. |
4955 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4956 |
^ dstMenu ? firstMenu |
1699 | 4957 |
! |
4958 |
||
1767 | 4959 |
detectViewAtX:x y:y in:aTopView |
2715 | 4960 |
"detect view at x@y" |
4961 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4962 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4963 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4964 |
"/ 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
|
4965 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4966 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4967 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4968 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4969 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4970 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4971 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4972 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4973 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4974 |
"/ 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
|
4975 |
"/ ^ 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
|
4976 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4977 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4978 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4979 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4980 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4981 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4982 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4983 |
! |
4984 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4985 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4986 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 4987 |
If no item match nil is returned." |
4988 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4989 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4990 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4991 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4992 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4993 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4994 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4995 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4996 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4997 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4998 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4999 |
itemAtPoint:aPoint |
2715 | 5000 |
"returns the item at aPoint or nil if none detected" |
5001 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5002 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5003 |
|
1699 | 5004 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5005 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5006 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5007 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 5008 |
]. |
5009 |
^ nil |
|
388 | 5010 |
! |
5011 |
||
2048 | 5012 |
superMenuAtPoint:aPoint |
2715 | 5013 |
"returns the superMenu which contains aPoint, or nil if none detected" |
5014 |
||
1699 | 5015 |
|grabPoint superMenu| |
5016 |
||
2048 | 5017 |
(self containsPoint:aPoint) ifTrue:[ |
2715 | 5018 |
^ self |
1699 | 5019 |
]. |
5020 |
||
2048 | 5021 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 5022 |
superMenu := self. |
5023 |
||
5024 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2715 | 5025 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
5026 |
^ superMenu |
|
5027 |
] |
|
5028 |
]. |
|
5029 |
^ nil |
|
1699 | 5030 |
|
2048 | 5031 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 5032 |
! ! |
5033 |
||
5034 |
!MenuPanel methodsFor:'queries'! |
|
5035 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5036 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5037 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5038 |
aView notNil ifTrue:[ |
3147 | 5039 |
"/ I am no longer a popUpView |
5040 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5041 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5042 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5043 |
|
388 | 5044 |
containsPoint:aPoint |
2715 | 5045 |
"returns true if the argument, aPoint is contained by the view" |
5046 |
||
388 | 5047 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
5048 |
! |
|
5049 |
||
5050 |
containsPointX:x y:y |
|
2715 | 5051 |
"returns true if point is contained by the view" |
5052 |
||
708 | 5053 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 5054 |
! |
5055 |
||
390 | 5056 |
hasGroupDividerAt:anIndex |
2715 | 5057 |
"returns true if a divider is defined at an index" |
5058 |
||
388 | 5059 |
|i| |
5060 |
||
5061 |
groupSizes size ~~ 0 ifTrue:[ |
|
2715 | 5062 |
i := 0. |
5063 |
||
5064 |
groupSizes do:[:t| |
|
5065 |
(i := i + t) == anIndex ifTrue:[ |
|
5066 |
^ true |
|
5067 |
] |
|
5068 |
] |
|
5069 |
]. |
|
5070 |
^ false |
|
388 | 5071 |
! |
5072 |
||
390 | 5073 |
hasGroupDividers |
2715 | 5074 |
"returns true if any group divider exists" |
5075 |
||
5076 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 5077 |
! |
5078 |
||
390 | 5079 |
isFitPanel |
5080 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 5081 |
be fit to the extent of its superView; |
2715 | 5082 |
NOT SUPPORTED" |
5083 |
||
1699 | 5084 |
^ false |
390 | 5085 |
! |
5086 |
||
388 | 5087 |
isPopUpView |
5088 |
"return true if view is a popup view; without decoration |
|
2715 | 5089 |
and popUp to top immediately" |
5090 |
||
388 | 5091 |
^ superView isNil |
5092 |
! |
|
5093 |
||
5094 |
isVerticalLayout |
|
2715 | 5095 |
"returns true if vertical layout otherwise false( horizontal layout )" |
5096 |
||
1699 | 5097 |
^ self verticalLayout |
416 | 5098 |
! |
5099 |
||
1793 | 5100 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
5101 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 5102 |
! |
5103 |
||
416 | 5104 |
type |
428 | 5105 |
^ nil. |
416 | 5106 |
|
388 | 5107 |
! ! |
5108 |
||
5109 |
!MenuPanel methodsFor:'selection'! |
|
5110 |
||
5111 |
hasSelection |
|
2715 | 5112 |
"returns true if a selection exists" |
5113 |
||
388 | 5114 |
^ self selection notNil |
5115 |
! |
|
5116 |
||
2199 | 5117 |
openDelayed:anItem |
3187 | 5118 |
self openDelayed:anItem afterSeconds:0.5. |
5119 |
! |
|
5120 |
||
5121 |
openDelayed:anItem afterSeconds:seconds |
|
2199 | 5122 |
|
2374 | 5123 |
superMenu notNil ifTrue:[ |
3187 | 5124 |
superMenu openDelayed:anItem afterSeconds:seconds. |
2374 | 5125 |
^ self |
5126 |
]. |
|
5127 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 5128 |
Processor removeTimedBlock:openDelayedMenuBlock. |
5129 |
openDelayedMenuBlock := nil. |
|
5130 |
]. |
|
3187 | 5131 |
(anItem notNil and:[anItem hasSubmenu]) ifFalse:[ |
2253 | 5132 |
openDelayedMenuBlock := nil. |
2374 | 5133 |
^ self |
2253 | 5134 |
]. |
5135 |
openDelayedMenuBlock := [ |
|
5136 |
openDelayedMenuBlock := nil. |
|
5137 |
anItem openDelayedSubmenu |
|
5138 |
]. |
|
5139 |
||
3187 | 5140 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
2199 | 5141 |
! |
5142 |
||
388 | 5143 |
selection |
2715 | 5144 |
"returns current selected item or nil" |
5145 |
||
388 | 5146 |
^ selection |
5147 |
! |
|
5148 |
||
5149 |
selection:anItemOrNil |
|
2016 | 5150 |
"change selection to an item or nil |
2715 | 5151 |
if the item has a submenu the first item might be selected (style-sheet)" |
5152 |
||
2249 | 5153 |
|openMenu openOnSelect submenu item| |
5154 |
||
5155 |
selection == anItemOrNil ifTrue:[^ self]. |
|
5156 |
||
5157 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
5158 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5159 |
^ self |
2249 | 5160 |
]. |
5161 |
||
5162 |
openMenu := self isPopUpView not. |
|
5163 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
5164 |
||
5165 |
openMenu ifFalse:[ |
|
5166 |
openMenu := openOnSelect. |
|
5167 |
]. |
|
5168 |
self selection:anItemOrNil openMenu:openMenu. |
|
5169 |
||
5170 |
openOnSelect ifFalse:[ |
|
5171 |
"/ select first item in submenu |
|
5172 |
||
5173 |
submenu := anItemOrNil currentSubmenu. |
|
5174 |
||
2374 | 5175 |
submenu notNil ifTrue:[ |
2249 | 5176 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5177 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 5178 |
submenu selection:item openMenu:false |
5179 |
] |
|
5180 |
]. |
|
5181 |
]. |
|
5182 |
! |
|
5183 |
||
5184 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 5185 |
"change selection to an item or nil" |
5186 |
||
2251 | 5187 |
|helpListener oldSelect| |
2249 | 5188 |
|
5189 |
anItemOrNil == selection ifTrue:[ |
|
5190 |
^ self |
|
2016 | 5191 |
]. |
2199 | 5192 |
self openDelayed:nil. |
388 | 5193 |
|
2251 | 5194 |
oldSelect := selection. |
5195 |
selection := nil. |
|
2249 | 5196 |
|
2374 | 5197 |
anItemOrNil notNil ifTrue:[ |
2249 | 5198 |
self makeItemVisible:anItemOrNil. |
5199 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 5200 |
selection := anItemOrNil |
2249 | 5201 |
] ifFalse:[ |
2374 | 5202 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 5203 |
]. |
5204 |
]. |
|
2374 | 5205 |
oldSelect notNil ifTrue:[ |
2249 | 5206 |
"/ clear current selection |
2251 | 5207 |
oldSelect isSelected:false. |
5208 |
]. |
|
2374 | 5209 |
selection isNil ifTrue:[^ self]. |
2251 | 5210 |
|
5211 |
selection == enteredItem ifTrue:[ |
|
2249 | 5212 |
enteredItem := nil |
2016 | 5213 |
] ifFalse:[ |
2249 | 5214 |
self pointerEntersItem:nil |
2016 | 5215 |
]. |
5216 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 5217 |
helpListener := ActiveHelp currentHelpListener. |
5218 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 5219 |
]. |
5220 |
shown ifTrue:[ |
|
5221 |
self rearrangeItems. |
|
5222 |
||
5223 |
openMenu ifFalse:[ |
|
5224 |
selection invalidate. |
|
5225 |
] |
|
5226 |
]. |
|
5227 |
openMenu ifTrue:[ |
|
5228 |
selection isSelected:true. |
|
5229 |
]. |
|
388 | 5230 |
! |
5231 |
||
5232 |
selectionIndex |
|
2715 | 5233 |
"returns index of current selection or 0" |
5234 |
||
388 | 5235 |
|item| |
5236 |
||
5237 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 5238 |
^ self findFirst:[:el| el == item ] |
388 | 5239 |
]. |
5240 |
^ 0 |
|
5241 |
! |
|
5242 |
||
5243 |
selectionIndex:anIndex |
|
2715 | 5244 |
"set selection at an index" |
5245 |
||
388 | 5246 |
self selection:(self itemAt:anIndex) |
5247 |
! ! |
|
5248 |
||
1791 | 5249 |
!MenuPanel methodsFor:'translation'! |
5250 |
||
5251 |
translateGrabPoint:aGrabPoint |
|
2715 | 5252 |
"translate the grab point into self" |
5253 |
||
1791 | 5254 |
superMenu isNil ifTrue:[ |
2936 | 5255 |
"I am the grabView" |
2715 | 5256 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
5257 |
^ aGrabPoint |
|
1791 | 5258 |
]. |
5259 |
||
5260 |
relativeGrabOrigin isNil ifTrue:[ |
|
2936 | 5261 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
5262 |
relativeGrabOrigin isNil ifTrue:[ |
|
5263 |
"I am the grabView" |
|
5264 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5265 |
^ aGrabPoint |
|
5266 |
]. |
|
1791 | 5267 |
]. |
5268 |
^ relativeGrabOrigin + aGrabPoint |
|
5269 |
! |
|
5270 |
||
5271 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 5272 |
"translate a point into another menu its point" |
5273 |
||
1791 | 5274 |
|grapPoint| |
5275 |
||
5276 |
aMenu == self ifTrue:[ |
|
2715 | 5277 |
^ aPoint |
1791 | 5278 |
]. |
5279 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
5280 |
||
2715 | 5281 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 5282 |
! |
5283 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5284 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 5285 |
"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
|
5286 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5287 |
^ device |
2715 | 5288 |
translatePoint:aPoint asPoint |
5289 |
fromView:self |
|
5290 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5291 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5292 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 5293 |
! ! |
5294 |
||
388 | 5295 |
!MenuPanel::Item class methodsFor:'accessing'! |
5296 |
||
689 | 5297 |
horizontalInset |
5298 |
^ HorizontalInset |
|
5299 |
! |
|
5300 |
||
388 | 5301 |
labelRightOffset |
5302 |
^ LabelRightOffset |
|
5303 |
! |
|
5304 |
||
689 | 5305 |
verticalInset |
5306 |
^ VerticalInset |
|
1765 | 5307 |
! |
5308 |
||
5309 |
verticalPopUpInset |
|
5310 |
^ VerticalPopUpInset |
|
388 | 5311 |
! ! |
5312 |
||
616 | 5313 |
!MenuPanel::Item class methodsFor:'defaults'! |
5314 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5315 |
halfSeparatorSize |
2870 | 5316 |
"returns the size of a space-separator" |
5317 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5318 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5319 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5320 |
|
1699 | 5321 |
separatorSize |
2870 | 5322 |
"returns the size of a separator" |
5323 |
||
1699 | 5324 |
^ 10 |
616 | 5325 |
! |
5326 |
||
5327 |
updateStyleCache |
|
2777 | 5328 |
"extract values from the styleSheet and cache them in class variables" |
5329 |
||
1765 | 5330 |
<resource: #style (#'menuPanel.verticalInset')> |
5331 |
||
1699 | 5332 |
HorizontalInset := 2. |
1765 | 5333 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5334 |
VerticalPopUpInset := 2. |
|
727 | 5335 |
|
5336 |
HorizontalButtonInset := 3. |
|
5337 |
VerticalButtonInset := 3. |
|
5338 |
||
681 | 5339 |
LabelRightOffset := 15. |
1765 | 5340 |
|
2777 | 5341 |
" |
5342 |
self updateStyleCache |
|
5343 |
" |
|
1124 | 5344 |
! ! |
1078 | 5345 |
|
388 | 5346 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5347 |
||
5348 |
in:aSuperMenu |
|
5349 |
^ self in:aSuperMenu label:nil |
|
5350 |
! |
|
5351 |
||
5352 |
in:aSuperMenu label:aLabel |
|
5353 |
|item| |
|
5354 |
||
5355 |
item := self new in:aSuperMenu. |
|
5356 |
item label:aLabel. |
|
2870 | 5357 |
^ item |
388 | 5358 |
! |
5359 |
||
5360 |
in:aSuperMenu menuItem:aMenuItem |
|
5361 |
|item| |
|
5362 |
||
5363 |
item := self in:aSuperMenu. |
|
5364 |
item menuItem:aMenuItem. |
|
2870 | 5365 |
^ item. |
2359 | 5366 |
! |
5367 |
||
5368 |
new |
|
5369 |
^ self basicNew initialize |
|
388 | 5370 |
! ! |
5371 |
||
1808 | 5372 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5373 |
|
420 | 5374 |
canAccept |
2870 | 5375 |
"returns true if item is acceptable" |
5376 |
||
2199 | 5377 |
self enabled ifFalse:[ ^ false]. |
5378 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5379 |
||
5380 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
5381 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 5382 |
! |
5383 |
||
5384 |
toggleIndication |
|
2870 | 5385 |
"toggle indication or choice" |
5386 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5387 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5388 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5389 |
indication notNil ifTrue:[ |
2359 | 5390 |
arg := self indicationValue not. |
5391 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5392 |
] ifFalse:[ |
2359 | 5393 |
choice notNil ifTrue:[ |
5394 |
choice value:(menuItem choiceValue). |
|
5395 |
^ true |
|
5396 |
] |
|
524 | 5397 |
]. |
5398 |
^ arg |
|
389 | 5399 |
! ! |
5400 |
||
388 | 5401 |
!MenuPanel::Item methodsFor:'accessing'! |
5402 |
||
5403 |
accessCharacter |
|
2870 | 5404 |
"returns my accessCharacter or nil" |
5405 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5406 |
^ accessCharacter |
388 | 5407 |
! |
5408 |
||
5409 |
accessCharacterPosition |
|
2870 | 5410 |
"get the access character position or nil" |
5411 |
||
2359 | 5412 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5413 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5414 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5415 |
accessCharacterPosition:anIndex |
2870 | 5416 |
"set the access character position or nil" |
5417 |
||
2359 | 5418 |
menuItem accessCharacterPosition:anIndex. |
388 | 5419 |
! |
5420 |
||
5421 |
argument |
|
2870 | 5422 |
"gets the argument" |
5423 |
||
2359 | 5424 |
^ menuItem argument |
388 | 5425 |
! |
5426 |
||
5427 |
argument:anArgument |
|
2870 | 5428 |
"sets the argument" |
5429 |
||
2359 | 5430 |
menuItem argument:anArgument. |
389 | 5431 |
! |
5432 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5433 |
displayLabel |
2870 | 5434 |
"returns my printable Label" |
5435 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5436 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5437 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5438 |
|
2614 | 5439 |
displayLabelExtent |
2870 | 5440 |
"returns the labels extent" |
5441 |
||
2614 | 5442 |
|prevFont w h| |
5443 |
||
5444 |
displayLabelExtent notNil ifTrue:[ |
|
5445 |
^ displayLabelExtent |
|
5446 |
]. |
|
5447 |
||
5448 |
displayLabel isNil ifTrue:[ |
|
5449 |
displayLabelExtent := 0@0. |
|
5450 |
^ displayLabelExtent |
|
5451 |
]. |
|
5452 |
prevFont := menuPanel setFont:(self font). |
|
5453 |
||
5454 |
displayLabel isArray ifTrue:[ |
|
5455 |
w := h := 0. |
|
5456 |
||
5457 |
displayLabel do:[:aSubLabel| |
|
5458 |
aSubLabel notNil ifTrue:[ |
|
5459 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5460 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5461 |
] ifFalse:[ |
|
5462 |
h := h + (self spaceBetweenEmptyLines) |
|
5463 |
] |
|
5464 |
] |
|
5465 |
] ifFalse:[ |
|
5466 |
w := displayLabel widthOn:menuPanel. |
|
5467 |
h := displayLabel heightOn:menuPanel. |
|
5468 |
]. |
|
5469 |
"/ care for italic fonts - give a few more pixels at the end |
|
5470 |
menuPanel font italic ifTrue:[ |
|
5471 |
w := w + 2. |
|
5472 |
]. |
|
5473 |
displayLabelExtent := w@h. |
|
5474 |
||
5475 |
prevFont notNil ifTrue:[ |
|
5476 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5477 |
]. |
|
5478 |
^ displayLabelExtent |
|
5479 |
! |
|
5480 |
||
1727 | 5481 |
font |
2870 | 5482 |
"returns the user configured font or nil (default menu font)" |
5483 |
||
2373 | 5484 |
|font| |
5485 |
||
5486 |
menuPanel isNil ifTrue:[^ nil]. |
|
5487 |
||
5488 |
font := menuItem font. |
|
5489 |
||
5490 |
font notNil ifTrue:[ |
|
5491 |
font := font onDevice:(menuPanel device). |
|
5492 |
menuItem font:font. |
|
5493 |
]. |
|
1727 | 5494 |
^ font |
5495 |
! |
|
5496 |
||
5497 |
font:aFont |
|
2870 | 5498 |
"returns the user configured font or nil (default menu font)" |
5499 |
||
2373 | 5500 |
menuItem font:aFont. |
1727 | 5501 |
! |
5502 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5503 |
ignoreMnemonicKeys |
2870 | 5504 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5505 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5506 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5507 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5508 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5509 |
ignoreMnemonicKeys:aBoolean |
2870 | 5510 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5511 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5512 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5513 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5514 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5515 |
ignoreShortcutKeys |
2870 | 5516 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5517 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5518 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5519 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5520 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5521 |
ignoreShortcutKeys:aBoolean |
2870 | 5522 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5523 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5524 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5525 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5526 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5527 |
itemValue |
2870 | 5528 |
"gets the items value" |
5529 |
||
2360 | 5530 |
^ menuItem itemValue |
5531 |
! |
|
5532 |
||
5533 |
itemValue:aValue |
|
2870 | 5534 |
"argument could be a value holder, an action or selector" |
5535 |
||
2360 | 5536 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5537 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5538 |
|
388 | 5539 |
label |
2870 | 5540 |
"returns the label" |
5541 |
||
388 | 5542 |
^ label |
5543 |
! |
|
5544 |
||
5545 |
label:aLabel |
|
399 | 5546 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 5547 |
handle characters $& (ST-80 compatibility)" |
5548 |
||
2614 | 5549 |
|size char oldExtent| |
5550 |
||
5551 |
oldExtent := displayLabelExtent. |
|
5552 |
displayLabelExtent := nil. "/ force a recomputation |
|
5553 |
accessCharacter := disabledDisplayLabel := nil. |
|
5554 |
label := aLabel value. |
|
5555 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5556 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5557 |
displayLabel isString ifTrue:[ |
2359 | 5558 |
"CHECK FOR SEPARATOR" |
5559 |
||
5560 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5561 |
size := displayLabel size. |
2359 | 5562 |
|
5563 |
size == 0 ifTrue:[ |
|
2614 | 5564 |
displayLabel := nil. "blank separator" |
2359 | 5565 |
^ self |
5566 |
]. |
|
5567 |
||
5568 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5569 |
char := displayLabel first. |
2359 | 5570 |
|
5571 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5572 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5573 |
displayLabel := nil. |
2359 | 5574 |
^ self |
5575 |
] |
|
5576 |
] |
|
5577 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5578 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5579 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5580 |
displayLabel := displayLabel asArray. |
2359 | 5581 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5582 |
]. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5583 |
menuPanel doAccessCharacterTranslation ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5584 |
displayLabel notNil ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5585 |
displayLabel isArray ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5586 |
displayLabel keysAndValuesDo:[:i :el| |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5587 |
el notNil ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5588 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5589 |
]. |
2614 | 5590 |
]. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5591 |
] ifFalse:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5592 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
2614 | 5593 |
]. |
5594 |
]. |
|
5595 |
]. |
|
5596 |
||
5597 |
menuPanel shown ifTrue:[ |
|
5598 |
self fetchImages. |
|
5599 |
||
5600 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5601 |
self invalidate |
|
5602 |
] ifFalse:[ |
|
5603 |
menuPanel mustRearrange |
|
2359 | 5604 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5605 |
]. |
388 | 5606 |
! |
5607 |
||
5608 |
menuPanel |
|
2870 | 5609 |
"returns my menuPanel" |
5610 |
||
399 | 5611 |
^ menuPanel |
388 | 5612 |
! |
5613 |
||
5614 |
nameKey |
|
2870 | 5615 |
"gets the nameKey" |
5616 |
||
2359 | 5617 |
^ menuItem nameKey |
388 | 5618 |
! |
5619 |
||
5620 |
nameKey:aNameKey |
|
2870 | 5621 |
"sets the nameKey" |
5622 |
||
2359 | 5623 |
menuItem nameKey:aNameKey. |
388 | 5624 |
! |
5625 |
||
5626 |
rawLabel |
|
2870 | 5627 |
"returns my raw, unprocessed label" |
5628 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5629 |
^ menuItem rawLabel |
388 | 5630 |
! |
5631 |
||
5632 |
shortcutKey |
|
5633 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 5634 |
no submenu exists evaluate the action assigned to the item (accept)." |
5635 |
||
2359 | 5636 |
^ menuItem shortcutKey |
388 | 5637 |
! |
5638 |
||
5639 |
shortcutKey:aKey |
|
5640 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 5641 |
no submenu exists evaluate the action assigned to the item (accept)." |
5642 |
||
2359 | 5643 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5644 |
menuItem shortcutKey:aKey. |
|
5645 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5646 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5647 |
! |
388 | 5648 |
|
710 | 5649 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5650 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5651 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 5652 |
|
2359 | 5653 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5654 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5655 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 5656 |
! |
5657 |
||
5658 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5659 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5660 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 5661 |
|
2359 | 5662 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5663 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5664 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 5665 |
! |
5666 |
||
388 | 5667 |
submenu |
3133 | 5668 |
"returns my submenu or creates it if its defined via a selector or channel. |
5669 |
May return nil, if there is really no menu" |
|
5670 |
||
5671 |
subMenu isNil ifTrue:[ |
|
5672 |
self setupSubmenu |
|
5673 |
]. |
|
5674 |
^ subMenu |
|
5675 |
||
5676 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 5677 |
! |
5678 |
||
5679 |
submenu:aSubMenu |
|
2870 | 5680 |
"set a new submenu; an existing submenu will be destroyed. |
5681 |
This might lead to a redraw if 'hasSubmenu' changed" |
|
5682 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5683 |
|widget| |
1767 | 5684 |
|
5685 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5686 |
subMenu notNil ifTrue:[ |
5687 |
subMenu destroy. |
|
5688 |
subMenu := nil. |
|
5689 |
]. |
|
5690 |
^ self |
|
1767 | 5691 |
]. |
5692 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5693 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5694 |
subMenu := MenuPanel new. |
5695 |
||
5696 |
menuPanel notNil ifTrue:[ |
|
5697 |
subMenu receiver:menuPanel receiver. |
|
5698 |
]. |
|
5699 |
subMenu superMenu:menuPanel. |
|
5700 |
||
5701 |
menuItem horizontalLayout == true ifTrue:[ |
|
5702 |
subMenu verticalLayout:false |
|
5703 |
]. |
|
5704 |
subMenu menu:aSubMenu. |
|
1767 | 5705 |
] ifFalse:[ |
2360 | 5706 |
aSubMenu isView ifFalse:[ |
5707 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5708 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5709 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5710 |
]. |
5711 |
widget := SimpleView new. |
|
5712 |
widget client:aSubMenu. |
|
5713 |
] ifTrue:[ |
|
2827 | 5714 |
widget := aSubMenu. |
5715 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
2360 | 5716 |
]. |
5717 |
||
5718 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5719 |
subMenu := widget. |
|
5720 |
||
5721 |
menuItem horizontalLayout == true ifTrue:[ |
|
5722 |
subMenu verticalLayout:false |
|
5723 |
]. |
|
5724 |
] ifFalse:[ |
|
5725 |
subMenu := MenuPanel new. |
|
5726 |
subMenu receiver:menuPanel receiver. |
|
5727 |
subMenu addSubView:widget. |
|
5728 |
subMenu extent:(widget preferredExtent). |
|
5729 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5730 |
]. |
|
5731 |
subMenu superMenu:menuPanel. |
|
5732 |
]. |
|
389 | 5733 |
! |
5734 |
||
3133 | 5735 |
submenuOrNil |
5736 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
5737 |
||
5738 |
^ subMenu |
|
5739 |
||
5740 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
5741 |
! |
|
5742 |
||
390 | 5743 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5744 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5745 |
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
|
5746 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5747 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5748 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5749 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5750 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5751 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5752 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5753 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5754 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5755 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5756 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5757 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5758 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5759 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5760 |
^ nil |
390 | 5761 |
! |
5762 |
||
1841 | 5763 |
triggerOnDown |
2870 | 5764 |
"return true if triggering the action if pressed" |
5765 |
||
2359 | 5766 |
menuItem triggerOnDown ifTrue:[ |
5767 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5768 |
]. |
5769 |
^ false |
|
5770 |
! |
|
5771 |
||
5772 |
triggerOnDown:aBool |
|
2870 | 5773 |
"setup to trigger the action if pressed" |
5774 |
||
2359 | 5775 |
menuItem triggerOnDown:aBool. |
1841 | 5776 |
! |
5777 |
||
389 | 5778 |
value |
2870 | 5779 |
"gets the items value |
5780 |
Left here for ST80 compatibility - value is a bad name" |
|
5781 |
||
2360 | 5782 |
^ menuItem itemValue |
5783 |
! |
|
5784 |
||
5785 |
value:aValue |
|
389 | 5786 |
"could be a value holder, an action or selector |
2870 | 5787 |
Left here for ST80 compatibility - value: is a bad name" |
5788 |
||
2360 | 5789 |
menuItem itemValue:aValue. |
502 | 5790 |
! |
5791 |
||
5792 |
value:aValue argument:anArgument |
|
2870 | 5793 |
"set the value and an argument" |
5794 |
||
2360 | 5795 |
menuItem itemValue:aValue. |
5796 |
menuItem argument:anArgument. |
|
388 | 5797 |
! ! |
5798 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5799 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5800 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5801 |
choice |
2870 | 5802 |
"implements a radio group; the field" |
5803 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5804 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5805 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5806 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5807 |
choice:something |
2870 | 5808 |
"set choice indication" |
5809 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5810 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5811 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5812 |
choice isValueModel ifTrue:[ |
2870 | 5813 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5814 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5815 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5816 |
(choice := something) notNil ifTrue:[ |
2870 | 5817 |
choice isSymbol ifTrue:[ |
5818 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5819 |
choice := something |
|
5820 |
] |
|
5821 |
]. |
|
5822 |
choice isValueModel ifTrue:[ |
|
5823 |
choice addDependent:self |
|
5824 |
] |
|
1699 | 5825 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5826 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5827 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5828 |
choiceValue |
2870 | 5829 |
"implements a radio group; the value writen to the choice if selected" |
5830 |
||
2359 | 5831 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5832 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5833 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5834 |
choiceValue:something |
2870 | 5835 |
"implements a radio group; the value writen to the choice if selected" |
5836 |
||
2359 | 5837 |
menuItem choiceValue ~= something ifTrue:[ |
5838 |
menuItem choiceValue:something. |
|
5839 |
choice notNil ifTrue:[ self invalidate ]. |
|
5840 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5841 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5842 |
|
388 | 5843 |
enabled |
2870 | 5844 |
"returns the enabled state" |
5845 |
||
524 | 5846 |
|state| |
5847 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5848 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5849 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5850 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5851 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5852 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5853 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5854 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5855 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5856 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5857 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5858 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5859 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5860 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5861 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5862 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5863 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5864 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5865 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5866 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5867 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5868 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5869 |
^ state ~~ false |
388 | 5870 |
! |
5871 |
||
389 | 5872 |
enabled:something |
2870 | 5873 |
"change the enabled state; if the state changed, a redraw is performed" |
5874 |
||
390 | 5875 |
|oldState newState| |
5876 |
||
5877 |
enableChannel isNil ifTrue:[ |
|
2870 | 5878 |
oldState := true |
390 | 5879 |
] ifFalse:[ |
2870 | 5880 |
oldState := enableChannel value. |
5881 |
enableChannel isValueModel ifTrue:[ |
|
5882 |
enableChannel removeDependent:self |
|
5883 |
] |
|
388 | 5884 |
]. |
390 | 5885 |
enableChannel := something. |
5886 |
||
5887 |
enableChannel isNil ifTrue:[ |
|
2870 | 5888 |
menuPanel shown ifFalse:[^ self]. |
5889 |
newState := true |
|
390 | 5890 |
] ifFalse:[ |
2870 | 5891 |
enableChannel isValueModel ifTrue:[ |
5892 |
enableChannel addDependent:self |
|
5893 |
] ifFalse:[ |
|
5894 |
enableChannel isSymbol ifTrue:[^ self] |
|
5895 |
]. |
|
5896 |
menuPanel shown ifFalse:[^ self]. |
|
5897 |
newState := enableChannel value. |
|
390 | 5898 |
]. |
5899 |
||
5900 |
newState ~~ oldState ifTrue:[ |
|
2870 | 5901 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5902 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5903 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5904 |
|
1670 | 5905 |
hideMenuOnActivated |
2870 | 5906 |
"hide the menu when the item was activated; the default is true" |
5907 |
||
2359 | 5908 |
^ menuItem hideMenuOnActivated |
1670 | 5909 |
! |
5910 |
||
5911 |
hideMenuOnActivated:aBool |
|
2870 | 5912 |
"hide the menu when the item was activated; the default is true" |
5913 |
||
2359 | 5914 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5915 |
! |
5916 |
||
2216 | 5917 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5918 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5919 |
||
5920 |
(menuPanel receiver isNil |
|
5921 |
and:[ menuPanel application notNil |
|
5922 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5923 |
ifTrue:[ |
|
3147 | 5924 |
^ self "/ suppressed |
2216 | 5925 |
]. |
5926 |
aMessage infoPrintCR |
|
5927 |
! |
|
5928 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5929 |
indication |
2870 | 5930 |
"get on/off indication" |
5931 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5932 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5933 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5934 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5935 |
indication:something |
2870 | 5936 |
"set on/off indication" |
5937 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5938 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5939 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5940 |
indication isValueModel ifTrue:[ |
2870 | 5941 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5942 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5943 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5944 |
(indication := something) notNil ifTrue:[ |
2870 | 5945 |
indication isValueModel ifTrue:[ |
5946 |
indication addDependent:self |
|
5947 |
] ifFalse:[ |
|
5948 |
"/ to force an update of the value |
|
5949 |
self indicationValue |
|
5950 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5951 |
]. |
464 | 5952 |
! |
5953 |
||
1767 | 5954 |
keepLinkedMenu |
2870 | 5955 |
"get the keepLinkedMenu flag" |
5956 |
||
2359 | 5957 |
^ menuItem keepLinkedMenu |
5958 |
! |
|
5959 |
||
5960 |
keepLinkedMenu:aBool |
|
2870 | 5961 |
"get the keepLinkedMenu flag" |
5962 |
||
2359 | 5963 |
menuItem keepLinkedMenu:aBool. |
1767 | 5964 |
! |
5965 |
||
2331 | 5966 |
sendToOriginator |
5967 |
"if true, the message is sent to the originating widget; |
|
5968 |
otherwise (the default), it it sent to the receiver/application." |
|
5969 |
||
2359 | 5970 |
^ menuItem sendToOriginator |
2331 | 5971 |
! |
5972 |
||
5973 |
sendToOriginator:aBoolean |
|
5974 |
"if true, the message is sent to the originating widget; |
|
5975 |
otherwise (the default), it it sent to the receiver/application." |
|
5976 |
||
2359 | 5977 |
menuItem sendToOriginator:aBoolean. |
2331 | 5978 |
! |
5979 |
||
464 | 5980 |
submenuChannel |
2870 | 5981 |
"get the submenu channel" |
5982 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5983 |
^ menuItem submenuChannel |
464 | 5984 |
! |
5985 |
||
5986 |
submenuChannel:aSelectorOrNil |
|
2870 | 5987 |
"returns the submenu channel" |
5988 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5989 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5990 |
! ! |
5991 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5992 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5993 |
|
2016 | 5994 |
moveBy:aPoint |
2870 | 5995 |
"move the layouts origin" |
5996 |
||
2016 | 5997 |
layout moveBy:aPoint. |
5998 |
! |
|
5999 |
||
1699 | 6000 |
preferredExtent |
2870 | 6001 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
6002 |
||
2614 | 6003 |
|isVertical icon wIcon isButton labelExtent |
1699 | 6004 |
x "{ Class:SmallInteger }" |
6005 |
y "{ Class:SmallInteger }" |
|
6006 |
s "{ Class:SmallInteger }" |
|
6007 |
| |
|
6008 |
self isVisible ifFalse:[^ 0@0 ]. |
|
6009 |
||
2359 | 6010 |
isButton := menuItem isButton. |
6011 |
||
1699 | 6012 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6013 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6014 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6015 |
y := s + VerticalButtonInset. |
1699 | 6016 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6017 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6018 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 6019 |
]. |
6020 |
x := x * 2. |
|
6021 |
y := y * 2. |
|
6022 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6023 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6024 |
|
2362 | 6025 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6026 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6027 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6028 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6029 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6030 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6031 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6032 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6033 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6034 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6035 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6036 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6037 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6038 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6039 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6040 |
]. |
1699 | 6041 |
] ifFalse:[ |
2614 | 6042 |
labelExtent := self displayLabelExtent. |
6043 |
||
6044 |
x := x + labelExtent x. |
|
6045 |
y := y + labelExtent y. |
|
3131 | 6046 |
x := x + (menuPanel stringOffsetXfor:self). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6047 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6048 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6049 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6050 |
"width of separator is 2 plus right offset 1 := 3" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6051 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6052 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6053 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6054 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6055 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6056 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6057 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6058 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6059 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6060 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6061 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6062 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6063 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6064 |
x := x + wIcon. |
1699 | 6065 |
]. |
6066 |
^ x@y |
|
388 | 6067 |
! ! |
6068 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6069 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 6070 |
|
6071 |
activeHelpKey |
|
2870 | 6072 |
"get the active helpKey; the key to retrieve the helpText from the application" |
6073 |
||
2359 | 6074 |
^ menuItem activeHelpKey |
1613 | 6075 |
! |
6076 |
||
6077 |
activeHelpKey:aHelpKey |
|
2870 | 6078 |
"set the active helpKey; the key to retrieve the helpText from the application" |
6079 |
||
2359 | 6080 |
menuItem activeHelpKey:aHelpKey. |
6081 |
activeHelpText := nil. |
|
1613 | 6082 |
! |
6083 |
||
6084 |
activeHelpText |
|
2870 | 6085 |
"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
|
6086 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6087 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6088 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6089 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6090 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6091 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6092 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6093 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6094 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6095 |
^ nil |
1613 | 6096 |
! |
6097 |
||
6098 |
activeHelpText:aText |
|
2870 | 6099 |
"set the active helpText" |
6100 |
||
1613 | 6101 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6102 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6103 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6104 |
flyByHelpText |
2870 | 6105 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6106 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6107 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6108 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6109 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6110 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6111 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6112 |
|
2471 | 6113 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
6114 |
"/ (if you have an argument for that let us know..) |
|
6115 |
"/ self isButton ifFalse:[^ nil]. |
|
6116 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6117 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6118 |
"/ if an activeHelpKey was explicitely given, use that one |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6119 |
key := self activeHelpKey. |
2895 | 6120 |
app := menuPanel application. |
6121 |
||
6122 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
6123 |
(key isAssociation) ifTrue:[ |
|
6124 |
app := key key. |
|
6125 |
key := key value. |
|
6126 |
]. |
|
6127 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6128 |
key notNil ifTrue:[ |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6129 |
app notNil ifTrue:[ |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6130 |
text := app flyByHelpTextForKey:key. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6131 |
]. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6132 |
text isNil ifTrue:[ |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6133 |
text := menuPanel flyByHelpTextForKey:key. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6134 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6135 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6136 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6137 |
"/ 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
|
6138 |
text isNil ifTrue:[ |
2676
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6139 |
self hasSubmenu ifTrue:[ |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6140 |
^ key |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6141 |
]. |
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6142 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6143 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6144 |
text isNil ifTrue:[ |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6145 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6146 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6147 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6148 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6149 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6150 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6151 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6152 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6153 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6154 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6155 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6156 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6157 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6158 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6159 |
text := (self updateAccessCharacterFor:text) string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6160 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6161 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6162 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6163 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6164 |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6165 |
(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
|
6166 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6167 |
"for text menus: it does not make sense to show the labels string again |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6168 |
(i.e. in a pull down menu)" |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6169 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6170 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6171 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6172 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6173 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6174 |
flyByHelpText:aText |
2870 | 6175 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
6176 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6177 |
flyByHelpText := aText. |
1613 | 6178 |
! ! |
6179 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6180 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6181 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6182 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6183 |
"on default submenus has a vertical layout; |
2870 | 6184 |
true, the submenu has a horizontal layout." |
6185 |
||
2360 | 6186 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6187 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6188 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6189 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6190 |
"on default submenus has a vertical layout; |
2870 | 6191 |
true, the submenu has a horizontal layout." |
6192 |
||
2360 | 6193 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6194 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6195 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6196 |
isButton |
2870 | 6197 |
"returns whether the item looks like a Button" |
6198 |
||
2359 | 6199 |
^ menuItem isButton |
6200 |
! |
|
6201 |
||
6202 |
isButton:aBool |
|
2870 | 6203 |
"set/clear the item to look like a Button" |
6204 |
||
2359 | 6205 |
menuItem isButton ~~ aBool ifTrue:[ |
6206 |
menuItem isButton:aBool. |
|
6207 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6208 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6209 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6210 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6211 |
layout |
2870 | 6212 |
"returns my layout ( Rectangle )" |
6213 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6214 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6215 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6216 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6217 |
layout:aLayout |
2870 | 6218 |
"set a new layout ( Rectangle )" |
6219 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6220 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6221 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6222 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6223 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6224 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6225 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 6226 |
while performing the menu action. Defaults to false." |
6227 |
||
2359 | 6228 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6229 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6230 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6231 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6232 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 6233 |
while performing the menu action. Defaults to false." |
6234 |
||
2359 | 6235 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6236 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6237 |
|
2504 | 6238 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 6239 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6240 |
currentSubmenu |
2870 | 6241 |
"returns the current submenu or nil" |
6242 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6243 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6244 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6245 |
|
1705 | 6246 |
hideSubmenu |
2870 | 6247 |
"hide submenu" |
6248 |
||
2199 | 6249 |
self hideSubmenu:subMenu. |
6250 |
! |
|
6251 |
||
6252 |
hideSubmenu:aSubmenu |
|
2870 | 6253 |
"hide submenu" |
6254 |
||
2871 | 6255 |
|id wg| |
1705 | 6256 |
|
2374 | 6257 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 6258 |
aSubmenu removeDependencies. |
2199 | 6259 |
|
6260 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6261 |
id := aSubmenu id. |
2374 | 6262 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 6263 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6264 |
aSubmenu hide |
2199 | 6265 |
]. |
6266 |
||
2870 | 6267 |
aSubmenu windowGroup:nil. |
2871 | 6268 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
6269 |
wg removeView:aSubmenu. |
|
6270 |
]. |
|
2199 | 6271 |
|
6272 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6273 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6274 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6275 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6276 |
] |
2199 | 6277 |
]. |
6278 |
! |
|
6279 |
||
6280 |
openDelayedSubmenu |
|
2870 | 6281 |
"called to open now my delayed submenu" |
6282 |
||
3133 | 6283 |
|subMenuBeforeOpening| |
2199 | 6284 |
|
6285 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
6286 |
||
2374 | 6287 |
subMenu notNil ifTrue:[ |
6288 |
subMenu realized ifTrue:[ |
|
6289 |
"/ already open |
|
6290 |
^ self |
|
6291 |
]. |
|
2199 | 6292 |
]. |
3133 | 6293 |
self setupSubmenu. |
6294 |
subMenu isNil ifTrue:[^ self]. |
|
6295 |
subMenuBeforeOpening := subMenu. |
|
2199 | 6296 |
self openSubmenu. |
6297 |
||
3133 | 6298 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
2374 | 6299 |
"/ closed during building or opening the submenu |
3133 | 6300 |
self hideSubmenu:subMenuBeforeOpening. |
6301 |
]. |
|
6302 |
||
6303 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 6304 |
! |
1701 | 6305 |
|
6306 |
openSubmenu |
|
6307 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
6308 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 6309 |
nescessary." |
6310 |
||
3203 | 6311 |
|p o device isVertical topMenu windGrp prefExtent lastEvent |
1701 | 6312 |
devBot "{ Class:SmallInteger }" |
6313 |
devRight "{ Class:SmallInteger }" |
|
6314 |
width "{ Class:SmallInteger }" |
|
6315 |
height "{ Class:SmallInteger }" |
|
6316 |
top "{ Class:SmallInteger }" |
|
6317 |
left "{ Class:SmallInteger }" |
|
6318 |
| |
|
6319 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
6320 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 6321 |
^ self |
1701 | 6322 |
]. |
6323 |
||
6324 |
topMenu := menuPanel topMenu. |
|
1829 | 6325 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 6326 |
subMenu releaseDeviceResources. |
6327 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
6328 |
subMenu recreate. |
|
1829 | 6329 |
]. |
6330 |
||
1701 | 6331 |
windGrp := topMenu windowGroup. |
3203 | 6332 |
windGrp notNil ifTrue:[ |
6333 |
lastEvent := windGrp lastEvent. |
|
6334 |
||
6335 |
(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[ |
|
6336 |
subMenu mapTime:(lastEvent timeStamp). |
|
6337 |
]. |
|
6338 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6339 |
subMenu superMenu:menuPanel. |
1701 | 6340 |
subMenu becomesActiveMenu. |
6341 |
subMenu cursor:Cursor hand. |
|
6342 |
||
6343 |
windGrp notNil ifTrue:[ |
|
2249 | 6344 |
subMenu windowGroup:windGrp. |
6345 |
windGrp addTopView:subMenu. |
|
1701 | 6346 |
]. |
6347 |
||
2111 | 6348 |
"Q&D kludge - test whether the layout is nil; |
2249 | 6349 |
if true recompute the layouts |
2111 | 6350 |
" |
2374 | 6351 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6352 |
|
1701 | 6353 |
" Q&D kludge - if any visibility attributes are blocks; |
6354 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 6355 |
(since I react correctly on valueHolder changes) |
1701 | 6356 |
" |
6357 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6358 |
subMenu fixSize. |
|
6359 |
||
6360 |
"compute origin of subMenu |
|
6361 |
" |
|
6362 |
isVertical := menuPanel verticalLayout. |
|
6363 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6364 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6365 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6366 |
width := prefExtent x. |
1701 | 6367 |
devBot := device usableHeight. |
6368 |
devRight := device usableWidth. |
|
6369 |
||
6370 |
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
|
6371 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6372 |
menuPanel isPopUpView ifTrue:[ |
2249 | 6373 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6374 |
] ifFalse:[ |
2249 | 6375 |
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
|
6376 |
]. |
1701 | 6377 |
left := o x. |
6378 |
top := o y. |
|
6379 |
||
2016 | 6380 |
top + height > devBot ifTrue:[ |
2249 | 6381 |
top := isVertical ifTrue:[devBot - height] |
6382 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 6383 |
]. |
6384 |
top := top max:0. |
|
6385 |
||
6386 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6387 |
"/ top < menuPanel bottom ifTrue:[ |
|
6388 |
"/ left := left + layout width. |
|
6389 |
"/ ]. |
|
6390 |
"/ left + width > devRight ifTrue:[ |
|
6391 |
"/ left := o x - width - 2 |
|
6392 |
"/ ]. |
|
6393 |
"/ ]. |
|
6394 |
||
1701 | 6395 |
left + width > devRight ifTrue:[ |
2249 | 6396 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6397 |
ifFalse:[devRight - width] |
|
1701 | 6398 |
]. |
6399 |
left := left max:0. |
|
6400 |
||
6401 |
subMenu origin:(left@top). |
|
6402 |
||
6403 |
subMenu realized ifFalse:[ |
|
2249 | 6404 |
subMenu realize. |
1701 | 6405 |
] ifTrue:[ |
2249 | 6406 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6407 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6408 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6409 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6410 |
toggleSubmenuVisibility |
2870 | 6411 |
"toggle the visibility of the submenu" |
6412 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6413 |
subMenu notNil ifTrue:[ |
2870 | 6414 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6415 |
] ifFalse:[ |
3133 | 6416 |
self setupSubmenu. |
6417 |
subMenu isNil ifTrue:[ |
|
2870 | 6418 |
"/ cannot open a submenu |
6419 |
^ self |
|
6420 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6421 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6422 |
self openSubmenu. |
3133 | 6423 |
|
6424 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6425 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6426 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6427 |
visibleSubmenu |
2870 | 6428 |
"returns the current visible submenu or nil" |
6429 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6430 |
subMenu notNil ifTrue:[ |
2870 | 6431 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6432 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6433 |
^ nil |
1701 | 6434 |
! ! |
6435 |
||
524 | 6436 |
!MenuPanel::Item methodsFor:'building'! |
6437 |
||
6438 |
aspectAt:aKey |
|
3092 | 6439 |
"returns the value assigned to key or nil" |
2870 | 6440 |
|
524 | 6441 |
|appl value| |
6442 |
||
6443 |
appl := menuPanel receiver. |
|
6444 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6445 |
(appl isValueModel) ifTrue:[ |
2359 | 6446 |
^ appl value:aKey |
524 | 6447 |
]. |
6448 |
||
2123 | 6449 |
appl isNil ifTrue:[ |
2359 | 6450 |
appl := menuPanel application. |
2123 | 6451 |
]. |
6452 |
appl isNil ifTrue:[ ^ nil]. |
|
6453 |
||
6454 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 6455 |
ex selector == aKey ifFalse:[ |
6456 |
ex reject |
|
6457 |
]. |
|
6458 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 6459 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' |
6460 |
bindWith:appl classNameWithArticle with:aKey). |
|
2123 | 6461 |
] do:[ |
2359 | 6462 |
aKey numArgs == 1 ifTrue:[ |
6463 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6464 |
] ifFalse:[ |
|
6465 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6466 |
value := appl aspectFor:aKey |
|
6467 |
] ifFalse:[ |
|
6468 |
value := appl perform:aKey |
|
6469 |
] |
|
6470 |
] |
|
524 | 6471 |
]. |
6472 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6473 |
|
3092 | 6474 |
"Modified: / 05-10-2006 / 03:10:20 / cg" |
524 | 6475 |
! ! |
6476 |
||
390 | 6477 |
!MenuPanel::Item methodsFor:'change & update'! |
6478 |
||
2614 | 6479 |
fontChanged |
2870 | 6480 |
"called whenever the font changed" |
6481 |
||
2614 | 6482 |
displayLabel notNil ifTrue:[ |
6483 |
displayLabelExtent := nil. |
|
6484 |
||
6485 |
subMenu notNil ifTrue:[ |
|
6486 |
subMenu font:(menuPanel font). |
|
6487 |
]. |
|
6488 |
]. |
|
6489 |
! |
|
6490 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6491 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6492 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6493 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6494 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6495 |
(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
|
6496 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6497 |
self isSeparator ifFalse:[ |
2359 | 6498 |
"/ NOT A SEPARATOR |
6499 |
||
6500 |
menuPanel shown ifTrue:[ |
|
6501 |
changedObject == enableChannel ifTrue:[ |
|
6502 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6503 |
^ menuPanel selection:nil. |
|
6504 |
]. |
|
6505 |
^ self invalidate |
|
6506 |
]. |
|
6507 |
||
6508 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6509 |
menuItem isButton ifTrue:[ |
|
6510 |
self invalidate |
|
6511 |
] ifFalse:[ |
|
6512 |
"/ invalidate the interactor only |
|
6513 |
"/ take any interactor; interactors has the same extent |
|
6514 |
form := menuPanel iconIndicationOff. |
|
6515 |
||
6516 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6517 |
top:(layout top) |
|
6518 |
width:(form width) |
|
6519 |
height:(layout height). |
|
6520 |
||
6521 |
menuPanel invalidate:rect repairNow:false |
|
6522 |
]. |
|
6523 |
^ self |
|
6524 |
]. |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6525 |
self invalidate. |
2359 | 6526 |
]. |
498 | 6527 |
]. |
712 | 6528 |
|
6529 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6530 |
menuPanel mustRearrange. |
6531 |
menuPanel rearrangeItems. |
|
6532 |
^ self. |
|
712 | 6533 |
]. |
6534 |
||
498 | 6535 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6536 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6537 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6538 |
updateIndicators |
2870 | 6539 |
"update indicators " |
6540 |
||
2934 | 6541 |
indication notNil ifTrue:[ |
6542 |
(indication isSymbol |
|
6543 |
or:[menuItem hideMenuOnActivated not]) |
|
6544 |
ifTrue:[ |
|
6545 |
"indication is a selector; |
|
6546 |
otherwise no need to redraw, because |
|
6547 |
a change notification is raised from the model !!!!" |
|
6548 |
self update:nil with:nil from:indication |
|
6549 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6550 |
] |
390 | 6551 |
! ! |
6552 |
||
388 | 6553 |
!MenuPanel::Item methodsFor:'converting'! |
6554 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6555 |
asMenuItem |
2870 | 6556 |
"convert to a MenuItem" |
6557 |
||
2359 | 6558 |
^ menuItem |
388 | 6559 |
! |
6560 |
||
2827 | 6561 |
menuItem |
6562 |
^ menuItem |
|
6563 |
! |
|
6564 |
||
388 | 6565 |
menuItem:aMenuItem |
2870 | 6566 |
"setup attributes from a MenuItem" |
6567 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6568 |
|lbl| |
389 | 6569 |
|
388 | 6570 |
menuPanel disabledRedrawDo:[ |
2359 | 6571 |
menuItem := aMenuItem. |
6572 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6573 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6574 |
label := displayLabel := activeHelpText := nil. |
2359 | 6575 |
|
6576 |
self enabled:(menuItem enabled). |
|
6577 |
self indication:(menuItem indication). |
|
6578 |
self choice:(menuItem choice). |
|
6579 |
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
|
6580 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6581 |
"/ 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
|
6582 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6583 |
|
2359 | 6584 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6585 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6586 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6587 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6588 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6589 |
self label:lbl. |
388 | 6590 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6591 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6592 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6593 |
! ! |
6594 |
||
2681 | 6595 |
!MenuPanel::Item methodsFor:'dependents access'! |
6596 |
||
6597 |
addDependencies |
|
2870 | 6598 |
"add all dependencies" |
6599 |
||
2681 | 6600 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
6601 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
6602 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
6603 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
6604 |
! |
|
6605 |
||
6606 |
removeDependencies |
|
2870 | 6607 |
"remove all dependencies" |
6608 |
||
2681 | 6609 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
6610 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
6611 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
6612 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
6613 |
! ! |
|
6614 |
||
388 | 6615 |
!MenuPanel::Item methodsFor:'drawing'! |
6616 |
||
2768 | 6617 |
choiceForm |
2870 | 6618 |
"returns choice form or nil" |
6619 |
||
2768 | 6620 |
|isOn| |
6621 |
||
6622 |
choice isNil ifTrue:[^ nil]. |
|
6623 |
||
6624 |
isOn := (choice value = menuItem choiceValue). |
|
6625 |
self enabled ifFalse:[ |
|
6626 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
|
6627 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
6628 |
]. |
|
6629 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
|
6630 |
ifFalse:[menuPanel iconRadioGroupOff] |
|
6631 |
! |
|
6632 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6633 |
draw |
2870 | 6634 |
"redraw this item" |
6635 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6636 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6637 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6638 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6639 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6640 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6641 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6642 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6643 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6644 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6645 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6646 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6647 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6648 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6649 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6650 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6651 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6652 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6653 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6654 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6655 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6656 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6657 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6658 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6659 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6660 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6661 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6662 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6663 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6664 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6665 |
]]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6666 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6667 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6668 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6669 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6670 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6671 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6672 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6673 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6674 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6675 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6676 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6677 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6678 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6679 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6680 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6681 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6682 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6683 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6684 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6685 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6686 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6687 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6688 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6689 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6690 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6691 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6692 |
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6693 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6694 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6695 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6696 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6697 |
drawButton |
2870 | 6698 |
"draw as button" |
6699 |
||
2362 | 6700 |
|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
|
6701 |
x "{ Class:SmallInteger }" |
2143 | 6702 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6703 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6704 |
drawObject := displayLabel. |
2362 | 6705 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6706 |
isSelected := self isSelected. |
2362 | 6707 |
|
6708 |
isSelected ifFalse:[ |
|
6709 |
"/ test whether button has pressed toggle behaviour |
|
6710 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6711 |
] ifTrue:[ |
|
6712 |
showSelected := isSelected |
|
6713 |
]. |
|
6714 |
||
6715 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6716 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6717 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6718 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6719 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6720 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6721 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6722 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6723 |
]. |
2059 | 6724 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6725 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6726 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6727 |
fg := menuPanel disabledForegroundColor. |
2059 | 6728 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6729 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6730 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6731 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6732 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6733 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6734 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6735 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6736 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6737 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6738 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6739 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6740 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6741 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6742 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6743 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6744 |
|
6745 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6746 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6747 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6748 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6749 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6750 |
"check whether button should be drawn selected; indicator or radio button" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6751 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6752 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6753 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6754 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6755 |
] ifFalse:[ |
2359 | 6756 |
isSelected := (choice notNil and:[choice value = menuItem choiceValue]). |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6757 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6758 |
]. |
2143 | 6759 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6760 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6761 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6762 |
level := menuPanel buttonActiveLevel. |
2142 | 6763 |
x := x + 1 "level abs". |
2143 | 6764 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6765 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6766 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6767 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6768 |
]. |
6769 |
||
2817 | 6770 |
drawObject notEmptyOrNil ifTrue:[ |
2362 | 6771 |
etchFg notNil ifTrue:[ |
6772 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6773 |
]. |
|
6774 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6775 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6776 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6777 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6778 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6779 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6780 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6781 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6782 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6783 |
drawLabel |
2870 | 6784 |
"draw a labeled entry; no button, no separator." |
6785 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6786 |
|scKey cLb cLa drawObject fg etchFg arrow |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6787 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6788 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6789 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6790 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6791 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6792 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6793 |
drawObject := displayLabel. |
2362 | 6794 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6795 |
isSelected := self isSelected. |
2362 | 6796 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6797 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6798 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6799 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6800 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6801 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6802 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6803 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6804 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6805 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6806 |
] ifFalse:[ |
2362 | 6807 |
fg := menuPanel disabledForegroundColor. |
6808 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6809 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6810 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6811 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6812 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6813 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6814 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6815 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6816 |
|
3131 | 6817 |
( (form := self indicatorForm) notNil |
6818 |
or:[(form := self choiceForm) notNil] |
|
6819 |
) ifTrue:[ |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6820 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6821 |
form displayOn:menuPanel x:x y:y. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6822 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6823 |
|
2817 | 6824 |
drawObject notEmptyOrNil ifTrue:[ |
3131 | 6825 |
x := x + (menuPanel stringOffsetXfor:self). |
6826 |
||
2362 | 6827 |
etchFg notNil ifTrue:[ |
6828 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6829 |
]. |
|
6830 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6831 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6832 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6833 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6834 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6835 |
|
2359 | 6836 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6837 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6838 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6839 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6840 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6841 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6842 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6843 |
scKey displayOn:menuPanel x:x y:y. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6844 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6845 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6846 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6847 |
|
2362 | 6848 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6849 |
^ self |
|
6850 |
]. |
|
6851 |
arrow := menuPanel rightArrow. |
|
6852 |
x := layout right - arrow width - HorizontalInset. |
|
3131 | 6853 |
y := t + ((h - arrow height) // 2). |
2362 | 6854 |
|
6855 |
(menuPanel styleSheet is3D not |
|
6856 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6857 |
^ menuPanel displayForm:arrow x:x y:y |
|
6858 |
]. |
|
6859 |
cLa := menuPanel shadowColor. |
|
6860 |
cLb := menuPanel lightColor. |
|
6861 |
||
6862 |
isSelected ifFalse:[ |
|
6863 |
fg := cLa. |
|
6864 |
cLa := cLb. |
|
6865 |
cLb := fg |
|
6866 |
]. |
|
6867 |
menuPanel paint:cLa. |
|
6868 |
menuPanel displayForm:arrow x:x y:y. |
|
6869 |
menuPanel paint:cLb. |
|
6870 |
menuPanel displayForm:drawObject x:x y:y. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6871 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6872 |
"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
|
6873 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6874 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6875 |
drawMenuIndicator |
2870 | 6876 |
"draw a menu indicator if the item has a menu or delayed menu." |
6877 |
||
2220 | 6878 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6879 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6880 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6881 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6882 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6883 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6884 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6885 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6886 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6887 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6888 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6889 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6890 |
x := layout right - icon width. |
2460 | 6891 |
false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[ |
2220 | 6892 |
y := layout height - icon height // 2 + layout top. |
6893 |
] ifFalse:[ |
|
6894 |
y := layout bottom - icon height - 2. |
|
6895 |
]. |
|
6896 |
||
6897 |
bAbsLevel := 0. |
|
2359 | 6898 |
menuItem isButton ifTrue:[ |
2220 | 6899 |
self isSelected ifTrue:[ |
6900 |
x := x + 1. |
|
6901 |
y := y + 1. |
|
6902 |
]. |
|
6903 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6904 |
x := x - bAbsLevel. |
|
6905 |
y := y - bAbsLevel. |
|
6906 |
]. |
|
6907 |
x := x - 1 "- HorizontalInset". |
|
6908 |
||
6909 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6910 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6911 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6912 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6913 |
|
2234 | 6914 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2761 | 6915 |
ifTrue:[ |
2220 | 6916 |
menuPanel paint:menuPanel buttonShadowColor. |
6917 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6918 |
menuPanel paint:menuPanel buttonLightColor. |
|
6919 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6920 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6921 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6922 |
|
2059 | 6923 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 6924 |
"draw a labeled entry; no button, no separator." |
6925 |
||
2614 | 6926 |
|mfont labelExtent |
1727 | 6927 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6928 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6929 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6930 |
| |
2059 | 6931 |
|
2373 | 6932 |
mfont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6933 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6934 |
menuPanel paint:fg. |
2614 | 6935 |
labelExtent := self displayLabelExtent. |
6936 |
||
6937 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 6938 |
"/ menuPanel centerItems ifTrue:[self halt]. |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6939 |
aLabel isArray ifFalse:[ |printLabel| |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6940 |
aLabel isText ifTrue:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6941 |
"/background of label already drawn |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6942 |
printLabel := aLabel withoutEmphasis:#backgroundColor. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6943 |
] ifFalse:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6944 |
printLabel := aLabel. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6945 |
]. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6946 |
y := y + (printLabel ascentOn:menuPanel). |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6947 |
printLabel displayOn:menuPanel x:x y:y. |
1727 | 6948 |
] ifTrue:[ |
2337 | 6949 |
aLabel do:[:el| |
6950 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6951 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6952 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6953 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6954 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6955 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6956 |
"/ ]. |
2614 | 6957 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 6958 |
el displayOn:menuPanel x:x0 y:y0. |
6959 |
y := y + 1 + (el heightOn:menuPanel) |
|
6960 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6961 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 6962 |
] |
6963 |
]. |
|
1727 | 6964 |
]. |
6965 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6966 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6967 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6968 |
drawSeparatingLines |
2870 | 6969 |
"draw separating lines" |
6970 |
||
2059 | 6971 |
|myIndex lfSep rtSep items prevItem nextItem |
6972 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6973 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6974 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6975 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6976 |
b "{ Class:SmallInteger }" |
706 | 6977 |
| |
2059 | 6978 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6979 |
items := menuPanel items. |
2059 | 6980 |
myIndex := items identityIndexOf:self. |
6981 |
||
6982 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6983 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6984 |
||
6985 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6986 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6987 |
||
6988 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2870 | 6989 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6990 |
]. |
2059 | 6991 |
|
6992 |
lightColor := menuPanel lightColor. |
|
6993 |
shadowColor := menuPanel shadowColor. |
|
6994 |
||
6995 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6996 |
|
608 | 6997 |
l := layout left. |
6998 |
t := layout top. |
|
6999 |
r := layout right. |
|
7000 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7001 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7002 |
menuPanel verticalLayout ifTrue:[ |
2870 | 7003 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
7004 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
7005 |
||
7006 |
menuPanel paint:shadowColor. |
|
7007 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
7008 |
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
|
7009 |
] ifFalse:[ |
2870 | 7010 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
7011 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
7012 |
||
7013 |
menuPanel paint:shadowColor. |
|
7014 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
7015 |
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
|
7016 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7017 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7018 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7019 |
drawSeparator |
2870 | 7020 |
"draw as separator" |
7021 |
||
2059 | 7022 |
|type lightColor shadowColor isDouble |
7023 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7024 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7025 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7026 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7027 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7028 |
| |
2059 | 7029 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7030 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7031 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2870 | 7032 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7033 |
]. |
2059 | 7034 |
|
7035 |
isDouble := type == #doubleLine. |
|
7036 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7037 |
lightColor := menuPanel lightColor. |
2059 | 7038 |
shadowColor := menuPanel shadowColor. |
7039 |
menuPanel paint:shadowColor. |
|
7040 |
||
7041 |
left := layout left. |
|
7042 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7043 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7044 |
menuPanel verticalLayout ifTrue:[ |
2870 | 7045 |
x0 := left + HorizontalInset. |
7046 |
x1 := layout right - HorizontalInset. |
|
7047 |
y0 := top - 1 + (layout height // 2). |
|
7048 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
7049 |
||
7050 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
7051 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
7052 |
||
7053 |
menuPanel paint:lightColor. |
|
7054 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
7055 |
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
|
7056 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7057 |
] ifFalse:[ |
2870 | 7058 |
y1 := layout bottom. |
7059 |
x0 := left - 1 + (layout width // 2). |
|
7060 |
y0 := top. |
|
7061 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
7062 |
||
7063 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
7064 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
7065 |
||
7066 |
menuPanel paint:lightColor. |
|
7067 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
7068 |
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
|
7069 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7070 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7071 |
|
2768 | 7072 |
indicatorForm |
2870 | 7073 |
"returns indication form or nil" |
7074 |
||
2768 | 7075 |
|val| |
7076 |
||
7077 |
indication isNil ifTrue:[^ nil]. |
|
7078 |
||
7079 |
val := self indicationValue. |
|
7080 |
self enabled ifFalse:[ |
|
2870 | 7081 |
^ val == true |
7082 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
7083 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 7084 |
]. |
7085 |
^ val == true |
|
2870 | 7086 |
ifTrue:[menuPanel iconIndicationOn] |
7087 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 7088 |
! |
7089 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7090 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7091 |
|
2362 | 7092 |
layout isNil ifTrue:[^ self]. |
7093 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7094 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 7095 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7096 |
] |
388 | 7097 |
! ! |
7098 |
||
7099 |
!MenuPanel::Item methodsFor:'initialization'! |
|
7100 |
||
7101 |
destroy |
|
2870 | 7102 |
"destroy submenus, remove dependencies" |
7103 |
||
616 | 7104 |
self submenu:nil. |
2681 | 7105 |
self removeDependencies. |
616 | 7106 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7107 |
menuPanel := nil. |
616 | 7108 |
! |
7109 |
||
794 | 7110 |
in:aPanel |
2870 | 7111 |
"create item in a menuPanel" |
7112 |
||
794 | 7113 |
menuPanel := aPanel. |
2359 | 7114 |
|
7115 |
menuItem isNil ifTrue:[ |
|
7116 |
self halt. |
|
7117 |
menuItem := MenuItem new |
|
7118 |
]. |
|
7119 |
! |
|
7120 |
||
7121 |
initialize |
|
7122 |
menuItem := MenuItem new. |
|
1811 | 7123 |
! |
7124 |
||
7125 |
reinitStyle |
|
7126 |
||
7127 |
subMenu notNil ifTrue:[ |
|
3147 | 7128 |
subMenu reinitStyle |
1811 | 7129 |
]. |
7130 |
||
7131 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
7132 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 7133 |
! ! |
7134 |
||
7135 |
!MenuPanel::Item methodsFor:'label basics'! |
|
7136 |
||
7137 |
disabledRawLabel |
|
2870 | 7138 |
"returns the label used if the item is disabled" |
7139 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7140 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7141 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7142 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7143 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7144 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7145 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7146 |
disabledDisplayLabel isString ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7147 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7148 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7149 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7150 |
block := [:el| |rslt| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7151 |
(rslt := el) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7152 |
el isImageOrForm ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7153 |
el colorMap notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7154 |
rslt := menuPanel lightenedImageOnDevice:el |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7155 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7156 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7157 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7158 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7159 |
form := menuPanel lightenedImageOnDevice:form |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7160 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7161 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7162 |
image := menuPanel lightenedImageOnDevice:image |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7163 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7164 |
rslt := LabelAndIcon form:form image:image string:(el string). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7165 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7166 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7167 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7168 |
rslt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7169 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7170 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7171 |
displayLabel isArray ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7172 |
disabledDisplayLabel := Array new:(displayLabel size). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7173 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7174 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7175 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7176 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7177 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7178 |
disabledDisplayLabel := block value:displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7179 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7180 |
^ disabledDisplayLabel |
794 | 7181 |
! |
7182 |
||
1829 | 7183 |
fetchDeviceResources |
2373 | 7184 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7185 |
disabledDisplayLabel := nil. |
1829 | 7186 |
self fetchImages. |
7187 |
! |
|
7188 |
||
616 | 7189 |
fetchImages |
2870 | 7190 |
"fetch my icon images" |
7191 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7192 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7193 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7194 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7195 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7196 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7197 |
displayLabel isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7198 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7199 |
^ self. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7200 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7201 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7202 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7203 |
(icon := displayLabel image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7204 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7205 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7206 |
(icon := displayLabel icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7207 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7208 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7209 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7210 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7211 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7212 |
displayLabel isArray ifFalse:[^ self]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7213 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7214 |
displayLabel keysAndValuesDo:[:i :el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7215 |
(el notNil and:[el isString not]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7216 |
el isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7217 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7218 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7219 |
el class == LabelAndIcon ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7220 |
(icon := el image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7221 |
el image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7222 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7223 |
(icon := el icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7224 |
el icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7225 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7226 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7227 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7228 |
] |
1078 | 7229 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7230 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7231 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7232 |
updateAccessCharacterFor:aLabel |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7233 |
"replace the & by the short-key attribute (i.e. underline it)" |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7234 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7235 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7236 |
|
3192 | 7237 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7238 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7239 |
aLabel isString ifFalse:[ |
2359 | 7240 |
aLabel class == LabelAndIcon ifTrue:[ |
7241 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
7242 |
]. |
|
7243 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7244 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7245 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7246 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7247 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7248 |
label := aLabel. |
2359 | 7249 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7250 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7251 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 7252 |
rest := label copyFrom:(i+1). |
7253 |
||
7254 |
i == 1 ifTrue:[label := rest] |
|
7255 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
7256 |
||
7257 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
7258 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7259 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7260 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7261 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 7262 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7263 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7264 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7265 |
label isText ifFalse:[ |
2359 | 7266 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7267 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7268 |
label emphasisAt:pos add:#underline. |
2359 | 7269 |
^ label |
388 | 7270 |
! ! |
7271 |
||
1573 | 7272 |
!MenuPanel::Item methodsFor:'printing & storing'! |
7273 |
||
7274 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7275 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7276 |
|
1573 | 7277 |
! ! |
7278 |
||
388 | 7279 |
!MenuPanel::Item methodsFor:'private'! |
7280 |
||
650 | 7281 |
activeBackgroundColor |
2870 | 7282 |
"returns the active background color derived from menuPanel" |
7283 |
||
2359 | 7284 |
menuItem isButton ifTrue:[ |
7285 |
^ menuPanel buttonActiveBackgroundColor |
|
7286 |
]. |
|
7287 |
^ menuPanel activeBackgroundColor |
|
650 | 7288 |
! |
7289 |
||
7290 |
activeForegroundColor |
|
2870 | 7291 |
"returns the active foreground color derived from menuPanel" |
650 | 7292 |
|
7293 |
^menuPanel activeForegroundColor |
|
7294 |
! |
|
7295 |
||
727 | 7296 |
backgroundColor |
2870 | 7297 |
"returns the background color derived from menuPanel" |
7298 |
||
2359 | 7299 |
menuItem isButton ifTrue:[ |
7300 |
^ menuPanel buttonPassiveBackgroundColor |
|
7301 |
]. |
|
7302 |
^ menuPanel backgroundColor |
|
727 | 7303 |
! |
7304 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7305 |
backgroundColorFromLabel |
2870 | 7306 |
"returns the background color derived from label or nil" |
7307 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7308 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7309 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7310 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7311 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7312 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7313 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7314 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7315 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7316 |
run size == 0 ifTrue:[ |
2870 | 7317 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
7318 |
^ run value |
|
7319 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7320 |
] ifFalse:[ |
2870 | 7321 |
run do:[:r| |
7322 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
7323 |
^ r value |
|
7324 |
] |
|
7325 |
] |
|
388 | 7326 |
]. |
7327 |
^ nil |
|
7328 |
! |
|
7329 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7330 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7331 |
"returns the background color to use when thhe mouse has entered |
2870 | 7332 |
derived from menuPanel" |
7333 |
||
2359 | 7334 |
menuItem isButton ifTrue:[ |
7335 |
^ menuPanel buttonEnteredBackgroundColor |
|
7336 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7337 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7338 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7339 |
|
663 | 7340 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7341 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7342 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7343 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7344 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7345 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7346 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7347 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7348 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7349 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7350 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7351 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7352 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7353 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7354 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7355 |
numArgs == 0 ifTrue:[ |
2359 | 7356 |
MessageNotUnderstood handle:[:ex | |
7357 |
|selector| |
|
7358 |
||
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7359 |
((selector := ex selector) == sel |
2359 | 7360 |
or:[selector == #aspectFor:]) ifFalse:[ |
7361 |
ex reject |
|
7362 |
]. |
|
7363 |
] do:[ |
|
7364 |
subm := aRecv aspectFor:sel. |
|
7365 |
]. |
|
7366 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7367 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7368 |
|
2043 | 7369 |
(Array with:(aRecv) with:(aRecv class)) |
7370 |
do:[:aPossibleReceiver | |
|
2359 | 7371 |
MessageNotUnderstood handle:[:ex| |
7372 |
ex message selector == sel ifFalse:[ ex reject ] |
|
7373 |
] do:[ |
|
7374 |
numArgs == 0 ifTrue:[ |
|
7375 |
subm := aPossibleReceiver perform:sel |
|
7376 |
] ifFalse:[ |
|
7377 |
numArgs == 1 ifTrue:[ |
|
7378 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
7379 |
] ifFalse:[ |
|
7380 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
7381 |
] |
|
7382 |
] |
|
7383 |
]. |
|
7384 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7385 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7386 |
|
663 | 7387 |
^ subm |
2043 | 7388 |
|
7389 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 7390 |
! |
7391 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7392 |
indicationValue |
2870 | 7393 |
"returns indication value or nil in case of no indication" |
7394 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7395 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7396 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7397 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7398 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7399 |
indication isSymbol ifFalse:[ |
2359 | 7400 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7401 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7402 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7403 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 7404 |
recv := menuPanel receiver. |
7405 |
||
7406 |
(recv isValueModel) ifFalse:[ |
|
7407 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
7408 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
7409 |
sel := sel asSymbol. |
|
7410 |
||
7411 |
MessageNotUnderstood handle:[:ex| |
|
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7412 |
ex selector == sel ifFalse:[ |
2359 | 7413 |
ex reject |
7414 |
]. |
|
7415 |
] do:[ |
|
7416 |
sel := recv perform:sel with:(menuItem argument) |
|
7417 |
] |
|
7418 |
]. |
|
7419 |
]. |
|
7420 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7421 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7422 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7423 |
numArgs ~~ 0 ifTrue:[ |
2359 | 7424 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7425 |
] ifFalse:[ |
2359 | 7426 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7427 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7428 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7429 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7430 |
sel isValueModel ifTrue:[ |
2359 | 7431 |
indication := sel. |
7432 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7433 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7434 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7435 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7436 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7437 |
indicationValue:aValue |
2870 | 7438 |
"set the indication value" |
7439 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7440 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7441 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7442 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7443 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7444 |
indication isSymbol ifFalse:[ |
2359 | 7445 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
7446 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7447 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7448 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7449 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 7450 |
^ self |
1218 | 7451 |
]. |
7452 |
||
524 | 7453 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7454 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7455 |
|
1218 | 7456 |
recv isNil ifTrue:[ |
2359 | 7457 |
recv := menuPanel application. |
7458 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7459 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7460 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7461 |
MessageNotUnderstood handle:[:ex| |
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7462 |
(ex selector ~~ indication) ifTrue:[ |
2359 | 7463 |
ex reject |
7464 |
]. |
|
7465 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 7466 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
7467 |
bindWith:recv classNameWithArticle with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7468 |
] do:[ |
2359 | 7469 |
numArgs == 1 ifTrue:[ |
7470 |
recv perform:indication with:aValue |
|
7471 |
] ifFalse:[ |
|
7472 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
7473 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7474 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7475 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7476 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7477 |
isEntered |
2870 | 7478 |
"returns true if the mouse pointer is over the item" |
7479 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7480 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7481 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7482 |
"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
|
7483 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7484 |
|
464 | 7485 |
separatorType |
2870 | 7486 |
"returns type of separator line or nil" |
7487 |
||
390 | 7488 |
|c lbl| |
388 | 7489 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7490 |
self isSeparator ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7491 |
^ nil |
388 | 7492 |
]. |
7493 |
||
390 | 7494 |
(lbl := label value) isNil ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7495 |
^ #singleLine |
388 | 7496 |
]. |
7497 |
||
390 | 7498 |
lbl size == 1 ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7499 |
c := lbl first. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7500 |
c == $- ifTrue:[^ #singleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7501 |
c == $= ifTrue:[^ #doubleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7502 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7503 |
^ #blankLine |
1130 | 7504 |
! |
7505 |
||
7506 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7507 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7508 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7509 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7510 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7511 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7512 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7513 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7514 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7515 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7516 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7517 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7518 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7519 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7520 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7521 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7522 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7523 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7524 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7525 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7526 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7527 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7528 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7529 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7530 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7531 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7532 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7533 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7534 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7535 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7536 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7537 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7538 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7539 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7540 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7541 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7542 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7543 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7544 |
submenuEncoding := submenu. |
3222 | 7545 |
submenu := Menu decodeFromLiteralArray:submenuEncoding. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7546 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7547 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7548 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7549 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7550 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7551 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7552 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7553 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7554 |
self submenu:submenu. |
1130 | 7555 |
^ subMenu |
7556 |
||
3222 | 7557 |
"Modified: / 27-03-2007 / 08:43:25 / cg" |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7558 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7559 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7560 |
spaceBetweenEmptyLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7561 |
^ 3 |
388 | 7562 |
! ! |
7563 |
||
7564 |
!MenuPanel::Item methodsFor:'queries'! |
|
7565 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7566 |
canChangeVisibility |
1699 | 7567 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 7568 |
otherwise there is a change notification raised if the model changed" |
7569 |
||
3122 | 7570 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 7571 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 7572 |
|
7573 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 7574 |
"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
|
7575 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7576 |
|
388 | 7577 |
canSelect |
1699 | 7578 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 7579 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
7580 |
||
2362 | 7581 |
self isSeparator ifTrue:[^ false]. |
7582 |
||
7583 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 7584 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
7585 |
^ true |
|
7586 |
]. |
|
1078 | 7587 |
]. |
7588 |
^ false |
|
388 | 7589 |
! |
7590 |
||
2046 | 7591 |
containsPoint:aPoint |
2870 | 7592 |
"returns true if aPoint is contained in my layout" |
7593 |
||
2046 | 7594 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2870 | 7595 |
^ layout containsPoint:aPoint |
2046 | 7596 |
]. |
7597 |
^ false |
|
7598 |
||
7599 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
7600 |
! |
|
7601 |
||
388 | 7602 |
containsPointX:x y:y |
2870 | 7603 |
"returns true if point is contained in my layout" |
7604 |
||
712 | 7605 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2870 | 7606 |
^ layout containsPointX:x y:y |
505 | 7607 |
]. |
7608 |
^ false |
|
388 | 7609 |
! |
7610 |
||
2199 | 7611 |
hasDelayedMenu |
2870 | 7612 |
"returns true if a delayed menu exists" |
7613 |
||
2360 | 7614 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7615 |
^ false |
2199 | 7616 |
]. |
2360 | 7617 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7618 |
||
7619 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7620 |
^ false |
2199 | 7621 |
]. |
7622 |
^ true |
|
7623 |
! |
|
7624 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7625 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7626 |
"returns true if the item has a delayed menu |
2870 | 7627 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
7628 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7629 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7630 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7631 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7632 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7633 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7634 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7635 |
hasIndication |
2870 | 7636 |
"returns true if on/off indication exists" |
7637 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7638 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7639 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7640 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7641 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7642 |
"returns true if the item has a delayed menu |
2870 | 7643 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
7644 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7645 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7646 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7647 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7648 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7649 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7650 |
|
388 | 7651 |
hasSubmenu |
2870 | 7652 |
"returns true if the item is configured as an subMenu entry" |
7653 |
||
7654 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
|
388 | 7655 |
! |
7656 |
||
7657 |
isEnabled |
|
2870 | 7658 |
"returns the enabled state" |
7659 |
||
388 | 7660 |
^ self enabled |
7661 |
! |
|
7662 |
||
608 | 7663 |
isSeparator |
2870 | 7664 |
"returns true if item is a separator" |
7665 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7666 |
^ displayLabel isNil |
608 | 7667 |
! |
7668 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7669 |
isToggle |
2870 | 7670 |
"returns true if on/off indication exists" |
7671 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7672 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7673 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7674 |
|
712 | 7675 |
isVisible |
2870 | 7676 |
"returns the visibility state" |
7677 |
||
712 | 7678 |
|state| |
7679 |
||
7680 |
isVisible isSymbol ifTrue:[ |
|
2870 | 7681 |
state := self aspectAt:isVisible. |
7682 |
||
7683 |
state isValueModel ifTrue:[ |
|
7684 |
isVisible := state. |
|
7685 |
isVisible addDependent:self. |
|
7686 |
state := isVisible. |
|
7687 |
] |
|
712 | 7688 |
] ifFalse:[ |
2870 | 7689 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7690 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7691 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7692 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7693 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7694 |
! |
7695 |
||
7696 |
isVisible:something |
|
2870 | 7697 |
"change the visibility state; if the state changed, a redraw is performed" |
7698 |
||
712 | 7699 |
|oldState newState| |
7700 |
||
7701 |
isVisible isNil ifTrue:[ |
|
2870 | 7702 |
oldState := true |
712 | 7703 |
] ifFalse:[ |
2870 | 7704 |
oldState := isVisible value. |
7705 |
isVisible isValueModel ifTrue:[ |
|
7706 |
isVisible removeDependent:self |
|
7707 |
] |
|
712 | 7708 |
]. |
7709 |
isVisible := something. |
|
7710 |
||
7711 |
isVisible isNil ifTrue:[ |
|
2870 | 7712 |
newState := true |
712 | 7713 |
] ifFalse:[ |
2870 | 7714 |
isVisible isValueModel ifTrue:[ |
7715 |
isVisible addDependent:self |
|
7716 |
] ifFalse:[ |
|
7717 |
isVisible isSymbol ifTrue:[^ self] |
|
7718 |
]. |
|
7719 |
menuPanel shown ifFalse:[^ self]. |
|
7720 |
newState := isVisible value. |
|
712 | 7721 |
]. |
7722 |
||
7723 |
newState ~~ oldState ifTrue:[ |
|
2870 | 7724 |
menuPanel mustRearrange |
712 | 7725 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7726 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7727 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7728 |
! |
7729 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7730 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7731 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7732 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7733 |
|
388 | 7734 |
shortcutKeyAsString |
3301 | 7735 |
"converts shortcutKey to a text object for the menu-label-hint" |
2870 | 7736 |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7737 |
|shortcutKey| |
2359 | 7738 |
|
7739 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7740 |
|
7741 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7742 |
^ nil |
1609 | 7743 |
]. |
7744 |
shortcutKey isCharacter ifTrue:[ |
|
3301 | 7745 |
shortcutKey == Character space ifFalse:[ |
7746 |
^ 'Space' |
|
7747 |
]. |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7748 |
^ shortcutKey asString |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7749 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7750 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7751 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7752 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 7753 |
! ! |
7754 |
||
7755 |
!MenuPanel::Item methodsFor:'selection'! |
|
7756 |
||
7757 |
isSelected |
|
2870 | 7758 |
"returns true if item is selected" |
1998 | 7759 |
|
7760 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 7761 |
! |
7762 |
||
2249 | 7763 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7764 |
"change selection to a state. Dependant on the state open or hide an existing |
2870 | 7765 |
submenu and perform a redraw" |
7766 |
||
2249 | 7767 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
7768 |
self invalidate. |
|
7769 |
self hideSubmenu. |
|
2359 | 7770 |
^ self |
2249 | 7771 |
]. |
7772 |
||
2199 | 7773 |
menuPanel realized ifFalse:[ ^ self ]. |
7774 |
||
2359 | 7775 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 7776 |
self invalidate |
2199 | 7777 |
]. |
7778 |
self hasSubmenu ifFalse:[ ^ self]. |
|
7779 |
||
7780 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 7781 |
menuPanel openDelayed:self |
2199 | 7782 |
] ifFalse:[ |
3133 | 7783 |
self setupSubmenu. |
2374 | 7784 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
1701 | 7785 |
]. |
3133 | 7786 |
|
7787 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 7788 |
! ! |
7789 |
||
2692 | 7790 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
7791 |
||
7792 |
argument2 |
|
7793 |
||
7794 |
^ argument2 |
|
7795 |
! |
|
7796 |
||
7797 |
argument2:anArgumentOrNil |
|
7798 |
||
7799 |
argument2 := anArgumentOrNil |
|
7800 |
! ! |
|
7801 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7802 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7803 |
|
2018 | 7804 |
icon |
2016 | 7805 |
"This resource specification was automatically generated |
7806 |
by the ImageEditor of ST/X." |
|
7807 |
||
7808 |
"Do not manually edit this!! If it is corrupted, |
|
7809 |
the ImageEditor may not be able to read the specification." |
|
7810 |
||
7811 |
" |
|
2018 | 7812 |
self icon inspect |
7813 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7814 |
" |
7815 |
||
7816 |
<resource: #image> |
|
7817 |
||
7818 |
^Icon |
|
3147 | 7819 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7820 |
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 | 7821 |
! ! |
7822 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7823 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7824 |
|
7825 |
new |
|
7826 |
^ self basicNew initialize |
|
7827 |
! ! |
|
7828 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7829 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7830 |
|
7831 |
activeMenu |
|
7832 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 7833 |
is returned if scrolling is deactivated" |
7834 |
||
2016 | 7835 |
^ activeMenu |
7836 |
! |
|
7837 |
||
7838 |
direction |
|
2870 | 7839 |
"returns the scroll-direction" |
7840 |
||
2016 | 7841 |
^ direction |
7842 |
! |
|
7843 |
||
7844 |
iconAt:aDirection on:aMenu |
|
2018 | 7845 |
|icon device index| |
2016 | 7846 |
|
7847 |
device := aMenu device. |
|
7848 |
||
7849 |
aDirection == #PREV ifTrue:[ |
|
3147 | 7850 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7851 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7852 |
] ifFalse:[ |
3147 | 7853 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7854 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7855 |
]. |
7856 |
||
7857 |
icon := icons at:index. |
|
7858 |
||
7859 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
3147 | 7860 |
icon := self class icon. |
7861 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7862 |
ifFalse:[ icon := icon copy ]. |
|
7863 |
||
7864 |
icon := icon onDevice:device. |
|
7865 |
icon clearMaskedPixels. |
|
7866 |
icons at:index put:icon |
|
2018 | 7867 |
]. |
7868 |
^ icon |
|
2016 | 7869 |
! ! |
7870 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7871 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7872 |
|
7873 |
initialize |
|
7874 |
||
7875 |
semaLock := RecursionLock new. |
|
2018 | 7876 |
icons := Array new:4. |
2016 | 7877 |
! ! |
7878 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7879 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7880 |
|
7881 |
isActive |
|
2870 | 7882 |
"returns true if scrolling is activated" |
7883 |
||
2016 | 7884 |
^ activeMenu notNil |
7885 |
! ! |
|
7886 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7887 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7888 |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7889 |
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress |
2870 | 7890 |
"start scrolling; returns true if scrolling is activated" |
7891 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7892 |
|bounds index isScrolledMenu boundsOnRoot| |
2860 | 7893 |
|
7894 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 7895 |
|
7896 |
semaLock critical:[ |
|
2860 | 7897 |
self stop. |
7898 |
||
7899 |
isScrolledMenu ifTrue:[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7900 |
bounds := aMenu scrollerBoundsAt:aDirection. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7901 |
|
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7902 |
comesViaButtonPress ifFalse:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7903 |
boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu) |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7904 |
extent:(bounds extent). |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7905 |
]. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7906 |
|
2860 | 7907 |
activeMenu := aMenu. |
7908 |
direction := aDirection. |
|
7909 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7910 |
||
7911 |
index ~~ 0 ifTrue:[ |
|
7912 |
scrollTask := |
|
7913 |
[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7914 |
|item step continue| |
2860 | 7915 |
|
7916 |
[ |
|
7917 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7918 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7919 |
aMenu makeItemVisible:item. |
|
7920 |
index := index + step. |
|
7921 |
]. |
|
7922 |
||
7923 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7924 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7925 |
[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7926 |
continue := (aMenu shown and:[(item := aMenu itemAt:index) notNil]). |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7927 |
|
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7928 |
boundsOnRoot notNil ifTrue:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7929 |
continue ifTrue:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7930 |
continue := boundsOnRoot containsPoint:aMenu sensor mousePoint. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7931 |
] ifFalse:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7932 |
boundsOnRoot := nil. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7933 |
] |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7934 |
]. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7935 |
continue |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7936 |
] whileTrue:[ |
2860 | 7937 |
aMenu makeItemVisible:item. |
7938 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7939 |
index := index + step. |
|
7940 |
]. |
|
7941 |
item := nil. |
|
7942 |
] ensure:[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7943 |
activeMenu := direction := scrollTask := nil. |
2860 | 7944 |
|
7945 |
item notNil ifTrue:[ |
|
7946 |
"/ process was killed |
|
7947 |
aMenu invalidate:bounds |
|
7948 |
] |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7949 |
]. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7950 |
boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ]. |
2860 | 7951 |
] forkAt:8. |
7952 |
] |
|
7953 |
] |
|
2016 | 7954 |
]. |
7955 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7956 |
|
2048 | 7957 |
"Created: ca" |
7958 |
||
7959 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7960 |
! |
7961 |
||
7962 |
stop |
|
2870 | 7963 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
7964 |
||
2016 | 7965 |
|task resp| |
7966 |
||
7967 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7968 |
^ false |
2016 | 7969 |
]. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
7970 |
|
2016 | 7971 |
semaLock critical:[ |
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7972 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7973 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7974 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7975 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7976 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7977 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7978 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7979 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7980 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7981 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7982 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7983 |
activeMenu := direction := nil. |
2016 | 7984 |
]. |
7985 |
^ resp |
|
7986 |
! ! |
|
7987 |
||
388 | 7988 |
!MenuPanel class methodsFor:'documentation'! |
7989 |
||
7990 |
version |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
7991 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.464 2008-05-19 13:10:25 cg Exp $' |
388 | 7992 |
! ! |
2199 | 7993 |
|
388 | 7994 |
MenuPanel initialize! |