author | Claus Gittinger <cg@exept.de> |
Sun, 25 Oct 2009 00:06:53 +0200 | |
changeset 3826 | 608aa28e7676 |
parent 3823 | 81781fb283b5 |
child 3830 | 84c0ce168c71 |
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 |
|
3565 | 465 |
"/ <resource: #image> |
466 |
"/ |
|
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 |
|
473 |
||
474 |
<resource: #programImage> |
|
475 |
^ RadioButton disabledPassiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
476 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
477 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
478 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
479 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
480 |
by the ImageEditor of ST/X." |
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 |
"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
|
483 |
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
|
484 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
485 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
486 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
487 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 488 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
489 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
490 |
|
3565 | 491 |
"/ <resource: #image> |
492 |
"/ |
|
493 |
"/ IconDisabledRadioOn isNil ifTrue:[ |
|
494 |
"/ IconDisabledRadioOn := Icon |
|
495 |
"/ constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
496 |
"/ 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] |
|
497 |
"/ ]. |
|
498 |
"/ ^ IconDisabledRadioOn |
|
499 |
||
500 |
<resource: #programImage> |
|
501 |
^ RadioButton disabledActiveForm |
|
502 |
! |
|
503 |
||
504 |
iconRadioGroupEnteredOff |
|
505 |
<resource: #programImage> |
|
506 |
^ RadioButton enteredPassiveForm |
|
507 |
! |
|
508 |
||
509 |
iconRadioGroupEnteredOn |
|
510 |
<resource: #programImage> |
|
511 |
^ RadioButton enteredActiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
512 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
513 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
514 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
515 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
516 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
517 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
518 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
519 |
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
|
520 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
521 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
522 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
523 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
524 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
525 |
|
3565 | 526 |
"/ <resource: #image> |
527 |
"/ |
|
528 |
"/ IconRadioOff isNil ifTrue:[ |
|
529 |
"/ IconRadioOff := Icon |
|
530 |
"/ constantNamed:#'MenuPanel iconRadioGroupOff' |
|
531 |
"/ 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] |
|
532 |
"/ ]. |
|
533 |
"/ ^ IconRadioOff |
|
534 |
||
535 |
<resource: #programImage> |
|
536 |
^ RadioButton passiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
537 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
538 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
539 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
540 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
541 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
542 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
543 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
544 |
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
|
545 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
546 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
547 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
548 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
549 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
550 |
|
3565 | 551 |
"/ <resource: #image> |
552 |
"/ |
|
553 |
"/ IconRadioOn isNil ifTrue:[ |
|
554 |
"/ IconRadioOn := Icon |
|
555 |
"/ constantNamed:#'MenuPanel iconRadioGroupOn' |
|
556 |
"/ 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] |
|
557 |
"/ ]. |
|
558 |
"/ ^ IconRadioOn |
|
559 |
||
560 |
<resource: #programImage> |
|
561 |
^ RadioButton activeForm |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
562 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
563 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
564 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
565 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
566 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
567 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
568 |
"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
|
569 |
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
|
570 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
571 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
572 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
573 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
574 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
575 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
576 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
577 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
578 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
579 |
^Icon |
3603
c93203750a0b
image resource method fixes (key must be name of method)
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
580 |
constantNamed:#'MenuPanel class menuIndicator' |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
581 |
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
|
582 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
583 |
|
616 | 584 |
!MenuPanel class methodsFor:'defaults'! |
450 | 585 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
586 |
defaultBackgroundColor |
2609 | 587 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 588 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
589 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
590 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
591 |
defaultLevel |
2372 | 592 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
593 |
" |
|
594 |
self defaultLevel |
|
595 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
596 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
597 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
598 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
599 |
"returns an additional offset between the label and the |
2715 | 600 |
delayedMenu indication (i.e. the down-arrow icon)" |
601 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
602 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
603 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
604 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
605 |
maxShortCutSearchLevel |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
606 |
"1 means: only search in top items. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
607 |
2 means: search one level of menus. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
608 |
used to be 10" |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
609 |
|
3384 | 610 |
MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.]. |
611 |
^ MaxShortCutSearchLevel |
|
612 |
! |
|
613 |
||
614 |
maxShortCutSearchLevel: anInteger |
|
615 |
"1 means: only search in top items. |
|
616 |
2 means: search one level of menus." |
|
617 |
||
618 |
MaxShortCutSearchLevel := anInteger |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
619 |
! |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
620 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
621 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
622 |
"returns an additional offset between the label and the |
2715 | 623 |
delayedMenu indication (i.e. the down-arrow icon)" |
624 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
625 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
626 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
627 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
628 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
629 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
630 |
ex: |
2715 | 631 |
&File mnemonic := Cmdf |
632 |
F&ile mnemonic := Cmdi |
|
633 |
....." |
|
634 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
635 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
636 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
637 |
|
450 | 638 |
updateStyleCache |
2777 | 639 |
"extract values from the styleSheet and cache them in class variables" |
657 | 640 |
|
2219 | 641 |
<resource: #style ( |
642 |
#'selection.disabledForegroundColor' |
|
643 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
644 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
2883 | 645 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
2219 | 646 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
647 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
648 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
649 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
650 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
651 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
652 |
#'menu.selectionFollowsMouse' |
|
653 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
654 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
655 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
656 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
2752 | 657 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
2754 | 658 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
659 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
|
660 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
|
2755 | 661 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
662 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
|
663 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
|
664 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
|
2219 | 665 |
)> |
666 |
||
667 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 668 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 669 |
|
2611 | 670 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
671 |
which returns the default cashed DefaultBackgroundColor |
|
672 |
" |
|
673 |
DefaultBackgroundColor := nil. |
|
674 |
||
2219 | 675 |
MenuView updateStyleCache. |
676 |
SelectionInListView updateStyleCache. |
|
1699 | 677 |
|
2372 | 678 |
styleSheet := StyleSheet. |
679 |
style := styleSheet name. |
|
680 |
||
2607 | 681 |
DefaultFont := MenuView defaultFont. |
2883 | 682 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
683 |
default:[styleSheet |
|
684 |
colorAt:#'menu.foregroundColor' |
|
685 |
default:Color black]. |
|
2609 | 686 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 687 |
|
688 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 689 |
var isNil ifTrue:[ |
2219 | 690 |
style == #motif ifTrue:[ var := backgroundColor ] |
691 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
692 |
]. |
|
693 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
694 |
||
695 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 696 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 697 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
698 |
||
699 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 700 |
var isNil ifTrue:[ |
2219 | 701 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 702 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 703 |
]. |
704 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
705 |
||
706 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 707 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 708 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
709 |
||
710 |
||
711 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 712 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 713 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
714 |
||
715 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 716 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 717 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
718 |
||
719 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
720 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
721 |
||
722 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
723 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
724 |
||
725 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 726 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 727 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
728 |
]. |
|
729 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
730 |
||
731 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 732 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 733 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
734 |
||
735 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 736 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 737 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
738 |
||
739 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 740 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 741 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
742 |
||
743 |
Item updateStyleCache. |
|
2607 | 744 |
|
2754 | 745 |
getBitmapOrFile := [:key :fileKey | |
746 |
|var| |
|
747 |
||
748 |
var := styleSheet at:key ifAbsent:nil. |
|
749 |
var isNil ifTrue:[ |
|
750 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
2752 | 751 |
var notNil ifTrue:[ |
2754 | 752 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
2752 | 753 |
]. |
754 |
]. |
|
2754 | 755 |
var |
756 |
]. |
|
757 |
||
2883 | 758 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
759 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
760 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
761 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
762 |
||
763 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
764 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
765 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
766 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 767 |
|
2607 | 768 |
" |
769 |
self updateStyleCache |
|
770 |
" |
|
388 | 771 |
! ! |
772 |
||
794 | 773 |
!MenuPanel class methodsFor:'image registration'! |
774 |
||
775 |
image:anImage onDevice:aDevice |
|
776 |
" |
|
777 |
Images := nil |
|
778 |
" |
|
2269 | 779 |
|deviceImages| |
794 | 780 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
781 |
anImage device == aDevice ifTrue:[ |
2269 | 782 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
783 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
784 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
785 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 786 |
|
1097 | 787 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 788 |
Images at:aDevice put:(deviceImages := Dictionary new) |
789 |
]. |
|
790 |
||
791 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
792 |
image := anImage copy onDevice:aDevice. |
|
793 |
image clearMaskedPixels. |
|
794 |
deviceImages at:anImage put:image. |
|
795 |
image |
|
796 |
]. |
|
794 | 797 |
! |
798 |
||
799 |
lightenedImage:anImage onDevice:aDevice |
|
800 |
" |
|
801 |
LigthenedImages := nil |
|
802 |
" |
|
2374 | 803 |
|deviceImages image colorMap| |
794 | 804 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
805 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 806 |
|
1097 | 807 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 808 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 809 |
]. |
810 |
||
811 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 812 |
^ image |
813 |
]. |
|
814 |
||
815 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
816 |
||
817 |
colorMap notNil ifTrue:[ |
|
818 |
image := anImage copy lightened onDevice:aDevice. |
|
819 |
image clearMaskedPixels. |
|
794 | 820 |
] ifFalse:[ |
2374 | 821 |
image := self image:anImage onDevice:aDevice |
794 | 822 |
]. |
1097 | 823 |
deviceImages at:anImage put:image. |
794 | 824 |
^ image |
825 |
! ! |
|
826 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
827 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
828 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
829 |
subMenu:aSubMenu |
2715 | 830 |
"create a submenu; can be redifined in derived classes" |
831 |
||
832 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
833 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
834 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
835 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
836 |
|
1808 | 837 |
!MenuPanel methodsFor:'accepting'! |
389 | 838 |
|
839 |
accept |
|
2715 | 840 |
"accept current selected item" |
841 |
||
1670 | 842 |
^ self acceptItem:(self selection) inMenu:self |
389 | 843 |
! |
844 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
845 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
846 |
"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
|
847 |
|
3142 | 848 |
|item tgState itemIdx recv panel masterGroup winGrp acceptAction focusView| |
1630 | 849 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
850 |
self superMenu notNil ifTrue:[ |
2253 | 851 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
852 |
]. |
3142 | 853 |
prevFocusView ~~ self ifTrue:[ |
854 |
focusView := prevFocusView. |
|
855 |
]. |
|
856 |
prevFocusView := nil. |
|
857 |
||
2199 | 858 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
859 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
860 |
self selection:nil. |
420 | 861 |
|
862 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 863 |
tgState := anItem toggleIndication. |
864 |
panel := anItem menuPanel. |
|
865 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
866 |
item := anItem. |
|
867 |
recv := panel receiver. |
|
389 | 868 |
]. |
1699 | 869 |
self doUngrab:true. |
389 | 870 |
|
510 | 871 |
self isPopUpView ifFalse:[ |
2253 | 872 |
self do:[:el| el updateIndicators]. |
3143 | 873 |
(winGrp := self windowGroup) notNil ifTrue:[ |
3142 | 874 |
winGrp processExposeEvents. |
875 |
]. |
|
524 | 876 |
] ifTrue:[ |
2253 | 877 |
self unmap. |
2712 | 878 |
self device sync. "/ round trip - all expose events are now received |
3143 | 879 |
|
880 |
(winGrp := self windowGroup) notNil ifTrue:[ |
|
2253 | 881 |
"/ give expose event a chance to arrive |
882 |
[shown and:[realized]] whileTrue:[ |
|
883 |
winGrp processExposeEventsFor:self |
|
884 |
]. |
|
885 |
masterGroup := winGrp previousGroup. |
|
886 |
]. |
|
887 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
888 |
"/ self destroy. |
|
889 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 890 |
]. |
1710 | 891 |
|
3144 | 892 |
acceptAction := [ |
893 |
|winGrp| |
|
894 |
||
3189 | 895 |
(focusView notNil and:[(winGrp := self windowGroup) notNil]) ifTrue:[ |
896 |
winGrp focusView:focusView. |
|
3142 | 897 |
]. |
3187 | 898 |
self accept:item index:itemIdx toggle:tgState receiver:recv. |
2826 | 899 |
]. |
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
900 |
|
1710 | 901 |
(item notNil |
902 |
and:[item showBusyCursorWhilePerforming |
|
903 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
904 |
ifTrue:[ |
|
2253 | 905 |
winGrp withWaitCursorDo:acceptAction |
3144 | 906 |
] ifFalse:[ |
907 |
acceptAction value |
|
908 |
]. |
|
524 | 909 |
|
910 |
self isPopUpView ifTrue:[ |
|
2253 | 911 |
self menuAdornmentAt:#item put:item. |
524 | 912 |
]. |
1699 | 913 |
^ item. |
524 | 914 |
|
3144 | 915 |
"Modified: / 08-11-2006 / 17:14:06 / cg" |
524 | 916 |
! |
917 |
||
918 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
2715 | 919 |
"accept an item" |
920 |
||
3558 | 921 |
|selectorOrBlock argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
922 |
app master fallBack| |
524 | 923 |
|
924 |
anItem isNil ifTrue:[ |
|
2253 | 925 |
self menuAdornmentAt:#hasPerformed put:true. |
3735 | 926 |
^ nil |
2253 | 927 |
]. |
928 |
||
929 |
isValueModel := aReceiver isValueModel. |
|
930 |
||
931 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 932 |
|
3558 | 933 |
(selectorOrBlock := anItem value) isNil ifTrue:[ |
2253 | 934 |
^ anIndex |
524 | 935 |
]. |
936 |
||
937 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 938 |
argument := aState ? anItem |
389 | 939 |
]. |
524 | 940 |
|
3558 | 941 |
selectorOrBlock isSymbol ifFalse:[ |
2253 | 942 |
"/ a valueHolder or block |
3558 | 943 |
(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[ |
944 |
^ selectorOrBlock |
|
945 |
]. |
|
946 |
||
947 |
numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0. |
|
2253 | 948 |
|
949 |
numArgs == 0 ifTrue:[ |
|
950 |
args := nil |
|
951 |
] ifFalse:[ |
|
952 |
numArgs == 1 ifTrue:[ |
|
953 |
args := Array with:argument |
|
954 |
] ifFalse:[ |
|
955 |
args := Array with:argument with:self |
|
956 |
] |
|
957 |
]. |
|
958 |
||
3558 | 959 |
selectorOrBlock valueWithArguments:args. |
2253 | 960 |
|
961 |
self menuAdornmentAt:#hasPerformed put:true. |
|
962 |
^ anIndex |
|
524 | 963 |
]. |
964 |
||
2331 | 965 |
anItem sendToOriginator ifTrue:[ |
2473 | 966 |
rec := self originator. |
967 |
rec isNil ifTrue:[ |
|
2844 | 968 |
self error:'no originating widget (no target for message)' mayProceed:true. |
2473 | 969 |
]. |
2331 | 970 |
] ifFalse:[ |
971 |
rec := aReceiver |
|
972 |
]. |
|
973 |
||
974 |
rec isNil ifTrue:[ |
|
3558 | 975 |
^ selectorOrBlock |
2253 | 976 |
]. |
977 |
||
978 |
isValueModel ifTrue:[ |
|
3558 | 979 |
rec value:selectorOrBlock |
465 | 980 |
] ifFalse:[ |
2253 | 981 |
arg2 := self. |
982 |
||
983 |
"/ support for ST80 style applications |
|
984 |
"/ (expecting the message to go to the application |
|
985 |
"/ if not understood by the view) |
|
986 |
"/ These expect the controller to be passed as argument. |
|
987 |
"/ sigh. |
|
988 |
||
2331 | 989 |
(rec isView |
3558 | 990 |
and:[(rec respondsTo:selectorOrBlock) not |
2331 | 991 |
and:[(app := rec application) ~~ rec |
2253 | 992 |
and:[app notNil]]]) ifTrue:[ |
2331 | 993 |
arg2 := rec controller. "/ the Views controller |
2253 | 994 |
rec := app. |
995 |
]. |
|
996 |
||
3558 | 997 |
(numArgs := selectorOrBlock numArgs) == 0 ifTrue:[ |
2253 | 998 |
args := nil |
999 |
] ifFalse:[ |
|
1000 |
numArgs == 1 ifTrue:[ |
|
1001 |
args := Array with:argument |
|
1002 |
] ifFalse:[ |
|
1003 |
args := Array with:argument with:arg2 |
|
1004 |
] |
|
1005 |
]. |
|
1006 |
||
1007 |
fallBack := |
|
1008 |
[ |
|
1009 |
"/ mhmh - the receiver did not respond to that message; |
|
1010 |
"/ if there is a master-application, try that one |
|
1011 |
"/ (recursive) |
|
1012 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
1013 |
master notNil ifTrue:[ |
|
1014 |
rec := master. |
|
3558 | 1015 |
rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack |
2253 | 1016 |
] ifFalse:[ |
1017 |
self |
|
3558 | 1018 |
error:'unimplemented (or error in) menu message: ' , selectorOrBlock |
2253 | 1019 |
mayProceed:true |
1020 |
]. |
|
1021 |
]. |
|
1022 |
||
3558 | 1023 |
rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack. |
420 | 1024 |
]. |
524 | 1025 |
self menuAdornmentAt:#hasPerformed put:true. |
3558 | 1026 |
^ selectorOrBlock |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1027 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
1028 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 1029 |
! |
1030 |
||
1670 | 1031 |
acceptItem:anItem inMenu:aMenu |
2199 | 1032 |
|tgState topMenu| |
1033 |
||
1034 |
topMenu := self topMenu. |
|
1035 |
topMenu openDelayed:nil. |
|
1670 | 1036 |
|
1841 | 1037 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2934 | 1038 |
topMenu accept:anItem |
1670 | 1039 |
] ifFalse:[ |
2934 | 1040 |
anItem canAccept ifTrue:[ |
1041 |
tgState := anItem toggleIndication. |
|
1042 |
||
1043 |
self accept:anItem |
|
1044 |
index:(aMenu selectionIndex) |
|
1045 |
toggle:tgState |
|
1046 |
receiver:(aMenu receiver). |
|
1047 |
||
1048 |
aMenu do:[:el| el updateIndicators]. |
|
1049 |
anItem hideMenuOnActivated ifFalse:[ |
|
1050 |
aMenu invalidate |
|
1051 |
]. |
|
1052 |
] |
|
1670 | 1053 |
] |
1054 |
! |
|
1055 |
||
389 | 1056 |
lastItemAccepted |
2715 | 1057 |
"returns last item selected or nil" |
1058 |
||
390 | 1059 |
^ self topMenu menuAdornmentAt:#item |
389 | 1060 |
! |
1061 |
||
1062 |
lastValueAccepted |
|
2715 | 1063 |
"returns last value accepted or nil" |
1064 |
||
2253 | 1065 |
^ self lastItemAccepted value |
389 | 1066 |
! ! |
1067 |
||
388 | 1068 |
!MenuPanel methodsFor:'accessing'! |
1069 |
||
1070 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1071 |
"get the access character position for a textLabel" |
1072 |
||
2059 | 1073 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1074 |
! |
1075 |
||
1076 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1077 |
"get the access character position for a textLabel" |
1078 |
||
388 | 1079 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1080 |
! |
|
1081 |
||
1082 |
accessCharacterPositions |
|
2715 | 1083 |
"returns a collection of accessCharacterPositions or nil" |
1084 |
||
388 | 1085 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1086 |
! |
|
1087 |
||
1088 |
accessCharacterPositions:something |
|
2715 | 1089 |
"define accessCharacterPositions for each item" |
1090 |
||
388 | 1091 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1092 |
! |
|
1093 |
||
1094 |
args |
|
2715 | 1095 |
"returns a collection of arguments or nil" |
1096 |
||
388 | 1097 |
^ self collect:[:anItem| anItem argument ] |
1098 |
! |
|
1099 |
||
1100 |
args:something |
|
2715 | 1101 |
"define arguments for each item" |
1102 |
||
388 | 1103 |
self onEachPerform:#argument: withArgList:something |
1104 |
! |
|
1105 |
||
1106 |
argsAt:stringOrNumber |
|
2715 | 1107 |
"gets the argument of an item or nil" |
1108 |
||
2059 | 1109 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1110 |
! |
1111 |
||
1112 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1113 |
"sets the argument of an item" |
1114 |
||
388 | 1115 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1116 |
! |
|
1117 |
||
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1118 |
doAccessCharacterTranslation |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1119 |
"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
|
1120 |
Can be set to false to leave labels unchanged" |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1121 |
|
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1122 |
^ doAccessCharacterTranslation ? true |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1123 |
! |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1124 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1125 |
doAccessCharacterTranslation:aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1126 |
"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
|
1127 |
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
|
1128 |
|
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1129 |
doAccessCharacterTranslation := aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1130 |
! |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1131 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1132 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1133 |
"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
|
1134 |
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
|
1135 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1136 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1137 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1138 |
"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
|
1139 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1140 |
|
388 | 1141 |
groupSizes |
2715 | 1142 |
"gets collection of group sizes" |
1143 |
||
388 | 1144 |
^ groupSizes |
1145 |
! |
|
1146 |
||
1147 |
groupSizes:aGroupSizes |
|
2715 | 1148 |
"sets collection of group sizes" |
1149 |
||
388 | 1150 |
aGroupSizes = groupSizes ifFalse:[ |
2715 | 1151 |
groupSizes := aGroupSizes copy. |
1152 |
self mustRearrange. |
|
388 | 1153 |
]. |
1154 |
! |
|
1155 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1156 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1157 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1158 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1159 |
|
3725 | 1160 |
hideOnRelease:aBoolean |
1161 |
hideOnRelease := aBoolean |
|
1162 |
! |
|
1163 |
||
388 | 1164 |
labelAt:stringOrNumber |
2715 | 1165 |
"gets the label of an item or nil" |
1166 |
||
388 | 1167 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1168 |
! |
|
1169 |
||
1170 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1171 |
"sets the label of an item" |
1172 |
||
388 | 1173 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1174 |
! |
|
1175 |
||
1176 |
labels |
|
2715 | 1177 |
"returns a collection of labels's or nil" |
1178 |
||
388 | 1179 |
^ self collect:[:anItem| anItem label ] |
1180 |
! |
|
1181 |
||
1182 |
labels:labels |
|
2715 | 1183 |
"define labels for each item" |
1184 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1185 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1186 |
|
388 | 1187 |
self disabledRedrawDo:[ |
2715 | 1188 |
self removeAll. |
1189 |
size := labels size. |
|
1190 |
||
1191 |
size > 0 ifTrue:[ |
|
1192 |
items := OrderedCollection new:size. |
|
1193 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1194 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1195 |
]. |
388 | 1196 |
! |
1197 |
||
1999 | 1198 |
menuPerformer:anObject |
1199 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1200 |
from all submenus no specific receiver is defined )." |
1201 |
||
1999 | 1202 |
^ self receiver:anObject |
1203 |
! |
|
1204 |
||
388 | 1205 |
nameKeyAt:stringOrNumber |
2715 | 1206 |
"gets the nameKey of an item or nil" |
1207 |
||
1208 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1209 |
! |
1210 |
||
1211 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1212 |
"sets the nameKey of an item" |
1213 |
||
388 | 1214 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1215 |
! |
|
1216 |
||
1217 |
nameKeys |
|
2715 | 1218 |
"returns a collection of nameKeyss or nil" |
1219 |
||
388 | 1220 |
^ self collect:[:anItem| anItem nameKey ] |
1221 |
! |
|
1222 |
||
1223 |
nameKeys:something |
|
2715 | 1224 |
"define nameKeys for each item" |
1225 |
||
388 | 1226 |
self onEachPerform:#nameKey: withArgList:something |
1227 |
! |
|
1228 |
||
1229 |
numberOfItems |
|
2715 | 1230 |
"gets number of items" |
1231 |
||
388 | 1232 |
^ items size |
1233 |
! |
|
1234 |
||
2331 | 1235 |
originator |
1236 |
originator notNil ifTrue:[^ originator]. |
|
1237 |
superMenu notNil ifTrue:[ |
|
1238 |
^ superMenu originator |
|
1239 |
]. |
|
1240 |
^ nil |
|
1241 |
! |
|
1242 |
||
388 | 1243 |
receiver |
1244 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1245 |
from all submenus no specific receiver is defined )." |
1246 |
||
389 | 1247 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2715 | 1248 |
^ superMenu receiver |
388 | 1249 |
]. |
389 | 1250 |
^ receiver |
388 | 1251 |
! |
1252 |
||
1253 |
receiver:anObject |
|
1254 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1255 |
from all submenus no specific receiver is defined )." |
1256 |
||
389 | 1257 |
receiver := anObject |
388 | 1258 |
! |
1259 |
||
1260 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1261 |
"gets the shortCutKey of an item or nil" |
1262 |
||
1263 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1264 |
! |
1265 |
||
1266 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1267 |
"sets the shortCutKey of an item" |
1268 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1269 |
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
|
1270 |
! |
388 | 1271 |
|
1272 |
shortcutKeys |
|
2715 | 1273 |
"returns a collection of shortcutKeys or nil" |
1274 |
||
388 | 1275 |
^ self collect:[:anItem| anItem shortcutKey ] |
1276 |
! |
|
1277 |
||
1278 |
shortcutKeys:something |
|
2715 | 1279 |
"define shortcutKeys for each item" |
1280 |
||
388 | 1281 |
self onEachPerform:#shortcutKey: withArgList:something |
1282 |
! |
|
1283 |
||
1284 |
valueAt:stringOrNumber |
|
2715 | 1285 |
"gets value of an item; a block, valueHolder, ..." |
1286 |
||
1287 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1288 |
! |
1289 |
||
1290 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1291 |
"sets value of an item; a block, valueHolder, ..." |
1292 |
||
388 | 1293 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1294 |
! |
|
1295 |
||
1296 |
values:something |
|
2715 | 1297 |
"define values for each item" |
1298 |
||
388 | 1299 |
self onEachPerform:#value: withArgList:something |
1300 |
! ! |
|
1301 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1302 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1303 |
|
1304 |
disableAll |
|
2715 | 1305 |
"disable all items; not the menu in case of enabled" |
1306 |
||
498 | 1307 |
self do:[:anItem| anItem enabled:false] |
388 | 1308 |
! |
1309 |
||
1310 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1311 |
"disable an collection of items" |
1312 |
||
388 | 1313 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1314 |
! |
|
1315 |
||
1316 |
enableAll |
|
2715 | 1317 |
"enable all items; not the menu in case of disabled" |
1318 |
||
498 | 1319 |
self do:[:anItem| anItem enabled:true] |
388 | 1320 |
! |
1321 |
||
1322 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1323 |
"enable an collection of items" |
1324 |
||
388 | 1325 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1326 |
! |
|
1327 |
||
1328 |
enabled |
|
2715 | 1329 |
"returns enabled state" |
1330 |
||
498 | 1331 |
^ enabled |
388 | 1332 |
! |
1333 |
||
1334 |
enabled:aState |
|
2715 | 1335 |
"change enabled state of menu" |
1336 |
||
545 | 1337 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1338 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1339 |
state := aState ? true. |
388 | 1340 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1341 |
enabled ~~ state ifTrue:[ |
2715 | 1342 |
enabled := state. |
1343 |
self invalidate. |
|
498 | 1344 |
]. |
388 | 1345 |
! |
1346 |
||
1347 |
enabledAt:stringOrNumber |
|
2715 | 1348 |
"gets the enabled state of an item or false" |
1349 |
||
388 | 1350 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1351 |
! |
|
1352 |
||
1353 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1354 |
"sets the enabled state of an item" |
1355 |
||
388 | 1356 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1357 |
! |
|
1358 |
||
3725 | 1359 |
exclusivePointer:aBoolean |
1360 |
"Do nothing here. Compatibility with PopUpListController" |
|
1361 |
||
1362 |
^ self |
|
1363 |
! |
|
1364 |
||
388 | 1365 |
isEnabled:stringOrNumber |
2715 | 1366 |
"gets the enabled state of an item or false" |
1367 |
||
388 | 1368 |
^ self enabledAt:stringOrNumber |
1369 |
! ! |
|
1370 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1371 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1372 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1373 |
enableChannel:aValueHolder |
2715 | 1374 |
"set my enableChannel" |
1375 |
||
498 | 1376 |
enableChannel notNil ifTrue:[ |
2715 | 1377 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1378 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1379 |
|
498 | 1380 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2715 | 1381 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1382 |
]. |
498 | 1383 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1384 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1385 |
|
3222 | 1386 |
menuChannel |
1387 |
^ self menuHolder |
|
1388 |
||
1389 |
"Created: / 27-03-2007 / 08:38:31 / cg" |
|
1390 |
! |
|
1391 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1392 |
menuHolder:aValueHolder |
2715 | 1393 |
"set my menuHolder" |
1394 |
||
498 | 1395 |
menuHolder notNil ifTrue:[ |
2715 | 1396 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1397 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1398 |
|
498 | 1399 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2715 | 1400 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1401 |
]. |
498 | 1402 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1403 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1404 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1405 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1406 |
|
616 | 1407 |
activeBackgroundColor |
2715 | 1408 |
"get the background drawing color used to highlight selection" |
1409 |
||
2219 | 1410 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1411 |
! |
1412 |
||
1413 |
activeForegroundColor |
|
2715 | 1414 |
"get the foreground color used to highlight selections" |
1415 |
||
2219 | 1416 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1417 |
! |
1418 |
||
390 | 1419 |
backgroundColor |
2715 | 1420 |
"return the background color" |
1421 |
||
502 | 1422 |
^ super viewBackground |
390 | 1423 |
! |
1424 |
||
1425 |
backgroundColor:aColor |
|
1426 |
"set the background drawing color. You should not use this method; |
|
2715 | 1427 |
instead, leave the value as defined in the styleSheet." |
1428 |
||
1429 |
self backgroundColor ~~ aColor ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1430 |
super viewBackground:aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1431 |
self invalidate "/ RepairNow:true |
616 | 1432 |
] |
1433 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1434 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1435 |
! |
1436 |
||
727 | 1437 |
buttonActiveBackgroundColor |
2715 | 1438 |
"get the background drawing color used to highlight button selection" |
1439 |
||
2219 | 1440 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1441 |
default:(self viewBackground) |
|
727 | 1442 |
! |
1443 |
||
3441 | 1444 |
buttonActiveForegroundColor |
1445 |
"get the foreground drawing color used to highlight button selection" |
|
1446 |
||
1447 |
^ styleSheet colorAt:#'button.activeForegroundColor' |
|
1448 |
default:(self foregroundColor) |
|
1449 |
! |
|
1450 |
||
730 | 1451 |
buttonEdgeStyle |
2715 | 1452 |
"get the button edge style" |
1453 |
||
2219 | 1454 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1455 |
! |
1456 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1457 |
buttonEnteredBackgroundColor |
2715 | 1458 |
"get the background drawing color used to highlight entered button items" |
1459 |
||
2219 | 1460 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1461 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1462 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1463 |
buttonEnteredLevel |
2715 | 1464 |
"get the 3D-level used to highlight entered button items" |
1465 |
||
2219 | 1466 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1467 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1468 |
|
730 | 1469 |
buttonHalfLightColor |
2715 | 1470 |
"get the background drawing color used to half light button frame" |
1471 |
||
2219 | 1472 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1473 |
! |
1474 |
||
1475 |
buttonHalfShadowColor |
|
2715 | 1476 |
"get the background drawing color used to half shadow button frame" |
1477 |
||
2219 | 1478 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1479 |
! |
1480 |
||
1481 |
buttonLightColor |
|
2715 | 1482 |
"get the background drawing color used to light button frame" |
1483 |
||
2219 | 1484 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1485 |
! |
1486 |
||
1487 |
buttonPassiveBackgroundColor |
|
2715 | 1488 |
"get the background drawing color used for button" |
1489 |
||
2219 | 1490 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1491 |
! |
1492 |
||
1493 |
buttonShadowColor |
|
2715 | 1494 |
"get the background drawing color used to shadow button frame" |
1495 |
||
2219 | 1496 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1497 |
! |
1498 |
||
1499 |
disabledEtchedForegroundColor |
|
1500 |
"return the color used for etching disabled items. |
|
2715 | 1501 |
If nil, no 3D effect is drawn." |
1502 |
||
2219 | 1503 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1504 |
! |
1505 |
||
390 | 1506 |
disabledForegroundColor |
2715 | 1507 |
"return the foreground color used by disabled items" |
1508 |
||
2219 | 1509 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1510 |
! |
1511 |
||
2170 | 1512 |
enteredBackgroundColor |
2715 | 1513 |
"return the background color for entered items" |
1514 |
||
2219 | 1515 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1516 |
default:(self backgroundColor) |
|
2170 | 1517 |
! |
1518 |
||
1519 |
enteredForegroundColor |
|
2715 | 1520 |
"return the foreground color for entered items" |
1521 |
||
2219 | 1522 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1523 |
! |
1524 |
||
390 | 1525 |
font:aFont |
2715 | 1526 |
"set the font" |
1527 |
||
2614 | 1528 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1529 |
||
1530 |
super font:aFont. |
|
1531 |
self do:[:anItem| anItem fontChanged ]. |
|
1532 |
||
1533 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1534 |
self extent:(self preferredExtent) |
|
1535 |
]. |
|
1536 |
self mustRearrange. |
|
390 | 1537 |
! |
1538 |
||
1539 |
foregroundColor |
|
2715 | 1540 |
"return the passive foreground color" |
1541 |
||
2059 | 1542 |
^ fgColor |
390 | 1543 |
! |
1544 |
||
1545 |
foregroundColor:aColor |
|
1546 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1547 |
instead leave the value as defined in the styleSheet." |
1548 |
||
2219 | 1549 |
aColor ~= fgColor ifTrue:[ |
1478 | 1550 |
fgColor := aColor onDevice:device. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1551 |
self invalidate |
2219 | 1552 |
]. |
580 | 1553 |
! |
1554 |
||
1699 | 1555 |
maxAbsoluteButtonLevel |
1556 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1557 |
extent of a button" |
1558 |
||
2219 | 1559 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1560 |
! |
1561 |
||
730 | 1562 |
selectionFrameBrightColor |
2715 | 1563 |
"get the selection frame bright color" |
1564 |
||
2219 | 1565 |
^ Color white |
730 | 1566 |
! |
1567 |
||
1568 |
selectionFrameDarkColor |
|
2715 | 1569 |
"get the selection frame dark color" |
1570 |
||
2219 | 1571 |
^ Color black |
730 | 1572 |
! |
1573 |
||
1727 | 1574 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1575 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1576 |
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
|
1577 |
|
1727 | 1578 |
|currentFont| |
1579 |
||
1580 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1581 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1582 |
super font:aFont. |
1727 | 1583 |
]. |
1584 |
^ currentFont |
|
2761 | 1585 |
! |
1586 |
||
1587 |
viewBackground:aColor |
|
1588 |
super viewBackground:aColor |
|
390 | 1589 |
! ! |
1590 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1591 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1592 |
|
1593 |
height |
|
2715 | 1594 |
"default height" |
1595 |
||
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
1596 |
(self hasExplicitExtent not) ifTrue:[ |
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
1597 |
^ self preferredHeight |
388 | 1598 |
]. |
1599 |
^ super height |
|
1600 |
! |
|
1601 |
||
2016 | 1602 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1603 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1604 |
device notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1605 |
^ device usableExtent - 2. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1606 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1607 |
superMenu notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1608 |
^ superMenu 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 |
"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
|
1611 |
self error:'don''t know maxExtent'. |
2016 | 1612 |
! |
1613 |
||
388 | 1614 |
preferredExtent |
2715 | 1615 |
"compute and returns my preferred extent" |
1616 |
||
2253 | 1617 |
|maxExtent usedExtent| |
2024 | 1618 |
|
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1619 |
"/ If I have an explicit preferredExtent.. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1620 |
explicitExtent notNil ifTrue:[ |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1621 |
^ explicitExtent |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1622 |
]. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1623 |
|
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1624 |
"/ If I have a cached preferredExtent value.. |
2016 | 1625 |
preferredExtent notNil ifTrue:[ |
2253 | 1626 |
^ preferredExtent |
2016 | 1627 |
]. |
2024 | 1628 |
usedExtent := self preferredExtentOfItems. |
1629 |
||
1630 |
superView isNil ifTrue:[ |
|
2253 | 1631 |
"/ is standalone |
2374 | 1632 |
preferredWidth notNil ifTrue:[ |
2253 | 1633 |
usedExtent x < preferredWidth ifTrue:[ |
1634 |
usedExtent := preferredWidth @ usedExtent y. |
|
1635 |
] |
|
1636 |
] |
|
2024 | 1637 |
]. |
1638 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1639 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1640 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1641 |
usedExtent := usedExtent min:maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1642 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1643 |
^ usedExtent |
2024 | 1644 |
|
1645 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1646 |
! |
1647 |
||
1648 |
preferredExtentOfItems |
|
1649 |
"compute and returns my preferred extent including all items |
|
2715 | 1650 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
1651 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1652 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1653 |
x "{ Class:SmallInteger }" |
1654 |
y "{ Class:SmallInteger }" |
|
1655 |
size "{ Class:SmallInteger }" |
|
2883 | 1656 |
buttonInsetX2 "{ Class:SmallInteger }" |
1657 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1658 |
labelInsetX "{ Class:SmallInteger }" |
1659 |
labelInsetY "{ Class:SmallInteger }" |
|
1660 |
itemMargin "{ Class:SmallInteger }" |
|
1661 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1662 |
| |
388 | 1663 |
|
1699 | 1664 |
(size := items size) == 0 ifTrue:[ |
2219 | 1665 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1666 |
^ 32 @ 32 |
2219 | 1667 |
]. |
3131 | 1668 |
stringOffsetX := nil. |
2883 | 1669 |
buttonInsetX2 := 2 * buttonInsetX. |
1670 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1671 |
|
1672 |
self isPopUpView ifFalse:[ |
|
2219 | 1673 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1674 |
] ifTrue:[ |
2145 | 1675 |
labelInsetX := labelInsetY := 0. |
1699 | 1676 |
]. |
1677 |
||
1678 |
x := 0. |
|
1679 |
y := 0. |
|
2219 | 1680 |
groupDividerSize := self groupDividerSize. |
388 | 1681 |
|
1682 |
self verticalLayout ifFalse:[ |
|
1699 | 1683 |
items keysAndValuesDo:[:key :el| |eX eY| |
1684 |
extent := el preferredExtent. |
|
1685 |
||
1686 |
"/ check for visibility (extent x ~~ 0) |
|
1687 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1688 |
eY := extent y. |
|
1689 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1690 |
el isButton ifTrue:[ |
2883 | 1691 |
eX := eX + buttonInsetX2. |
1692 |
eY := eY + buttonInsetY2. |
|
1699 | 1693 |
] ifFalse:[ |
2145 | 1694 |
eX := eX + labelInsetX. |
1695 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1696 |
]. |
1699 | 1697 |
key ~~ size ifTrue:[ |
1698 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1699 |
x := x + groupDividerSize |
|
1700 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1701 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1702 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1703 |
] |
1699 | 1704 |
] |
1705 |
]. |
|
1706 |
x := eX + x. |
|
1707 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1708 |
] |
1699 | 1709 |
] |
388 | 1710 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1711 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1712 |
shCtKey := 0. |
1699 | 1713 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1714 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1715 |
x := 0. |
2219 | 1716 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1717 |
|
1699 | 1718 |
items keysAndValuesDo:[:key :el| |eX eY| |
1719 |
extent := el preferredExtent. |
|
1720 |
||
1721 |
"/ check for visibility (extent x ~~ 0) |
|
1722 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1723 |
eY := extent y. |
|
1724 |
||
1725 |
el isButton ifTrue:[ |
|
2883 | 1726 |
eX := eX + buttonInsetX2. |
1727 |
eY := eY + buttonInsetY2. |
|
1699 | 1728 |
] ifFalse:[ |
2145 | 1729 |
eX := eX + labelInsetX. |
1730 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1731 |
]. |
1699 | 1732 |
hasMenu ifFalse:[ |
1733 |
hasMenu := el hasSubmenu |
|
1734 |
]. |
|
1735 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1736 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1737 |
]. |
|
1738 |
key ~~ size ifTrue:[ |
|
1739 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1740 |
y := y + groupDividerSize |
|
1741 |
] |
|
1742 |
]. |
|
1743 |
y := eY + y. |
|
1744 |
x := eX max:x. |
|
1745 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1746 |
]. |
2219 | 1747 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1748 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1749 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1750 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1751 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1752 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1753 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1754 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1755 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1756 |
]. |
1699 | 1757 |
"/ to have a small inset |
1758 |
y := y + 1. |
|
1759 |
"/ x := x + 1. |
|
1760 |
]. |
|
1761 |
x := x + margin + margin. |
|
1762 |
y := y + margin + margin. |
|
1763 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1764 |
^ x @ y |
388 | 1765 |
! |
1766 |
||
2253 | 1767 |
preferredWidth:aWidthOrNil |
1768 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1769 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1770 |
If not nil, the width is the maximum from the contained items and the required width." |
1771 |
||
2253 | 1772 |
preferredWidth := aWidthOrNil. |
2024 | 1773 |
! |
1774 |
||
388 | 1775 |
shortKeyInset |
2715 | 1776 |
"left inset of shortcutKey" |
1777 |
||
1778 |
^ shortKeyInset |
|
616 | 1779 |
! |
1780 |
||
3131 | 1781 |
stringOffsetXfor:anItem |
1782 |
"return the x offset for a MenuItem where to draw the text |
|
1783 |
" |
|
1784 |
|label w| |
|
1785 |
||
1786 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
1787 |
||
1788 |
stringOffsetX isNil ifTrue:[ |
|
1789 |
stringOffsetX := 0. |
|
1790 |
||
1791 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
1792 |
self do:[:el| |
|
1793 |
el isVisible ifTrue:[ |
|
1794 |
( (label := el indicatorForm) notNil |
|
1795 |
or:[(label := el choiceForm) notNil] |
|
1796 |
) ifTrue:[ |
|
1797 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
1798 |
] ifFalse:[ |
|
1799 |
label := el displayLabel. |
|
1800 |
label class == LabelAndIcon ifTrue:[ |
|
1801 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
1802 |
]. |
|
1803 |
]. |
|
1804 |
]. |
|
1805 |
]. |
|
1806 |
]. |
|
1807 |
]. |
|
1808 |
w := 0. |
|
1809 |
||
1810 |
( (label := anItem indicatorForm) notNil |
|
1811 |
or:[(label := anItem choiceForm) notNil] |
|
1812 |
) ifTrue:[ |
|
1813 |
w := label width + 2. |
|
1814 |
]. |
|
1815 |
stringOffsetX == 0 ifTrue:[ |
|
1816 |
^ w |
|
1817 |
]. |
|
1818 |
w == 0 ifTrue:[ |
|
1819 |
label := anItem displayLabel. |
|
1820 |
||
1821 |
label class == LabelAndIcon ifTrue:[ |
|
1822 |
^ stringOffsetX - label xOfString |
|
1823 |
]. |
|
1824 |
]. |
|
1825 |
^ stringOffsetX. |
|
1826 |
! |
|
1827 |
||
616 | 1828 |
subMenuIndicationWidth |
2219 | 1829 |
^ self rightArrow width |
388 | 1830 |
! ! |
1831 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1832 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1833 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1834 |
iconIndicationDisabledOff |
2219 | 1835 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1836 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1837 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1838 |
iconIndicationDisabledOn |
2219 | 1839 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1840 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1841 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1842 |
iconIndicationOff |
2219 | 1843 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1844 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1845 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1846 |
iconIndicationOn |
2219 | 1847 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1848 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1849 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1850 |
iconRadioGroupDisabledOff |
2219 | 1851 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1852 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1853 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1854 |
iconRadioGroupDisabledOn |
2219 | 1855 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1856 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1857 |
|
3565 | 1858 |
iconRadioGroupEnteredOff |
1859 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff) |
|
1860 |
! |
|
1861 |
||
1862 |
iconRadioGroupEnteredOn |
|
1863 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn) |
|
1864 |
! |
|
1865 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1866 |
iconRadioGroupOff |
2219 | 1867 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1868 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1869 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1870 |
iconRadioGroupOn |
2219 | 1871 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1872 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1873 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1874 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1875 |
|
1876 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1877 |
"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
|
1878 |
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
|
1879 |
|
388 | 1880 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1881 |
! |
|
1882 |
||
1883 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1884 |
"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
|
1885 |
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
|
1886 |
|
388 | 1887 |
|item| |
1888 |
||
1889 |
item := self itemAt:stringOrNumber. |
|
1890 |
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
|
1891 |
^ exceptionBlock value |
706 | 1892 |
! |
1893 |
||
1894 |
itemAtIndex:anIndex |
|
2715 | 1895 |
"returns item at an index or nil" |
1896 |
||
706 | 1897 |
^ 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
|
1898 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1899 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1900 |
items |
2715 | 1901 |
"returns list of items or nil" |
1902 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1903 |
^ items |
388 | 1904 |
! ! |
1905 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1906 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1907 |
|
727 | 1908 |
buttonActiveLevel |
2715 | 1909 |
"get the buttons active level" |
1910 |
||
2219 | 1911 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1912 |
! |
1913 |
||
1914 |
buttonPassiveLevel |
|
2715 | 1915 |
"get the buttons passive level" |
1916 |
||
2219 | 1917 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
727 | 1918 |
! |
1919 |
||
2337 | 1920 |
centerItems |
1921 |
^ centerItems ? false |
|
1922 |
! |
|
1923 |
||
1924 |
centerItems:aBoolean |
|
1925 |
centerItems := aBoolean |
|
1926 |
! |
|
1927 |
||
390 | 1928 |
fitFirstPanel |
1929 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1930 |
to the extent of its superView |
|
1699 | 1931 |
|
2715 | 1932 |
NOT SUPPORTED" |
1933 |
||
2219 | 1934 |
^ false |
388 | 1935 |
! |
1936 |
||
390 | 1937 |
fitFirstPanel:aState |
1938 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1939 |
to the extent of its superView |
|
1699 | 1940 |
|
2715 | 1941 |
NOT SUPPORTED" |
616 | 1942 |
! |
1943 |
||
1093 | 1944 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1945 |
anInt ~~ level ifTrue:[ |
3147 | 1946 |
super level:anInt. |
1947 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1948 |
] |
2052 | 1949 |
|
1950 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1951 |
! |
1952 |
||
616 | 1953 |
rightArrow |
2374 | 1954 |
rightArrow isNil ifTrue:[ |
1955 |
device isNil ifTrue:[ |
|
2219 | 1956 |
^ SelectionInListView rightArrowFormOn:Display |
1957 |
]. |
|
1958 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1959 |
]. |
|
616 | 1960 |
^ rightArrow |
1961 |
! |
|
1962 |
||
1963 |
rightArrowShadow |
|
1964 |
^ rightArrowShadow |
|
388 | 1965 |
! |
1966 |
||
390 | 1967 |
showGroupDivider |
2715 | 1968 |
"get the enabled flag for showing groupDiveders" |
1969 |
||
2253 | 1970 |
^ showGroupDivider |
388 | 1971 |
! |
1972 |
||
390 | 1973 |
showGroupDivider:aState |
2715 | 1974 |
"set the enabled flag for showing groupDiveders" |
1975 |
||
2253 | 1976 |
showGroupDivider ~~ aState ifTrue:[ |
1977 |
showGroupDivider := aState. |
|
1978 |
self mustRearrange. |
|
653 | 1979 |
] |
388 | 1980 |
! |
1981 |
||
1982 |
showSeparatingLines |
|
2715 | 1983 |
"gets true if drawing of separating lines is enabled." |
1984 |
||
2253 | 1985 |
^ showSeparatingLines |
388 | 1986 |
! |
1987 |
||
390 | 1988 |
showSeparatingLines:aState |
2715 | 1989 |
"turn on/off drawing of separating lines." |
1990 |
||
2253 | 1991 |
aState ~~ showSeparatingLines ifTrue:[ |
1992 |
showSeparatingLines := aState. |
|
1993 |
self mustRearrange |
|
1994 |
]. |
|
388 | 1995 |
! |
1996 |
||
1997 |
verticalLayout |
|
2715 | 1998 |
"get the layout: vertical( true ) or horizontal( false )" |
1999 |
||
2374 | 2000 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 2001 |
|
2002 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
2003 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
2374 | 2004 |
^ verticalLayout |
388 | 2005 |
! |
2006 |
||
2007 |
verticalLayout:aState |
|
2715 | 2008 |
"set the layout: vertical( true ) or horizontal( false )" |
2009 |
||
2253 | 2010 |
aState ~~ verticalLayout ifTrue:[ |
2011 |
verticalLayout isNil ifTrue:[ |
|
2012 |
verticalLayout := aState |
|
2013 |
] ifFalse:[ |
|
2014 |
verticalLayout := aState. |
|
2015 |
self mustRearrange. |
|
2016 |
]. |
|
2017 |
]. |
|
388 | 2018 |
! ! |
2019 |
||
2219 | 2020 |
!MenuPanel methodsFor:'accessing-style'! |
2021 |
||
2022 |
buttonInsetX |
|
2715 | 2023 |
"returns the verical button space" |
2024 |
||
2883 | 2025 |
^ buttonInsetX |
2219 | 2026 |
! |
2027 |
||
2028 |
buttonInsetY |
|
2715 | 2029 |
"returns the verical button space" |
2030 |
||
2883 | 2031 |
^ buttonInsetY |
2219 | 2032 |
! |
2033 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2034 |
drawMenuIndicatorSeparatorLine |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2035 |
^ true. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2036 |
^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine' default:false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2037 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2038 |
|
2219 | 2039 |
enteredLevel |
2715 | 2040 |
"returns the enter-level for an unselected item moved through" |
2041 |
||
2219 | 2042 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
2043 |
! |
|
2044 |
||
2045 |
groupDividerSize |
|
2715 | 2046 |
"returns the width of a group divider" |
2047 |
||
2219 | 2048 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
2049 |
! |
|
2050 |
||
2051 |
itemMargin |
|
2715 | 2052 |
"returns the margin of an item" |
2053 |
||
2219 | 2054 |
^ styleSheet at:#'menu.itemMargin' default:0 |
2055 |
! |
|
2056 |
||
2057 |
itemSpace |
|
2715 | 2058 |
"returns the additional space for an item in a (vertical) panel" |
2059 |
||
2883 | 2060 |
^ itemSpace |
2219 | 2061 |
! |
2062 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2063 |
menuIndicatorVerticalPosition |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2064 |
"#center, #top or #bottom" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2065 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2066 |
^ #center |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2067 |
"/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2068 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2069 |
|
2219 | 2070 |
selectionFollowsMouse |
2715 | 2071 |
"returns true if the selection follows the mouse" |
2072 |
||
2219 | 2073 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
2074 |
! |
|
2075 |
||
2076 |
shortcutKeyOffset |
|
2715 | 2077 |
"returns the offset for a shortcutKey" |
2078 |
||
2219 | 2079 |
^ 5 |
2080 |
! ! |
|
2081 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2082 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 2083 |
|
2084 |
subMenuAt:stringOrNumber |
|
3192 | 2085 |
"gets the current submenu of an item; if the submenu is nil, the |
2086 |
submenu is generated if specified otherwise nil is returned." |
|
2087 |
||
2088 |
|submenu| |
|
2089 |
||
2090 |
||
2091 |
self itemAt:stringOrNumber do:[:anItem| |
|
2092 |
submenu := anItem currentSubmenu. |
|
2093 |
submenu isNil ifTrue:[ |
|
2094 |
submenu := anItem setupSubmenu |
|
2095 |
]. |
|
2096 |
]. |
|
2097 |
^ submenu |
|
388 | 2098 |
! |
2099 |
||
2100 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2101 |
"sets the submenu of an item" |
2102 |
||
388 | 2103 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2104 |
! |
|
2105 |
||
2106 |
subMenuShown |
|
2715 | 2107 |
"return the currently visible submenu - or nil if there is none" |
2108 |
||
3192 | 2109 |
|item submenu| |
2110 |
||
2111 |
item := self selection. |
|
2112 |
||
2113 |
item notNil ifTrue:[ |
|
2114 |
submenu := item currentSubmenu. |
|
2115 |
||
2116 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2117 |
^ submenu |
|
2118 |
]. |
|
2715 | 2119 |
]. |
2120 |
^ nil |
|
388 | 2121 |
! ! |
2122 |
||
2504 | 2123 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2124 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2125 |
closeMenus |
2715 | 2126 |
"close all menus without accepting" |
2127 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2128 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2129 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2130 |
|
388 | 2131 |
hide |
2715 | 2132 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2133 |
|
2407 | 2134 |
"/ TODO: replace with LeaveSignal raise. |
2135 |
||
388 | 2136 |
self selection:nil. |
2137 |
self unmap. |
|
2138 |
! |
|
2139 |
||
2140 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2141 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2142 |
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
|
2143 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2144 |
to some performer)" |
2145 |
||
2146 |
^ self showAt:(self origin) resizing:true |
|
388 | 2147 |
! |
2148 |
||
2149 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2150 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2151 |
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
|
2152 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2153 |
to some performer)" |
2154 |
||
3754 | 2155 |
^ self showAt:aPoint resizing:true |
388 | 2156 |
! |
2157 |
||
2158 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2159 |
"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
|
2160 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2161 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2162 |
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
|
2163 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2164 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2165 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2166 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2167 |
|
2168 |
aBoolean ifTrue:[ |
|
2715 | 2169 |
self fixSize. |
388 | 2170 |
]. |
2171 |
self origin:aPoint. |
|
1459 | 2172 |
"/ self makeFullyVisible. -- done in realize |
388 | 2173 |
self openModal:[true]. "realize " |
2174 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2175 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2176 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2177 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2178 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2715 | 2179 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2180 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2181 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2182 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2183 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2184 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 2185 |
! |
2186 |
||
2187 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2188 |
"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
|
2189 |
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
|
2190 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2191 |
to some performer)" |
2192 |
||
388 | 2193 |
^ self showAt:(device pointerPosition) resizing:true |
2194 |
! |
|
2195 |
||
2196 |
showCenteredIn:aView |
|
2197 |
"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
|
2198 |
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
|
2199 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2200 |
to some performer)" |
2201 |
||
388 | 2202 |
|top| |
2203 |
||
2204 |
top := aView topView. |
|
2205 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2206 |
^ 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
|
2207 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2208 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2209 |
! |
2210 |
||
2211 |
startUp |
|
2212 |
"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
|
2213 |
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
|
2214 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2215 |
to some performer)" |
2216 |
||
388 | 2217 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2218 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2219 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2220 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2221 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2222 |
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
|
2223 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2224 |
to some performer)" |
2225 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2226 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2227 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2228 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2229 |
! |
2230 |
||
2332 | 2231 |
startUpFor:originatingWidget |
2232 |
"realize the menu at the current pointer position |
|
2233 |
return the value of the selectedItem or nil, of none was selected |
|
2234 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2235 |
to some performer)" |
2236 |
||
2332 | 2237 |
originator := originatingWidget. |
2238 |
^ self startUp |
|
2239 |
! |
|
2240 |
||
1750 | 2241 |
startUpOrNil |
2242 |
"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
|
2243 |
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
|
2244 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2245 |
to some performer)" |
2246 |
||
1750 | 2247 |
^ self showAtPointer |
388 | 2248 |
! ! |
2249 |
||
2250 |
!MenuPanel methodsFor:'adding & removing'! |
|
2251 |
||
2252 |
createAtIndex:anIndexOrNil |
|
1800 | 2253 |
"create an item and add this item to the index. In case of nil, the item |
2254 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2255 |
otherwise the new created item is returned." |
2256 |
||
388 | 2257 |
|max item| |
2258 |
||
2259 |
max := (items size) + 1. |
|
2260 |
||
2261 |
anIndexOrNil notNil ifTrue:[ |
|
2715 | 2262 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2263 |
^ nil |
|
2264 |
] |
|
388 | 2265 |
]. |
2266 |
items isNil ifTrue:[ |
|
2715 | 2267 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2268 |
] ifFalse:[ |
2715 | 2269 |
items := items asOrderedCollection |
388 | 2270 |
]. |
2271 |
item := Item in:self. |
|
2272 |
||
2273 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2715 | 2274 |
items add:item |
388 | 2275 |
] ifFalse:[ |
2715 | 2276 |
items add:item beforeIndex:anIndexOrNil |
388 | 2277 |
]. |
2278 |
^ item |
|
2279 |
! |
|
2280 |
||
2281 |
remove:stringOrNumber |
|
2282 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2283 |
if found, remove and return it" |
2284 |
||
388 | 2285 |
|item| |
2286 |
||
2287 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2715 | 2288 |
items remove:item. |
2289 |
item destroy. |
|
2290 |
items isEmpty ifTrue:[items := nil]. |
|
2291 |
self mustRearrange. |
|
388 | 2292 |
]. |
2293 |
^ item |
|
2294 |
! |
|
2295 |
||
2296 |
removeAll |
|
2715 | 2297 |
"remove all items and submenus" |
2298 |
||
388 | 2299 |
self disabledRedrawDo:[ |
2715 | 2300 |
self selection:nil. |
2301 |
groupSizes := nil. |
|
2302 |
items notNil ifTrue:[ |
|
2303 |
items copy do:[:el| el destroy ]. |
|
2304 |
]. |
|
2305 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2306 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2307 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2308 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2309 |
! ! |
2310 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2311 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2312 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2313 |
update:something with:aParameter from:changedObject |
498 | 2314 |
|
2315 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2316 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2317 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2318 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2319 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2320 |
|
388 | 2321 |
!MenuPanel methodsFor:'converting'! |
2322 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2323 |
asMenu |
3222 | 2324 |
"convert contents to a menu" |
2715 | 2325 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2326 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2327 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2328 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2329 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2330 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2331 |
^ menu |
3222 | 2332 |
|
2333 |
"Modified: / 27-03-2007 / 08:39:48 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2334 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2335 |
|
388 | 2336 |
fromSpec:aMenuSpec |
2715 | 2337 |
"build from spec" |
2338 |
||
3222 | 2339 |
self menu:(Menu decodeFromLiteralArray:aMenuSpec) |
2340 |
||
2341 |
"Modified: / 27-03-2007 / 08:42:43 / cg" |
|
388 | 2342 |
! |
2343 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2344 |
menu:aMenu |
2715 | 2345 |
"convert to Menu" |
2346 |
||
388 | 2347 |
self disabledRedrawDo:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2348 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2349 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2350 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2351 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2352 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2353 |
(aMenu isCollection) ifTrue:[ |
3222 | 2354 |
menu := Menu decodeFromLiteralArray:aMenu. |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2355 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2356 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2357 |
menuReceiver notNil ifTrue:[ |
2793 | 2358 |
self receiver:menuReceiver. |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2359 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2360 |
]. |
3612 | 2361 |
(newItems := menu menuItems) notEmptyOrNil ifTrue:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2362 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2363 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2364 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2365 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2366 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2367 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2368 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2369 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2370 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2371 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2372 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2373 |
|
3222 | 2374 |
"Modified: / 27-03-2007 / 08:42:28 / cg" |
388 | 2375 |
! ! |
2376 |
||
2681 | 2377 |
!MenuPanel methodsFor:'dependents access'! |
2378 |
||
2379 |
addDependencies |
|
2715 | 2380 |
"add all dependencies" |
2381 |
||
2681 | 2382 |
self do:[:anItem| anItem addDependencies ]. |
2383 |
||
2384 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2385 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2386 |
! |
|
2387 |
||
2388 |
removeDependencies |
|
2715 | 2389 |
"remove all dependencies" |
2390 |
||
2681 | 2391 |
self do:[:anItem| anItem removeDependencies ]. |
2392 |
||
2393 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2394 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2395 |
! ! |
|
2396 |
||
388 | 2397 |
!MenuPanel methodsFor:'drawing'! |
2398 |
||
2399 |
disabledRedrawDo:aBlock |
|
2400 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2401 |
of the block a redraw might be performed" |
2402 |
||
388 | 2403 |
|state| |
2404 |
||
2405 |
state := mustRearrange. |
|
2406 |
mustRearrange := true. |
|
2407 |
aBlock value. |
|
2408 |
mustRearrange := state. |
|
2409 |
self mustRearrange |
|
2410 |
! |
|
2411 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2412 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2413 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2414 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2415 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2416 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2417 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2418 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2419 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2420 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2421 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2422 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2423 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2424 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2425 |
level:aLevel |
2219 | 2426 |
shadow:(self buttonShadowColor) |
2427 |
light:(self buttonLightColor) |
|
2428 |
halfShadow:(self buttonHalfShadowColor) |
|
2429 |
halfLight:(self buttonHalfLightColor) |
|
2430 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2431 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2432 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2433 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2434 |
|
3187 | 2435 |
drawFocusForItem:anItem |
2436 |
|lytItem| |
|
2437 |
||
2438 |
lytItem := anItem layout. |
|
2439 |
self paint:(Color black). |
|
2440 |
||
2441 |
self displayDottedRectangleX:(lytItem left) |
|
2442 |
y:(lytItem top) |
|
2443 |
width:(lytItem width) |
|
2444 |
height:(lytItem height). |
|
2445 |
! |
|
2446 |
||
2016 | 2447 |
drawItemsX:x y:y width:w height:h |
2715 | 2448 |
"redraw items and groups in a damage" |
2449 |
||
2016 | 2450 |
|isVertical item layout prevClip |
2451 |
x1 "{ Class:SmallInteger }" |
|
2452 |
x2 "{ Class:SmallInteger }" |
|
2453 |
y1 "{ Class:SmallInteger }" |
|
2454 |
y2 "{ Class:SmallInteger }" |
|
2455 |
start "{ Class:SmallInteger }" |
|
2456 |
stop "{ Class:SmallInteger }" |
|
2457 |
size "{ Class:SmallInteger }" |
|
2458 |
groupDivInset "{ Class:SmallInteger }" |
|
2459 |
| |
|
2460 |
||
2461 |
size := items size. |
|
2462 |
isVertical := self verticalLayout. |
|
2463 |
||
2464 |
isVertical ifTrue:[ |
|
2064 | 2465 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2466 |
start == 0 ifTrue:[ ^ self ]. |
2467 |
y1 := y + h. |
|
2064 | 2468 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2469 |
startingAt:(start + 1). |
|
2016 | 2470 |
] ifFalse:[ |
2064 | 2471 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2472 |
start == 0 ifTrue:[ ^ self ]. |
2473 |
x1 := x + w. |
|
2064 | 2474 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2475 |
startingAt:(start + 1). |
|
2016 | 2476 |
]. |
2477 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2478 |
||
2253 | 2479 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2480 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2481 |
|
2482 |
groupDivInset ~~ 0 ifTrue:[ |
|
2483 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2484 |
start := start - 1 |
|
2485 |
] |
|
2486 |
]. |
|
2487 |
] ifFalse:[ |
|
2488 |
groupDivInset := 0 |
|
2489 |
]. |
|
2490 |
||
2491 |
prevClip := clipRect. |
|
2492 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2493 |
||
2494 |
start to:stop do:[:i| |
|
2495 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2496 |
item draw. |
2016 | 2497 |
|
2498 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2499 |
layout := item layout. |
|
2500 |
||
2501 |
isVertical ifTrue:[ |
|
2502 |
x1 := layout left. |
|
2503 |
x2 := layout right. |
|
2504 |
y1 := layout bottom + groupDivInset. |
|
2505 |
y2 := y1. |
|
2506 |
] ifFalse:[ |
|
2507 |
y1 := layout top. |
|
2508 |
y2 := layout bottom. |
|
2509 |
x1 := layout right + groupDivInset. |
|
2510 |
x2 := x1. |
|
2511 |
]. |
|
2512 |
self paint:shadowColor. |
|
2513 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2514 |
self paint:lightColor. |
|
2515 |
||
2516 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2517 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2518 |
||
2519 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
3187 | 2520 |
]. |
2521 |
selection == item ifTrue:[ |
|
2522 |
self focusComesByTab ifTrue:[ |
|
2523 |
self drawFocusForItem:item. |
|
2524 |
]. |
|
2525 |
]. |
|
2016 | 2526 |
]. |
2527 |
self clippingRectangle:prevClip. |
|
2528 |
! |
|
2529 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2530 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2531 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2532 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2533 |
isSelected ifTrue:[ |
2219 | 2534 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2535 |
] ifFalse:[ |
2219 | 2536 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2537 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2538 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2539 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2540 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2541 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2542 |
|
1691 | 2543 |
self drawEdgesForX:(layout left) |
2544 |
y:(layout top) |
|
2545 |
width:(layout width) |
|
2546 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2547 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2548 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2549 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2550 |
|
2016 | 2551 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2552 |
"draw a scroller" |
2553 |
||
2016 | 2554 |
|scrolling icon level x y w h| |
2555 |
||
2556 |
x := bounds left. |
|
2557 |
y := bounds top. |
|
2558 |
w := bounds width. |
|
2559 |
h := bounds height. |
|
2560 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2561 |
scrolling := self scrollActivity. |
2016 | 2562 |
|
2563 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2715 | 2564 |
level := -2 |
2016 | 2565 |
] ifFalse:[ |
2715 | 2566 |
level := 1 |
2016 | 2567 |
]. |
2568 |
||
2569 |
level ~~ 0 ifTrue:[ |
|
2715 | 2570 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2571 |
]. |
2572 |
icon := scrolling iconAt:aDirection on:self. |
|
2573 |
||
2574 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2715 | 2575 |
y:(y + (h - icon height // 2)). |
2016 | 2576 |
! |
2577 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2578 |
invalidateItem:anItem repairNow:aBool |
2715 | 2579 |
"an item changed; invalidate the items layout" |
2580 |
||
2016 | 2581 |
|layout| |
2582 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2583 |
(mustRearrange not and:[shown]) ifTrue:[ |
2715 | 2584 |
layout := anItem layout. |
2585 |
||
2586 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2587 |
self invalidate:(layout "insetBy:-1") repairNow:aBool |
2715 | 2588 |
] |
1728 | 2589 |
]. |
2590 |
||
2591 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2592 |
! |
2593 |
||
388 | 2594 |
mustRearrange |
2715 | 2595 |
"force rearrange (i.e. set the rearrange flag)" |
2596 |
||
2080 | 2597 |
mustRearrange ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2598 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2599 |
self invalidate "/ RepairNow:true |
388 | 2600 |
] |
590 | 2601 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2602 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2603 |
! |
2604 |
||
710 | 2605 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2606 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2607 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2608 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2609 |
|
1699 | 2610 |
|layout point |
710 | 2611 |
dltX "{ Class:SmallInteger }" |
2612 |
start "{ Class:SmallInteger }" |
|
2613 |
| |
|
2614 |
||
2615 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2715 | 2616 |
^ self |
710 | 2617 |
]. |
2618 |
||
2619 |
layout := items last layout. |
|
3246 | 2620 |
layout notNil ifTrue:[ |
2621 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
|
2622 |
^ self "/ no free space |
|
2623 |
]. |
|
710 | 2624 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2625 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2626 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2627 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2628 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2629 |
"/ 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
|
2630 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2631 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
2632 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2633 |
] ifFalse:[ |
|
2634 |
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
|
2635 |
]. |
710 | 2636 |
start == 0 ifTrue:[ |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2637 |
^ self "/ no right-group item detected |
1699 | 2638 |
]. |
2639 |
point := dltX @ 0. |
|
2640 |
||
2641 |
"/ move items layout to right |
|
710 | 2642 |
items from:start do:[:anItem| |
2715 | 2643 |
anItem isVisible ifTrue:[ |
2644 |
anItem layout moveBy:point. |
|
2645 |
] |
|
710 | 2646 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2647 |
self updateEnteredItem. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2648 |
|
3246 | 2649 |
"Modified: / 10-10-2007 / 00:29:34 / cg" |
710 | 2650 |
! |
2651 |
||
388 | 2652 |
rearrangeItems |
1699 | 2653 |
"recompute the layout of each item |
2715 | 2654 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2655 |
||
1791 | 2656 |
|isVertical extent isPopUpMenu |
2219 | 2657 |
x "{ Class:SmallInteger }" |
2658 |
y "{ Class:SmallInteger }" |
|
2659 |
x0 "{ Class:SmallInteger }" |
|
2660 |
y0 "{ Class:SmallInteger }" |
|
2661 |
x1 "{ Class:SmallInteger }" |
|
2662 |
y1 "{ Class:SmallInteger }" |
|
2663 |
size "{ Class:SmallInteger }" |
|
2664 |
insetX "{ Class:SmallInteger }" |
|
2665 |
insetY "{ Class:SmallInteger }" |
|
2666 |
labelInsetX "{ Class:SmallInteger }" |
|
2667 |
labelInsetY "{ Class:SmallInteger }" |
|
2668 |
itemMargin "{ Class:SmallInteger }" |
|
2669 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2670 |
| |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2671 |
|
1699 | 2672 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2673 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2674 |
^ self |
390 | 2675 |
]. |
2219 | 2676 |
|
2080 | 2677 |
"/ DON'T SET THIS!! |
2678 |
"/ item layout: below of first item -> item invalidate |
|
2679 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2680 |
"/ -> invalidate:rapairDamage: |
|
2681 |
"/ -> redrawX:y:width:height: |
|
2682 |
"/ tries to get uninitialized layout from second item. |
|
2683 |
"/ This happens in a modal debugger!! |
|
2684 |
"/ mustRearrange := false. |
|
2219 | 2685 |
isVertical := self verticalLayout. |
2686 |
groupDividerSize := self groupDividerSize. |
|
2687 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2688 |
|
2689 |
isPopUpMenu ifFalse:[ |
|
2219 | 2690 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2691 |
] ifTrue:[ |
2145 | 2692 |
labelInsetX := labelInsetY := 0 |
388 | 2693 |
]. |
390 | 2694 |
|
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2695 |
(isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ |
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2696 |
|saveExtent maxExtent extentToSet| |
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2697 |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2698 |
extent := self preferredExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2699 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2700 |
isPopUpMenu ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2701 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2702 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2703 |
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
|
2704 |
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
|
2705 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2706 |
] ifFalse:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2707 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
1478 | 2708 |
]. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2709 |
self extent:extentToSet. |
390 | 2710 |
] ifFalse:[ |
1699 | 2711 |
extent := self computeExtent |
390 | 2712 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2713 |
|
1093 | 2714 |
x := y := margin. |
2715 |
||
1699 | 2716 |
isVertical ifFalse:[ |
2717 |
y0 := margin. |
|
2718 |
y1 := extent y - margin. |
|
2719 |
||
2720 |
items keysAndValuesDo:[:anIndex :el| |
|
2721 |
el isVisible ifFalse:[ |
|
2722 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2723 |
] ifTrue:[ |
|
1478 | 2724 |
el isButton ifTrue:[ |
2145 | 2725 |
insetX := buttonInsetX. |
2726 |
insetY := buttonInsetY. |
|
2062 | 2727 |
] ifFalse:[ |
2145 | 2728 |
insetX := labelInsetX. |
2729 |
insetY := labelInsetY. |
|
1478 | 2730 |
]. |
2145 | 2731 |
x0 := x + insetX. |
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
2732 |
x1 := x0 + (el preferredWidth). |
2145 | 2733 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2734 |
x := x1 + insetX. |
|
1699 | 2735 |
|
2736 |
size ~~ anIndex ifTrue:[ |
|
2737 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2738 |
x := x + groupDividerSize |
|
2739 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2740 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2741 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2742 |
] |
1699 | 2743 |
] |
2744 |
] |
|
1478 | 2745 |
]. |
1699 | 2746 |
]. |
2747 |
] ifTrue:[ |
|
2219 | 2748 |
itemMargin := self itemMargin. |
1699 | 2749 |
x0 := margin. |
2219 | 2750 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2751 |
|
2752 |
items keysAndValuesDo:[:anIndex :el| |
|
2753 |
el isVisible ifFalse:[ |
|
2754 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2755 |
] ifTrue:[ |
|
2756 |
el isButton ifTrue:[ |
|
2145 | 2757 |
insetX := buttonInsetX. |
2758 |
insetY := buttonInsetY. |
|
1699 | 2759 |
] ifFalse:[ |
2145 | 2760 |
insetX := labelInsetX. |
2761 |
insetY := labelInsetY. |
|
1699 | 2762 |
]. |
2145 | 2763 |
y0 := y + insetY. |
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
2764 |
y1 := y0 + el preferredHeight. |
2219 | 2765 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2766 |
y := y1 + insetY. |
1699 | 2767 |
|
2768 |
size ~~ anIndex ifTrue:[ |
|
2769 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2770 |
y := y + groupDividerSize |
|
2771 |
] |
|
2772 |
] |
|
1478 | 2773 |
] |
2774 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2775 |
]. |
710 | 2776 |
self rearrangeGroups. |
2048 | 2777 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2778 |
mustRearrange := false. |
2048 | 2779 |
|
2780 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2781 |
! |
2782 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2783 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2784 |
"check for items which can change its visibility; |
2715 | 2785 |
if at least one item exists, rearrange all items" |
2786 |
||
1464 | 2787 |
items isNil ifTrue:[^ self]. |
1699 | 2788 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2789 |
items do:[:item | |
2715 | 2790 |
item canChangeVisibility ifTrue:[ |
2791 |
mustRearrange := true. |
|
2792 |
self rearrangeItems. |
|
2793 |
^ self |
|
2794 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2795 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2796 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2797 |
|
388 | 2798 |
redrawX:x y:y width:w height:h |
2715 | 2799 |
"redraw a damage" |
2800 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2801 |
|y0 y1 x0 x1 prvBound mustDraw nxtBound| |
388 | 2802 |
|
710 | 2803 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2804 |
|
1699 | 2805 |
mustRearrange ifTrue:[ |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
2806 |
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
|
2807 |
self rearrangeItems. |
2569 | 2808 |
self invalidate. |
2809 |
^ self |
|
1699 | 2810 |
]. |
2888 | 2811 |
"/ self paint:(self viewBackground). |
1699 | 2812 |
self clearRectangleX:x y:y width:w height:h. |
2813 |
||
2016 | 2814 |
items size == 0 ifTrue:[ |
1699 | 2815 |
^ self |
2816 |
]. |
|
2016 | 2817 |
y0 := y. |
2818 |
y1 := y + h. |
|
2018 | 2819 |
x0 := x. |
2820 |
x1 := x + w. |
|
2016 | 2821 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2822 |
"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
|
2823 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2824 |
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
|
2825 |
(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
|
2826 |
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
|
2827 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2828 |
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
|
2829 |
(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
|
2830 |
y0 := prvBound bottom. |
2018 | 2831 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2832 |
] ifFalse:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2833 |
(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
|
2834 |
x0 := prvBound right. |
2018 | 2835 |
]. |
2052 | 2836 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2837 |
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
|
2838 |
self drawScrollerAt:#PREV bounds:prvBound. |
2052 | 2839 |
]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2840 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2841 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2842 |
(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
|
2843 |
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
|
2844 |
|
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2845 |
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
|
2846 |
(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
|
2847 |
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
|
2848 |
] |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2849 |
] ifFalse:[ |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2850 |
(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
|
2851 |
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
|
2852 |
] |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2853 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2854 |
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
|
2855 |
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
|
2856 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2857 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2858 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2859 |
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
|
2860 |
|
2018 | 2861 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2862 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2863 |
]. |
2052 | 2864 |
|
2865 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2866 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2867 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2868 |
updateEnteredItem |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2869 |
|mousePoint| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2870 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2871 |
mousePoint := device translatePoint:(device pointerPosition) |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2872 |
fromView:nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2873 |
toView:self. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2874 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2875 |
(self containsPoint:mousePoint) ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2876 |
enteredItem := self itemAtPoint:mousePoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2877 |
]. |
388 | 2878 |
! ! |
2879 |
||
2880 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2881 |
||
2882 |
collect:aOneArgBlock |
|
2883 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 2884 |
and return a collection of the results" |
2885 |
||
388 | 2886 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 2887 |
^ nil |
388 | 2888 |
! |
2889 |
||
2890 |
do:aOneArgBlock |
|
2715 | 2891 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
2892 |
||
388 | 2893 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
2894 |
! |
|
2895 |
||
2896 |
findFirst:aOneArgBlock |
|
3206 | 2897 |
"find the index of the first item, for which evaluation of the argument, aOneArgBlock |
2715 | 2898 |
returns true; return its index or 0 if none detected." |
2899 |
||
388 | 2900 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 2901 |
^ 0 |
388 | 2902 |
! |
2903 |
||
2904 |
findLast:aOneArgBlock |
|
2905 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2906 |
returns true; return its index or 0 if none detected." |
2907 |
||
388 | 2908 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 2909 |
^ 0 |
388 | 2910 |
! |
2911 |
||
3187 | 2912 |
firstItemSelectable |
2913 |
"returns the first item which is selectable or nil |
|
2914 |
" |
|
2915 |
items size > 0 ifTrue:[ |
|
2916 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
|
2917 |
]. |
|
2918 |
^ nil |
|
2919 |
! |
|
2920 |
||
390 | 2921 |
indexOf:something |
2922 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 2923 |
If no item match 0 is returned. No range checks are performed on a number argument" |
2924 |
||
390 | 2925 |
|i v| |
2926 |
||
2927 |
something isNumber ifTrue:[ ^ something ]. |
|
2928 |
something isNil ifTrue:[ ^ 0 ]. |
|
2929 |
||
1218 | 2930 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2931 |
|
2932 |
i ~~ 0 ifTrue:[ |
|
2715 | 2933 |
^ i |
388 | 2934 |
]. |
390 | 2935 |
|
2936 |
something isSymbol ifTrue:[ |
|
2715 | 2937 |
i := self findFirst:[:el| |
2938 |
v := el value. |
|
2939 |
v isSymbol and:[v == something] |
|
2940 |
]. |
|
2941 |
i ~~ 0 ifTrue:[ |
|
2942 |
^ i |
|
2943 |
] |
|
390 | 2944 |
]. |
2945 |
||
2946 |
(something respondsTo:#string) ifTrue:[ |
|
2715 | 2947 |
v := something string. |
1218 | 2948 |
^ self findFirst:[:el | el textLabel = v]. |
2949 |
]. |
|
2950 |
^ 0 |
|
388 | 2951 |
! |
2952 |
||
706 | 2953 |
indexOfItem:anItem |
2715 | 2954 |
"returns the index of the item or 0" |
2955 |
||
706 | 2956 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
2957 |
! |
|
2958 |
||
388 | 2959 |
keysAndValuesDo:aTwoArgBlock |
2715 | 2960 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
2961 |
||
388 | 2962 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
2963 |
! ! |
|
2964 |
||
2965 |
!MenuPanel methodsFor:'event handling'! |
|
2966 |
||
2967 |
buttonMotion:state x:x y:y |
|
2715 | 2968 |
"open or close the corresponding submenu" |
2969 |
||
2046 | 2970 |
|menue motionPoint translatedPoint sensor| |
1699 | 2971 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2972 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2973 |
^ self |
2016 | 2974 |
]. |
2975 |
||
1699 | 2976 |
sensor := self sensor. |
2977 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2978 |
^ self |
1699 | 2979 |
]. |
2980 |
menue := self detectGrabMenu. |
|
1841 | 2981 |
|
2046 | 2982 |
motionPoint := x@y. |
2983 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2984 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2985 |
|
3780 | 2986 |
"/ hideOnRelease := true. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2987 |
|
1699 | 2988 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2989 |
^ self |
1699 | 2990 |
]. |
2991 |
||
3826 | 2992 |
hideOnRelease ifTrue:[ |
2993 |
sensor anyButtonPressed ifFalse:[^ self] |
|
2994 |
] ifFalse:[ |
|
2995 |
sensor anyButtonPressed ifTrue:[^ self] |
|
2996 |
]. |
|
2997 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2998 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
3321 | 2999 |
"/ 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
|
3000 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3001 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3002 |
] |
1699 | 3003 |
]. |
3004 |
||
2048 | 3005 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 3006 |
! |
3007 |
||
3008 |
buttonPress:button x:x y:y |
|
2715 | 3009 |
"any button pressed; open or close the corresponding submenus" |
3010 |
||
2016 | 3011 |
|menu point| |
3012 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3013 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3014 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3015 |
self scrollActivity stop. |
2016 | 3016 |
point := x@y. |
3017 |
menu := self detectMenuAtGrabPoint:point. |
|
3018 |
||
3019 |
menu isNil ifTrue:[ |
|
3203 | 3020 |
self accept:nil |
2016 | 3021 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3022 |
point := menu translateGrabPoint:point. |
3383 | 3023 |
menu handleButtonPress:button atPoint:point. |
2016 | 3024 |
] |
2046 | 3025 |
|
3026 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 3027 |
! |
3028 |
||
3029 |
buttonRelease:button x:x y:y |
|
2715 | 3030 |
"button release action; accept selection and close all views" |
3031 |
||
2679 | 3032 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
3203 | 3033 |
releaseTime menuMapTime| |
2199 | 3034 |
|
3780 | 3035 |
hideOnRelease ifFalse:[ |
3036 |
^ self |
|
3037 |
]. |
|
3038 |
||
2199 | 3039 |
topMenu := self topMenu. |
3040 |
topMenu openDelayed:nil. |
|
1699 | 3041 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3042 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3043 |
^ self |
2016 | 3044 |
]. |
3045 |
||
1699 | 3046 |
dstMenu := topMenu activeMenu. |
3047 |
||
2679 | 3048 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
3049 |
||
3050 |
hideMenuAndPerformAction ifFalse:[ |
|
3051 |
hideOnRelease ifTrue:[ |
|
3203 | 3052 |
releaseTime := windowGroup lastEvent timeStamp. |
3053 |
menuMapTime := dstMenu mapTime ? releaseTime. |
|
3054 |
||
3055 |
hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime) |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3056 |
> (PopUpMenu maxClickTimeToStayOpen). |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3057 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3058 |
]. |
2679 | 3059 |
hideMenuAndPerformAction ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3060 |
srcPoint := x@y. |
1699 | 3061 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3062 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3063 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3064 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3065 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3066 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3067 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3068 |
self accept:nil. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3069 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3070 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3071 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3072 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3073 |
|
2374 | 3074 |
subm notNil ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3075 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3076 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3077 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3078 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3079 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3080 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3081 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3082 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3083 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3084 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3085 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3086 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3087 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3088 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3089 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3090 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3091 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3092 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3093 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3094 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3095 |
self accept:nil. |
1699 | 3096 |
]. |
3097 |
! |
|
3098 |
||
2860 | 3099 |
handleSizeChanged:how |
3100 |
"used to handle the scrollers and groups in a none popUpView |
|
3101 |
" |
|
3102 |
|layouts damage isVertical scrollBound| |
|
3103 |
||
3104 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
3105 |
^ self |
|
3106 |
]. |
|
3107 |
mustRearrange := true. |
|
3108 |
||
3109 |
shown ifFalse:[ |
|
3110 |
^ self |
|
3111 |
]. |
|
3112 |
layouts := OrderedCollection new. |
|
3113 |
||
3114 |
items do:[:el| |layout| |
|
3115 |
(layout := el layout) isNil ifTrue:[ |
|
3116 |
self invalidate. |
|
3117 |
^ self. |
|
3118 |
]. |
|
3119 |
layouts add:layout. |
|
3120 |
]. |
|
3121 |
isVertical := self verticalLayout. |
|
3122 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3123 |
||
3124 |
self rearrangeItems. |
|
3125 |
||
3126 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
3127 |
damage isNil ifTrue:[ |
|
3128 |
newLyt := el layout. |
|
3129 |
oldLyt := layouts at:i ifAbsent:newLyt. |
|
3130 |
||
3131 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
|
3132 |
start := 0. |
|
3133 |
||
3134 |
i > 1 ifTrue:[ |
|
3135 |
isVertical ifTrue:[ |
|
3136 |
x := 0. |
|
3137 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
|
3138 |
] ifFalse:[ |
|
3139 |
y := 0. |
|
3140 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
|
3141 |
]. |
|
3142 |
]. |
|
3143 |
start <= 20 ifTrue:[ |
|
3144 |
self invalidate. |
|
3145 |
^ self |
|
3146 |
]. |
|
3147 |
damage := Rectangle left:x top:y extent:(self extent). |
|
3148 |
]. |
|
3149 |
]. |
|
3150 |
]. |
|
3151 |
damage isNil ifTrue:[ |
|
3152 |
damage := scrollBound. |
|
3153 |
]. |
|
3154 |
scrollBound := self menuAdornmentAt:#lastDrawnScrollerNextBounds. |
|
3155 |
||
3156 |
scrollBound notNil ifTrue:[ |
|
3157 |
damage := damage merge:scrollBound |
|
3158 |
]. |
|
3159 |
self invalidate:damage. |
|
3160 |
! |
|
3161 |
||
1699 | 3162 |
keyPress:key x:x y:y |
2715 | 3163 |
"any key is pressed" |
3164 |
||
2869 | 3165 |
<resource: #keyboard (#Escape |
3166 |
#Tab #FocusNext #FocusPrevious |
|
3167 |
#CursorLeft #CursorRight )> |
|
3168 |
||
3169 |
|menu menusSuperMenu sensor| |
|
2251 | 3170 |
|
3171 |
sensor := self sensor. |
|
3158 | 3172 |
|
3173 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3174 |
"/ ^ self "/ ignored while any button is pressed |
|
3175 |
"/ ]. |
|
1699 | 3176 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3177 |
self scrollActivity isActive ifTrue:[ |
2016 | 3178 |
key ~~ #Escape ifTrue:[ |
3179 |
^ self |
|
3180 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3181 |
self scrollActivity stop |
2016 | 3182 |
]. |
3183 |
||
1699 | 3184 |
(key == #Tab |
3185 |
or:[key == #FocusNext |
|
3186 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
3187 |
self accept:nil. |
|
2374 | 3188 |
^ super keyPress:key x:x y:y |
1699 | 3189 |
]. |
3190 |
||
3191 |
menu := self detectGrabMenu. |
|
2869 | 3192 |
menusSuperMenu := menu superMenu. |
1699 | 3193 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
3194 |
(key == #Escape) ifTrue:[ |
1699 | 3195 |
"/ must hide the active menu |
2869 | 3196 |
(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[ |
1703 | 3197 |
"/ hide active menu but keep the grab |
2869 | 3198 |
menusSuperMenu selection:nil |
1699 | 3199 |
] ifFalse:[ |
1703 | 3200 |
"/ hide active menu and ungrab |
1699 | 3201 |
self accept:nil |
2251 | 3202 |
]. |
3203 |
^ self |
|
3204 |
]. |
|
3205 |
||
3206 |
menu isViewWrapper ifFalse:[ |
|
3207 |
sensor compressKeyPressEventsWithKey:key. |
|
3208 |
menu handleKeyPress:key. |
|
2374 | 3209 |
^ self |
2251 | 3210 |
]. |
2869 | 3211 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3212 |
|
3213 |
"/ allow cursor movement |
|
3214 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3215 |
(self containsPoint:x@y) ifTrue:[ |
|
3216 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3217 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3218 |
]. |
1699 | 3219 |
! |
3220 |
||
3415 | 3221 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
3222 |
"mousewheel action" |
|
3223 |
||
3224 |
|menu| |
|
3225 |
||
3226 |
menu := self detectGrabMenu. |
|
3227 |
menu isViewWrapper ifTrue:[ |
|
3228 |
menu superMenu ~~ self ifTrue:[ |
|
3229 |
^ self. |
|
3230 |
]. |
|
3231 |
menu := self. |
|
3232 |
]. |
|
3233 |
amount > 0 ifTrue:[ |
|
3234 |
menu handleCursorKey:#CursorUp. |
|
3235 |
] ifFalse:[ |
|
3236 |
menu handleCursorKey:#CursorDown. |
|
3237 |
]. |
|
3238 |
! |
|
3239 |
||
1699 | 3240 |
pointerLeave:state |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3241 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3242 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3243 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3244 |
|
1699 | 3245 |
self detectGrabMenu handlePointerLeave:state. |
3246 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3247 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 3248 |
^ self |
3249 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3250 |
|
2374 | 3251 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3252 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3253 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3254 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3255 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3256 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3257 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3258 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3259 |
sensor isNil ifTrue:[ |
2251 | 3260 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3261 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3262 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3263 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3264 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3265 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3266 |
]. |
2251 | 3267 |
] |
1699 | 3268 |
]. |
3269 |
! |
|
3270 |
||
3271 |
sizeChanged:how |
|
2715 | 3272 |
"redraw #right groups" |
3273 |
||
2860 | 3274 |
"/ self isPopUpView ifFalse:[ |
3275 |
"/ mustRearrange := true. |
|
3276 |
"/ self invalidate |
|
3277 |
"/ ]. |
|
3278 |
"/ ^ super sizeChanged:how. |
|
3279 |
||
3280 |
self handleSizeChanged:how. |
|
3281 |
super sizeChanged:how. |
|
1699 | 3282 |
! ! |
3283 |
||
2503 | 3284 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3285 |
|
1767 | 3286 |
clearImplicitGrab |
2253 | 3287 |
implicitGrabView := lastPointerView := nil. |
1767 | 3288 |
! |
3289 |
||
3290 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3291 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3292 |
|
2253 | 3293 |
|view x y p syntheticEvent menu| |
1767 | 3294 |
|
2658 | 3295 |
ev isDamage ifTrue:[ |
3296 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3297 |
]. |
|
3298 |
||
3142 | 3299 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
3300 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
|
3301 |
]. |
|
3302 |
||
1767 | 3303 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3304 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3305 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3306 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3307 |
self sensor leftButtonPressed ifFalse:[ |
3308 |
self clearImplicitGrab. |
|
3309 |
]. |
|
1767 | 3310 |
]. |
3311 |
||
3312 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 3313 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3314 |
]. |
3315 |
||
3316 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3317 |
ev isButtonEvent ifTrue:[ |
3318 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3319 |
ev view:implicitGrabView. |
|
3320 |
ev arguments at:2 put:p x. |
|
3321 |
ev arguments at:3 put:p y. |
|
3322 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3323 |
||
3324 |
ev isButtonReleaseEvent ifTrue:[ |
|
3325 |
self clearImplicitGrab. |
|
3326 |
]. |
|
3327 |
^ self |
|
3328 |
] |
|
1767 | 3329 |
]. |
3330 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3331 |
||
2016 | 3332 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 3333 |
self clearImplicitGrab. |
3415 | 3334 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
1767 | 3335 |
]. |
3336 |
||
3337 |
p := menu translateGrabPoint:(x@y). |
|
3338 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
3630 | 3339 |
view == self ifTrue:[^self]. "MB:changed - recursion" |
3340 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3341 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3342 |
|
3343 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 3344 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3345 |
view requestFocus. |
|
3346 |
]. |
|
3347 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3348 |
implicitGrabView := view. |
|
3349 |
] |
|
3350 |
]. |
|
1767 | 3351 |
|
3352 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 3353 |
lastPointerView ~~ view ifTrue:[ |
3354 |
"/ must generate enter/leave ... (sigh) |
|
3355 |
lastPointerView notNil ifTrue:[ |
|
3356 |
"/ XXX: should be fixed |
|
3357 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3358 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3359 |
]. |
|
3360 |
view notNil ifTrue:[ |
|
3361 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3362 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3363 |
]. |
|
3364 |
lastPointerView := view. |
|
3365 |
]. |
|
1767 | 3366 |
]. |
3367 |
||
3368 |
ev view:view. |
|
3369 |
ev x:p x. |
|
3370 |
ev y:p y. |
|
3371 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3372 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3373 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3374 |
! |
3375 |
||
2048 | 3376 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3377 |
"open or close the corresponding submenus" |
3378 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3379 |
|menu item translatedPoint containsPoint direction| |
2251 | 3380 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3381 |
containsPoint := self containsPoint:motionPoint. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3382 |
containsPoint ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3383 |
item := self itemAtPoint:motionPoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3384 |
]. |
2251 | 3385 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3386 |
"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
|
3387 |
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
|
3388 |
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
|
3389 |
self pointerEntersItem:nil. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3390 |
|
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3391 |
self sensor anyButtonPressed ifTrue:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3392 |
self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
3393 |
]. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3394 |
^ self |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3395 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3396 |
|
2251 | 3397 |
self pointerEntersItem:item. |
1699 | 3398 |
|
1910 | 3399 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
3187 | 3400 |
( self selectionFollowsMouse |
3401 |
and:[self topMenu focusComesByTab not] |
|
3402 |
) ifTrue:[ |
|
3403 |
self isPopUpView ifTrue:[ |
|
3404 |
item isNil ifTrue:[ |
|
3405 |
superMenu notNil ifTrue:[ |
|
3406 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3407 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3408 |
] |
|
3409 |
] ifFalse:[ |
|
3410 |
self selection:item openMenu:false. |
|
3411 |
self openDelayed:item afterSeconds:0.1. |
|
3412 |
]. |
|
3413 |
] ifFalse:[ "/ processing in the toolbar |
|
3414 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
|
3415 |
self selection:item openMenu:true. |
|
3416 |
]. |
|
3417 |
]. |
|
3418 |
]. |
|
2048 | 3419 |
^ self |
3420 |
]. |
|
3421 |
||
2251 | 3422 |
containsPoint ifTrue:[ |
3423 |
self selection:item openMenu:true. |
|
2374 | 3424 |
^ self |
2251 | 3425 |
]. |
3426 |
||
3427 |
menu := self superMenuAtPoint:motionPoint. |
|
3428 |
||
2374 | 3429 |
menu notNil ifTrue:[ |
2046 | 3430 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3431 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3432 |
^ self |
2251 | 3433 |
]. |
3434 |
self isPopUpView ifTrue:[ |
|
3435 |
self selection:nil |
|
3436 |
]. |
|
2046 | 3437 |
! |
3438 |
||
3383 | 3439 |
handleButtonPress:button atPoint:aPoint |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3440 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3441 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3442 |
|item scrollerDirectionOrNil wasSelected| |
2016 | 3443 |
|
2046 | 3444 |
item := self itemAtPoint:aPoint. |
2374 | 3445 |
item isNil ifTrue:[ |
2251 | 3446 |
self selection:nil openMenu:false. |
2374 | 3447 |
^ self |
2251 | 3448 |
]. |
3449 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3450 |
"/ is a scroller-button present and hit ? |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3451 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3452 |
scrollerDirectionOrNil notNil ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3453 |
(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[ |
2251 | 3454 |
self pointerEntersItem:nil. |
3455 |
^ self |
|
2238 | 3456 |
] |
2016 | 3457 |
]. |
2251 | 3458 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3459 |
"/ right button always immediately pulls the delayedMenu |
3383 | 3460 |
button == 2 ifTrue:[ |
3461 |
item hasDelayedMenu ifTrue:[ |
|
3462 |
self selection:item openMenu:false. |
|
3463 |
self openDelayed:item afterSeconds:0. |
|
3464 |
^ self. |
|
3465 |
]. |
|
3466 |
]. |
|
3467 |
||
2251 | 3468 |
wasSelected := (selection == item). |
3469 |
wasSelected ifFalse:[ |
|
3470 |
self selection:item openMenu:true |
|
3471 |
]. |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3472 |
item hasDelayedMenu ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3473 |
"/ clicked on the arrow icon ? |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3474 |
(item menuIndicatorContains:aPoint) ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3475 |
self selection:item openMenu:false. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3476 |
self openDelayed:item afterSeconds:0. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3477 |
^ self. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3478 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3479 |
^ self |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3480 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3481 |
|
2238 | 3482 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3483 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3484 |
item toggleSubmenuVisibility |
|
3485 |
]. |
|
2238 | 3486 |
^ self |
3487 |
]. |
|
3488 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3489 |
^ self |
|
3490 |
]. |
|
3491 |
self invalidateItem:item repairNow:true. |
|
3492 |
self acceptItem:item inMenu:self. |
|
3493 |
||
3233 | 3494 |
[ (device notNil and:[device anyButtonPressed]) ] whileTrue:[ |
3495 |
"/ using device - sensor is not updated sometimes |
|
3496 |
Delay waitForSeconds:0.1. |
|
3497 |
]. |
|
3498 |
self sensor flushUserEvents. |
|
2238 | 3499 |
self selection:nil. |
2046 | 3500 |
|
3501 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3502 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3503 |
! |
3504 |
||
1699 | 3505 |
handleCursorKey:aKey |
2715 | 3506 |
"handle a cursor key" |
3507 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3508 |
|next menu item isVrt backKey p1 p2 |
2354 | 3509 |
idx0 "{ Class:SmallInteger }" |
687 | 3510 |
idx "{ Class:SmallInteger }" |
1705 | 3511 |
size "{ Class:SmallInteger }" |
687 | 3512 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3513 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3514 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3515 |
^ self |
388 | 3516 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3517 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3518 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3519 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3520 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3521 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3522 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3523 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3524 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3525 |
^ superMenu handleCursorKey:aKey |
1699 | 3526 |
]. |
2016 | 3527 |
idx := 0. |
3528 |
||
3529 |
isVrt ifTrue:[ |
|
3530 |
"/ used because of vertical scrolling |
|
3531 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3532 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3533 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3534 |
] ifFalse:[ |
2016 | 3535 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3536 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3537 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3538 |
|
2354 | 3539 |
idx0 := idx. |
3540 |
size timesRepeat:[ |
|
3541 |
|el| |
|
3542 |
||
3543 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3544 |
||
3545 |
idx > size ifTrue:[ |
|
3546 |
idx := 0 "1" |
|
3547 |
] ifFalse:[ |
|
3548 |
idx < 0 ifTrue:[ |
|
3549 |
idx := size |
|
3550 |
] |
|
3551 |
]. |
|
3552 |
||
3553 |
idx == 0 ifTrue:[ |
|
3554 |
self selection:nil. |
|
3555 |
^ self |
|
3556 |
] ifFalse:[ |
|
3557 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3558 |
el canSelect ifTrue:[ |
|
3559 |
el hasDelayedMenu ifTrue:[ |
|
3560 |
"/ do not open menu |
|
3561 |
self selection:el openMenu:false |
|
3562 |
] ifFalse:[ |
|
3563 |
"/ open comes from style-sheet |
|
3564 |
self selection:el. |
|
3565 |
]. |
|
3566 |
^ self |
|
2249 | 3567 |
]. |
2354 | 3568 |
] |
3569 |
]. |
|
3570 |
idx == idx0 ifTrue:[ |
|
3571 |
^ self |
|
3572 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3573 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3574 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3575 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3576 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3577 |
superMenu notNil ifTrue:[ |
1791 | 3578 |
p1 := self translateGrabPoint:0. |
3579 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3580 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3581 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3582 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3583 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3584 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3585 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3586 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3587 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3588 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3589 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3590 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3591 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3592 |
backKey := #CursorUp. |
1699 | 3593 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3594 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3595 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3596 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3597 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3598 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3599 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3600 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3601 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3602 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3603 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3604 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3605 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3606 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3607 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3608 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3609 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3610 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3611 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3612 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3613 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3614 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3615 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3616 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3617 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3618 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3619 |
^ self |
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 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3622 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3623 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3624 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3625 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3626 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3627 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3628 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3629 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3630 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3631 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3632 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3633 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3634 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3635 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3636 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3637 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3638 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3639 |
handleKeyPress:key |
2715 | 3640 |
"any key is pressed" |
3641 |
||
2219 | 3642 |
|item inMenu| |
1699 | 3643 |
|
3644 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
3754 | 3645 |
self handleReturnPressed. |
3646 |
^ true. |
|
3647 |
]. |
|
3648 |
key isCharacter ifTrue:[ |
|
1862 | 3649 |
"/ selection notNil ifTrue:[ |
3650 |
"/ inMenu := self |
|
3651 |
"/ ] ifFalse:[ |
|
3652 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3653 |
"/ ]. |
|
3754 | 3654 |
inMenu := self. |
3655 |
||
3656 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
|
3657 |
inMenu selection:item |
|
3658 |
]. |
|
3659 |
^ true |
|
3660 |
]. |
|
3661 |
(key == #CursorDown |
|
3662 |
or:[key == #CursorUp |
|
3663 |
or:[key == #CursorLeft |
|
3664 |
or:[key == #CursorRight]]]) |
|
3665 |
ifTrue:[ |
|
3666 |
self handleCursorKey:key. |
|
3667 |
^ true |
|
3668 |
]. |
|
3669 |
^ false. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3670 |
! |
1699 | 3671 |
|
3672 |
handlePointerLeave:state |
|
3673 |
self pointerEntersItem:nil. |
|
3674 |
super pointerLeave:state |
|
3675 |
! |
|
3676 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3677 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3678 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3679 |
|
2238 | 3680 |
|sensor subm item| |
3681 |
||
3682 |
(item := selection) isNil ifTrue:[ |
|
3683 |
superMenu notNil ifTrue:[ |
|
2249 | 3684 |
item := superMenu selection. |
3685 |
||
3686 |
item value notNil ifTrue:[ |
|
3687 |
"/ is a delayed menu |
|
3688 |
self accept:item |
|
3689 |
] ifFalse:[ |
|
3690 |
item toggleSubmenuVisibility |
|
3691 |
] |
|
2238 | 3692 |
] ifFalse:[ |
3693 |
self accept |
|
3694 |
]. |
|
3695 |
^ self |
|
1841 | 3696 |
]. |
3697 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3698 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3699 |
selection toggleSubmenuVisibility. |
3700 |
^ self |
|
2238 | 3701 |
]. |
3702 |
subm := selection currentSubmenu. |
|
3703 |
||
3704 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3705 |
selection toggleSubmenuVisibility. |
3706 |
^ self |
|
2238 | 3707 |
]. |
3708 |
self openDelayed:nil |
|
1841 | 3709 |
]. |
3710 |
self accept. |
|
3711 |
||
2238 | 3712 |
" test for toggle " |
3713 |
item isToggle ifTrue:[ |
|
3714 |
self selection:item. |
|
3715 |
] ifFalse:[ |
|
3716 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3717 |
^ self |
|
3718 |
] |
|
3719 |
]. |
|
1841 | 3720 |
|
3721 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3722 |
^ self |
1841 | 3723 |
]. |
3724 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3725 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3726 |
sensor flushKeyboardFor:nil. |
2238 | 3727 |
Delay waitForSeconds:0.1. |
3728 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3729 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3730 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3731 |
|
1699 | 3732 |
pointerEntersItem:anItemOrNil |
3733 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3734 |
redraw the new item highlighted." |
3735 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3736 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3737 |
|
1699 | 3738 |
( anItemOrNil notNil |
3739 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3740 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3741 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3742 |
anItemOrNil isButton ifTrue:[ |
2219 | 3743 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3744 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3745 |
) ifTrue:[ |
1699 | 3746 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3747 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3748 |
] ifFalse:[ |
2219 | 3749 |
(self enteredLevel ~~ 0 |
3750 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3751 |
) ifTrue:[ |
|
1699 | 3752 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3753 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3754 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3755 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3756 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3757 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3758 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3759 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3760 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3761 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3762 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3763 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3764 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3765 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3766 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3767 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3768 |
]. |
388 | 3769 |
! ! |
3770 |
||
2251 | 3771 |
!MenuPanel methodsFor:'focus handling'! |
3772 |
||
3187 | 3773 |
canTab |
3774 |
"depends whether I'am a toolbar and selectable items exists |
|
3775 |
" |
|
3776 |
|selectableItem| |
|
3777 |
||
3778 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3779 |
selectableItem := self firstItemSelectable. |
|
3780 |
^ selectableItem notNil |
|
3781 |
]. |
|
3782 |
^ false |
|
3783 |
! |
|
3784 |
||
3785 |
focusComesByTab |
|
3786 |
"returns true if focus comes by tab and should be drawn |
|
3787 |
" |
|
3788 |
|focusComesByTab| |
|
3789 |
||
3790 |
focusComesByTab := self menuAdornmentAt:#focusComesByTab. |
|
3791 |
||
3792 |
focusComesByTab == true ifTrue:[ |
|
3793 |
(shown and:[self hasFocus]) ifTrue:[ |
|
3794 |
^ true |
|
3795 |
]. |
|
3796 |
self menuAdornmentAt:#focusComesByTab put:false. |
|
3797 |
]. |
|
3798 |
^ false |
|
3799 |
! |
|
3800 |
||
3801 |
focusComesByTab:aBoolean |
|
3802 |
"only handled for toolBars" |
|
3803 |
||
3804 |
|selectableItem| |
|
3805 |
||
3806 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
3807 |
self menuAdornmentAt:#focusComesByTab put:aBoolean. |
|
3808 |
||
3809 |
self hasSelection ifTrue:[ |
|
3810 |
^ self |
|
3811 |
]. |
|
3812 |
||
3813 |
aBoolean ifTrue:[ |
|
3814 |
selectableItem := self firstItemSelectable. |
|
3815 |
]. |
|
3816 |
self selection:selectableItem openMenu:false. |
|
3817 |
]. |
|
3818 |
! |
|
3819 |
||
2251 | 3820 |
hasKeyboardFocus:aBoolean |
2715 | 3821 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3822 |
||
2251 | 3823 |
|focusView| |
3824 |
||
3825 |
self isPopUpView ifTrue:[ |
|
3826 |
"/ not visible for popup menus |
|
3827 |
^ super hasKeyboardFocus:aBoolean |
|
3828 |
]. |
|
3829 |
||
3830 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3831 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3832 |
focusView := windowGroup focusView. |
|
3833 |
||
3834 |
focusView == self ifFalse:[ |
|
3835 |
self selection:nil. |
|
3836 |
] |
|
3837 |
] |
|
3838 |
]. |
|
3839 |
super hasKeyboardFocus:aBoolean. |
|
3142 | 3840 |
! |
3841 |
||
3187 | 3842 |
showFocus:focusComesByTab |
3843 |
self focusComesByTab:focusComesByTab. |
|
3844 |
super showFocus:focusComesByTab. |
|
3845 |
! |
|
3846 |
||
3847 |
showNoFocus:focusByTab |
|
3848 |
self focusComesByTab:false. |
|
3849 |
super showNoFocus:focusByTab. |
|
3850 |
! |
|
3851 |
||
3852 |
supportsFocusOnTab |
|
3853 |
"returns true if focus is supported |
|
3854 |
" |
|
3855 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 3856 |
! |
3857 |
||
3858 |
wantsFocusWithButtonPress |
|
3187 | 3859 |
"needs only the focus if I'am a toolbar; all events are delegated |
3860 |
to my subMenus" |
|
3861 |
||
3862 |
^ self isPopUpView not |
|
2251 | 3863 |
! ! |
3864 |
||
388 | 3865 |
!MenuPanel methodsFor:'grabbing'! |
3866 |
||
1699 | 3867 |
doGrab |
3868 |
relativeGrabOrigin := nil. |
|
3869 |
||
3870 |
superMenu notNil ifTrue:[ |
|
3158 | 3871 |
superMenu doGrab |
1699 | 3872 |
] ifFalse:[ |
3158 | 3873 |
hasImplicitGrap ~~ true ifTrue:[ |
3874 |
self grabMouseAndKeyboard. |
|
3875 |
hasImplicitGrap := true |
|
3876 |
] |
|
1699 | 3877 |
] |
3878 |
! |
|
3879 |
||
3880 |
doUngrab:forceDo |
|
3881 |
||
3882 |
relativeGrabOrigin := nil. |
|
1767 | 3883 |
self clearImplicitGrab. |
1699 | 3884 |
|
3885 |
superMenu notNil ifTrue:[ |
|
3158 | 3886 |
forceDo ifTrue:[ |
3887 |
superMenu doUngrab:true |
|
3888 |
]. |
|
3889 |
^ self |
|
1699 | 3890 |
]. |
3891 |
||
3892 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3158 | 3893 |
^ self |
1699 | 3894 |
]. |
3895 |
||
3896 |
forceDo ifFalse:[ |
|
3158 | 3897 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3898 |
^ self |
|
3899 |
]. |
|
1699 | 3900 |
]. |
3901 |
self ungrabMouseAndKeyboard. |
|
3902 |
self selection:nil. |
|
3903 |
hasImplicitGrap := nil. |
|
1703 | 3904 |
prevFocusView := nil. |
1699 | 3905 |
! |
3906 |
||
1630 | 3907 |
grabKeyboard |
2715 | 3908 |
"grap the keyboard; keep previous grab" |
3909 |
||
1630 | 3910 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 3911 |
^ super grabKeyboard |
1630 | 3912 |
! |
3913 |
||
388 | 3914 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3915 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3916 |
|
3754 | 3917 |
|winGroup sensor activeGrab| |
3142 | 3918 |
|
3919 |
winGroup := self windowGroup. |
|
3920 |
||
3921 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
3922 |
prevFocusView isNil ifTrue:[ |
|
3923 |
prevFocusView := winGroup focusView. |
|
3924 |
]. |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3925 |
sensor := self sensor. |
3754 | 3926 |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3927 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3928 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3929 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3930 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3931 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3932 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3933 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3934 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3935 |
self unmap |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3936 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3937 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3938 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3939 |
|
3754 | 3940 |
(activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[ |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3941 |
device sync. |
3754 | 3942 |
"/ cg: mhmh - should we flush for all or for the activeGrab only ? |
3943 |
"/ activeGrab notNil ifTrue:[ |
|
3944 |
"/ sensor flushKeyboardFor:activeGrab. |
|
3945 |
"/ ]. |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3946 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3947 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3948 |
] |
388 | 3949 |
] |
3950 |
||
3158 | 3951 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3952 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3953 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3954 |
! |
3955 |
||
1630 | 3956 |
grabPointerWithCursor:aCursorOrNil |
2715 | 3957 |
"grap the pointer; keep previous grab" |
3958 |
||
1630 | 3959 |
previousPointerGrab := device activePointerGrab. |
1699 | 3960 |
hasImplicitGrap := true. |
2715 | 3961 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3962 |
! |
3963 |
||
3964 |
ungrabKeyboard |
|
2715 | 3965 |
"ungrap the keyboard; restore previous grab" |
3966 |
||
1630 | 3967 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3968 |
|
2579 | 3969 |
(previousKeyboardGrab notNil |
3970 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3971 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3972 |
]. |
|
1630 | 3973 |
! |
3974 |
||
388 | 3975 |
ungrabMouseAndKeyboard |
2715 | 3976 |
"ungrab resources (mouse and keyboard)" |
3977 |
||
1630 | 3978 |
self ungrabPointer. |
3979 |
self ungrabKeyboard. |
|
3980 |
! |
|
3981 |
||
3982 |
ungrabPointer |
|
2715 | 3983 |
"ungrap the pointer; restore previous grab" |
3984 |
||
1630 | 3985 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3986 |
|
2579 | 3987 |
(previousPointerGrab notNil |
3988 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3989 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3990 |
]. |
388 | 3991 |
! ! |
3992 |
||
1251 | 3993 |
!MenuPanel methodsFor:'help'! |
3994 |
||
3441 | 3995 |
flyByHelpSpec |
3996 |
"allows subclasses to provide texts" |
|
3997 |
||
3998 |
^ IdentityDictionary new |
|
3999 |
! |
|
4000 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4001 |
flyByHelpTextAt:aPoint |
2058 | 4002 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4003 |
If there is a selection, that items helpText is used (ignoring the given point)." |
4004 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4005 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4006 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4007 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4008 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4009 |
scrollerDirectionOrNil notNil ifTrue:[ |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4010 |
^ 'Scroll Menu Items' |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4011 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4012 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4013 |
self withMenuAndItemAt:aPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item]. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4014 |
^ nil |
2058 | 4015 |
! |
4016 |
||
4017 |
flyByHelpTextForItem:anItem |
|
2715 | 4018 |
"returns the helpText for an item (empty if none)" |
4019 |
||
2063 | 4020 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4021 |
^ anItem flyByHelpText. |
2058 | 4022 |
! |
4023 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4024 |
flyByHelpTextForKey:aKey |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4025 |
|app text| |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4026 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4027 |
app := self application. |
3441 | 4028 |
app notNil ifTrue:[ |
4029 |
text := self application flyByHelpTextForKey:aKey. |
|
4030 |
text notNil ifTrue:[^ text]. |
|
4031 |
]. |
|
4032 |
^ self flyByHelpSpec at:aKey ifAbsent:nil |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4033 |
! |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4034 |
|
1251 | 4035 |
helpText |
2715 | 4036 |
"return the helpText for the currently selected item (empty if none)" |
4037 |
||
1613 | 4038 |
^ self helpTextForItem:selection |
1251 | 4039 |
! |
4040 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4041 |
helpTextAt:aPoint |
1252 | 4042 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4043 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
4044 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4045 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4046 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4047 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4048 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4049 |
scrollerDirectionOrNil notNil ifTrue:[ |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4050 |
^ 'Scroll Menu Items' |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4051 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4052 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4053 |
self withMenuAndItemAt:aPoint do:[:menu :item | ^ menu helpTextForItem:item]. |
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4054 |
^ nil |
1613 | 4055 |
! |
4056 |
||
4057 |
helpTextForItem:anItem |
|
2715 | 4058 |
"returns the helpText for an item (empty if none)" |
4059 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4060 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4061 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4062 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4063 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4064 |
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
|
4065 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4066 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4067 |
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
|
4068 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4069 |
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
|
4070 |
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
|
4071 |
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
|
4072 |
] |
1251 | 4073 |
! ! |
4074 |
||
794 | 4075 |
!MenuPanel methodsFor:'image registration'! |
4076 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
4077 |
imageOnMyDevice:anImage |
2715 | 4078 |
"returns image registered on device" |
4079 |
||
2770 | 4080 |
^ self class image:anImage value onDevice:device |
794 | 4081 |
! |
4082 |
||
4083 |
lightenedImageOnDevice:anImage |
|
2715 | 4084 |
"returns lightened image registered on device" |
4085 |
||
794 | 4086 |
^ self class lightenedImage:anImage onDevice:device |
4087 |
! ! |
|
4088 |
||
1688 | 4089 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 4090 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4091 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4092 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4093 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4094 |
|
388 | 4095 |
create |
2715 | 4096 |
"create the shadow view for a none contained submenu" |
4097 |
||
388 | 4098 |
super create. |
4099 |
||
4100 |
self isPopUpView ifTrue:[ |
|
2715 | 4101 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
4102 |
shadowView isNil ifTrue:[ |
|
4103 |
shadowView := (ShadowView onDevice:device) for:self |
|
4104 |
] ifFalse:[ |
|
4105 |
self saveUnder:true. |
|
4106 |
]. |
|
4107 |
] |
|
388 | 4108 |
] ifFalse:[ |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4109 |
self hasExplicitExtent ifTrue:[ |
2715 | 4110 |
(self width) == (superView width) ifTrue:[ |
4111 |
self verticalLayout:false |
|
4112 |
] |
|
4113 |
] |
|
388 | 4114 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4115 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4116 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 4117 |
! |
4118 |
||
4119 |
destroy |
|
2715 | 4120 |
"destroy items and shadowView; remove dependencies" |
4121 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4122 |
self clearLastActiveMenu. |
2051 | 4123 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 4124 |
items := nil. |
4125 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4126 |
|
388 | 4127 |
super destroy. |
3142 | 4128 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4129 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4130 |
|
2051 | 4131 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4132 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4133 |
|
616 | 4134 |
fetchDeviceResources |
2715 | 4135 |
"fetch device colors, to avoid reallocation at redraw time" |
4136 |
||
2219 | 4137 |
|style| |
4138 |
||
2374 | 4139 |
superMenu notNil ifTrue:[ |
2219 | 4140 |
styleSheet := superMenu styleSheet |
4141 |
]. |
|
616 | 4142 |
|
4143 |
super fetchDeviceResources. |
|
4144 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4145 |
"/ 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
|
4146 |
"/ (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
|
4147 |
|
616 | 4148 |
superMenu isNil ifTrue:[ |
2374 | 4149 |
rightArrow isNil ifTrue:[ |
2219 | 4150 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 4151 |
]. |
2219 | 4152 |
fgColor := fgColor onDevice:device. |
4153 |
style := styleSheet name. |
|
4154 |
||
2761 | 4155 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
2219 | 4156 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
4157 |
] ifFalse:[ |
|
4158 |
rightArrowShadow := nil |
|
4159 |
]. |
|
616 | 4160 |
] ifFalse:[ |
2219 | 4161 |
rightArrow := superMenu rightArrow. |
4162 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4163 |
||
4164 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 4165 |
self font:(superMenu font). |
2761 | 4166 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4167 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4168 |
|
1829 | 4169 |
items notNil ifTrue:[ |
2219 | 4170 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 4171 |
]. |
4172 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4173 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 4174 |
! |
4175 |
||
580 | 4176 |
initStyle |
4177 |
"initialize style specific stuff" |
|
4178 |
||
2919 | 4179 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
4180 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
|
4181 |
#'menu.itemHorizontalSpace' |
|
4182 |
#'popup.hideOnRelease' |
|
4183 |
)> |
|
2609 | 4184 |
|fn| |
4185 |
||
580 | 4186 |
super initStyle. |
616 | 4187 |
|
2883 | 4188 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
4189 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4190 |
buttonInsetX := buttonInsetX abs. |
|
4191 |
||
4192 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
4193 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4194 |
buttonInsetY := buttonInsetY abs. |
|
4195 |
||
4196 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
4197 |
itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ]. |
|
4198 |
||
4199 |
||
2609 | 4200 |
fgColor := DefaultForegroundColor ? Color black. |
4201 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
4202 |
fn := self class defaultFont. |
|
2610 | 4203 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 4204 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4205 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4206 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4207 |
self updateLevelAndBorder. |
580 | 4208 |
! |
4209 |
||
388 | 4210 |
initialize |
2715 | 4211 |
"set default configuration" |
4212 |
||
388 | 4213 |
super initialize. |
616 | 4214 |
|
2877 | 4215 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4216 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
4217 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
4218 |
self originChangedFlag:false. |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4219 |
"/ explicitExtent := nil. |
2253 | 4220 |
shortKeyInset := 0. |
4221 |
mustRearrange := false. |
|
4222 |
showSeparatingLines := false. |
|
4223 |
showGroupDivider := true. |
|
3780 | 4224 |
hideOnRelease := defaultHideOnRelease. |
388 | 4225 |
! |
4226 |
||
1573 | 4227 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4228 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4229 |
If the grab fails, try again and unmap myself if that fails too." |
4230 |
||
1791 | 4231 |
|loIndices loItems| |
388 | 4232 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4233 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4234 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4235 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4236 |
self becomesActiveMenu. |
1573 | 4237 |
super map. |
2681 | 4238 |
self addDependencies. |
388 | 4239 |
|
1785 | 4240 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4241 |
loItems := items ? #[]. |
4242 |
||
4243 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4244 |
|
388 | 4245 |
self isPopUpView ifTrue:[ |
2681 | 4246 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4247 |
] ifFalse:[ |
2681 | 4248 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4249 |
]. |
1791 | 4250 |
loItems do:[:el| el updateIndicators ]. |
388 | 4251 |
|
1785 | 4252 |
loIndices size > 0 ifTrue:[ |
2681 | 4253 |
self redrawX:0 y:0 width:width height:height. |
4254 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4255 |
]. |
4256 |
||
1177 | 4257 |
"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
|
4258 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4259 |
! |
4260 |
||
4261 |
realize |
|
2715 | 4262 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4263 |
|
2761 | 4264 |
|bgColor| |
4265 |
||
388 | 4266 |
self isPopUpView ifTrue:[ |
2761 | 4267 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4268 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4269 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4270 |
"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
|
4271 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4272 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4273 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4274 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4275 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4276 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4277 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4278 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4279 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4280 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4281 |
self map. |
736 | 4282 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4283 |
super realize. |
1767 | 4284 |
]. |
4285 |
self allSubViewsDo:[:aView| aView realize ]. |
|
3780 | 4286 |
"/ hideOnRelease := defaultHideOnRelease. |
388 | 4287 |
! |
4288 |
||
4289 |
recreate |
|
1832 | 4290 |
"this is called after a snapin or a migration. |
2715 | 4291 |
If the image was saved with an active menu, hide the menu" |
4292 |
||
1455 | 4293 |
selection := nil. |
388 | 4294 |
super recreate. |
4295 |
! |
|
4296 |
||
1130 | 4297 |
reinitStyle |
4298 |
"handle style change while being open (win32 only - for now)" |
|
4299 |
||
4300 |
super reinitStyle. |
|
4301 |
||
4302 |
self fetchDeviceResources. |
|
1811 | 4303 |
self mustRearrange. "/ care for changed font sizes etc. |
4304 |
||
4305 |
self do:[:anItem | |
|
4306 |
anItem reinitStyle |
|
4307 |
]. |
|
1130 | 4308 |
|
4309 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4310 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4311 |
! |
4312 |
||
388 | 4313 |
unmap |
1330 | 4314 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4315 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4316 |
|
3203 | 4317 |
mapTime := nil. |
4318 |
||
2681 | 4319 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4320 |
self clearLastActiveMenu. |
1699 | 4321 |
self doUngrab:(superMenu isNil). |
4322 |
"/ self isPopUpView ifTrue:[ |
|
4323 |
"/ self doUngrab:(superMenu isNil) |
|
4324 |
"/ ]. |
|
3142 | 4325 |
prevFocusView := nil. |
388 | 4326 |
super unmap. |
4327 |
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
|
4328 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4329 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4330 |
updateLevelAndBorder |
3820 | 4331 |
"update level & border" |
4332 |
||
4333 |
<resource: #style (#'popup.borderWidth' |
|
4334 |
#'popup.borderColor' |
|
4335 |
#'popup.level' |
|
4336 |
#'pullDownMenu.level' |
|
4337 |
)> |
|
4338 |
||
4339 |
|bw bc lvl| |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4340 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4341 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4342 |
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
|
4343 |
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
|
4344 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4345 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 4346 |
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
|
4347 |
]. |
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4348 |
bw ~~ 0 ifTrue:[ |
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4349 |
bc := styleSheet at:#'popup.borderColor' default:Color black. |
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4350 |
self borderColor:bc |
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4351 |
]. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4352 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4353 |
self level:lvl. |
388 | 4354 |
! ! |
4355 |
||
1878 | 4356 |
!MenuPanel methodsFor:'keyboard control'! |
4357 |
||
4358 |
mnemonicViewNext:aKeyEvent |
|
4359 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4360 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4361 |
return the topMenu otherwise nil." |
4362 |
||
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4363 |
|menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel| |
2112 | 4364 |
|
4365 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4366 |
shown ifFalse:[^ nil]. |
4367 |
||
4368 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4369 |
lKey := uKey asLowercase. |
|
2112 | 4370 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4371 |
accessCharacterMatchQuery := [:el| |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4372 |
|k| |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4373 |
k := el accessCharacter. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4374 |
k == uKey or:[k == lKey] |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4375 |
]. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4376 |
maxShortCutSearchLevel := self class maxShortCutSearchLevel. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4377 |
|
2112 | 4378 |
selection notNil ifTrue:[ |
2374 | 4379 |
"first lookup the current grapMenu before starting in the topMenu |
4380 |
" |
|
4381 |
menu := self detectGrabMenu. |
|
4382 |
||
4383 |
[ menu ~~ self ] whileTrue:[ |
|
4384 |
index := menu selectionIndex. |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4385 |
list := menu |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4386 |
selectItemIndicesFor:accessCharacterMatchQuery |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4387 |
maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999 |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4388 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 4389 |
|
2374 | 4390 |
list size ~~ 0 ifTrue:[ |
4391 |
"/ has item which responds to the mnemonic |
|
4392 |
menu processCollectedIndices:list. |
|
4393 |
^ self |
|
4394 |
]. |
|
4395 |
menu := menu superMenu. |
|
4396 |
]. |
|
4397 |
index := self selectionIndex. |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4398 |
list := self |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4399 |
selectItemIndicesFor:accessCharacterMatchQuery |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4400 |
maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999 |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4401 |
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
|
4402 |
|
2112 | 4403 |
] ifFalse:[ |
2374 | 4404 |
index := 99999. |
4405 |
list := nil. |
|
2112 | 4406 |
]. |
4407 |
||
2374 | 4408 |
list isNil ifTrue:[ |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4409 |
list := self |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4410 |
selectItemIndicesFor:accessCharacterMatchQuery |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4411 |
maxDepth:maxShortCutSearchLevel from:1 to:index |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4412 |
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
|
4413 |
|
2374 | 4414 |
|
4415 |
list isNil ifTrue:[ |
|
4416 |
"/ must clear existing selection |
|
4417 |
self selection:nil. |
|
4418 |
^ nil |
|
4419 |
] |
|
2112 | 4420 |
]. |
4421 |
||
4422 |
"/ has item which responds to the mnemonic |
|
4423 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4424 |
! |
1878 | 4425 |
|
4426 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4427 |
"open all menus derived from sequence of item indices" |
4428 |
||
1878 | 4429 |
|item| |
4430 |
||
4431 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 4432 |
^ self |
1878 | 4433 |
]. |
4434 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4435 |
||
4436 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 4437 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4438 |
self selection:item openMenu:true. |
|
4439 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4440 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4441 |
! |
1878 | 4442 |
|
4443 |
processCollectedIndices:indices |
|
4444 |
|menu item| |
|
4445 |
||
4446 |
indices size == 0 ifTrue:[ |
|
3192 | 4447 |
^ self |
1878 | 4448 |
]. |
4449 |
menu := self. |
|
4450 |
||
3192 | 4451 |
"/ first lookup in current open submenus |
1878 | 4452 |
[menu selectionIndex == indices first] whileTrue:[ |
3192 | 4453 |
( (item := menu selection) isNil |
4454 |
or:[(menu := item currentSubmenu) isNil] |
|
4455 |
) ifTrue:[ "/ selected but no submenu open - not handled |
|
4456 |
^ self |
|
4457 |
]. |
|
4458 |
indices removeFirst. |
|
4459 |
||
4460 |
indices isEmpty ifTrue:[ |
|
4461 |
menu selection:nil. |
|
4462 |
^ self |
|
4463 |
] |
|
1878 | 4464 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4465 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4466 |
! |
1878 | 4467 |
|
4468 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4469 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4470 |
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
|
4471 |
Otherwise return false." |
2715 | 4472 |
|
3431 | 4473 |
|menu rawKey logicalKey list item selectableItem| |
1878 | 4474 |
|
4475 |
superMenu notNil ifTrue:[ |
|
4476 |
^ superMenu processShortcut:aKeyEvent |
|
4477 |
]. |
|
4478 |
shown ifFalse:[^ false]. |
|
4479 |
||
3431 | 4480 |
logicalKey := aKeyEvent key. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4481 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4482 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4483 |
|
3192 | 4484 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
3431 | 4485 |
) includes:logicalKey |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4486 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4487 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4488 |
]. |
3431 | 4489 |
rawKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4490 |
item := nil. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4491 |
menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu |
1878 | 4492 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4493 |
"/ 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
|
4494 |
aKeyEvent isKeyReleaseEvent ifTrue:[ |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4495 |
selection isNil ifTrue:[ |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4496 |
prevFocusView := self windowGroup focusView. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4497 |
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
|
4498 |
selectableItem := self firstItemSelectable. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4499 |
self selection:selectableItem openMenu:false. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4500 |
] ifFalse:[ |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4501 |
prevFocusView requestFocus. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4502 |
self selection:nil. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4503 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4504 |
^ true |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4505 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4506 |
|
1878 | 4507 |
[true] whileTrue:[ |
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4508 |
list := menu |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4509 |
selectItemIndicesFor:[:el| |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4510 |
|skey| |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4511 |
|
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4512 |
item := el. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4513 |
el ignoreShortcutKeys ifTrue:[ |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4514 |
false |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4515 |
] ifFalse:[ |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4516 |
skey := el shortcutKey. |
3431 | 4517 |
skey == rawKey or:[skey == logicalKey] |
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4518 |
] |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4519 |
] |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4520 |
maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999 |
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4521 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
1878 | 4522 |
|
4523 |
list size ~~ 0 ifTrue:[ |
|
4524 |
"/ has item which responds to the shortcut |
|
4525 |
item hasSubmenu ifFalse:[ |
|
4526 |
menu accept:item |
|
4527 |
] ifTrue:[ |
|
4528 |
menu processCollectedIndices:list. |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4529 |
self requestFocus. "/ self windowGroup focusView:self. |
1878 | 4530 |
]. |
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4531 |
^ true |
1878 | 4532 |
]. |
4533 |
||
4534 |
menu == self ifTrue:[ ^ false ]. |
|
4535 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4536 |
]. |
2219 | 4537 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4538 |
! |
1878 | 4539 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4540 |
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
|
4541 |
"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
|
4542 |
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
|
4543 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4544 |
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
|
4545 |
is created and passed through if the block returns false. |
2715 | 4546 |
Otherwise the item is not asked for its submenu." |
4547 |
||
2112 | 4548 |
|start stop| |
4549 |
||
4550 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4551 |
||
4552 |
start := aStart max:1. |
|
4553 |
stop := aStop min:(items size). |
|
4554 |
||
3431 | 4555 |
start to:stop do:[:i| |
4556 |
|item menu result| |
|
4557 |
||
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4558 |
item := items at:i. |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4559 |
(item enabled and:[item isVisible]) ifTrue:[ |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4560 |
(aOneArgBlock value:item) ifTrue:[ |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4561 |
^ OrderedCollection with:i |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4562 |
]. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4563 |
|
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4564 |
maxDepth > 1 ifTrue:[ |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4565 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4566 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
3192 | 4567 |
menu := item setupSubmenu. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4568 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4569 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4570 |
result := menu |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4571 |
selectItemIndicesFor:aOneArgBlock |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4572 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4573 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4574 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4575 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4576 |
result addFirst:i. |
3128 | 4577 |
^ result |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4578 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4579 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4580 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4581 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4582 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4583 |
]. |
1878 | 4584 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4585 |
^ nil |
3128 | 4586 |
|
4587 |
"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
|
4588 |
! ! |
1878 | 4589 |
|
388 | 4590 |
!MenuPanel methodsFor:'misc'! |
4591 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4592 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4593 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4594 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4595 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4596 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4597 |
|
388 | 4598 |
superMenu |
2715 | 4599 |
"returns supermenu or nil" |
4600 |
||
388 | 4601 |
^ superMenu |
4602 |
! |
|
4603 |
||
4604 |
topMenu |
|
2715 | 4605 |
"returns the topMenu; the one having no superMenu" |
4606 |
||
1791 | 4607 |
|menu smenu| |
4608 |
||
4609 |
menu := self. |
|
4610 |
||
4611 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2715 | 4612 |
menu := smenu |
1791 | 4613 |
]. |
4614 |
^ menu |
|
388 | 4615 |
! ! |
4616 |
||
1825 | 4617 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4618 |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4619 |
printOn:aStream |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4620 |
|label| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4621 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4622 |
aStream nextPutAll:'Menu:'. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4623 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4624 |
self do:[:eachItem| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4625 |
label := eachItem label. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4626 |
label notEmptyOrNil ifTrue:[ |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4627 |
aStream nextPutAll:' '. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4628 |
label printOn:aStream. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4629 |
]. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4630 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4631 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4632 |
|
388 | 4633 |
!MenuPanel methodsFor:'private'! |
4634 |
||
434 | 4635 |
application |
2715 | 4636 |
"optimize access to retrive the application" |
4637 |
||
2374 | 4638 |
application notNil ifTrue:[^ application ]. |
434 | 4639 |
|
4640 |
superMenu notNil ifTrue:[ |
|
2253 | 4641 |
application := superMenu application. |
2374 | 4642 |
^ application |
2253 | 4643 |
]. |
4644 |
application := super application. |
|
2374 | 4645 |
^ application |
1872 | 4646 |
! |
434 | 4647 |
|
3725 | 4648 |
detectItem:aBlock |
4649 |
"returns the item for which aBlock returns true." |
|
4650 |
||
4651 |
items notNil ifTrue:[ |
|
4652 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4653 |
(aBlock value:anItem) ifTrue:[^ anItem]. |
|
4654 |
]. |
|
4655 |
]. |
|
4656 |
^ nil |
|
4657 |
! |
|
4658 |
||
1572 | 4659 |
detectItemForKey:aKey |
4660 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4661 |
if no item is detected nil is returned." |
4662 |
||
1572 | 4663 |
|cIdx uKey lKey item| |
4664 |
||
1699 | 4665 |
items isNil ifTrue:[^ nil]. |
4666 |
||
1572 | 4667 |
cIdx := self selectionIndex. |
4668 |
uKey := aKey asUppercase. |
|
4669 |
lKey := aKey asLowercase. |
|
4670 |
||
3725 | 4671 |
items keysAndValuesDo:[:anIndex :anItem| |
4672 |
|char label| |
|
4673 |
||
2715 | 4674 |
( anIndex ~~ cIdx |
4675 |
and:[anItem canSelect |
|
4676 |
and:[(label := anItem textLabel) notNil |
|
4677 |
and:[label size ~~ 0]]] |
|
4678 |
) ifTrue:[ |
|
4679 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4680 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4681 |
^ anItem |
|
4682 |
] |
|
4683 |
] ifFalse:[ |
|
4684 |
char := label at:1. |
|
4685 |
||
4686 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4687 |
anIndex > cIdx ifTrue:[ |
|
4688 |
^ anItem |
|
4689 |
]. |
|
4690 |
item isNil ifTrue:[item := anItem] |
|
4691 |
] |
|
4692 |
] |
|
4693 |
] |
|
1572 | 4694 |
]. |
4695 |
^ item |
|
4696 |
! |
|
4697 |
||
3725 | 4698 |
detectItemForLabel:aLabel |
4699 |
^ self detectItem:[:anItem | anItem label = aLabel]. |
|
4700 |
! |
|
4701 |
||
4702 |
detectItemForNameKey:aKey |
|
4703 |
^ self detectItem:[:anItem | anItem nameKey == aKey]. |
|
4704 |
! |
|
4705 |
||
390 | 4706 |
menuAdornmentAt:aSymbol |
2715 | 4707 |
"returns a value derived from adornment" |
4708 |
||
2374 | 4709 |
adornment isNil ifTrue:[^ nil]. |
4710 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4711 |
! |
4712 |
||
390 | 4713 |
menuAdornmentAt:aSymbol put:something |
2715 | 4714 |
"sets a value for the specific menu" |
4715 |
||
2253 | 4716 |
|oldValue| |
4717 |
||
653 | 4718 |
adornment isNil ifTrue:[ |
2374 | 4719 |
something isNil ifTrue:[^ self]. |
2253 | 4720 |
adornment := IdentityDictionary new. |
4721 |
] ifFalse:[ |
|
4722 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4723 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4724 |
]. |
4725 |
adornment at:aSymbol put:something. |
|
388 | 4726 |
! |
4727 |
||
4728 |
onEachPerform:aSelector withArgList:aList |
|
2715 | 4729 |
"on each item perform selector with an argument derived from aList" |
4730 |
||
388 | 4731 |
aList isCollection ifTrue:[ |
2715 | 4732 |
items size >= aList size ifTrue:[ |
4733 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4734 |
(items at:anIndex) perform:aSelector with:anArg |
|
4735 |
] |
|
4736 |
] |
|
388 | 4737 |
] ifFalse:[ |
2715 | 4738 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4739 |
] |
4740 |
! |
|
4741 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4742 |
registerImageOnDevice:anImage |
2269 | 4743 |
|
4744 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4745 |
^ self class image:anImage onDevice:device |
|
4746 |
||
4747 |
"/ |image| |
|
4748 |
"/ |
|
4749 |
"/ (image := anImage) notNil ifTrue:[ |
|
4750 |
"/ image device ~~ device ifTrue:[ |
|
4751 |
"/ image := image copy. |
|
4752 |
"/ ]. |
|
4753 |
"/ image := image onDevice:device. |
|
4754 |
"/ image := image clearMaskedPixels. |
|
4755 |
"/ ]. |
|
4756 |
"/ ^ image |
|
2355 | 4757 |
! |
4758 |
||
4759 |
superMenu:aSuperMenu |
|
2715 | 4760 |
"set my supermenu from which i'am activated" |
4761 |
||
2355 | 4762 |
superMenu := aSuperMenu. |
4763 |
||
2374 | 4764 |
superMenu notNil ifTrue:[ |
2355 | 4765 |
styleSheet := superMenu styleSheet. |
4766 |
rightArrow := superMenu rightArrow. |
|
4767 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4768 |
]. |
|
388 | 4769 |
! ! |
4770 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4771 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4772 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4773 |
activeMenu |
2715 | 4774 |
"returns the current active menu or self (the top menu)" |
4775 |
||
687 | 4776 |
^ lastActiveMenu ? self |
4777 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4778 |
"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
|
4779 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4780 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4781 |
activeMenu:aMenu |
2715 | 4782 |
"set the current active menu" |
4783 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4784 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4785 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4786 |
"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
|
4787 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4788 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4789 |
becomesActiveMenu |
2715 | 4790 |
"submenu becomes the active menu" |
4791 |
||
3224 | 4792 |
mapTime isNil ifTrue:[ |
4793 |
"/ set the mapTime if not yet done |
|
4794 |
mapTime := AbsoluteTime now. |
|
4795 |
]. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4796 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4797 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4798 |
"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
|
4799 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4800 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4801 |
clearLastActiveMenu |
2715 | 4802 |
"reset the current active menu" |
4803 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4804 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4805 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4806 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4807 |
|
2251 | 4808 |
"/ prevFocusView notNil ifTrue:[ |
4809 |
"/ self windowGroup focusView:prevFocusView. |
|
4810 |
"/ prevFocusView := nil. |
|
4811 |
"/ ]. |
|
4812 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4813 |
top activeMenu == self ifTrue:[ |
2251 | 4814 |
top activeMenu:nil |
687 | 4815 |
] |
4816 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4817 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4818 |
! |
4819 |
||
4820 |
mapTime |
|
3203 | 4821 |
"get the time the menu was activated or nil" |
2715 | 4822 |
|
687 | 4823 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4824 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4825 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
3203 | 4826 |
! |
4827 |
||
4828 |
mapTime:aTimestamp |
|
4829 |
"set the time the menu was activated" |
|
4830 |
||
4831 |
mapTime := aTimestamp. |
|
4832 |
||
4833 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
|
687 | 4834 |
! ! |
4835 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4836 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4837 |
|
4838 |
hasScrollerAt:aDirection |
|
2715 | 4839 |
"returns true if a visible scroller at a direction exists" |
4840 |
||
2016 | 4841 |
|layout| |
4842 |
||
4843 |
self hasScrollers ifFalse:[ |
|
2715 | 4844 |
^ false |
2016 | 4845 |
]. |
4846 |
||
4847 |
aDirection == #PREV ifTrue:[ |
|
2715 | 4848 |
layout := items first layout. |
2016 | 4849 |
|
4850 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2715 | 4851 |
ifFalse:[ layout left < margin] |
2016 | 4852 |
]. |
4853 |
layout := items last layout. |
|
4854 |
||
4855 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2715 | 4856 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4857 |
! |
4858 |
||
4859 |
hasScrollers |
|
2715 | 4860 |
"returns true if scrollers are needed" |
4861 |
||
2018 | 4862 |
|maxExtent first last isVert| |
4863 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4864 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 4865 |
|
4866 |
isVert := self verticalLayout. |
|
4867 |
||
4868 |
superView notNil ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4869 |
((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
|
4870 |
or:[(last := items last layout) isNil] |
2715 | 4871 |
) ifTrue:[ |
4872 |
^ false |
|
4873 |
]. |
|
4874 |
isVert ifTrue:[ |
|
4875 |
^ first top < 0 or:[last bottom > height] |
|
4876 |
]. |
|
4877 |
^ first left < 0 or:[last right > width] |
|
2018 | 4878 |
]. |
4879 |
maxExtent := self maxExtent. |
|
4880 |
isVert ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4881 |
^ (height >= maxExtent y) |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4882 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4883 |
^ (width >= maxExtent x) |
2016 | 4884 |
! |
4885 |
||
4886 |
indexOfItemAtScroller:aDirection |
|
2715 | 4887 |
"returns the index of the item under the scroller or 0" |
4888 |
||
2016 | 4889 |
|bounds min max layout| |
4890 |
||
2860 | 4891 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 4892 |
bounds := self scrollerBoundsAt:aDirection. |
4893 |
||
4894 |
self verticalLayout ifTrue:[ |
|
2715 | 4895 |
min := bounds top. |
4896 |
max := bounds bottom. |
|
4897 |
||
4898 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4899 |
anItem isVisible ifTrue:[ |
|
4900 |
layout := anItem layout. |
|
4901 |
||
4902 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4903 |
^ anIndex |
|
4904 |
]. |
|
4905 |
]. |
|
4906 |
]. |
|
2016 | 4907 |
] ifFalse:[ |
2715 | 4908 |
min := bounds left. |
4909 |
max := bounds right. |
|
4910 |
||
4911 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4912 |
anItem isVisible ifTrue:[ |
|
4913 |
layout := anItem layout. |
|
4914 |
||
4915 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4916 |
^ anIndex |
|
4917 |
]. |
|
4918 |
]. |
|
4919 |
] |
|
2016 | 4920 |
]. |
4921 |
^ 0 |
|
4922 |
! |
|
4923 |
||
4924 |
makeItemVisible:anItem |
|
2715 | 4925 |
"make an item visible" |
4926 |
||
2018 | 4927 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4928 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4929 |
inv1 inv2| |
2018 | 4930 |
|
4931 |
( anItem notNil |
|
4932 |
and:[self hasScrollers |
|
4933 |
and:[(layout := anItem layout) notNil]] |
|
4934 |
) ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4935 |
^ self |
2016 | 4936 |
]. |
2018 | 4937 |
index := self indexOfItem:anItem. |
2016 | 4938 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4939 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4940 |
||
2018 | 4941 |
isVertical := self verticalLayout. |
4942 |
||
4943 |
isVertical ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4944 |
boundsMin := boundsPREV bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4945 |
boundsMax := boundsNEXT top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4946 |
layoutMin := layout top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4947 |
layoutMax := layout bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4948 |
windowSz := height. |
2018 | 4949 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4950 |
boundsMin := boundsPREV right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4951 |
boundsMax := boundsNEXT left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4952 |
layoutMin := layout left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4953 |
layoutMax := layout right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4954 |
windowSz := width. |
2018 | 4955 |
]. |
4956 |
||
4957 |
||
4958 |
layoutMin < boundsMin ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4959 |
layoutMin >= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4960 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4961 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4962 |
"/ test whether is first visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4963 |
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
|
4964 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4965 |
index == 0 ifTrue:[ scr0 := margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4966 |
ifFalse:[ scr0 := boundsMin ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4967 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4968 |
delta := layoutMin negated + scr0. |
2016 | 4969 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4970 |
layoutMax > boundsMax ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4971 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4972 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4973 |
"/ test whether is last visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4974 |
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
|
4975 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4976 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4977 |
ifFalse:[ scr0 := boundsMax ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4978 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4979 |
delta := scr0 - layoutMax. |
2018 | 4980 |
]. |
4981 |
delta == 0 ifTrue:[ ^ self ]. |
|
4982 |
||
2016 | 4983 |
doScroll := false. |
4984 |
||
4985 |
shown ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4986 |
delta abs < (windowSz / 2) ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4987 |
doScroll := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4988 |
self repairDamage |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4989 |
] |
2016 | 4990 |
]. |
2018 | 4991 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4992 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4993 |
|
4994 |
doScroll ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4995 |
self invalidate. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4996 |
^ self |
2016 | 4997 |
]. |
4998 |
||
2018 | 4999 |
windowSz := windowSz - margin - margin. |
5000 |
||
5001 |
scr0 := boundsMin. |
|
5002 |
scr1 := scr0 + delta abs. |
|
5003 |
scrSz := boundsMax - scr1. |
|
5004 |
||
5005 |
delta < 0 ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5006 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5007 |
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
|
5008 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5009 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5010 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5011 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5012 |
"/ 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
|
5013 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5014 |
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
|
5015 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5016 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5017 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5018 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5019 |
"/ 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
|
5020 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5021 |
inv1 := boundsPREV. |
2016 | 5022 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5023 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5024 |
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
|
5025 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5026 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5027 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5028 |
"/ 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
|
5029 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5030 |
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
|
5031 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5032 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5033 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5034 |
"/ 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
|
5035 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
5036 |
inv1 := boundsNEXT. |
2042 | 5037 |
]. |
5038 |
self invalidate:inv1. |
|
5039 |
self invalidate:inv2. |
|
2048 | 5040 |
|
5041 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 5042 |
! |
5043 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5044 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5045 |
"returns the one and only scrollActivity - data holder |
2715 | 5046 |
for a menu and all contained submenus" |
5047 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5048 |
superMenu notNil ifTrue:[ |
2715 | 5049 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5050 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5051 |
scrollActivity isNil ifTrue:[ |
2715 | 5052 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5053 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5054 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5055 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5056 |
|
2016 | 5057 |
scrollerBoundsAt:aDirection |
2860 | 5058 |
"returns the bounds of the scroller at a direction" |
2715 | 5059 |
|
2016 | 5060 |
|y x w h inset| |
5061 |
||
5062 |
inset := 0. |
|
5063 |
x := y := inset. |
|
5064 |
w := h := 15. |
|
5065 |
||
5066 |
self verticalLayout ifTrue:[ |
|
2715 | 5067 |
aDirection == #NEXT ifTrue:[ |
5068 |
y := height - h - inset. |
|
5069 |
]. |
|
5070 |
w := width - inset - inset. |
|
2016 | 5071 |
] ifFalse:[ |
2715 | 5072 |
aDirection == #NEXT ifTrue:[ |
5073 |
x := width - w - inset. |
|
5074 |
]. |
|
5075 |
h := height - inset - inset. |
|
2016 | 5076 |
]. |
5077 |
^ Rectangle left:x top:y width:w height:h |
|
5078 |
! |
|
5079 |
||
2046 | 5080 |
scrollerDirectionAtPoint:aPoint |
2715 | 5081 |
"returns the scroller-direction at aPoint, or nil" |
5082 |
||
2046 | 5083 |
self hasScrollers ifTrue:[ |
2715 | 5084 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
2860 | 5085 |
bounds := self scrollerBoundsAt:aDirection. |
5086 |
||
5087 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
2715 | 5088 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
5089 |
] |
|
5090 |
] |
|
2046 | 5091 |
]. |
5092 |
^ nil |
|
5093 |
||
5094 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 5095 |
! ! |
5096 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5097 |
!MenuPanel methodsFor:'private-searching'! |
388 | 5098 |
|
1699 | 5099 |
detectGrabMenu |
2715 | 5100 |
"returns the menu which is responsible for the grap; the last opened menu" |
5101 |
||
1699 | 5102 |
|subMenu| |
5103 |
||
5104 |
selection notNil ifTrue:[ |
|
2715 | 5105 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
5106 |
^ subMenu detectGrabMenu |
|
5107 |
] |
|
1699 | 5108 |
]. |
5109 |
^ self |
|
5110 |
! |
|
5111 |
||
5112 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 5113 |
"returns the menu which contains the grab-point" |
5114 |
||
1699 | 5115 |
|dstMenu dstPoint firstMenu| |
5116 |
||
5117 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
5118 |
||
5119 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2715 | 5120 |
firstMenu := self. |
1699 | 5121 |
]. |
5122 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5123 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2715 | 5124 |
^ firstMenu |
1699 | 5125 |
]. |
5126 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 5127 |
^ dstMenu ? firstMenu |
1699 | 5128 |
! |
5129 |
||
1767 | 5130 |
detectViewAtX:x y:y in:aTopView |
2715 | 5131 |
"detect view at x@y" |
5132 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5133 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5134 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5135 |
"/ 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
|
5136 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5137 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5138 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5139 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5140 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5141 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5142 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5143 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5144 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5145 |
"/ 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
|
5146 |
"/ ^ 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
|
5147 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5148 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5149 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5150 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5151 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5152 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5153 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 5154 |
! |
5155 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5156 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5157 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 5158 |
If no item match nil is returned." |
5159 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5160 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5161 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5162 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5163 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5164 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5165 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5166 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 5167 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5168 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5169 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5170 |
itemAtPoint:aPoint |
2715 | 5171 |
"returns the item at aPoint or nil if none detected" |
5172 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5173 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5174 |
|
1699 | 5175 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5176 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5177 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5178 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 5179 |
]. |
5180 |
^ nil |
|
388 | 5181 |
! |
5182 |
||
2048 | 5183 |
superMenuAtPoint:aPoint |
2715 | 5184 |
"returns the superMenu which contains aPoint, or nil if none detected" |
5185 |
||
1699 | 5186 |
|grabPoint superMenu| |
5187 |
||
2048 | 5188 |
(self containsPoint:aPoint) ifTrue:[ |
2715 | 5189 |
^ self |
1699 | 5190 |
]. |
5191 |
||
2048 | 5192 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 5193 |
superMenu := self. |
5194 |
||
5195 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2715 | 5196 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
5197 |
^ superMenu |
|
5198 |
] |
|
5199 |
]. |
|
5200 |
^ nil |
|
1699 | 5201 |
|
2048 | 5202 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 5203 |
! ! |
5204 |
||
5205 |
!MenuPanel methodsFor:'queries'! |
|
5206 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5207 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5208 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5209 |
aView notNil ifTrue:[ |
3147 | 5210 |
"/ I am no longer a popUpView |
5211 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5212 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5213 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5214 |
|
388 | 5215 |
containsPoint:aPoint |
2715 | 5216 |
"returns true if the argument, aPoint is contained by the view" |
5217 |
||
388 | 5218 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
5219 |
! |
|
5220 |
||
5221 |
containsPointX:x y:y |
|
2715 | 5222 |
"returns true if point is contained by the view" |
5223 |
||
708 | 5224 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 5225 |
! |
5226 |
||
390 | 5227 |
hasGroupDividerAt:anIndex |
2715 | 5228 |
"returns true if a divider is defined at an index" |
5229 |
||
388 | 5230 |
|i| |
5231 |
||
5232 |
groupSizes size ~~ 0 ifTrue:[ |
|
2715 | 5233 |
i := 0. |
5234 |
||
5235 |
groupSizes do:[:t| |
|
5236 |
(i := i + t) == anIndex ifTrue:[ |
|
5237 |
^ true |
|
5238 |
] |
|
5239 |
] |
|
5240 |
]. |
|
5241 |
^ false |
|
388 | 5242 |
! |
5243 |
||
390 | 5244 |
hasGroupDividers |
2715 | 5245 |
"returns true if any group divider exists" |
5246 |
||
5247 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 5248 |
! |
5249 |
||
3457
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5250 |
isActive |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5251 |
"true, if I have the focus (w.r.t the windowing system); |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5252 |
i.e. if one of my subViews actually has the real focus. |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5253 |
With click-to-focus behavior, this is obviously the current application. |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5254 |
Use this query with caution, for example, to suppress tooltips for inactive apps. |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5255 |
|
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5256 |
This should be only in TowView, but apparently MenuPanel is used as a TopView" |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5257 |
|
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5258 |
^ windowGroup notNil and:[windowGroup anyViewHasFocus] |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5259 |
! |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5260 |
|
390 | 5261 |
isFitPanel |
5262 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 5263 |
be fit to the extent of its superView; |
2715 | 5264 |
NOT SUPPORTED" |
5265 |
||
1699 | 5266 |
^ false |
390 | 5267 |
! |
5268 |
||
388 | 5269 |
isPopUpView |
5270 |
"return true if view is a popup view; without decoration |
|
2715 | 5271 |
and popUp to top immediately" |
5272 |
||
388 | 5273 |
^ superView isNil |
5274 |
! |
|
5275 |
||
5276 |
isVerticalLayout |
|
2715 | 5277 |
"returns true if vertical layout otherwise false( horizontal layout )" |
5278 |
||
1699 | 5279 |
^ self verticalLayout |
416 | 5280 |
! |
5281 |
||
1793 | 5282 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
5283 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 5284 |
! |
5285 |
||
416 | 5286 |
type |
428 | 5287 |
^ nil. |
416 | 5288 |
|
388 | 5289 |
! ! |
5290 |
||
5291 |
!MenuPanel methodsFor:'selection'! |
|
5292 |
||
5293 |
hasSelection |
|
2715 | 5294 |
"returns true if a selection exists" |
5295 |
||
388 | 5296 |
^ self selection notNil |
5297 |
! |
|
5298 |
||
2199 | 5299 |
openDelayed:anItem |
3187 | 5300 |
self openDelayed:anItem afterSeconds:0.5. |
5301 |
! |
|
5302 |
||
5303 |
openDelayed:anItem afterSeconds:seconds |
|
2199 | 5304 |
|
2374 | 5305 |
superMenu notNil ifTrue:[ |
3187 | 5306 |
superMenu openDelayed:anItem afterSeconds:seconds. |
2374 | 5307 |
^ self |
5308 |
]. |
|
5309 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 5310 |
Processor removeTimedBlock:openDelayedMenuBlock. |
5311 |
openDelayedMenuBlock := nil. |
|
5312 |
]. |
|
3187 | 5313 |
(anItem notNil and:[anItem hasSubmenu]) ifFalse:[ |
2253 | 5314 |
openDelayedMenuBlock := nil. |
2374 | 5315 |
^ self |
2253 | 5316 |
]. |
5317 |
openDelayedMenuBlock := [ |
|
5318 |
openDelayedMenuBlock := nil. |
|
5319 |
anItem openDelayedSubmenu |
|
5320 |
]. |
|
5321 |
||
3187 | 5322 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
2199 | 5323 |
! |
5324 |
||
388 | 5325 |
selection |
2715 | 5326 |
"returns current selected item or nil" |
5327 |
||
388 | 5328 |
^ selection |
5329 |
! |
|
5330 |
||
5331 |
selection:anItemOrNil |
|
2016 | 5332 |
"change selection to an item or nil |
2715 | 5333 |
if the item has a submenu the first item might be selected (style-sheet)" |
5334 |
||
2249 | 5335 |
|openMenu openOnSelect submenu item| |
5336 |
||
5337 |
selection == anItemOrNil ifTrue:[^ self]. |
|
5338 |
||
5339 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
5340 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5341 |
^ self |
2249 | 5342 |
]. |
5343 |
||
5344 |
openMenu := self isPopUpView not. |
|
5345 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
5346 |
||
5347 |
openMenu ifFalse:[ |
|
5348 |
openMenu := openOnSelect. |
|
5349 |
]. |
|
5350 |
self selection:anItemOrNil openMenu:openMenu. |
|
5351 |
||
5352 |
openOnSelect ifFalse:[ |
|
5353 |
"/ select first item in submenu |
|
5354 |
||
5355 |
submenu := anItemOrNil currentSubmenu. |
|
5356 |
||
2374 | 5357 |
submenu notNil ifTrue:[ |
2249 | 5358 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5359 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 5360 |
submenu selection:item openMenu:false |
5361 |
] |
|
5362 |
]. |
|
5363 |
]. |
|
5364 |
! |
|
5365 |
||
5366 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 5367 |
"change selection to an item or nil" |
5368 |
||
2251 | 5369 |
|helpListener oldSelect| |
2249 | 5370 |
|
5371 |
anItemOrNil == selection ifTrue:[ |
|
5372 |
^ self |
|
2016 | 5373 |
]. |
2199 | 5374 |
self openDelayed:nil. |
388 | 5375 |
|
2251 | 5376 |
oldSelect := selection. |
5377 |
selection := nil. |
|
2249 | 5378 |
|
2374 | 5379 |
anItemOrNil notNil ifTrue:[ |
2249 | 5380 |
self makeItemVisible:anItemOrNil. |
5381 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 5382 |
selection := anItemOrNil |
2249 | 5383 |
] ifFalse:[ |
2374 | 5384 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 5385 |
]. |
5386 |
]. |
|
2374 | 5387 |
oldSelect notNil ifTrue:[ |
2249 | 5388 |
"/ clear current selection |
2251 | 5389 |
oldSelect isSelected:false. |
5390 |
]. |
|
2374 | 5391 |
selection isNil ifTrue:[^ self]. |
2251 | 5392 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5393 |
"/ selection == enteredItem ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5394 |
"/ enteredItem := nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5395 |
"/ ] ifFalse:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5396 |
"/ self pointerEntersItem:nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5397 |
"/ ]. |
2016 | 5398 |
ActiveHelp isActive ifTrue:[ |
2251 | 5399 |
helpListener := ActiveHelp currentHelpListener. |
5400 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 5401 |
]. |
5402 |
shown ifTrue:[ |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5403 |
"/ self rearrangeItems. |
2249 | 5404 |
|
5405 |
openMenu ifFalse:[ |
|
5406 |
selection invalidate. |
|
5407 |
] |
|
5408 |
]. |
|
5409 |
openMenu ifTrue:[ |
|
5410 |
selection isSelected:true. |
|
5411 |
]. |
|
388 | 5412 |
! |
5413 |
||
5414 |
selectionIndex |
|
2715 | 5415 |
"returns index of current selection or 0" |
5416 |
||
388 | 5417 |
|item| |
5418 |
||
5419 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 5420 |
^ self findFirst:[:el| el == item ] |
388 | 5421 |
]. |
5422 |
^ 0 |
|
5423 |
! |
|
5424 |
||
5425 |
selectionIndex:anIndex |
|
2715 | 5426 |
"set selection at an index" |
5427 |
||
388 | 5428 |
self selection:(self itemAt:anIndex) |
5429 |
! ! |
|
5430 |
||
1791 | 5431 |
!MenuPanel methodsFor:'translation'! |
5432 |
||
5433 |
translateGrabPoint:aGrabPoint |
|
2715 | 5434 |
"translate the grab point into self" |
5435 |
||
1791 | 5436 |
superMenu isNil ifTrue:[ |
2936 | 5437 |
"I am the grabView" |
2715 | 5438 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
5439 |
^ aGrabPoint |
|
1791 | 5440 |
]. |
5441 |
||
5442 |
relativeGrabOrigin isNil ifTrue:[ |
|
2936 | 5443 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
5444 |
relativeGrabOrigin isNil ifTrue:[ |
|
5445 |
"I am the grabView" |
|
5446 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5447 |
^ aGrabPoint |
|
5448 |
]. |
|
1791 | 5449 |
]. |
5450 |
^ relativeGrabOrigin + aGrabPoint |
|
5451 |
! |
|
5452 |
||
5453 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 5454 |
"translate a point into another menu its point" |
5455 |
||
1791 | 5456 |
|grapPoint| |
5457 |
||
5458 |
aMenu == self ifTrue:[ |
|
2715 | 5459 |
^ aPoint |
1791 | 5460 |
]. |
5461 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
5462 |
||
2715 | 5463 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 5464 |
! |
5465 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5466 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 5467 |
"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
|
5468 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5469 |
^ device |
2715 | 5470 |
translatePoint:aPoint asPoint |
5471 |
fromView:self |
|
5472 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5473 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5474 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 5475 |
! ! |
5476 |
||
388 | 5477 |
!MenuPanel::Item class methodsFor:'accessing'! |
5478 |
||
689 | 5479 |
horizontalInset |
5480 |
^ HorizontalInset |
|
5481 |
! |
|
5482 |
||
388 | 5483 |
labelRightOffset |
5484 |
^ LabelRightOffset |
|
5485 |
! |
|
5486 |
||
689 | 5487 |
verticalInset |
5488 |
^ VerticalInset |
|
1765 | 5489 |
! |
5490 |
||
5491 |
verticalPopUpInset |
|
5492 |
^ VerticalPopUpInset |
|
388 | 5493 |
! ! |
5494 |
||
616 | 5495 |
!MenuPanel::Item class methodsFor:'defaults'! |
5496 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5497 |
halfSeparatorSize |
2870 | 5498 |
"returns the size of a space-separator" |
5499 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5500 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5501 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5502 |
|
1699 | 5503 |
separatorSize |
2870 | 5504 |
"returns the size of a separator" |
5505 |
||
1699 | 5506 |
^ 10 |
616 | 5507 |
! |
5508 |
||
5509 |
updateStyleCache |
|
2777 | 5510 |
"extract values from the styleSheet and cache them in class variables" |
5511 |
||
1765 | 5512 |
<resource: #style (#'menuPanel.verticalInset')> |
5513 |
||
1699 | 5514 |
HorizontalInset := 2. |
1765 | 5515 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5516 |
VerticalPopUpInset := 2. |
|
727 | 5517 |
|
5518 |
HorizontalButtonInset := 3. |
|
5519 |
VerticalButtonInset := 3. |
|
5520 |
||
681 | 5521 |
LabelRightOffset := 15. |
1765 | 5522 |
|
2777 | 5523 |
" |
5524 |
self updateStyleCache |
|
5525 |
" |
|
1124 | 5526 |
! ! |
1078 | 5527 |
|
388 | 5528 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5529 |
||
5530 |
in:aSuperMenu |
|
5531 |
^ self in:aSuperMenu label:nil |
|
5532 |
! |
|
5533 |
||
5534 |
in:aSuperMenu label:aLabel |
|
5535 |
|item| |
|
5536 |
||
5537 |
item := self new in:aSuperMenu. |
|
5538 |
item label:aLabel. |
|
2870 | 5539 |
^ item |
388 | 5540 |
! |
5541 |
||
5542 |
in:aSuperMenu menuItem:aMenuItem |
|
5543 |
|item| |
|
5544 |
||
5545 |
item := self in:aSuperMenu. |
|
5546 |
item menuItem:aMenuItem. |
|
2870 | 5547 |
^ item. |
2359 | 5548 |
! |
5549 |
||
5550 |
new |
|
5551 |
^ self basicNew initialize |
|
388 | 5552 |
! ! |
5553 |
||
1808 | 5554 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5555 |
|
420 | 5556 |
canAccept |
2870 | 5557 |
"returns true if item is acceptable" |
5558 |
||
2199 | 5559 |
self enabled ifFalse:[ ^ false]. |
5560 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5561 |
||
5562 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
3558 | 5563 |
^ subMenu isNil or:[subMenu shown not] |
524 | 5564 |
! |
5565 |
||
5566 |
toggleIndication |
|
2870 | 5567 |
"toggle indication or choice" |
5568 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5569 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5570 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5571 |
indication notNil ifTrue:[ |
2359 | 5572 |
arg := self indicationValue not. |
5573 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5574 |
] ifFalse:[ |
2359 | 5575 |
choice notNil ifTrue:[ |
5576 |
choice value:(menuItem choiceValue). |
|
5577 |
^ true |
|
5578 |
] |
|
524 | 5579 |
]. |
5580 |
^ arg |
|
389 | 5581 |
! ! |
5582 |
||
388 | 5583 |
!MenuPanel::Item methodsFor:'accessing'! |
5584 |
||
5585 |
accessCharacter |
|
2870 | 5586 |
"returns my accessCharacter or nil" |
5587 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5588 |
^ accessCharacter |
388 | 5589 |
! |
5590 |
||
5591 |
accessCharacterPosition |
|
2870 | 5592 |
"get the access character position or nil" |
5593 |
||
2359 | 5594 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5595 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5596 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5597 |
accessCharacterPosition:anIndex |
2870 | 5598 |
"set the access character position or nil" |
5599 |
||
2359 | 5600 |
menuItem accessCharacterPosition:anIndex. |
388 | 5601 |
! |
5602 |
||
5603 |
argument |
|
2870 | 5604 |
"gets the argument" |
5605 |
||
2359 | 5606 |
^ menuItem argument |
388 | 5607 |
! |
5608 |
||
5609 |
argument:anArgument |
|
2870 | 5610 |
"sets the argument" |
5611 |
||
2359 | 5612 |
menuItem argument:anArgument. |
389 | 5613 |
! |
5614 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5615 |
displayLabel |
2870 | 5616 |
"returns my printable Label" |
5617 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5618 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5619 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5620 |
|
2614 | 5621 |
displayLabelExtent |
2870 | 5622 |
"returns the labels extent" |
5623 |
||
2614 | 5624 |
|prevFont w h| |
5625 |
||
5626 |
displayLabelExtent notNil ifTrue:[ |
|
5627 |
^ displayLabelExtent |
|
5628 |
]. |
|
5629 |
||
5630 |
displayLabel isNil ifTrue:[ |
|
5631 |
displayLabelExtent := 0@0. |
|
5632 |
^ displayLabelExtent |
|
5633 |
]. |
|
5634 |
prevFont := menuPanel setFont:(self font). |
|
5635 |
||
5636 |
displayLabel isArray ifTrue:[ |
|
5637 |
w := h := 0. |
|
5638 |
||
5639 |
displayLabel do:[:aSubLabel| |
|
5640 |
aSubLabel notNil ifTrue:[ |
|
5641 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5642 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5643 |
] ifFalse:[ |
|
5644 |
h := h + (self spaceBetweenEmptyLines) |
|
5645 |
] |
|
5646 |
] |
|
5647 |
] ifFalse:[ |
|
5648 |
w := displayLabel widthOn:menuPanel. |
|
5649 |
h := displayLabel heightOn:menuPanel. |
|
5650 |
]. |
|
5651 |
"/ care for italic fonts - give a few more pixels at the end |
|
5652 |
menuPanel font italic ifTrue:[ |
|
5653 |
w := w + 2. |
|
5654 |
]. |
|
5655 |
displayLabelExtent := w@h. |
|
5656 |
||
5657 |
prevFont notNil ifTrue:[ |
|
5658 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5659 |
]. |
|
5660 |
^ displayLabelExtent |
|
5661 |
! |
|
5662 |
||
1727 | 5663 |
font |
2870 | 5664 |
"returns the user configured font or nil (default menu font)" |
5665 |
||
2373 | 5666 |
|font| |
5667 |
||
5668 |
menuPanel isNil ifTrue:[^ nil]. |
|
5669 |
||
5670 |
font := menuItem font. |
|
5671 |
||
5672 |
font notNil ifTrue:[ |
|
5673 |
font := font onDevice:(menuPanel device). |
|
5674 |
menuItem font:font. |
|
5675 |
]. |
|
1727 | 5676 |
^ font |
5677 |
! |
|
5678 |
||
5679 |
font:aFont |
|
2870 | 5680 |
"returns the user configured font or nil (default menu font)" |
5681 |
||
2373 | 5682 |
menuItem font:aFont. |
1727 | 5683 |
! |
5684 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5685 |
ignoreMnemonicKeys |
2870 | 5686 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5687 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5688 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5689 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5690 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5691 |
ignoreMnemonicKeys:aBoolean |
2870 | 5692 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5693 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5694 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5695 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5696 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5697 |
ignoreShortcutKeys |
2870 | 5698 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5699 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5700 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5701 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5702 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5703 |
ignoreShortcutKeys:aBoolean |
2870 | 5704 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5705 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5706 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5707 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5708 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5709 |
itemValue |
2870 | 5710 |
"gets the items value" |
5711 |
||
2360 | 5712 |
^ menuItem itemValue |
5713 |
! |
|
5714 |
||
5715 |
itemValue:aValue |
|
2870 | 5716 |
"argument could be a value holder, an action or selector" |
5717 |
||
2360 | 5718 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5719 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5720 |
|
388 | 5721 |
label |
2870 | 5722 |
"returns the label" |
5723 |
||
388 | 5724 |
^ label |
5725 |
! |
|
5726 |
||
5727 |
label:aLabel |
|
399 | 5728 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 5729 |
handle characters $& (ST-80 compatibility)" |
5730 |
||
2614 | 5731 |
|size char oldExtent| |
5732 |
||
5733 |
oldExtent := displayLabelExtent. |
|
5734 |
displayLabelExtent := nil. "/ force a recomputation |
|
5735 |
accessCharacter := disabledDisplayLabel := nil. |
|
3454
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
5736 |
|
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
5737 |
"Stefan: Why do we use #value two times??" |
2614 | 5738 |
label := aLabel value. |
5739 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5740 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5741 |
displayLabel isString ifTrue:[ |
2359 | 5742 |
"CHECK FOR SEPARATOR" |
5743 |
||
5744 |
(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
|
5745 |
size := displayLabel size. |
2359 | 5746 |
|
5747 |
size == 0 ifTrue:[ |
|
2614 | 5748 |
displayLabel := nil. "blank separator" |
2359 | 5749 |
^ self |
5750 |
]. |
|
5751 |
||
5752 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5753 |
char := displayLabel first. |
2359 | 5754 |
|
5755 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5756 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5757 |
displayLabel := nil. |
2359 | 5758 |
^ self |
5759 |
] |
|
5760 |
] |
|
5761 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5762 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5763 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5764 |
displayLabel := displayLabel asArray. |
2359 | 5765 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5766 |
]. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5767 |
menuPanel doAccessCharacterTranslation ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5768 |
displayLabel notNil ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5769 |
displayLabel isArray ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5770 |
displayLabel keysAndValuesDo:[:i :el| |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5771 |
el notNil ifTrue:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5772 |
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
|
5773 |
]. |
2614 | 5774 |
]. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5775 |
] ifFalse:[ |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5776 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
2614 | 5777 |
]. |
5778 |
]. |
|
5779 |
]. |
|
5780 |
||
5781 |
menuPanel shown ifTrue:[ |
|
5782 |
self fetchImages. |
|
5783 |
||
5784 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5785 |
self invalidate |
|
5786 |
] ifFalse:[ |
|
5787 |
menuPanel mustRearrange |
|
2359 | 5788 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5789 |
]. |
388 | 5790 |
! |
5791 |
||
5792 |
menuPanel |
|
2870 | 5793 |
"returns my menuPanel" |
5794 |
||
399 | 5795 |
^ menuPanel |
388 | 5796 |
! |
5797 |
||
5798 |
nameKey |
|
2870 | 5799 |
"gets the nameKey" |
5800 |
||
2359 | 5801 |
^ menuItem nameKey |
388 | 5802 |
! |
5803 |
||
5804 |
nameKey:aNameKey |
|
2870 | 5805 |
"sets the nameKey" |
5806 |
||
2359 | 5807 |
menuItem nameKey:aNameKey. |
388 | 5808 |
! |
5809 |
||
5810 |
rawLabel |
|
2870 | 5811 |
"returns my raw, unprocessed label" |
5812 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5813 |
^ menuItem rawLabel |
388 | 5814 |
! |
5815 |
||
5816 |
shortcutKey |
|
5817 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 5818 |
no submenu exists evaluate the action assigned to the item (accept)." |
5819 |
||
2359 | 5820 |
^ menuItem shortcutKey |
388 | 5821 |
! |
5822 |
||
5823 |
shortcutKey:aKey |
|
5824 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 5825 |
no submenu exists evaluate the action assigned to the item (accept)." |
5826 |
||
2359 | 5827 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5828 |
menuItem shortcutKey:aKey. |
|
5829 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5830 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5831 |
! |
388 | 5832 |
|
710 | 5833 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5834 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5835 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 5836 |
|
2359 | 5837 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5838 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5839 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 5840 |
! |
5841 |
||
5842 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5843 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5844 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 5845 |
|
2359 | 5846 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5847 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5848 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 5849 |
! |
5850 |
||
388 | 5851 |
submenu |
3133 | 5852 |
"returns my submenu or creates it if its defined via a selector or channel. |
5853 |
May return nil, if there is really no menu" |
|
5854 |
||
5855 |
subMenu isNil ifTrue:[ |
|
5856 |
self setupSubmenu |
|
5857 |
]. |
|
5858 |
^ subMenu |
|
5859 |
||
5860 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 5861 |
! |
5862 |
||
5863 |
submenu:aSubMenu |
|
2870 | 5864 |
"set a new submenu; an existing submenu will be destroyed. |
5865 |
This might lead to a redraw if 'hasSubmenu' changed" |
|
5866 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5867 |
|widget| |
1767 | 5868 |
|
5869 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5870 |
subMenu notNil ifTrue:[ |
5871 |
subMenu destroy. |
|
5872 |
subMenu := nil. |
|
5873 |
]. |
|
5874 |
^ self |
|
1767 | 5875 |
]. |
5876 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5877 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5878 |
subMenu := MenuPanel new. |
5879 |
||
5880 |
menuPanel notNil ifTrue:[ |
|
5881 |
subMenu receiver:menuPanel receiver. |
|
5882 |
]. |
|
5883 |
subMenu superMenu:menuPanel. |
|
5884 |
||
5885 |
menuItem horizontalLayout == true ifTrue:[ |
|
5886 |
subMenu verticalLayout:false |
|
5887 |
]. |
|
5888 |
subMenu menu:aSubMenu. |
|
1767 | 5889 |
] ifFalse:[ |
2360 | 5890 |
aSubMenu isView ifFalse:[ |
5891 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5892 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5893 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5894 |
]. |
5895 |
widget := SimpleView new. |
|
5896 |
widget client:aSubMenu. |
|
5897 |
] ifTrue:[ |
|
2827 | 5898 |
widget := aSubMenu. |
5899 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
2360 | 5900 |
]. |
5901 |
||
5902 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5903 |
subMenu := widget. |
|
5904 |
||
5905 |
menuItem horizontalLayout == true ifTrue:[ |
|
5906 |
subMenu verticalLayout:false |
|
5907 |
]. |
|
5908 |
] ifFalse:[ |
|
5909 |
subMenu := MenuPanel new. |
|
5910 |
subMenu receiver:menuPanel receiver. |
|
5911 |
subMenu addSubView:widget. |
|
5912 |
subMenu extent:(widget preferredExtent). |
|
5913 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5914 |
]. |
|
5915 |
subMenu superMenu:menuPanel. |
|
5916 |
]. |
|
389 | 5917 |
! |
5918 |
||
3133 | 5919 |
submenuOrNil |
5920 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
5921 |
||
5922 |
^ subMenu |
|
5923 |
||
5924 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
5925 |
! |
|
5926 |
||
390 | 5927 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5928 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5929 |
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
|
5930 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5931 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5932 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5933 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5934 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5935 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5936 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5937 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5938 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5939 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5940 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5941 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5942 |
]. |
1726
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 |
^ nil |
390 | 5945 |
! |
5946 |
||
1841 | 5947 |
triggerOnDown |
2870 | 5948 |
"return true if triggering the action if pressed" |
5949 |
||
2359 | 5950 |
menuItem triggerOnDown ifTrue:[ |
5951 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5952 |
]. |
5953 |
^ false |
|
5954 |
! |
|
5955 |
||
5956 |
triggerOnDown:aBool |
|
2870 | 5957 |
"setup to trigger the action if pressed" |
5958 |
||
2359 | 5959 |
menuItem triggerOnDown:aBool. |
1841 | 5960 |
! |
5961 |
||
389 | 5962 |
value |
2870 | 5963 |
"gets the items value |
5964 |
Left here for ST80 compatibility - value is a bad name" |
|
5965 |
||
2360 | 5966 |
^ menuItem itemValue |
5967 |
! |
|
5968 |
||
5969 |
value:aValue |
|
389 | 5970 |
"could be a value holder, an action or selector |
2870 | 5971 |
Left here for ST80 compatibility - value: is a bad name" |
5972 |
||
2360 | 5973 |
menuItem itemValue:aValue. |
502 | 5974 |
! |
5975 |
||
5976 |
value:aValue argument:anArgument |
|
2870 | 5977 |
"set the value and an argument" |
5978 |
||
2360 | 5979 |
menuItem itemValue:aValue. |
5980 |
menuItem argument:anArgument. |
|
388 | 5981 |
! ! |
5982 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5983 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5984 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5985 |
choice |
2870 | 5986 |
"implements a radio group; the field" |
5987 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5988 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5989 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5990 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5991 |
choice:something |
2870 | 5992 |
"set choice indication" |
5993 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5994 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5995 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5996 |
choice isValueModel ifTrue:[ |
2870 | 5997 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5998 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5999 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6000 |
(choice := something) notNil ifTrue:[ |
2870 | 6001 |
choice isSymbol ifTrue:[ |
6002 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
6003 |
choice := something |
|
6004 |
] |
|
6005 |
]. |
|
6006 |
choice isValueModel ifTrue:[ |
|
6007 |
choice addDependent:self |
|
6008 |
] |
|
1699 | 6009 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6010 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6011 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6012 |
choiceValue |
2870 | 6013 |
"implements a radio group; the value writen to the choice if selected" |
6014 |
||
2359 | 6015 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6016 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6017 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6018 |
choiceValue:something |
2870 | 6019 |
"implements a radio group; the value writen to the choice if selected" |
6020 |
||
2359 | 6021 |
menuItem choiceValue ~= something ifTrue:[ |
6022 |
menuItem choiceValue:something. |
|
6023 |
choice notNil ifTrue:[ self invalidate ]. |
|
6024 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6025 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6026 |
|
388 | 6027 |
enabled |
2870 | 6028 |
"returns the enabled state" |
6029 |
||
524 | 6030 |
|state| |
6031 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6032 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6033 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6034 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6035 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6036 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6037 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6038 |
self ifNotInUIBuilderInfoPrintCR: |
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6039 |
('MenuPanel::Item [info]: no aspect for %1 (in %2)' |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6040 |
bindWith:enableChannel |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6041 |
with:label). |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6042 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6043 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6044 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6045 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6046 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6047 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6048 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6049 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6050 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6051 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6052 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6053 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6054 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6055 |
^ state ~~ false |
388 | 6056 |
! |
6057 |
||
389 | 6058 |
enabled:something |
2870 | 6059 |
"change the enabled state; if the state changed, a redraw is performed" |
6060 |
||
390 | 6061 |
|oldState newState| |
6062 |
||
6063 |
enableChannel isNil ifTrue:[ |
|
2870 | 6064 |
oldState := true |
390 | 6065 |
] ifFalse:[ |
2870 | 6066 |
oldState := enableChannel value. |
6067 |
enableChannel isValueModel ifTrue:[ |
|
6068 |
enableChannel removeDependent:self |
|
6069 |
] |
|
388 | 6070 |
]. |
390 | 6071 |
enableChannel := something. |
6072 |
||
6073 |
enableChannel isNil ifTrue:[ |
|
2870 | 6074 |
menuPanel shown ifFalse:[^ self]. |
6075 |
newState := true |
|
390 | 6076 |
] ifFalse:[ |
2870 | 6077 |
enableChannel isValueModel ifTrue:[ |
6078 |
enableChannel addDependent:self |
|
6079 |
] ifFalse:[ |
|
6080 |
enableChannel isSymbol ifTrue:[^ self] |
|
6081 |
]. |
|
6082 |
menuPanel shown ifFalse:[^ self]. |
|
6083 |
newState := enableChannel value. |
|
390 | 6084 |
]. |
6085 |
||
6086 |
newState ~~ oldState ifTrue:[ |
|
2870 | 6087 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6088 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6089 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6090 |
|
1670 | 6091 |
hideMenuOnActivated |
2870 | 6092 |
"hide the menu when the item was activated; the default is true" |
6093 |
||
2359 | 6094 |
^ menuItem hideMenuOnActivated |
1670 | 6095 |
! |
6096 |
||
6097 |
hideMenuOnActivated:aBool |
|
2870 | 6098 |
"hide the menu when the item was activated; the default is true" |
6099 |
||
2359 | 6100 |
menuItem hideMenuOnActivated:aBool. |
1670 | 6101 |
! |
6102 |
||
2216 | 6103 |
ifNotInUIBuilderInfoPrintCR:aMessage |
6104 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
6105 |
||
3732 | 6106 |
|app| |
6107 |
||
6108 |
app := menuPanel application. |
|
6109 |
||
2216 | 6110 |
(menuPanel receiver isNil |
3732 | 6111 |
and:[ app notNil |
6112 |
and:[ app askFor:#isUIPainter]]) |
|
2216 | 6113 |
ifTrue:[ |
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6114 |
^ self "/ suppressed |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6115 |
]. |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6116 |
aMessage infoPrint. |
3732 | 6117 |
app notNil ifTrue:[ |
6118 |
app infoPrint |
|
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6119 |
]. |
3444
b7d2f3fe5055
avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents:
3441
diff
changeset
|
6120 |
'' infoPrintCR. |
2216 | 6121 |
! |
6122 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6123 |
indication |
2870 | 6124 |
"get on/off indication" |
6125 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6126 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6127 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6128 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6129 |
indication:something |
2870 | 6130 |
"set on/off indication" |
6131 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6132 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6133 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6134 |
indication isValueModel ifTrue:[ |
2870 | 6135 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6136 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6137 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6138 |
(indication := something) notNil ifTrue:[ |
2870 | 6139 |
indication isValueModel ifTrue:[ |
6140 |
indication addDependent:self |
|
6141 |
] ifFalse:[ |
|
6142 |
"/ to force an update of the value |
|
6143 |
self indicationValue |
|
6144 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6145 |
]. |
464 | 6146 |
! |
6147 |
||
1767 | 6148 |
keepLinkedMenu |
2870 | 6149 |
"get the keepLinkedMenu flag" |
6150 |
||
2359 | 6151 |
^ menuItem keepLinkedMenu |
6152 |
! |
|
6153 |
||
6154 |
keepLinkedMenu:aBool |
|
2870 | 6155 |
"get the keepLinkedMenu flag" |
6156 |
||
2359 | 6157 |
menuItem keepLinkedMenu:aBool. |
1767 | 6158 |
! |
6159 |
||
2331 | 6160 |
sendToOriginator |
6161 |
"if true, the message is sent to the originating widget; |
|
6162 |
otherwise (the default), it it sent to the receiver/application." |
|
6163 |
||
2359 | 6164 |
^ menuItem sendToOriginator |
2331 | 6165 |
! |
6166 |
||
6167 |
sendToOriginator:aBoolean |
|
6168 |
"if true, the message is sent to the originating widget; |
|
6169 |
otherwise (the default), it it sent to the receiver/application." |
|
6170 |
||
2359 | 6171 |
menuItem sendToOriginator:aBoolean. |
2331 | 6172 |
! |
6173 |
||
464 | 6174 |
submenuChannel |
2870 | 6175 |
"get the submenu channel" |
6176 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6177 |
^ menuItem submenuChannel |
464 | 6178 |
! |
6179 |
||
6180 |
submenuChannel:aSelectorOrNil |
|
2870 | 6181 |
"returns the submenu channel" |
6182 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6183 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 6184 |
! ! |
6185 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6186 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 6187 |
|
2016 | 6188 |
moveBy:aPoint |
2870 | 6189 |
"move the layouts origin" |
6190 |
||
2016 | 6191 |
layout moveBy:aPoint. |
6192 |
! |
|
6193 |
||
1699 | 6194 |
preferredExtent |
2870 | 6195 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
6196 |
||
2614 | 6197 |
|isVertical icon wIcon isButton labelExtent |
1699 | 6198 |
x "{ Class:SmallInteger }" |
6199 |
y "{ Class:SmallInteger }" |
|
6200 |
s "{ Class:SmallInteger }" |
|
6201 |
| |
|
6202 |
self isVisible ifFalse:[^ 0@0 ]. |
|
6203 |
||
2359 | 6204 |
isButton := menuItem isButton. |
6205 |
||
1699 | 6206 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6207 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6208 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6209 |
y := s + VerticalButtonInset. |
1699 | 6210 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6211 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6212 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 6213 |
]. |
6214 |
x := x * 2. |
|
6215 |
y := y * 2. |
|
6216 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6217 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6218 |
|
2362 | 6219 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6220 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6221 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6222 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6223 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6224 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6225 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6226 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6227 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6228 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6229 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6230 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6231 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6232 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6233 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6234 |
]. |
1699 | 6235 |
] ifFalse:[ |
2614 | 6236 |
labelExtent := self displayLabelExtent. |
6237 |
||
6238 |
x := x + labelExtent x. |
|
6239 |
y := y + labelExtent y. |
|
3131 | 6240 |
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
|
6241 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6242 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6243 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6244 |
"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
|
6245 |
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
|
6246 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6247 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6248 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6249 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6250 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6251 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6252 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6253 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6254 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6255 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6256 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6257 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6258 |
x := x + wIcon. |
1699 | 6259 |
]. |
6260 |
^ x@y |
|
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6261 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6262 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6263 |
preferredHeight |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6264 |
^ self preferredExtent y |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6265 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6266 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6267 |
preferredWidth |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6268 |
^ self preferredExtent x |
388 | 6269 |
! ! |
6270 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6271 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 6272 |
|
6273 |
activeHelpKey |
|
2870 | 6274 |
"get the active helpKey; the key to retrieve the helpText from the application" |
6275 |
||
2359 | 6276 |
^ menuItem activeHelpKey |
1613 | 6277 |
! |
6278 |
||
6279 |
activeHelpKey:aHelpKey |
|
2870 | 6280 |
"set the active helpKey; the key to retrieve the helpText from the application" |
6281 |
||
2359 | 6282 |
menuItem activeHelpKey:aHelpKey. |
6283 |
activeHelpText := nil. |
|
1613 | 6284 |
! |
6285 |
||
6286 |
activeHelpText |
|
2870 | 6287 |
"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
|
6288 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6289 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6290 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6291 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6292 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6293 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6294 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6295 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6296 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6297 |
^ nil |
1613 | 6298 |
! |
6299 |
||
6300 |
activeHelpText:aText |
|
2870 | 6301 |
"set the active helpText" |
6302 |
||
1613 | 6303 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6304 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6305 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6306 |
flyByHelpText |
2870 | 6307 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6308 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6309 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6310 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6311 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6312 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6313 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6314 |
|
2471 | 6315 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
6316 |
"/ (if you have an argument for that let us know..) |
|
6317 |
"/ self isButton ifFalse:[^ nil]. |
|
6318 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6319 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6320 |
"/ 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
|
6321 |
key := self activeHelpKey. |
2895 | 6322 |
app := menuPanel application. |
6323 |
||
6324 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
6325 |
(key isAssociation) ifTrue:[ |
|
6326 |
app := key key. |
|
6327 |
key := key value. |
|
6328 |
]. |
|
6329 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6330 |
key notNil ifTrue:[ |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6331 |
app notNil ifTrue:[ |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6332 |
text := app flyByHelpTextForKey:key. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6333 |
]. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6334 |
text isNil ifTrue:[ |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6335 |
text := menuPanel flyByHelpTextForKey:key. |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6336 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6337 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6338 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6339 |
"/ 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
|
6340 |
text isNil ifTrue:[ |
2676
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6341 |
self hasSubmenu ifTrue:[ |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6342 |
^ key |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6343 |
]. |
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6344 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6345 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6346 |
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
|
6347 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6348 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6349 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6350 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6351 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6352 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6353 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6354 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6355 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6356 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6357 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6358 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6359 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6360 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6361 |
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
|
6362 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6363 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6364 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6365 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6366 |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6367 |
(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
|
6368 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6369 |
"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
|
6370 |
(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
|
6371 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6372 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6373 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6374 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6375 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6376 |
flyByHelpText:aText |
2870 | 6377 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
6378 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6379 |
flyByHelpText := aText. |
1613 | 6380 |
! ! |
6381 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6382 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6383 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6384 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6385 |
"on default submenus has a vertical layout; |
2870 | 6386 |
true, the submenu has a horizontal layout." |
6387 |
||
2360 | 6388 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6389 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6390 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6391 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6392 |
"on default submenus has a vertical layout; |
2870 | 6393 |
true, the submenu has a horizontal layout." |
6394 |
||
2360 | 6395 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6396 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6397 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6398 |
isButton |
2870 | 6399 |
"returns whether the item looks like a Button" |
6400 |
||
2359 | 6401 |
^ menuItem isButton |
6402 |
! |
|
6403 |
||
6404 |
isButton:aBool |
|
2870 | 6405 |
"set/clear the item to look like a Button" |
6406 |
||
2359 | 6407 |
menuItem isButton ~~ aBool ifTrue:[ |
6408 |
menuItem isButton:aBool. |
|
6409 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6410 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6411 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6412 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6413 |
layout |
2870 | 6414 |
"returns my layout ( Rectangle )" |
6415 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6416 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6417 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6418 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6419 |
layout:aLayout |
2870 | 6420 |
"set a new layout ( Rectangle )" |
6421 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6422 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6423 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6424 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6425 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6426 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6427 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 6428 |
while performing the menu action. Defaults to false." |
6429 |
||
2359 | 6430 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6431 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6432 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6433 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6434 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 6435 |
while performing the menu action. Defaults to false." |
6436 |
||
2359 | 6437 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6438 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6439 |
|
2504 | 6440 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 6441 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6442 |
currentSubmenu |
2870 | 6443 |
"returns the current submenu or nil" |
6444 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6445 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6446 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6447 |
|
1705 | 6448 |
hideSubmenu |
2870 | 6449 |
"hide submenu" |
6450 |
||
2199 | 6451 |
self hideSubmenu:subMenu. |
6452 |
! |
|
6453 |
||
6454 |
hideSubmenu:aSubmenu |
|
2870 | 6455 |
"hide submenu" |
6456 |
||
2871 | 6457 |
|id wg| |
1705 | 6458 |
|
2374 | 6459 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 6460 |
aSubmenu removeDependencies. |
2199 | 6461 |
|
6462 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6463 |
id := aSubmenu id. |
2374 | 6464 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 6465 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6466 |
aSubmenu hide |
2199 | 6467 |
]. |
6468 |
||
2870 | 6469 |
aSubmenu windowGroup:nil. |
2871 | 6470 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
6471 |
wg removeView:aSubmenu. |
|
6472 |
]. |
|
2199 | 6473 |
|
6474 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6475 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6476 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6477 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6478 |
] |
2199 | 6479 |
]. |
6480 |
! |
|
6481 |
||
6482 |
openDelayedSubmenu |
|
2870 | 6483 |
"called to open now my delayed submenu" |
6484 |
||
3133 | 6485 |
|subMenuBeforeOpening| |
2199 | 6486 |
|
6487 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
6488 |
||
2374 | 6489 |
subMenu notNil ifTrue:[ |
6490 |
subMenu realized ifTrue:[ |
|
6491 |
"/ already open |
|
6492 |
^ self |
|
6493 |
]. |
|
2199 | 6494 |
]. |
3133 | 6495 |
self setupSubmenu. |
6496 |
subMenu isNil ifTrue:[^ self]. |
|
6497 |
subMenuBeforeOpening := subMenu. |
|
2199 | 6498 |
self openSubmenu. |
6499 |
||
3133 | 6500 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
2374 | 6501 |
"/ closed during building or opening the submenu |
3133 | 6502 |
self hideSubmenu:subMenuBeforeOpening. |
6503 |
]. |
|
6504 |
||
6505 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 6506 |
! |
1701 | 6507 |
|
6508 |
openSubmenu |
|
6509 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
6510 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 6511 |
nescessary." |
6512 |
||
3203 | 6513 |
|p o device isVertical topMenu windGrp prefExtent lastEvent |
1701 | 6514 |
devBot "{ Class:SmallInteger }" |
6515 |
devRight "{ Class:SmallInteger }" |
|
6516 |
width "{ Class:SmallInteger }" |
|
6517 |
height "{ Class:SmallInteger }" |
|
6518 |
top "{ Class:SmallInteger }" |
|
6519 |
left "{ Class:SmallInteger }" |
|
6520 |
| |
|
6521 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
6522 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 6523 |
^ self |
1701 | 6524 |
]. |
6525 |
||
6526 |
topMenu := menuPanel topMenu. |
|
1829 | 6527 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 6528 |
subMenu releaseDeviceResources. |
6529 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
6530 |
subMenu recreate. |
|
1829 | 6531 |
]. |
6532 |
||
1701 | 6533 |
windGrp := topMenu windowGroup. |
3203 | 6534 |
windGrp notNil ifTrue:[ |
6535 |
lastEvent := windGrp lastEvent. |
|
6536 |
||
6537 |
(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[ |
|
6538 |
subMenu mapTime:(lastEvent timeStamp). |
|
6539 |
]. |
|
6540 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6541 |
subMenu superMenu:menuPanel. |
1701 | 6542 |
subMenu becomesActiveMenu. |
6543 |
subMenu cursor:Cursor hand. |
|
6544 |
||
6545 |
windGrp notNil ifTrue:[ |
|
2249 | 6546 |
subMenu windowGroup:windGrp. |
6547 |
windGrp addTopView:subMenu. |
|
1701 | 6548 |
]. |
6549 |
||
2111 | 6550 |
"Q&D kludge - test whether the layout is nil; |
2249 | 6551 |
if true recompute the layouts |
2111 | 6552 |
" |
2374 | 6553 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6554 |
|
1701 | 6555 |
" Q&D kludge - if any visibility attributes are blocks; |
6556 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 6557 |
(since I react correctly on valueHolder changes) |
1701 | 6558 |
" |
6559 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6560 |
subMenu fixSize. |
|
6561 |
||
6562 |
"compute origin of subMenu |
|
6563 |
" |
|
6564 |
isVertical := menuPanel verticalLayout. |
|
6565 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6566 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6567 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6568 |
width := prefExtent x. |
1701 | 6569 |
devBot := device usableHeight. |
6570 |
devRight := device usableWidth. |
|
6571 |
||
6572 |
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
|
6573 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6574 |
menuPanel isPopUpView ifTrue:[ |
2249 | 6575 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6576 |
] ifFalse:[ |
2249 | 6577 |
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
|
6578 |
]. |
1701 | 6579 |
left := o x. |
6580 |
top := o y. |
|
6581 |
||
2016 | 6582 |
top + height > devBot ifTrue:[ |
2249 | 6583 |
top := isVertical ifTrue:[devBot - height] |
6584 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 6585 |
]. |
6586 |
top := top max:0. |
|
6587 |
||
6588 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6589 |
"/ top < menuPanel bottom ifTrue:[ |
|
6590 |
"/ left := left + layout width. |
|
6591 |
"/ ]. |
|
6592 |
"/ left + width > devRight ifTrue:[ |
|
6593 |
"/ left := o x - width - 2 |
|
6594 |
"/ ]. |
|
6595 |
"/ ]. |
|
6596 |
||
1701 | 6597 |
left + width > devRight ifTrue:[ |
2249 | 6598 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6599 |
ifFalse:[devRight - width] |
|
1701 | 6600 |
]. |
6601 |
left := left max:0. |
|
6602 |
||
6603 |
subMenu origin:(left@top). |
|
6604 |
||
6605 |
subMenu realized ifFalse:[ |
|
2249 | 6606 |
subMenu realize. |
1701 | 6607 |
] ifTrue:[ |
2249 | 6608 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6609 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6610 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6611 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6612 |
toggleSubmenuVisibility |
2870 | 6613 |
"toggle the visibility of the submenu" |
6614 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6615 |
subMenu notNil ifTrue:[ |
2870 | 6616 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6617 |
] ifFalse:[ |
3133 | 6618 |
self setupSubmenu. |
6619 |
subMenu isNil ifTrue:[ |
|
2870 | 6620 |
"/ cannot open a submenu |
6621 |
^ self |
|
6622 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6623 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6624 |
self openSubmenu. |
3133 | 6625 |
|
6626 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6627 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6628 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6629 |
visibleSubmenu |
2870 | 6630 |
"returns the current visible submenu or nil" |
6631 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6632 |
subMenu notNil ifTrue:[ |
2870 | 6633 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6634 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6635 |
^ nil |
1701 | 6636 |
! ! |
6637 |
||
524 | 6638 |
!MenuPanel::Item methodsFor:'building'! |
6639 |
||
6640 |
aspectAt:aKey |
|
3092 | 6641 |
"returns the value assigned to key or nil" |
2870 | 6642 |
|
524 | 6643 |
|appl value| |
6644 |
||
6645 |
appl := menuPanel receiver. |
|
6646 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6647 |
(appl isValueModel) ifTrue:[ |
2359 | 6648 |
^ appl value:aKey |
524 | 6649 |
]. |
6650 |
||
2123 | 6651 |
appl isNil ifTrue:[ |
2359 | 6652 |
appl := menuPanel application. |
2123 | 6653 |
]. |
6654 |
appl isNil ifTrue:[ ^ nil]. |
|
6655 |
||
6656 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 6657 |
ex selector == aKey ifFalse:[ |
6658 |
ex reject |
|
6659 |
]. |
|
6660 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 6661 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' |
6662 |
bindWith:appl classNameWithArticle with:aKey). |
|
2123 | 6663 |
] do:[ |
2359 | 6664 |
aKey numArgs == 1 ifTrue:[ |
6665 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6666 |
] ifFalse:[ |
|
6667 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6668 |
value := appl aspectFor:aKey |
|
6669 |
] ifFalse:[ |
|
6670 |
value := appl perform:aKey |
|
6671 |
] |
|
6672 |
] |
|
524 | 6673 |
]. |
6674 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6675 |
|
3092 | 6676 |
"Modified: / 05-10-2006 / 03:10:20 / cg" |
524 | 6677 |
! ! |
6678 |
||
390 | 6679 |
!MenuPanel::Item methodsFor:'change & update'! |
6680 |
||
2614 | 6681 |
fontChanged |
2870 | 6682 |
"called whenever the font changed" |
6683 |
||
2614 | 6684 |
displayLabel notNil ifTrue:[ |
6685 |
displayLabelExtent := nil. |
|
6686 |
||
6687 |
subMenu notNil ifTrue:[ |
|
6688 |
subMenu font:(menuPanel font). |
|
6689 |
]. |
|
6690 |
]. |
|
6691 |
! |
|
6692 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6693 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6694 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6695 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6696 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6697 |
(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
|
6698 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6699 |
self isSeparator ifFalse:[ |
2359 | 6700 |
"/ NOT A SEPARATOR |
6701 |
||
6702 |
menuPanel shown ifTrue:[ |
|
6703 |
changedObject == enableChannel ifTrue:[ |
|
6704 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6705 |
^ menuPanel selection:nil. |
|
6706 |
]. |
|
6707 |
^ self invalidate |
|
6708 |
]. |
|
6709 |
||
6710 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6711 |
menuItem isButton ifTrue:[ |
|
6712 |
self invalidate |
|
6713 |
] ifFalse:[ |
|
6714 |
"/ invalidate the interactor only |
|
6715 |
"/ take any interactor; interactors has the same extent |
|
6716 |
form := menuPanel iconIndicationOff. |
|
6717 |
||
6718 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6719 |
top:(layout top) |
|
6720 |
width:(form width) |
|
6721 |
height:(layout height). |
|
6722 |
||
6723 |
menuPanel invalidate:rect repairNow:false |
|
6724 |
]. |
|
6725 |
^ self |
|
6726 |
]. |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6727 |
self invalidate. |
2359 | 6728 |
]. |
498 | 6729 |
]. |
712 | 6730 |
|
6731 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6732 |
menuPanel mustRearrange. |
6733 |
menuPanel rearrangeItems. |
|
6734 |
^ self. |
|
712 | 6735 |
]. |
6736 |
||
498 | 6737 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6738 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6739 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6740 |
updateIndicators |
2870 | 6741 |
"update indicators " |
6742 |
||
2934 | 6743 |
indication notNil ifTrue:[ |
6744 |
(indication isSymbol |
|
6745 |
or:[menuItem hideMenuOnActivated not]) |
|
6746 |
ifTrue:[ |
|
6747 |
"indication is a selector; |
|
6748 |
otherwise no need to redraw, because |
|
6749 |
a change notification is raised from the model !!!!" |
|
6750 |
self update:nil with:nil from:indication |
|
6751 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6752 |
] |
390 | 6753 |
! ! |
6754 |
||
388 | 6755 |
!MenuPanel::Item methodsFor:'converting'! |
6756 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6757 |
asMenuItem |
2870 | 6758 |
"convert to a MenuItem" |
6759 |
||
2359 | 6760 |
^ menuItem |
388 | 6761 |
! |
6762 |
||
2827 | 6763 |
menuItem |
6764 |
^ menuItem |
|
6765 |
! |
|
6766 |
||
388 | 6767 |
menuItem:aMenuItem |
2870 | 6768 |
"setup attributes from a MenuItem" |
6769 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6770 |
|lbl| |
389 | 6771 |
|
388 | 6772 |
menuPanel disabledRedrawDo:[ |
2359 | 6773 |
menuItem := aMenuItem. |
6774 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6775 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6776 |
label := displayLabel := activeHelpText := nil. |
2359 | 6777 |
|
6778 |
self enabled:(menuItem enabled). |
|
6779 |
self indication:(menuItem indication). |
|
6780 |
self choice:(menuItem choice). |
|
6781 |
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
|
6782 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6783 |
"/ 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
|
6784 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6785 |
|
2359 | 6786 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6787 |
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
|
6788 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6789 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6790 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6791 |
self label:lbl. |
388 | 6792 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6793 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6794 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6795 |
! ! |
6796 |
||
2681 | 6797 |
!MenuPanel::Item methodsFor:'dependents access'! |
6798 |
||
6799 |
addDependencies |
|
2870 | 6800 |
"add all dependencies" |
6801 |
||
2681 | 6802 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
6803 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
6804 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
6805 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
6806 |
! |
|
6807 |
||
6808 |
removeDependencies |
|
2870 | 6809 |
"remove all dependencies" |
6810 |
||
2681 | 6811 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
6812 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
6813 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
6814 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
6815 |
! ! |
|
6816 |
||
388 | 6817 |
!MenuPanel::Item methodsFor:'drawing'! |
6818 |
||
2768 | 6819 |
choiceForm |
2870 | 6820 |
"returns choice form or nil" |
6821 |
||
2768 | 6822 |
|isOn| |
6823 |
||
6824 |
choice isNil ifTrue:[^ nil]. |
|
6825 |
||
6826 |
isOn := (choice value = menuItem choiceValue). |
|
6827 |
self enabled ifFalse:[ |
|
6828 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
|
6829 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
6830 |
]. |
|
3565 | 6831 |
self isSelected ifTrue:[ |
6832 |
^ isOn == true |
|
6833 |
ifTrue:[menuPanel iconRadioGroupEnteredOn] |
|
6834 |
ifFalse:[menuPanel iconRadioGroupEnteredOff] |
|
6835 |
]. |
|
2768 | 6836 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
6837 |
ifFalse:[menuPanel iconRadioGroupOff] |
|
6838 |
! |
|
6839 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6840 |
draw |
2870 | 6841 |
"redraw this item" |
6842 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6843 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6844 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6845 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6846 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6847 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6848 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6849 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6850 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6851 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6852 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6853 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6854 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6855 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6856 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6857 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6858 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6859 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6860 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6861 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6862 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6863 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6864 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6865 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6866 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6867 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6868 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6869 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6870 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6871 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6872 |
]]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6873 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6874 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6875 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6876 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6877 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6878 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6879 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6880 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6881 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6882 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6883 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6884 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6885 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6886 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6887 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6888 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6889 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6890 |
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
|
6891 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6892 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6893 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6894 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6895 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6896 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6897 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6898 |
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
|
6899 |
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
|
6900 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6901 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6902 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6903 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6904 |
drawButton |
2870 | 6905 |
"draw as button" |
6906 |
||
2362 | 6907 |
|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
|
6908 |
x "{ Class:SmallInteger }" |
2143 | 6909 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6910 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6911 |
drawObject := displayLabel. |
2362 | 6912 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6913 |
isSelected := self isSelected. |
2362 | 6914 |
|
6915 |
isSelected ifFalse:[ |
|
6916 |
"/ test whether button has pressed toggle behaviour |
|
6917 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6918 |
] ifTrue:[ |
|
6919 |
showSelected := isSelected |
|
6920 |
]. |
|
6921 |
||
6922 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6923 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6924 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6925 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6926 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6927 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6928 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6929 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6930 |
]. |
2059 | 6931 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6932 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6933 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6934 |
fg := menuPanel disabledForegroundColor. |
2059 | 6935 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6936 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6937 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6938 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6939 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6940 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6941 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6942 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6943 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6944 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6945 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6946 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6947 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6948 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6949 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6950 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6951 |
|
6952 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6953 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6954 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6955 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6956 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6957 |
"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
|
6958 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6959 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6960 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6961 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6962 |
] ifFalse:[ |
2359 | 6963 |
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
|
6964 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6965 |
]. |
2143 | 6966 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6967 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6968 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6969 |
level := menuPanel buttonActiveLevel. |
2142 | 6970 |
x := x + 1 "level abs". |
2143 | 6971 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6972 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6973 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6974 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6975 |
]. |
6976 |
||
2817 | 6977 |
drawObject notEmptyOrNil ifTrue:[ |
2362 | 6978 |
etchFg notNil ifTrue:[ |
6979 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6980 |
]. |
|
6981 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6982 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6983 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6984 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6985 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6986 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6987 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6988 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6989 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6990 |
drawLabel |
2870 | 6991 |
"draw a labeled entry; no button, no separator." |
6992 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6993 |
|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
|
6994 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6995 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6996 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6997 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6998 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6999 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7000 |
drawObject := displayLabel. |
2362 | 7001 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7002 |
isSelected := self isSelected. |
2362 | 7003 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7004 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7005 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7006 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7007 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7008 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7009 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7010 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7011 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7012 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7013 |
] ifFalse:[ |
2362 | 7014 |
fg := menuPanel disabledForegroundColor. |
7015 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
7016 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7017 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7018 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7019 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7020 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7021 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7022 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7023 |
|
3131 | 7024 |
( (form := self indicatorForm) notNil |
7025 |
or:[(form := self choiceForm) notNil] |
|
7026 |
) ifTrue:[ |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7027 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7028 |
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
|
7029 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7030 |
|
2817 | 7031 |
drawObject notEmptyOrNil ifTrue:[ |
3131 | 7032 |
x := x + (menuPanel stringOffsetXfor:self). |
7033 |
||
2362 | 7034 |
etchFg notNil ifTrue:[ |
7035 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
7036 |
]. |
|
7037 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
7038 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7039 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7040 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7041 |
"/ DRAW SHORTCUT KEY |
2359 | 7042 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7043 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7044 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7045 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7046 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7047 |
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
|
7048 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7049 |
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
|
7050 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7051 |
|
3403 | 7052 |
"/ DRAW SUBMENU INDICATION (if a vertical menu with submenu) |
7053 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[ |
|
7054 |
arrow := menuPanel rightArrow. |
|
7055 |
x := layout right - arrow width - HorizontalInset. |
|
7056 |
y := t + ((h - arrow height) // 2). |
|
7057 |
||
7058 |
(menuPanel styleSheet is3D not |
|
7059 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
7060 |
menuPanel displayForm:arrow x:x y:y. |
|
7061 |
] ifFalse:[ |
|
7062 |
cLa := menuPanel shadowColor. |
|
7063 |
cLb := menuPanel lightColor. |
|
7064 |
||
7065 |
isSelected ifFalse:[ |
|
7066 |
fg := cLa. |
|
7067 |
cLa := cLb. |
|
7068 |
cLb := fg |
|
7069 |
]. |
|
7070 |
menuPanel paint:cLa. |
|
7071 |
menuPanel displayForm:arrow x:x y:y. |
|
7072 |
menuPanel paint:cLb. |
|
7073 |
menuPanel displayForm:drawObject x:x y:y. |
|
7074 |
]. |
|
7075 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7076 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7077 |
"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
|
7078 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7079 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7080 |
drawMenuIndicator |
2870 | 7081 |
"draw a menu indicator if the item has a menu or delayed menu." |
7082 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7083 |
|x y icon bAbsLevel verticalPosition| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7084 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7085 |
icon := self menuIndicatorIcon. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7086 |
icon isNil ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7087 |
^ self |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7088 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7089 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7090 |
x := layout right - icon width. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7091 |
verticalPosition := menuPanel menuIndicatorVerticalPosition. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7092 |
verticalPosition == #center ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7093 |
y := (layout height - icon height) // 2 + layout top. |
2220 | 7094 |
] ifFalse:[ |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7095 |
verticalPosition == #top ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7096 |
y := layout top + 2. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7097 |
] ifFalse:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7098 |
y := layout bottom - icon height - 2. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7099 |
] |
2220 | 7100 |
]. |
7101 |
||
7102 |
bAbsLevel := 0. |
|
2359 | 7103 |
menuItem isButton ifTrue:[ |
2220 | 7104 |
self isSelected ifTrue:[ |
7105 |
x := x + 1. |
|
7106 |
y := y + 1. |
|
7107 |
]. |
|
7108 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
7109 |
x := x - bAbsLevel. |
|
7110 |
y := y - bAbsLevel. |
|
7111 |
]. |
|
7112 |
x := x - 1 "- HorizontalInset". |
|
7113 |
||
7114 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
7115 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7116 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7117 |
icon displayOn:menuPanel x:x y:y. |
2220 | 7118 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7119 |
(menuPanel drawMenuIndicatorSeparatorLine |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7120 |
and:[ self isEntered |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7121 |
and:[ menuPanel buttonEnteredLevel ~~ 0] ]) |
2761 | 7122 |
ifTrue:[ |
2220 | 7123 |
menuPanel paint:menuPanel buttonShadowColor. |
7124 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
7125 |
menuPanel paint:menuPanel buttonLightColor. |
|
7126 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
7127 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7128 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7129 |
|
2059 | 7130 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 7131 |
"draw a labeled entry; no button, no separator." |
7132 |
||
3486 | 7133 |
|oldFont labelExtent |
1727 | 7134 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7135 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7136 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7137 |
| |
2059 | 7138 |
|
3486 | 7139 |
oldFont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7140 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7141 |
menuPanel paint:fg. |
2614 | 7142 |
labelExtent := self displayLabelExtent. |
7143 |
||
7144 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 7145 |
"/ menuPanel centerItems ifTrue:[self halt]. |
3454
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
7146 |
aLabel isArray ifFalse:[ |
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
7147 |
|printLabel| |
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
7148 |
|
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
7149 |
aLabel isText ifTrue:[ |
3454
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
7150 |
"/ background of label has already been drawn |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
7151 |
printLabel := aLabel withoutEmphasis:#backgroundColor. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
7152 |
] ifFalse:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
7153 |
printLabel := aLabel. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
7154 |
]. |
3454
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
7155 |
y := y + (printLabel ascentOn:menuPanel). |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
7156 |
printLabel displayOn:menuPanel x:x y:y. |
1727 | 7157 |
] ifTrue:[ |
2337 | 7158 |
aLabel do:[:el| |
7159 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7160 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7161 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7162 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7163 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7164 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7165 |
"/ ]. |
2614 | 7166 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 7167 |
el displayOn:menuPanel x:x0 y:y0. |
7168 |
y := y + 1 + (el heightOn:menuPanel) |
|
7169 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7170 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 7171 |
] |
7172 |
]. |
|
1727 | 7173 |
]. |
3486 | 7174 |
menuPanel setFont:oldFont |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7175 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7176 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7177 |
drawSeparatingLines |
2870 | 7178 |
"draw separating lines" |
7179 |
||
2059 | 7180 |
|myIndex lfSep rtSep items prevItem nextItem |
7181 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7182 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7183 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7184 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7185 |
b "{ Class:SmallInteger }" |
706 | 7186 |
| |
2059 | 7187 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7188 |
items := menuPanel items. |
2059 | 7189 |
myIndex := items identityIndexOf:self. |
7190 |
||
7191 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
7192 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
7193 |
||
7194 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
7195 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
7196 |
||
7197 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2870 | 7198 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7199 |
]. |
2059 | 7200 |
|
7201 |
lightColor := menuPanel lightColor. |
|
7202 |
shadowColor := menuPanel shadowColor. |
|
7203 |
||
7204 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7205 |
|
608 | 7206 |
l := layout left. |
7207 |
t := layout top. |
|
7208 |
r := layout right. |
|
7209 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7210 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7211 |
menuPanel verticalLayout ifTrue:[ |
2870 | 7212 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
7213 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
7214 |
||
7215 |
menuPanel paint:shadowColor. |
|
7216 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
7217 |
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
|
7218 |
] ifFalse:[ |
2870 | 7219 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
7220 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
7221 |
||
7222 |
menuPanel paint:shadowColor. |
|
7223 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
7224 |
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
|
7225 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7226 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7227 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7228 |
drawSeparator |
2870 | 7229 |
"draw as separator" |
7230 |
||
2059 | 7231 |
|type lightColor shadowColor isDouble |
7232 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7233 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7234 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7235 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7236 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7237 |
| |
2059 | 7238 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7239 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7240 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2870 | 7241 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7242 |
]. |
2059 | 7243 |
|
7244 |
isDouble := type == #doubleLine. |
|
7245 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7246 |
lightColor := menuPanel lightColor. |
2059 | 7247 |
shadowColor := menuPanel shadowColor. |
7248 |
menuPanel paint:shadowColor. |
|
7249 |
||
7250 |
left := layout left. |
|
7251 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7252 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7253 |
menuPanel verticalLayout ifTrue:[ |
2870 | 7254 |
x0 := left + HorizontalInset. |
7255 |
x1 := layout right - HorizontalInset. |
|
7256 |
y0 := top - 1 + (layout height // 2). |
|
7257 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
7258 |
||
7259 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
7260 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
7261 |
||
7262 |
menuPanel paint:lightColor. |
|
7263 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
7264 |
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
|
7265 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7266 |
] ifFalse:[ |
2870 | 7267 |
y1 := layout bottom. |
7268 |
x0 := left - 1 + (layout width // 2). |
|
7269 |
y0 := top. |
|
7270 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
7271 |
||
7272 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
7273 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
7274 |
||
7275 |
menuPanel paint:lightColor. |
|
7276 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
7277 |
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
|
7278 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7279 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7280 |
|
2768 | 7281 |
indicatorForm |
2870 | 7282 |
"returns indication form or nil" |
7283 |
||
3565 | 7284 |
|isOn| |
2768 | 7285 |
|
7286 |
indication isNil ifTrue:[^ nil]. |
|
7287 |
||
3565 | 7288 |
isOn := self indicationValue. |
2768 | 7289 |
self enabled ifFalse:[ |
3565 | 7290 |
^ isOn == true |
2870 | 7291 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
7292 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 7293 |
]. |
3565 | 7294 |
"/ self isSelected ifTrue:[ |
7295 |
"/ ^ isOn == true |
|
7296 |
"/ ifTrue:[menuPanel iconIndicationEnteredOn] |
|
7297 |
"/ ifFalse:[menuPanel iconIndicationEnteredOff] |
|
7298 |
"/ ]. |
|
7299 |
||
7300 |
^ isOn == true |
|
2870 | 7301 |
ifTrue:[menuPanel iconIndicationOn] |
7302 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 7303 |
! |
7304 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7305 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7306 |
|
2362 | 7307 |
layout isNil ifTrue:[^ self]. |
7308 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7309 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 7310 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7311 |
] |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7312 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7313 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7314 |
menuIndicatorIcon |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7315 |
"return a menu indicator icon used if the item has a menu or delayed menu." |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7316 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7317 |
self hasDelayedMenuIndicator ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7318 |
^ MenuPanel delayedMenuIndicator. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7319 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7320 |
self hasMenuIndicator ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7321 |
^ MenuPanel menuIndicator. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7322 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7323 |
^ nil |
388 | 7324 |
! ! |
7325 |
||
7326 |
!MenuPanel::Item methodsFor:'initialization'! |
|
7327 |
||
7328 |
destroy |
|
2870 | 7329 |
"destroy submenus, remove dependencies" |
7330 |
||
616 | 7331 |
self submenu:nil. |
2681 | 7332 |
self removeDependencies. |
616 | 7333 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7334 |
menuPanel := nil. |
616 | 7335 |
! |
7336 |
||
794 | 7337 |
in:aPanel |
2870 | 7338 |
"create item in a menuPanel" |
7339 |
||
794 | 7340 |
menuPanel := aPanel. |
2359 | 7341 |
|
7342 |
menuItem isNil ifTrue:[ |
|
3561 | 7343 |
self breakPoint:#ca. |
2359 | 7344 |
menuItem := MenuItem new |
7345 |
]. |
|
7346 |
! |
|
7347 |
||
7348 |
initialize |
|
7349 |
menuItem := MenuItem new. |
|
1811 | 7350 |
! |
7351 |
||
7352 |
reinitStyle |
|
7353 |
||
7354 |
subMenu notNil ifTrue:[ |
|
3147 | 7355 |
subMenu reinitStyle |
1811 | 7356 |
]. |
7357 |
||
7358 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
7359 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 7360 |
! ! |
7361 |
||
7362 |
!MenuPanel::Item methodsFor:'label basics'! |
|
7363 |
||
7364 |
disabledRawLabel |
|
2870 | 7365 |
"returns the label used if the item is disabled" |
7366 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7367 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7368 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7369 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7370 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7371 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7372 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7373 |
disabledDisplayLabel isString ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7374 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7375 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7376 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7377 |
block := [:el| |rslt| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7378 |
(rslt := el) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7379 |
el isImageOrForm ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7380 |
el colorMap notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7381 |
rslt := menuPanel lightenedImageOnDevice:el |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7382 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7383 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7384 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7385 |
((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
|
7386 |
form := menuPanel lightenedImageOnDevice:form |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7387 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7388 |
((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
|
7389 |
image := menuPanel lightenedImageOnDevice:image |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7390 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7391 |
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
|
7392 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7393 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7394 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7395 |
rslt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7396 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7397 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7398 |
displayLabel isArray ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7399 |
disabledDisplayLabel := Array new:(displayLabel size). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7400 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7401 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7402 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7403 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7404 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7405 |
disabledDisplayLabel := block value:displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7406 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7407 |
^ disabledDisplayLabel |
794 | 7408 |
! |
7409 |
||
1829 | 7410 |
fetchDeviceResources |
2373 | 7411 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7412 |
disabledDisplayLabel := nil. |
1829 | 7413 |
self fetchImages. |
7414 |
! |
|
7415 |
||
616 | 7416 |
fetchImages |
2870 | 7417 |
"fetch my icon images" |
7418 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7419 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7420 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7421 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7422 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7423 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7424 |
displayLabel isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7425 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7426 |
^ self. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7427 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7428 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7429 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7430 |
(icon := displayLabel image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7431 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7432 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7433 |
(icon := displayLabel icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7434 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7435 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7436 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7437 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7438 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7439 |
displayLabel isArray ifFalse:[^ self]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7440 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7441 |
displayLabel keysAndValuesDo:[:i :el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7442 |
(el notNil and:[el isString not]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7443 |
el isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7444 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7445 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7446 |
el class == LabelAndIcon ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7447 |
(icon := el image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7448 |
el image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7449 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7450 |
(icon := el icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7451 |
el icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7452 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7453 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7454 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7455 |
] |
1078 | 7456 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7457 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7458 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7459 |
updateAccessCharacterFor:aLabel |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7460 |
"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
|
7461 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7462 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7463 |
|
3192 | 7464 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7465 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7466 |
aLabel isString ifFalse:[ |
2359 | 7467 |
aLabel class == LabelAndIcon ifTrue:[ |
7468 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
7469 |
]. |
|
7470 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7471 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7472 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7473 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7474 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7475 |
label := aLabel. |
2359 | 7476 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7477 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7478 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 7479 |
rest := label copyFrom:(i+1). |
7480 |
||
7481 |
i == 1 ifTrue:[label := rest] |
|
7482 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
7483 |
||
7484 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
7485 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7486 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7487 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7488 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 7489 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7490 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7491 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7492 |
label isText ifFalse:[ |
2359 | 7493 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7494 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7495 |
label emphasisAt:pos add:#underline. |
2359 | 7496 |
^ label |
388 | 7497 |
! ! |
7498 |
||
1573 | 7499 |
!MenuPanel::Item methodsFor:'printing & storing'! |
7500 |
||
7501 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7502 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7503 |
|
1573 | 7504 |
! ! |
7505 |
||
388 | 7506 |
!MenuPanel::Item methodsFor:'private'! |
7507 |
||
650 | 7508 |
activeBackgroundColor |
2870 | 7509 |
"returns the active background color derived from menuPanel" |
7510 |
||
2359 | 7511 |
menuItem isButton ifTrue:[ |
7512 |
^ menuPanel buttonActiveBackgroundColor |
|
7513 |
]. |
|
7514 |
^ menuPanel activeBackgroundColor |
|
650 | 7515 |
! |
7516 |
||
7517 |
activeForegroundColor |
|
2870 | 7518 |
"returns the active foreground color derived from menuPanel" |
650 | 7519 |
|
3441 | 7520 |
menuItem isButton ifTrue:[ |
7521 |
^ menuPanel buttonActiveForegroundColor |
|
7522 |
]. |
|
650 | 7523 |
^menuPanel activeForegroundColor |
7524 |
! |
|
7525 |
||
727 | 7526 |
backgroundColor |
2870 | 7527 |
"returns the background color derived from menuPanel" |
7528 |
||
2359 | 7529 |
menuItem isButton ifTrue:[ |
7530 |
^ menuPanel buttonPassiveBackgroundColor |
|
7531 |
]. |
|
7532 |
^ menuPanel backgroundColor |
|
727 | 7533 |
! |
7534 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7535 |
backgroundColorFromLabel |
2870 | 7536 |
"returns the background color derived from label or nil" |
7537 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7538 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7539 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7540 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7541 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7542 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7543 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7544 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7545 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7546 |
run size == 0 ifTrue:[ |
2870 | 7547 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
7548 |
^ run value |
|
7549 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7550 |
] ifFalse:[ |
2870 | 7551 |
run do:[:r| |
7552 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
7553 |
^ r value |
|
7554 |
] |
|
7555 |
] |
|
388 | 7556 |
]. |
7557 |
^ nil |
|
7558 |
! |
|
7559 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7560 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7561 |
"returns the background color to use when thhe mouse has entered |
2870 | 7562 |
derived from menuPanel" |
7563 |
||
2359 | 7564 |
menuItem isButton ifTrue:[ |
7565 |
^ menuPanel buttonEnteredBackgroundColor |
|
7566 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7567 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7568 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7569 |
|
663 | 7570 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7571 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7572 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7573 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7574 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7575 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7576 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7577 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7578 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7579 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7580 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7581 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7582 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7583 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7584 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7585 |
numArgs == 0 ifTrue:[ |
2359 | 7586 |
MessageNotUnderstood handle:[:ex | |
7587 |
|selector| |
|
7588 |
||
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7589 |
((selector := ex selector) == sel |
2359 | 7590 |
or:[selector == #aspectFor:]) ifFalse:[ |
7591 |
ex reject |
|
7592 |
]. |
|
7593 |
] do:[ |
|
7594 |
subm := aRecv aspectFor:sel. |
|
7595 |
]. |
|
7596 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7597 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7598 |
|
2043 | 7599 |
(Array with:(aRecv) with:(aRecv class)) |
7600 |
do:[:aPossibleReceiver | |
|
2359 | 7601 |
MessageNotUnderstood handle:[:ex| |
7602 |
ex message selector == sel ifFalse:[ ex reject ] |
|
7603 |
] do:[ |
|
7604 |
numArgs == 0 ifTrue:[ |
|
7605 |
subm := aPossibleReceiver perform:sel |
|
7606 |
] ifFalse:[ |
|
7607 |
numArgs == 1 ifTrue:[ |
|
7608 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
7609 |
] ifFalse:[ |
|
7610 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
7611 |
] |
|
7612 |
] |
|
7613 |
]. |
|
7614 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7615 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7616 |
|
663 | 7617 |
^ subm |
2043 | 7618 |
|
7619 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 7620 |
! |
7621 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7622 |
indicationValue |
2870 | 7623 |
"returns indication value or nil in case of no indication" |
7624 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7625 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7626 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7627 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7628 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7629 |
indication isSymbol ifFalse:[ |
2359 | 7630 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7631 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7632 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7633 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 7634 |
recv := menuPanel receiver. |
7635 |
||
7636 |
(recv isValueModel) ifFalse:[ |
|
7637 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
7638 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
7639 |
sel := sel asSymbol. |
|
7640 |
||
7641 |
MessageNotUnderstood handle:[:ex| |
|
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7642 |
ex selector == sel ifFalse:[ |
2359 | 7643 |
ex reject |
7644 |
]. |
|
7645 |
] do:[ |
|
7646 |
sel := recv perform:sel with:(menuItem argument) |
|
7647 |
] |
|
7648 |
]. |
|
7649 |
]. |
|
7650 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7651 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7652 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7653 |
numArgs ~~ 0 ifTrue:[ |
2359 | 7654 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7655 |
] ifFalse:[ |
2359 | 7656 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7657 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7658 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7659 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7660 |
sel isValueModel ifTrue:[ |
2359 | 7661 |
indication := sel. |
7662 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7663 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7664 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7665 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7666 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7667 |
indicationValue:aValue |
2870 | 7668 |
"set the indication value" |
7669 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7670 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7671 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7672 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7673 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7674 |
indication isSymbol ifFalse:[ |
2359 | 7675 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
7676 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7677 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7678 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7679 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 7680 |
^ self |
1218 | 7681 |
]. |
7682 |
||
524 | 7683 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7684 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7685 |
|
1218 | 7686 |
recv isNil ifTrue:[ |
2359 | 7687 |
recv := menuPanel application. |
7688 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7689 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7690 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7691 |
MessageNotUnderstood handle:[:ex| |
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7692 |
(ex selector ~~ indication) ifTrue:[ |
2359 | 7693 |
ex reject |
7694 |
]. |
|
7695 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 7696 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
7697 |
bindWith:recv classNameWithArticle with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7698 |
] do:[ |
2359 | 7699 |
numArgs == 1 ifTrue:[ |
7700 |
recv perform:indication with:aValue |
|
7701 |
] ifFalse:[ |
|
7702 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
7703 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7704 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7705 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7706 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7707 |
isEntered |
2870 | 7708 |
"returns true if the mouse pointer is over the item" |
7709 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7710 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7711 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7712 |
"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
|
7713 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7714 |
|
464 | 7715 |
separatorType |
2870 | 7716 |
"returns type of separator line or nil" |
7717 |
||
390 | 7718 |
|c lbl| |
388 | 7719 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7720 |
self isSeparator ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7721 |
^ nil |
388 | 7722 |
]. |
7723 |
||
390 | 7724 |
(lbl := label value) isNil ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7725 |
^ #singleLine |
388 | 7726 |
]. |
7727 |
||
390 | 7728 |
lbl size == 1 ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7729 |
c := lbl first. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7730 |
c == $- ifTrue:[^ #singleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7731 |
c == $= ifTrue:[^ #doubleLine]. |
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 |
^ #blankLine |
1130 | 7734 |
! |
7735 |
||
7736 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7737 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7738 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7739 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7740 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7741 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7742 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7743 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7744 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7745 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7746 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7747 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7748 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7749 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7750 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7751 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7752 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7753 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7754 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7755 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7756 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7757 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7758 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7759 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7760 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7761 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7762 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7763 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7764 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7765 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7766 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7767 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7768 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7769 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7770 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7771 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7772 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7773 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7774 |
submenuEncoding := submenu. |
3222 | 7775 |
submenu := Menu decodeFromLiteralArray:submenuEncoding. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7776 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7777 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7778 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7779 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7780 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7781 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7782 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7783 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7784 |
self submenu:submenu. |
1130 | 7785 |
^ subMenu |
7786 |
||
3222 | 7787 |
"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
|
7788 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7789 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7790 |
spaceBetweenEmptyLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7791 |
^ 3 |
388 | 7792 |
! ! |
7793 |
||
7794 |
!MenuPanel::Item methodsFor:'queries'! |
|
7795 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7796 |
canChangeVisibility |
1699 | 7797 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 7798 |
otherwise there is a change notification raised if the model changed" |
7799 |
||
3122 | 7800 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 7801 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 7802 |
|
7803 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 7804 |
"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
|
7805 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7806 |
|
388 | 7807 |
canSelect |
1699 | 7808 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 7809 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
7810 |
||
2362 | 7811 |
self isSeparator ifTrue:[^ false]. |
7812 |
||
7813 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 7814 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
7815 |
^ true |
|
7816 |
]. |
|
1078 | 7817 |
]. |
7818 |
^ false |
|
388 | 7819 |
! |
7820 |
||
2046 | 7821 |
containsPoint:aPoint |
2870 | 7822 |
"returns true if aPoint is contained in my layout" |
7823 |
||
2046 | 7824 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2870 | 7825 |
^ layout containsPoint:aPoint |
2046 | 7826 |
]. |
7827 |
^ false |
|
7828 |
||
7829 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
7830 |
! |
|
7831 |
||
388 | 7832 |
containsPointX:x y:y |
2870 | 7833 |
"returns true if point is contained in my layout" |
7834 |
||
712 | 7835 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2870 | 7836 |
^ layout containsPointX:x y:y |
505 | 7837 |
]. |
7838 |
^ false |
|
388 | 7839 |
! |
7840 |
||
2199 | 7841 |
hasDelayedMenu |
2870 | 7842 |
"returns true if a delayed menu exists" |
7843 |
||
2360 | 7844 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7845 |
^ false |
2199 | 7846 |
]. |
2360 | 7847 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7848 |
||
7849 |
(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
|
7850 |
^ false |
2199 | 7851 |
]. |
7852 |
^ true |
|
7853 |
! |
|
7854 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7855 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7856 |
"returns true if the item has a delayed menu |
2870 | 7857 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
7858 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7859 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7860 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7861 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7862 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7863 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7864 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7865 |
hasIndication |
2870 | 7866 |
"returns true if on/off indication exists" |
7867 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7868 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7869 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7870 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7871 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7872 |
"returns true if the item has a delayed menu |
2870 | 7873 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
7874 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7875 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7876 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7877 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7878 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7879 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7880 |
|
388 | 7881 |
hasSubmenu |
2870 | 7882 |
"returns true if the item is configured as an subMenu entry" |
7883 |
||
7884 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
|
388 | 7885 |
! |
7886 |
||
7887 |
isEnabled |
|
2870 | 7888 |
"returns the enabled state" |
7889 |
||
388 | 7890 |
^ self enabled |
7891 |
! |
|
7892 |
||
608 | 7893 |
isSeparator |
2870 | 7894 |
"returns true if item is a separator" |
7895 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7896 |
^ displayLabel isNil |
608 | 7897 |
! |
7898 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7899 |
isToggle |
2870 | 7900 |
"returns true if on/off indication exists" |
7901 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7902 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7903 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7904 |
|
712 | 7905 |
isVisible |
2870 | 7906 |
"returns the visibility state" |
7907 |
||
712 | 7908 |
|state| |
7909 |
||
7910 |
isVisible isSymbol ifTrue:[ |
|
2870 | 7911 |
state := self aspectAt:isVisible. |
7912 |
||
7913 |
state isValueModel ifTrue:[ |
|
7914 |
isVisible := state. |
|
7915 |
isVisible addDependent:self. |
|
7916 |
state := isVisible. |
|
7917 |
] |
|
712 | 7918 |
] ifFalse:[ |
2870 | 7919 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7920 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7921 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7922 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7923 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7924 |
! |
7925 |
||
7926 |
isVisible:something |
|
2870 | 7927 |
"change the visibility state; if the state changed, a redraw is performed" |
7928 |
||
712 | 7929 |
|oldState newState| |
7930 |
||
7931 |
isVisible isNil ifTrue:[ |
|
2870 | 7932 |
oldState := true |
712 | 7933 |
] ifFalse:[ |
2870 | 7934 |
oldState := isVisible value. |
7935 |
isVisible isValueModel ifTrue:[ |
|
7936 |
isVisible removeDependent:self |
|
7937 |
] |
|
712 | 7938 |
]. |
7939 |
isVisible := something. |
|
7940 |
||
7941 |
isVisible isNil ifTrue:[ |
|
2870 | 7942 |
newState := true |
712 | 7943 |
] ifFalse:[ |
2870 | 7944 |
isVisible isValueModel ifTrue:[ |
7945 |
isVisible addDependent:self |
|
7946 |
] ifFalse:[ |
|
7947 |
isVisible isSymbol ifTrue:[^ self] |
|
7948 |
]. |
|
7949 |
menuPanel shown ifFalse:[^ self]. |
|
7950 |
newState := isVisible value. |
|
712 | 7951 |
]. |
7952 |
||
7953 |
newState ~~ oldState ifTrue:[ |
|
2870 | 7954 |
menuPanel mustRearrange |
712 | 7955 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7956 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7957 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7958 |
! |
7959 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7960 |
menuIndicatorContains:aPoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7961 |
"returns true if the items delayed menu is hit by a button-press" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7962 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7963 |
|icon xSep| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7964 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7965 |
(self isVisible and:[layout notNil]) ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7966 |
(layout containsPoint:aPoint) ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7967 |
icon := self menuIndicatorIcon. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7968 |
icon notNil ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7969 |
xSep := layout right - icon width. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7970 |
^ aPoint x >= xSep |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7971 |
] |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7972 |
] |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7973 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7974 |
^ false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7975 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7976 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7977 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7978 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7979 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7980 |
|
388 | 7981 |
shortcutKeyAsString |
3601 | 7982 |
"converts shortcutKey to a text object for the menu-label-hint. |
7983 |
returns nil, if the key has no assignment." |
|
2870 | 7984 |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7985 |
|shortcutKey| |
2359 | 7986 |
|
7987 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7988 |
|
7989 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7990 |
^ nil |
1609 | 7991 |
]. |
7992 |
shortcutKey isCharacter ifTrue:[ |
|
3301 | 7993 |
shortcutKey == Character space ifFalse:[ |
7994 |
^ 'Space' |
|
7995 |
]. |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7996 |
^ shortcutKey asString |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7997 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7998 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7999 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8000 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 8001 |
! ! |
8002 |
||
8003 |
!MenuPanel::Item methodsFor:'selection'! |
|
8004 |
||
8005 |
isSelected |
|
2870 | 8006 |
"returns true if item is selected" |
1998 | 8007 |
|
8008 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 8009 |
! |
8010 |
||
2249 | 8011 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
8012 |
"change selection to a state. Dependant on the state open or hide an existing |
2870 | 8013 |
submenu and perform a redraw" |
8014 |
||
2249 | 8015 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
8016 |
self invalidate. |
|
8017 |
self hideSubmenu. |
|
2359 | 8018 |
^ self |
2249 | 8019 |
]. |
8020 |
||
2199 | 8021 |
menuPanel realized ifFalse:[ ^ self ]. |
8022 |
||
2359 | 8023 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 8024 |
self invalidate |
2199 | 8025 |
]. |
8026 |
self hasSubmenu ifFalse:[ ^ self]. |
|
8027 |
||
8028 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 8029 |
menuPanel openDelayed:self |
2199 | 8030 |
] ifFalse:[ |
3133 | 8031 |
self setupSubmenu. |
2374 | 8032 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
1701 | 8033 |
]. |
3133 | 8034 |
|
8035 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 8036 |
! ! |
8037 |
||
2692 | 8038 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
8039 |
||
8040 |
argument2 |
|
8041 |
||
8042 |
^ argument2 |
|
8043 |
! |
|
8044 |
||
8045 |
argument2:anArgumentOrNil |
|
8046 |
||
8047 |
argument2 := anArgumentOrNil |
|
8048 |
! ! |
|
8049 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8050 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 8051 |
|
2018 | 8052 |
icon |
2016 | 8053 |
"This resource specification was automatically generated |
8054 |
by the ImageEditor of ST/X." |
|
8055 |
||
8056 |
"Do not manually edit this!! If it is corrupted, |
|
8057 |
the ImageEditor may not be able to read the specification." |
|
8058 |
||
8059 |
" |
|
2018 | 8060 |
self icon inspect |
8061 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 8062 |
" |
8063 |
||
8064 |
<resource: #image> |
|
8065 |
||
8066 |
^Icon |
|
3603
c93203750a0b
image resource method fixes (key must be name of method)
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
8067 |
constantNamed:#'MenuPanel::ScrollActivity class icon' |
c93203750a0b
image resource method fixes (key must be name of method)
Claus Gittinger <cg@exept.de>
parents:
3601
diff
changeset
|
8068 |
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 | 8069 |
! ! |
8070 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8071 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 8072 |
|
8073 |
new |
|
8074 |
^ self basicNew initialize |
|
8075 |
! ! |
|
8076 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8077 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 8078 |
|
8079 |
activeMenu |
|
8080 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 8081 |
is returned if scrolling is deactivated" |
8082 |
||
2016 | 8083 |
^ activeMenu |
8084 |
! |
|
8085 |
||
8086 |
direction |
|
2870 | 8087 |
"returns the scroll-direction" |
8088 |
||
2016 | 8089 |
^ direction |
8090 |
! |
|
8091 |
||
8092 |
iconAt:aDirection on:aMenu |
|
2018 | 8093 |
|icon device index| |
2016 | 8094 |
|
8095 |
device := aMenu device. |
|
8096 |
||
8097 |
aDirection == #PREV ifTrue:[ |
|
3147 | 8098 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
8099 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 8100 |
] ifFalse:[ |
3147 | 8101 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
8102 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 8103 |
]. |
8104 |
||
8105 |
icon := icons at:index. |
|
8106 |
||
8107 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
3147 | 8108 |
icon := self class icon. |
8109 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
8110 |
ifFalse:[ icon := icon copy ]. |
|
8111 |
||
8112 |
icon := icon onDevice:device. |
|
8113 |
icon clearMaskedPixels. |
|
8114 |
icons at:index put:icon |
|
2018 | 8115 |
]. |
8116 |
^ icon |
|
2016 | 8117 |
! ! |
8118 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8119 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 8120 |
|
8121 |
initialize |
|
8122 |
||
8123 |
semaLock := RecursionLock new. |
|
2018 | 8124 |
icons := Array new:4. |
2016 | 8125 |
! ! |
8126 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8127 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 8128 |
|
8129 |
isActive |
|
2870 | 8130 |
"returns true if scrolling is activated" |
8131 |
||
2016 | 8132 |
^ activeMenu notNil |
8133 |
! ! |
|
8134 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8135 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 8136 |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8137 |
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress |
2870 | 8138 |
"start scrolling; returns true if scrolling is activated" |
8139 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8140 |
|bounds index isScrolledMenu boundsOnRoot| |
2860 | 8141 |
|
8142 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 8143 |
|
8144 |
semaLock critical:[ |
|
2860 | 8145 |
self stop. |
8146 |
||
8147 |
isScrolledMenu ifTrue:[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8148 |
bounds := aMenu scrollerBoundsAt:aDirection. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8149 |
|
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8150 |
comesViaButtonPress ifFalse:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8151 |
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
|
8152 |
extent:(bounds extent). |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8153 |
]. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8154 |
|
2860 | 8155 |
activeMenu := aMenu. |
8156 |
direction := aDirection. |
|
8157 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
8158 |
||
8159 |
index ~~ 0 ifTrue:[ |
|
8160 |
scrollTask := |
|
8161 |
[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8162 |
|item step continue| |
2860 | 8163 |
|
8164 |
[ |
|
8165 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
8166 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
8167 |
aMenu makeItemVisible:item. |
|
8168 |
index := index + step. |
|
8169 |
]. |
|
8170 |
||
8171 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
8172 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8173 |
[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8174 |
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
|
8175 |
|
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8176 |
boundsOnRoot notNil ifTrue:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8177 |
continue ifTrue:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8178 |
continue := boundsOnRoot containsPoint:aMenu sensor mousePoint. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8179 |
] ifFalse:[ |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8180 |
boundsOnRoot := nil. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8181 |
] |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8182 |
]. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8183 |
continue |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8184 |
] whileTrue:[ |
2860 | 8185 |
aMenu makeItemVisible:item. |
8186 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
8187 |
index := index + step. |
|
8188 |
]. |
|
8189 |
item := nil. |
|
8190 |
] ensure:[ |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8191 |
activeMenu := direction := scrollTask := nil. |
2860 | 8192 |
|
8193 |
item notNil ifTrue:[ |
|
8194 |
"/ process was killed |
|
8195 |
aMenu invalidate:bounds |
|
8196 |
] |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8197 |
]. |
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8198 |
boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ]. |
2860 | 8199 |
] forkAt:8. |
8200 |
] |
|
8201 |
] |
|
2016 | 8202 |
]. |
8203 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
8204 |
|
2048 | 8205 |
"Created: ca" |
8206 |
||
8207 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 8208 |
! |
8209 |
||
8210 |
stop |
|
2870 | 8211 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
8212 |
||
2016 | 8213 |
|task resp| |
8214 |
||
8215 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8216 |
^ false |
2016 | 8217 |
]. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8218 |
|
2016 | 8219 |
semaLock critical:[ |
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8220 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8221 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8222 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8223 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8224 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8225 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8226 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8227 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8228 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8229 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8230 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
8231 |
activeMenu := direction := nil. |
2016 | 8232 |
]. |
8233 |
^ resp |
|
8234 |
! ! |
|
8235 |
||
388 | 8236 |
!MenuPanel class methodsFor:'documentation'! |
8237 |
||
8238 |
version |
|
3826 | 8239 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.493 2009-10-24 22:06:53 cg Exp $' |
3780 | 8240 |
! |
8241 |
||
8242 |
version_CVS |
|
3826 | 8243 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.493 2009-10-24 22:06:53 cg Exp $' |
388 | 8244 |
! ! |
2199 | 8245 |
|
388 | 8246 |
MenuPanel initialize! |