author | Claus Gittinger <cg@exept.de> |
Wed, 15 Feb 2012 22:32:09 +0100 | |
changeset 4110 | e5d8fe91874e |
parent 4109 | ed4578d2f007 |
child 4112 | df82e28ca882 |
permissions | -rw-r--r-- |
2005 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 3 |
All Rights Reserved |
2005 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1750 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
2182
59a770bbb95a
changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
14 |
View subclass:#MenuPanel |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
15 |
instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
16 |
selection items groupSizes receiver enabled lastActiveMenu |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
17 |
enteredItem prevFocusView previousPointerGrab |
3147 | 18 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
19 |
scrollActivity rightArrowShadow rightArrow fgColor verticalLayout |
|
20 |
showSeparatingLines showGroupDivider implicitGrabView |
|
21 |
lastPointerView openDelayedMenuBlock preferredWidth application |
|
22 |
originator centerItems hideOnRelease defaultHideOnRelease |
|
23 |
buttonInsetX buttonInsetY itemSpace activeBackgroundColor |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
24 |
stringOffsetX doAccessCharacterTranslation lastItem hasPerformed |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
25 |
focusComesByTab lastDrawnScrollerNextBounds |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
26 |
buttonActiveBackgroundColor buttonEnteredBackgroundColor |
4110 | 27 |
buttonPassiveBackgroundColor maxExtent' |
3147 | 28 |
classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages |
29 |
DefaultForegroundColor DefaultBackgroundColor IconIndicationOn |
|
30 |
IconIndicationOff IconRadioOn IconRadioOff |
|
31 |
IconDisabledIndicationOn IconDisabledIndicationOff |
|
32 |
IconDisabledRadioOn IconDisabledRadioOff' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Views-Menus' |
|
388 | 35 |
! |
36 |
||
37 |
Object subclass:#Item |
|
3147 | 38 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
39 |
disabledDisplayLabel enableChannel label activeHelpText |
|
40 |
flyByHelpText isVisible indication choice accessCharacter' |
|
41 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
|
42 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
43 |
poolDictionaries:'' |
|
44 |
privateIn:MenuPanel |
|
388 | 45 |
! |
46 |
||
2692 | 47 |
Object subclass:#Adornment |
3147 | 48 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
49 |
choice choiceValue' |
|
50 |
classVariableNames:'' |
|
51 |
poolDictionaries:'' |
|
52 |
privateIn:MenuPanel::Item |
|
2692 | 53 |
! |
54 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
55 |
Object subclass:#ScrollActivity |
3147 | 56 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
57 |
classVariableNames:'' |
|
58 |
poolDictionaries:'' |
|
59 |
privateIn:MenuPanel |
|
2016 | 60 |
! |
61 |
||
388 | 62 |
!MenuPanel class methodsFor:'documentation'! |
63 |
||
2005 | 64 |
copyright |
65 |
" |
|
66 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 67 |
All Rights Reserved |
2005 | 68 |
|
69 |
This software is furnished under a license and may be used |
|
70 |
only in accordance with the terms of that license and with the |
|
71 |
inclusion of the above copyright notice. This software may not |
|
72 |
be provided or otherwise made available to, or used by, any |
|
73 |
other person. No title to or ownership of the software is |
|
74 |
hereby transferred. |
|
75 |
" |
|
76 |
||
388 | 77 |
! |
78 |
||
79 |
documentation |
|
80 |
" |
|
81 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
82 |
||
2170 | 83 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 84 |
(and hopefully be ST-80 compatible ...) |
85 |
||
502 | 86 |
To create a menu, there exists a MenuEditor which will generate |
87 |
a menu specification. |
|
88 |
||
89 |
||
2061 | 90 |
Notice: |
3938 | 91 |
This is going to replace the obsolete MenuView. |
2061 | 92 |
|
388 | 93 |
[author:] |
3938 | 94 |
Claus Atzkern |
388 | 95 |
|
96 |
[see also:] |
|
3938 | 97 |
Menu |
98 |
MenuItem |
|
99 |
MenuEditor |
|
2170 | 100 |
|
101 |
cg: this code is so ugly - needs a complete rewrite... |
|
102 |
||
388 | 103 |
" |
104 |
! |
|
105 |
||
106 |
examples |
|
107 |
||
108 |
" |
|
4081 | 109 |
a PullDownMenu |
110 |
[exBegin] |
|
388 | 111 |
|top subView mview desc s1 s2 s3 img lbs labels| |
112 |
||
113 |
top := StandardSystemView new. |
|
114 |
||
436 | 115 |
mview := MenuPanel in:top. |
388 | 116 |
|
502 | 117 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 118 |
mview level:2. |
119 |
mview verticalLayout:false. |
|
120 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 121 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 122 |
mview labels:lbs. |
123 |
mview shortcutKeyAt:2 put:#Cut. |
|
124 |
mview accessCharacterPositionAt:1 put:1. |
|
125 |
mview accessCharacterPositionAt:2 put:2. |
|
126 |
||
127 |
mview enabledAt:5 put:false. |
|
128 |
mview groupSizes:#( 2 2 ). |
|
436 | 129 |
s1 := MenuPanel labels:labels. |
388 | 130 |
s1 accessCharacterPositionAt:1 put:1. |
131 |
s1 accessCharacterPositionAt:2 put:2. |
|
132 |
s1 groupSizes:#( 2 2 ). |
|
436 | 133 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
134 |
s3 := MenuPanel labels:lbs. |
|
388 | 135 |
|
136 |
s1 subMenuAt:2 put:s2. |
|
436 | 137 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 138 |
s2 subMenuAt:3 put:s3. |
436 | 139 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 140 |
s3 shortcutKeyAt:3 put:$q. |
141 |
||
142 |
mview subMenuAt:1 put:s1. |
|
436 | 143 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 144 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
145 |
s1 shortcutKeyAt:1 put:#Copy. |
|
146 |
s1 shortcutKeyAt:3 put:#Paste. |
|
147 |
||
436 | 148 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 149 |
top extent:(mview preferredExtent). |
388 | 150 |
top open. |
4081 | 151 |
[exEnd] |
152 |
||
153 |
a PullDownMenu with applications |
|
154 |
[exBegin] |
|
1767 | 155 |
|top menu view item| |
156 |
||
157 |
top := StandardSystemView extent:240@100. |
|
158 |
menu := MenuPanel in:top. |
|
159 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
160 |
menu verticalLayout:false. |
|
161 |
||
162 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
163 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
164 |
||
165 |
view := ClockView new. |
|
166 |
view preferredExtent:100@100. |
|
167 |
item := menu itemAt:3. |
|
168 |
item submenu:view. |
|
169 |
||
4081 | 170 |
view := ImageView new. |
171 |
view image:(Image fromScreen:(0@0 corner:200@200)). |
|
172 |
view preferredExtent:(200@200). |
|
1767 | 173 |
item := menu itemAt:2. |
174 |
item submenu:view. |
|
175 |
||
176 |
menu origin:0@0 corner:1.0@30. |
|
177 |
top open. |
|
4081 | 178 |
[exEnd] |
179 |
||
180 |
||
181 |
a PopUpMenu |
|
182 |
[exBegin] |
|
388 | 183 |
|subView mview desc s1 s2 s3 img lbs labels| |
184 |
||
436 | 185 |
mview := MenuPanel new. |
502 | 186 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 187 |
mview level:2. |
188 |
||
189 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 190 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 191 |
mview labels:lbs. |
192 |
||
436 | 193 |
s1 := MenuPanel labels:labels. |
194 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
195 |
s3 := MenuPanel labels:lbs. |
|
388 | 196 |
s1 subMenuAt:2 put:s2. |
436 | 197 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 198 |
s2 subMenuAt:3 put:s3. |
436 | 199 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 200 |
s3 shortcutKeyAt:3 put:$q. |
201 |
||
202 |
mview subMenuAt:1 put:s1. |
|
436 | 203 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 204 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
205 |
s1 shortcutKeyAt:1 put:#Copy. |
|
206 |
s1 shortcutKeyAt:3 put:#Paste. |
|
207 |
||
436 | 208 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 209 |
mview startUp |
4081 | 210 |
[exEnd] |
211 |
||
212 |
||
213 |
a menu spec |
|
214 |
[exBegin] |
|
388 | 215 |
|menu| |
216 |
||
436 | 217 |
menu := MenuPanel menu: |
4081 | 218 |
#(#Menu #( #(#MenuItem |
219 |
#label: 'File' |
|
220 |
#submenu: |
|
221 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
222 |
(#MenuItem |
|
223 |
#label: 'edit' |
|
224 |
#submenu: |
|
225 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
226 |
#(#MenuItem #label: 'close' #value:#close) |
|
227 |
) |
|
228 |
nil |
|
229 |
nil |
|
230 |
) |
|
231 |
) |
|
232 |
#(#MenuItem #label: 'help' #value:#help ) |
|
233 |
) |
|
234 |
nil |
|
235 |
nil |
|
236 |
) |
|
237 |
) |
|
238 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
239 |
#(#MenuItem #label: 'Bar' |
|
240 |
#submenu: |
|
241 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
242 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
243 |
) |
|
244 |
nil |
|
245 |
nil |
|
246 |
) |
|
247 |
) |
|
248 |
) |
|
249 |
#( 2 ) |
|
250 |
nil |
|
251 |
) decodeAsLiteralArray. |
|
388 | 252 |
|
253 |
menu verticalLayout:false. |
|
254 |
Transcript showCR:(menu startUp). |
|
4081 | 255 |
[exEnd] |
388 | 256 |
|
257 |
" |
|
258 |
! ! |
|
259 |
||
260 |
!MenuPanel class methodsFor:'instance creation'! |
|
261 |
||
262 |
fromSpec:aSpec |
|
263 |
^ self fromSpec:aSpec receiver:nil |
|
264 |
! |
|
265 |
||
266 |
fromSpec:aSpec receiver:aReceiver |
|
267 |
|menu| |
|
268 |
||
269 |
aSpec notNil ifTrue:[ |
|
3147 | 270 |
menu := Menu new. |
271 |
menu receiver:aReceiver. |
|
272 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 273 |
]. |
274 |
^ self menu:menu receiver:aReceiver |
|
275 |
! |
|
276 |
||
277 |
labels:labels |
|
278 |
^ self labels:labels nameKeys:nil receiver:nil |
|
279 |
! |
|
280 |
||
281 |
labels:labels nameKeys:nameKeys |
|
282 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
283 |
! |
|
284 |
||
285 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
286 |
|mview| |
|
287 |
||
288 |
mview := self menu:nil receiver:aReceiver. |
|
289 |
mview labels:labels. |
|
290 |
mview nameKeys:nameKeys. |
|
291 |
^ mview |
|
292 |
||
293 |
! |
|
294 |
||
502 | 295 |
labels:labels receiver:aReceiver |
296 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
297 |
! |
|
298 |
||
388 | 299 |
menu:aMenu |
300 |
^ self menu:aMenu receiver:nil |
|
301 |
! |
|
302 |
||
303 |
menu:aMenu receiver:aReceiver |
|
304 |
|mview| |
|
305 |
||
306 |
mview := self new. |
|
1955 | 307 |
|
308 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
3147 | 309 |
"/ no receiver specified in the menu; thus set the receiver immediately |
310 |
mview receiver:aReceiver |
|
1955 | 311 |
]. |
312 |
||
388 | 313 |
mview menu:aMenu. |
314 |
||
1955 | 315 |
|
388 | 316 |
"/ a menu itself may contain a receiver |
317 |
"/ thus we do not overwrite the receiver |
|
318 |
||
319 |
aReceiver notNil ifTrue:[ |
|
3147 | 320 |
mview receiver:aReceiver |
388 | 321 |
]. |
322 |
^ mview |
|
323 |
! ! |
|
324 |
||
325 |
!MenuPanel class methodsFor:'class initialization'! |
|
326 |
||
327 |
initialize |
|
328 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
3938 | 329 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 330 |
]. |
331 |
||
2715 | 332 |
" |
333 |
self initialize |
|
334 |
" |
|
335 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
336 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 337 |
! |
338 |
||
339 |
preSnapshot |
|
2715 | 340 |
"remove all resources" |
341 |
||
794 | 342 |
Images := nil. |
343 |
LigthenedImages := nil. |
|
616 | 344 |
! ! |
345 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
346 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
347 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
348 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
349 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
350 |
by the ImageEditor of ST/X." |
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 |
"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
|
353 |
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
|
354 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
355 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
356 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
357 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
358 |
Icon flushCachedIcons |
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 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
361 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
362 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
363 |
^Icon |
3938 | 364 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
365 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself] |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
366 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
367 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
368 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
369 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
370 |
by the ImageEditor of ST/X." |
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 |
"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
|
373 |
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
|
374 |
|
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 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
377 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
378 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
379 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
380 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
381 |
|
2755 | 382 |
IconDisabledIndicationOff isNil ifTrue:[ |
3938 | 383 |
IconDisabledIndicationOff := Icon |
384 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
|
385 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
2755 | 386 |
]. |
387 |
^ IconDisabledIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
388 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
390 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
391 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
392 |
by the ImageEditor of ST/X." |
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 |
"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
|
395 |
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
|
396 |
|
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 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
399 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
400 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
401 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
402 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
403 |
|
2755 | 404 |
IconDisabledIndicationOn isNil ifTrue:[ |
3938 | 405 |
IconDisabledIndicationOn := Icon |
406 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
|
407 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
2755 | 408 |
]. |
409 |
^ IconDisabledIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
410 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
411 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
417 |
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
|
418 |
|
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 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
422 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
423 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
424 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
425 |
|
2752 | 426 |
IconIndicationOff isNil ifTrue:[ |
3938 | 427 |
IconIndicationOff := Icon |
428 |
constantNamed:#'MenuPanel iconIndicationOff' |
|
429 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
2752 | 430 |
]. |
431 |
^ IconIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
432 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
433 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
434 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
435 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
436 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
439 |
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
|
440 |
|
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 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
443 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
444 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
445 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
446 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
447 |
|
2752 | 448 |
IconIndicationOn isNil ifTrue:[ |
3938 | 449 |
IconIndicationOn := Icon |
450 |
constantNamed:#'MenuPanel iconIndicationOn' |
|
451 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
2752 | 452 |
]. |
453 |
^ IconIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
454 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
455 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
456 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
457 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
by the ImageEditor of ST/X." |
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 |
"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
|
461 |
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
|
462 |
|
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 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
465 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
466 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
467 |
|
3565 | 468 |
"/ <resource: #image> |
469 |
"/ |
|
470 |
"/ IconDisabledRadioOff isNil ifTrue:[ |
|
471 |
"/ IconDisabledRadioOff := Icon |
|
472 |
"/ constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
|
473 |
"/ 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] |
|
474 |
"/ ]. |
|
475 |
"/ ^ IconDisabledRadioOff |
|
476 |
||
477 |
<resource: #programImage> |
|
478 |
^ RadioButton disabledPassiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
479 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
480 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
481 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
482 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
483 |
by the ImageEditor of ST/X." |
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 |
"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
|
486 |
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
|
487 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
488 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
489 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
490 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 491 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
492 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
493 |
|
3565 | 494 |
"/ <resource: #image> |
495 |
"/ |
|
496 |
"/ IconDisabledRadioOn isNil ifTrue:[ |
|
497 |
"/ IconDisabledRadioOn := Icon |
|
498 |
"/ constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
499 |
"/ 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] |
|
500 |
"/ ]. |
|
501 |
"/ ^ IconDisabledRadioOn |
|
502 |
||
503 |
<resource: #programImage> |
|
504 |
^ RadioButton disabledActiveForm |
|
505 |
! |
|
506 |
||
507 |
iconRadioGroupEnteredOff |
|
508 |
<resource: #programImage> |
|
509 |
^ RadioButton enteredPassiveForm |
|
510 |
! |
|
511 |
||
512 |
iconRadioGroupEnteredOn |
|
513 |
<resource: #programImage> |
|
514 |
^ RadioButton enteredActiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
515 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
516 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
517 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
518 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
519 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
522 |
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
|
523 |
|
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 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
526 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
527 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
528 |
|
3565 | 529 |
"/ <resource: #image> |
530 |
"/ |
|
531 |
"/ IconRadioOff isNil ifTrue:[ |
|
532 |
"/ IconRadioOff := Icon |
|
533 |
"/ constantNamed:#'MenuPanel iconRadioGroupOff' |
|
534 |
"/ 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] |
|
535 |
"/ ]. |
|
536 |
"/ ^ IconRadioOff |
|
537 |
||
538 |
<resource: #programImage> |
|
539 |
^ RadioButton passiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
540 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
541 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
542 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
543 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
544 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
547 |
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
|
548 |
|
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 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
551 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
552 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
553 |
|
3565 | 554 |
"/ <resource: #image> |
555 |
"/ |
|
556 |
"/ IconRadioOn isNil ifTrue:[ |
|
557 |
"/ IconRadioOn := Icon |
|
558 |
"/ constantNamed:#'MenuPanel iconRadioGroupOn' |
|
559 |
"/ 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] |
|
560 |
"/ ]. |
|
561 |
"/ ^ IconRadioOn |
|
562 |
||
563 |
<resource: #programImage> |
|
564 |
^ RadioButton activeForm |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
565 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
566 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
567 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
568 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
569 |
by the ImageEditor of ST/X." |
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 |
"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
|
572 |
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
|
573 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
574 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
575 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
576 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
577 |
Icon flushCachedIcons |
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 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
580 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
581 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
582 |
^Icon |
3938 | 583 |
constantNamed:#'MenuPanel class menuIndicator' |
584 |
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
|
585 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
586 |
|
616 | 587 |
!MenuPanel class methodsFor:'defaults'! |
450 | 588 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
589 |
defaultBackgroundColor |
2609 | 590 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 591 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
592 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
593 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
594 |
defaultLevel |
2372 | 595 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
596 |
" |
|
597 |
self defaultLevel |
|
598 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
599 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
600 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
601 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
602 |
"returns an additional offset between the label and the |
2715 | 603 |
delayedMenu indication (i.e. the down-arrow icon)" |
604 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
605 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
606 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
607 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
608 |
maxShortCutSearchLevel |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
609 |
"1 means: only search in top items. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
610 |
2 means: search one level of menus. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
611 |
used to be 10" |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
612 |
|
3384 | 613 |
MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.]. |
614 |
^ MaxShortCutSearchLevel |
|
615 |
! |
|
616 |
||
617 |
maxShortCutSearchLevel: anInteger |
|
618 |
"1 means: only search in top items. |
|
619 |
2 means: search one level of menus." |
|
620 |
||
621 |
MaxShortCutSearchLevel := anInteger |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
622 |
! |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
623 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
624 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
625 |
"returns an additional offset between the label and the |
2715 | 626 |
delayedMenu indication (i.e. the down-arrow icon)" |
627 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
628 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
629 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
630 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
631 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
632 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
633 |
ex: |
3938 | 634 |
&File mnemonic := Cmdf |
635 |
F&ile mnemonic := Cmdi |
|
636 |
....." |
|
2715 | 637 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
638 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
639 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
640 |
|
450 | 641 |
updateStyleCache |
2777 | 642 |
"extract values from the styleSheet and cache them in class variables" |
657 | 643 |
|
2219 | 644 |
<resource: #style ( |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
645 |
#'selection.disabledForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
646 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
647 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
648 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
649 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
650 |
#'menu.hilightLevel' #'menu.enteredLevel' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
651 |
#'menu.groupDividerSize' #'menu.itemMargin' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
652 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
653 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
654 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
655 |
#'menu.selectionFollowsMouse' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
656 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
657 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
658 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
659 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
660 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
661 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
662 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
663 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
664 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
665 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
666 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
667 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
2219 | 668 |
)> |
669 |
||
670 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 671 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 672 |
|
2611 | 673 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
674 |
which returns the default cashed DefaultBackgroundColor |
|
675 |
" |
|
676 |
DefaultBackgroundColor := nil. |
|
677 |
||
2219 | 678 |
MenuView updateStyleCache. |
679 |
SelectionInListView updateStyleCache. |
|
1699 | 680 |
|
2372 | 681 |
styleSheet := StyleSheet. |
682 |
style := styleSheet name. |
|
683 |
||
2607 | 684 |
DefaultFont := MenuView defaultFont. |
3938 | 685 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
686 |
default:[styleSheet |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
687 |
colorAt:#'menu.foregroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
688 |
default:Color black]. |
2609 | 689 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 690 |
|
691 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 692 |
var isNil ifTrue:[ |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
693 |
style == #motif ifTrue:[ var := backgroundColor ] |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
694 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
2219 | 695 |
]. |
696 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
697 |
||
698 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 699 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 700 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
701 |
||
702 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 703 |
var isNil ifTrue:[ |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
704 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
705 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 706 |
]. |
707 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
708 |
||
709 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 710 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 711 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
712 |
||
713 |
||
714 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 715 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 716 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
717 |
||
718 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 719 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 720 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
721 |
||
722 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
723 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
724 |
||
725 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
726 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
727 |
||
728 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 729 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
730 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
2219 | 731 |
]. |
732 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
733 |
||
734 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 735 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 736 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
737 |
||
738 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 739 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 740 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
741 |
||
742 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 743 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 744 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
745 |
||
746 |
Item updateStyleCache. |
|
2607 | 747 |
|
2754 | 748 |
getBitmapOrFile := [:key :fileKey | |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
749 |
|var| |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
750 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
751 |
var := styleSheet at:key ifAbsent:nil. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
752 |
var isNil ifTrue:[ |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
753 |
var := styleSheet at:fileKey ifAbsent:nil. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
754 |
var notNil ifTrue:[ |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
755 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
756 |
]. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
757 |
]. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
758 |
var |
2754 | 759 |
]. |
760 |
||
2883 | 761 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
762 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
763 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
764 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
765 |
||
766 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
767 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
768 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
769 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 770 |
|
2607 | 771 |
" |
772 |
self updateStyleCache |
|
773 |
" |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
774 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
775 |
"Modified: / 19-01-2012 / 13:17:59 / cg" |
388 | 776 |
! ! |
777 |
||
794 | 778 |
!MenuPanel class methodsFor:'image registration'! |
779 |
||
780 |
image:anImage onDevice:aDevice |
|
781 |
" |
|
782 |
Images := nil |
|
783 |
" |
|
2269 | 784 |
|deviceImages| |
794 | 785 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
786 |
anImage device == aDevice ifTrue:[ |
3938 | 787 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
788 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
789 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
790 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 791 |
|
1097 | 792 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
3938 | 793 |
Images at:aDevice put:(deviceImages := Dictionary new) |
2269 | 794 |
]. |
795 |
||
796 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
3938 | 797 |
image := anImage copy onDevice:aDevice. |
798 |
image clearMaskedPixels. |
|
799 |
deviceImages at:anImage put:image. |
|
800 |
image |
|
2269 | 801 |
]. |
794 | 802 |
! |
803 |
||
804 |
lightenedImage:anImage onDevice:aDevice |
|
805 |
" |
|
806 |
LigthenedImages := nil |
|
807 |
" |
|
2374 | 808 |
|deviceImages image colorMap| |
794 | 809 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
810 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 811 |
|
1097 | 812 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
3938 | 813 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 814 |
]. |
815 |
||
816 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
3938 | 817 |
^ image |
2374 | 818 |
]. |
819 |
||
820 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
821 |
||
822 |
colorMap notNil ifTrue:[ |
|
3938 | 823 |
image := anImage copy lightened onDevice:aDevice. |
824 |
image clearMaskedPixels. |
|
794 | 825 |
] ifFalse:[ |
3938 | 826 |
image := self image:anImage onDevice:aDevice |
794 | 827 |
]. |
1097 | 828 |
deviceImages at:anImage put:image. |
794 | 829 |
^ image |
830 |
! ! |
|
831 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
832 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
833 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
834 |
subMenu:aSubMenu |
2715 | 835 |
"create a submenu; can be redifined in derived classes" |
836 |
||
837 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
838 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
839 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
840 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
841 |
|
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
842 |
!MenuPanel class methodsFor:'utilities'! |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
843 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
844 |
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
845 |
"replace &x by the short-key attribute (i.e. remove & and underline x) |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
846 |
The position is either specified by an accessCharacter position (useful if computed |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
847 |
or fix), or by an ampersand escape. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
848 |
Double ampersands are replaced by a single one." |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
849 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
850 |
|i label nextChar rest pos size accessCharacter| |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
851 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
852 |
pos := accessCharacterPositionOrNil. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
853 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
854 |
label := aLabel. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
855 |
size := aLabel size. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
856 |
i := 1. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
857 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < size])] whileTrue:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
858 |
nextChar := label at:(i+1). |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
859 |
nextChar isSeparator ifTrue:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
860 |
i := i + 1 |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
861 |
] ifFalse:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
862 |
rest := label copyFrom:(i+1). |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
863 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
864 |
i == 1 ifTrue:[label := rest] |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
865 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
866 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
867 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
868 |
size := size - 1. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
869 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
870 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
871 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
872 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
873 |
^ label |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
874 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
875 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
876 |
label isText ifFalse:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
877 |
label := Text string:label |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
878 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
879 |
label emphasisAt:pos add:#underline. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
880 |
^ label |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
881 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
882 |
"Created: / 15-02-2012 / 18:50:58 / cg" |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
883 |
! ! |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
884 |
|
1808 | 885 |
!MenuPanel methodsFor:'accepting'! |
389 | 886 |
|
887 |
accept |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
888 |
"accept the current selected item" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
889 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
890 |
|item| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
891 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
892 |
(item := self selection) isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
893 |
self topMenu |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
894 |
openDelayed:nil; |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
895 |
accept:nil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
896 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
897 |
self acceptItem:item inMenu:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
898 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
899 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
900 |
"Modified: / 29-06-2011 / 16:14:26 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
901 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
902 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
903 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
904 |
"this is the topMenu: close the menu and accept the item (if not nil)" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
905 |
|
4089 | 906 |
|itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor| |
1630 | 907 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
908 |
self superMenu notNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
909 |
^ self topMenu accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
910 |
]. |
3142 | 911 |
prevFocusView ~~ self ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
912 |
focusView := prevFocusView. |
3142 | 913 |
]. |
914 |
prevFocusView := nil. |
|
915 |
||
2199 | 916 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
917 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
918 |
self selection:nil. |
420 | 919 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
920 |
(anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
921 |
tgState := anItemOrNil toggleIndication. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
922 |
panel := anItemOrNil menuPanel. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
923 |
itemIdx := panel findFirst:[:el| el == anItemOrNil ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
924 |
itemAcceptedOrNil := anItemOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
925 |
recv := panel receiver. |
389 | 926 |
]. |
1699 | 927 |
self doUngrab:true. |
389 | 928 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
929 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
930 |
|
510 | 931 |
self isPopUpView ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
932 |
self do:[:el| el updateIndicators]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
933 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
934 |
winGrp processExposeEvents. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
935 |
]. |
524 | 936 |
] ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
937 |
self unmap. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
938 |
self device sync. "/ round trip - all expose events are now received |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
939 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
940 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
941 |
"/ give expose event a chance to arrive |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
942 |
[shown and:[realized]] whileTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
943 |
winGrp processExposeEventsFor:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
944 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
945 |
masterGroup := winGrp previousGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
946 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
947 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
948 |
"/ self destroy. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
949 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
950 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
951 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
952 |
(focusView notNil and:[winGrp notNil]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
953 |
winGrp focusView:focusView. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
954 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
955 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
956 |
itemAcceptedOrNil isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
957 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
958 |
self isPopUpView ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
959 |
lastItem := itemAcceptedOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
960 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
961 |
^ itemAcceptedOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
962 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
963 |
|
4089 | 964 |
"/ using master maingroup, sensor in my current windowgroup |
965 |
"/ flushes its events if the window goes |
|
966 |
winGrp notNil ifTrue:[ |
|
967 |
winGrp mainGroup notNil ifTrue:[ |
|
968 |
sensor := winGrp mainGroup sensor. |
|
969 |
]. |
|
970 |
]. |
|
971 |
sensor isNil ifTrue:[sensor := self sensor ]. |
|
972 |
||
973 |
sensor pushEvent:( |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
974 |
MenuEvent |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
975 |
selectMenuItem:itemAcceptedOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
976 |
index:itemIdx |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
977 |
text:nil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
978 |
value:tgState |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
979 |
inMenu:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
980 |
menuReceiver:recv). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
981 |
|
4053 | 982 |
^ anItemOrNil. "/ stupid convention |
983 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
984 |
"/ acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
985 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
986 |
"/ winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
987 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
988 |
"/ (itemAcceptedOrNil showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
989 |
"/ and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
990 |
"/ ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
991 |
"/ winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
992 |
"/ ] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
993 |
"/ acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
994 |
"/ ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
995 |
|
4053 | 996 |
"Modified: / 07-07-2011 / 18:08:41 / cg" |
524 | 997 |
! |
998 |
||
999 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1000 |
"really accept an item" |
2715 | 1001 |
|
3938 | 1002 |
|selectorOrBlock argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
1003 |
app master fallBack| |
524 | 1004 |
|
2253 | 1005 |
isValueModel := aReceiver isValueModel. |
1006 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1007 |
hasPerformed := isValueModel. |
524 | 1008 |
|
3558 | 1009 |
(selectorOrBlock := anItem value) isNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1010 |
^ self "/ ^ anIndex |
524 | 1011 |
]. |
1012 |
||
1013 |
(argument := anItem argument) isNil ifTrue:[ |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1014 |
argument := aState ? anItem |
389 | 1015 |
]. |
524 | 1016 |
|
3558 | 1017 |
selectorOrBlock isSymbol ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1018 |
"/ a valueHolder or block |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1019 |
(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1020 |
^ self "/ ^ selectorOrBlock |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1021 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1022 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1023 |
numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1024 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1025 |
numArgs == 0 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1026 |
args := nil |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1027 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1028 |
numArgs == 1 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1029 |
args := Array with:argument |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1030 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1031 |
args := Array with:argument with:self |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1032 |
] |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1033 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1034 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1035 |
selectorOrBlock valueWithArguments:args. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1036 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1037 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1038 |
^ self "/ ^ anIndex |
524 | 1039 |
]. |
1040 |
||
2331 | 1041 |
anItem sendToOriginator ifTrue:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1042 |
rec := self originator. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1043 |
rec isNil ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1044 |
self error:'no originating widget (no target for message)' mayProceed:true. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1045 |
]. |
2331 | 1046 |
] ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1047 |
rec := aReceiver |
2331 | 1048 |
]. |
1049 |
||
1050 |
rec isNil ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1051 |
^ self "/ ^ selectorOrBlock |
2253 | 1052 |
]. |
1053 |
||
1054 |
isValueModel ifTrue:[ |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1055 |
rec value:selectorOrBlock |
465 | 1056 |
] ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1057 |
arg2 := self. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1058 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1059 |
"/ support for ST80 style applications |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1060 |
"/ (expecting the message to go to the application |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1061 |
"/ if not understood by the view) |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1062 |
"/ These expect the controller to be passed as argument. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1063 |
"/ sigh. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1064 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1065 |
(rec isView |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1066 |
and:[(rec respondsTo:selectorOrBlock) not |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1067 |
and:[(app := rec application) ~~ rec |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1068 |
and:[app notNil]]]) ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1069 |
arg2 := rec controller. "/ the Views controller |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1070 |
rec := app. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1071 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1072 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1073 |
(numArgs := selectorOrBlock numArgs) == 0 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1074 |
args := nil |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1075 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1076 |
numArgs == 1 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1077 |
args := Array with:argument |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1078 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1079 |
args := Array with:argument with:arg2 |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1080 |
] |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1081 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1082 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1083 |
fallBack := |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1084 |
[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1085 |
|val| |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1086 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1087 |
"/ mhmh - the receiver did not respond to that message; |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1088 |
"/ if there is a master-application, try that one |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1089 |
"/ (recursive) |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1090 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1091 |
master notNil ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1092 |
rec := master. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1093 |
val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1094 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1095 |
self |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1096 |
error:'unimplemented (or error in) menu message: ' , selectorOrBlock |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1097 |
mayProceed:true. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1098 |
val := nil. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1099 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1100 |
val |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1101 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1102 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1103 |
rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack. |
420 | 1104 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1105 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1106 |
^ self "/ ^ selectorOrBlock |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1107 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1108 |
"Modified: / 29-06-2011 / 16:22:08 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1109 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1110 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1111 |
acceptItem:anItemOrNil inMenu:aMenu |
2199 | 1112 |
|tgState topMenu| |
1113 |
||
1114 |
topMenu := self topMenu. |
|
1115 |
topMenu openDelayed:nil. |
|
1670 | 1116 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1117 |
(anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1118 |
topMenu accept:anItemOrNil |
1670 | 1119 |
] ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1120 |
anItemOrNil canAccept ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1121 |
tgState := anItemOrNil toggleIndication. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1122 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1123 |
self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1124 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1125 |
index:(aMenu selectionIndex) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1126 |
toggle:tgState |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1127 |
receiver:(aMenu receiver). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1128 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1129 |
aMenu do:[:el| el updateIndicators]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1130 |
anItemOrNil hideMenuOnActivated ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1131 |
aMenu invalidate |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1132 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1133 |
] |
1670 | 1134 |
] |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1135 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1136 |
"Modified: / 29-06-2011 / 14:34:45 / cg" |
1670 | 1137 |
! |
1138 |
||
389 | 1139 |
lastItemAccepted |
2715 | 1140 |
"returns last item selected or nil" |
1141 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1142 |
^ lastItem |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1143 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1144 |
"Modified: / 29-06-2011 / 16:24:48 / cg" |
389 | 1145 |
! |
1146 |
||
1147 |
lastValueAccepted |
|
2715 | 1148 |
"returns last value accepted or nil" |
1149 |
||
2253 | 1150 |
^ self lastItemAccepted value |
389 | 1151 |
! ! |
1152 |
||
388 | 1153 |
!MenuPanel methodsFor:'accessing'! |
1154 |
||
1155 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1156 |
"get the access character position for a textLabel" |
1157 |
||
2059 | 1158 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1159 |
! |
1160 |
||
1161 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1162 |
"get the access character position for a textLabel" |
1163 |
||
388 | 1164 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1165 |
! |
|
1166 |
||
1167 |
accessCharacterPositions |
|
2715 | 1168 |
"returns a collection of accessCharacterPositions or nil" |
1169 |
||
388 | 1170 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1171 |
! |
|
1172 |
||
1173 |
accessCharacterPositions:something |
|
2715 | 1174 |
"define accessCharacterPositions for each item" |
1175 |
||
388 | 1176 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1177 |
! |
|
1178 |
||
1179 |
args |
|
2715 | 1180 |
"returns a collection of arguments or nil" |
1181 |
||
388 | 1182 |
^ self collect:[:anItem| anItem argument ] |
1183 |
! |
|
1184 |
||
1185 |
args:something |
|
2715 | 1186 |
"define arguments for each item" |
1187 |
||
388 | 1188 |
self onEachPerform:#argument: withArgList:something |
1189 |
! |
|
1190 |
||
1191 |
argsAt:stringOrNumber |
|
2715 | 1192 |
"gets the argument of an item or nil" |
1193 |
||
2059 | 1194 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1195 |
! |
1196 |
||
1197 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1198 |
"sets the argument of an item" |
1199 |
||
388 | 1200 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1201 |
! |
|
1202 |
||
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1203 |
doAccessCharacterTranslation |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1204 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1205 |
Can be set to false to leave accessCharacter unchanged" |
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1206 |
|
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1207 |
^ doAccessCharacterTranslation ? true |
3958 | 1208 |
|
1209 |
"Modified: / 02-11-2010 / 10:19:09 / cg" |
|
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1210 |
! |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1211 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1212 |
doAccessCharacterTranslation:aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1213 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1214 |
Can be set to false to leave accessCharacter unchanged" |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1215 |
|
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1216 |
doAccessCharacterTranslation := aBoolean |
3958 | 1217 |
|
1218 |
"Modified: / 02-11-2010 / 10:19:14 / cg" |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1219 |
! |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1220 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1221 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1222 |
"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
|
1223 |
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
|
1224 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1225 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1226 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1227 |
"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
|
1228 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1229 |
|
388 | 1230 |
groupSizes |
2715 | 1231 |
"gets collection of group sizes" |
1232 |
||
388 | 1233 |
^ groupSizes |
1234 |
! |
|
1235 |
||
1236 |
groupSizes:aGroupSizes |
|
2715 | 1237 |
"sets collection of group sizes" |
1238 |
||
388 | 1239 |
aGroupSizes = groupSizes ifFalse:[ |
3938 | 1240 |
groupSizes := aGroupSizes copy. |
1241 |
self mustRearrange. |
|
388 | 1242 |
]. |
1243 |
! |
|
1244 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1245 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1246 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1247 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1248 |
|
3725 | 1249 |
hideOnRelease:aBoolean |
1250 |
hideOnRelease := aBoolean |
|
1251 |
! |
|
1252 |
||
388 | 1253 |
labelAt:stringOrNumber |
2715 | 1254 |
"gets the label of an item or nil" |
1255 |
||
388 | 1256 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1257 |
! |
|
1258 |
||
1259 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1260 |
"sets the label of an item" |
1261 |
||
388 | 1262 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1263 |
! |
|
1264 |
||
1265 |
labels |
|
2715 | 1266 |
"returns a collection of labels's or nil" |
1267 |
||
388 | 1268 |
^ self collect:[:anItem| anItem label ] |
1269 |
! |
|
1270 |
||
1271 |
labels:labels |
|
2715 | 1272 |
"define labels for each item" |
1273 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1274 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1275 |
|
388 | 1276 |
self disabledRedrawDo:[ |
3938 | 1277 |
self removeAll. |
1278 |
size := labels size. |
|
1279 |
||
1280 |
size > 0 ifTrue:[ |
|
1281 |
items := OrderedCollection new:size. |
|
1282 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1283 |
] |
|
1284 |
]. |
|
1285 |
! |
|
1286 |
||
1287 |
menuPerformer:anObject |
|
1999 | 1288 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1289 |
from all submenus no specific receiver is defined )." |
1290 |
||
1999 | 1291 |
^ self receiver:anObject |
1292 |
! |
|
1293 |
||
388 | 1294 |
nameKeyAt:stringOrNumber |
2715 | 1295 |
"gets the nameKey of an item or nil" |
1296 |
||
1297 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1298 |
! |
1299 |
||
1300 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1301 |
"sets the nameKey of an item" |
1302 |
||
388 | 1303 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1304 |
! |
|
1305 |
||
1306 |
nameKeys |
|
2715 | 1307 |
"returns a collection of nameKeyss or nil" |
1308 |
||
388 | 1309 |
^ self collect:[:anItem| anItem nameKey ] |
1310 |
! |
|
1311 |
||
1312 |
nameKeys:something |
|
2715 | 1313 |
"define nameKeys for each item" |
1314 |
||
388 | 1315 |
self onEachPerform:#nameKey: withArgList:something |
1316 |
! |
|
1317 |
||
1318 |
numberOfItems |
|
2715 | 1319 |
"gets number of items" |
1320 |
||
388 | 1321 |
^ items size |
1322 |
! |
|
1323 |
||
2331 | 1324 |
originator |
1325 |
originator notNil ifTrue:[^ originator]. |
|
1326 |
superMenu notNil ifTrue:[ |
|
3938 | 1327 |
^ superMenu originator |
2331 | 1328 |
]. |
1329 |
^ nil |
|
1330 |
! |
|
1331 |
||
388 | 1332 |
receiver |
1333 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1334 |
from all submenus no specific receiver is defined )." |
1335 |
||
389 | 1336 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
3938 | 1337 |
^ superMenu receiver |
388 | 1338 |
]. |
389 | 1339 |
^ receiver |
388 | 1340 |
! |
1341 |
||
3938 | 1342 |
receiver:anObject |
388 | 1343 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1344 |
from all submenus no specific receiver is defined )." |
1345 |
||
389 | 1346 |
receiver := anObject |
388 | 1347 |
! |
1348 |
||
1349 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1350 |
"gets the shortCutKey of an item or nil" |
1351 |
||
1352 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1353 |
! |
1354 |
||
1355 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1356 |
"sets the shortCutKey of an item" |
1357 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1358 |
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
|
1359 |
! |
388 | 1360 |
|
1361 |
shortcutKeys |
|
2715 | 1362 |
"returns a collection of shortcutKeys or nil" |
1363 |
||
388 | 1364 |
^ self collect:[:anItem| anItem shortcutKey ] |
1365 |
! |
|
1366 |
||
1367 |
shortcutKeys:something |
|
2715 | 1368 |
"define shortcutKeys for each item" |
1369 |
||
388 | 1370 |
self onEachPerform:#shortcutKey: withArgList:something |
1371 |
! |
|
1372 |
||
1373 |
valueAt:stringOrNumber |
|
2715 | 1374 |
"gets value of an item; a block, valueHolder, ..." |
1375 |
||
1376 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1377 |
! |
1378 |
||
1379 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1380 |
"sets value of an item; a block, valueHolder, ..." |
1381 |
||
388 | 1382 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1383 |
! |
|
1384 |
||
1385 |
values:something |
|
2715 | 1386 |
"define values for each item" |
1387 |
||
388 | 1388 |
self onEachPerform:#value: withArgList:something |
1389 |
! ! |
|
1390 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1391 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1392 |
|
1393 |
disableAll |
|
2715 | 1394 |
"disable all items; not the menu in case of enabled" |
1395 |
||
498 | 1396 |
self do:[:anItem| anItem enabled:false] |
388 | 1397 |
! |
1398 |
||
1399 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1400 |
"disable an collection of items" |
1401 |
||
388 | 1402 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1403 |
! |
|
1404 |
||
1405 |
enableAll |
|
2715 | 1406 |
"enable all items; not the menu in case of disabled" |
1407 |
||
498 | 1408 |
self do:[:anItem| anItem enabled:true] |
388 | 1409 |
! |
1410 |
||
1411 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1412 |
"enable an collection of items" |
1413 |
||
388 | 1414 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1415 |
! |
|
1416 |
||
1417 |
enabled |
|
2715 | 1418 |
"returns enabled state" |
1419 |
||
498 | 1420 |
^ enabled |
388 | 1421 |
! |
1422 |
||
1423 |
enabled:aState |
|
2715 | 1424 |
"change enabled state of menu" |
1425 |
||
545 | 1426 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1427 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1428 |
state := aState ? true. |
388 | 1429 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1430 |
enabled ~~ state ifTrue:[ |
3938 | 1431 |
enabled := state. |
1432 |
self invalidate. |
|
498 | 1433 |
]. |
388 | 1434 |
! |
1435 |
||
1436 |
enabledAt:stringOrNumber |
|
2715 | 1437 |
"gets the enabled state of an item or false" |
1438 |
||
388 | 1439 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1440 |
! |
|
1441 |
||
1442 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1443 |
"sets the enabled state of an item" |
1444 |
||
388 | 1445 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1446 |
! |
|
1447 |
||
3725 | 1448 |
exclusivePointer:aBoolean |
1449 |
"Do nothing here. Compatibility with PopUpListController" |
|
1450 |
||
1451 |
^ self |
|
1452 |
! |
|
1453 |
||
388 | 1454 |
isEnabled:stringOrNumber |
2715 | 1455 |
"gets the enabled state of an item or false" |
1456 |
||
388 | 1457 |
^ self enabledAt:stringOrNumber |
1458 |
! ! |
|
1459 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1460 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1461 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1462 |
enableChannel:aValueHolder |
2715 | 1463 |
"set my enableChannel" |
1464 |
||
498 | 1465 |
enableChannel notNil ifTrue:[ |
3938 | 1466 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1467 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1468 |
|
498 | 1469 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
3938 | 1470 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1471 |
]. |
498 | 1472 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1473 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1474 |
|
3222 | 1475 |
menuChannel |
1476 |
^ self menuHolder |
|
1477 |
||
1478 |
"Created: / 27-03-2007 / 08:38:31 / cg" |
|
1479 |
! |
|
1480 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1481 |
menuHolder:aValueHolder |
2715 | 1482 |
"set my menuHolder" |
1483 |
||
498 | 1484 |
menuHolder notNil ifTrue:[ |
3938 | 1485 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1486 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1487 |
|
498 | 1488 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
3938 | 1489 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1490 |
]. |
498 | 1491 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1492 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1493 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1494 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1495 |
|
616 | 1496 |
activeBackgroundColor |
2715 | 1497 |
"get the background drawing color used to highlight selection" |
1498 |
||
2219 | 1499 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1500 |
! |
1501 |
||
1502 |
activeForegroundColor |
|
2715 | 1503 |
"get the foreground color used to highlight selections" |
1504 |
||
2219 | 1505 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1506 |
! |
1507 |
||
390 | 1508 |
backgroundColor |
2715 | 1509 |
"return the background color" |
1510 |
||
502 | 1511 |
^ super viewBackground |
390 | 1512 |
! |
1513 |
||
1514 |
backgroundColor:aColor |
|
1515 |
"set the background drawing color. You should not use this method; |
|
2715 | 1516 |
instead, leave the value as defined in the styleSheet." |
1517 |
||
1518 |
self backgroundColor ~~ aColor ifTrue:[ |
|
3938 | 1519 |
super viewBackground:aColor. |
1520 |
self invalidate "/ RepairNow:true |
|
616 | 1521 |
] |
1522 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1523 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1524 |
! |
1525 |
||
727 | 1526 |
buttonActiveBackgroundColor |
2715 | 1527 |
"get the background drawing color used to highlight button selection" |
1528 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1529 |
^ buttonActiveBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1530 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1531 |
"Modified: / 19-01-2012 / 11:51:46 / cg" |
727 | 1532 |
! |
1533 |
||
3441 | 1534 |
buttonActiveForegroundColor |
1535 |
"get the foreground drawing color used to highlight button selection" |
|
1536 |
||
1537 |
^ styleSheet colorAt:#'button.activeForegroundColor' |
|
3938 | 1538 |
default:(self foregroundColor) |
3441 | 1539 |
! |
1540 |
||
730 | 1541 |
buttonEdgeStyle |
2715 | 1542 |
"get the button edge style" |
1543 |
||
2219 | 1544 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1545 |
! |
1546 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1547 |
buttonEnteredBackgroundColor |
2715 | 1548 |
"get the background drawing color used to highlight entered button items" |
1549 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1550 |
^ buttonEnteredBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1551 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1552 |
"Modified: / 19-01-2012 / 11:52:17 / cg" |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1553 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1554 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1555 |
buttonEnteredLevel |
2715 | 1556 |
"get the 3D-level used to highlight entered button items" |
1557 |
||
2219 | 1558 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1559 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1560 |
|
730 | 1561 |
buttonHalfLightColor |
2715 | 1562 |
"get the background drawing color used to half light button frame" |
1563 |
||
2219 | 1564 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1565 |
! |
1566 |
||
1567 |
buttonHalfShadowColor |
|
2715 | 1568 |
"get the background drawing color used to half shadow button frame" |
1569 |
||
2219 | 1570 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1571 |
! |
1572 |
||
1573 |
buttonLightColor |
|
2715 | 1574 |
"get the background drawing color used to light button frame" |
1575 |
||
2219 | 1576 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1577 |
! |
1578 |
||
1579 |
buttonPassiveBackgroundColor |
|
2715 | 1580 |
"get the background drawing color used for button" |
1581 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1582 |
^ buttonPassiveBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1583 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1584 |
"Modified: / 19-01-2012 / 13:13:59 / cg" |
727 | 1585 |
! |
1586 |
||
1587 |
buttonShadowColor |
|
2715 | 1588 |
"get the background drawing color used to shadow button frame" |
1589 |
||
2219 | 1590 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1591 |
! |
1592 |
||
1593 |
disabledEtchedForegroundColor |
|
1594 |
"return the color used for etching disabled items. |
|
2715 | 1595 |
If nil, no 3D effect is drawn." |
1596 |
||
2219 | 1597 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1598 |
! |
1599 |
||
390 | 1600 |
disabledForegroundColor |
2715 | 1601 |
"return the foreground color used by disabled items" |
1602 |
||
2219 | 1603 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1604 |
! |
1605 |
||
2170 | 1606 |
enteredBackgroundColor |
2715 | 1607 |
"return the background color for entered items" |
1608 |
||
2219 | 1609 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
3938 | 1610 |
default:(self backgroundColor) |
2170 | 1611 |
! |
1612 |
||
1613 |
enteredForegroundColor |
|
2715 | 1614 |
"return the foreground color for entered items" |
1615 |
||
2219 | 1616 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1617 |
! |
1618 |
||
390 | 1619 |
font:aFont |
2715 | 1620 |
"set the font" |
1621 |
||
2614 | 1622 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1623 |
||
1624 |
super font:aFont. |
|
1625 |
self do:[:anItem| anItem fontChanged ]. |
|
1626 |
||
1627 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
3938 | 1628 |
self extent:(self preferredExtent) |
2614 | 1629 |
]. |
1630 |
self mustRearrange. |
|
390 | 1631 |
! |
1632 |
||
1633 |
foregroundColor |
|
2715 | 1634 |
"return the passive foreground color" |
1635 |
||
2059 | 1636 |
^ fgColor |
390 | 1637 |
! |
1638 |
||
1639 |
foregroundColor:aColor |
|
1640 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1641 |
instead leave the value as defined in the styleSheet." |
1642 |
||
2219 | 1643 |
aColor ~= fgColor ifTrue:[ |
3938 | 1644 |
fgColor := aColor onDevice:device. |
1645 |
self invalidate |
|
2219 | 1646 |
]. |
580 | 1647 |
! |
1648 |
||
1699 | 1649 |
maxAbsoluteButtonLevel |
1650 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1651 |
extent of a button" |
1652 |
||
3987 | 1653 |
^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0 |
1654 |
||
1655 |
"Modified: / 19-01-2011 / 21:21:53 / cg" |
|
390 | 1656 |
! |
1657 |
||
730 | 1658 |
selectionFrameBrightColor |
2715 | 1659 |
"get the selection frame bright color" |
1660 |
||
2219 | 1661 |
^ Color white |
730 | 1662 |
! |
1663 |
||
1664 |
selectionFrameDarkColor |
|
2715 | 1665 |
"get the selection frame dark color" |
1666 |
||
2219 | 1667 |
^ Color black |
730 | 1668 |
! |
1669 |
||
1727 | 1670 |
setFont:aFont |
3938 | 1671 |
"set the font if the argument is nonNil; |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1672 |
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
|
1673 |
|
1727 | 1674 |
|currentFont| |
1675 |
||
1676 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
3938 | 1677 |
currentFont := font. |
1678 |
super font:aFont. |
|
1727 | 1679 |
]. |
1680 |
^ currentFont |
|
2761 | 1681 |
! |
1682 |
||
1683 |
viewBackground:aColor |
|
1684 |
super viewBackground:aColor |
|
390 | 1685 |
! ! |
1686 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1687 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1688 |
|
1689 |
height |
|
2715 | 1690 |
"default height" |
1691 |
||
3886 | 1692 |
self hasExplicitExtent ifFalse:[ |
3938 | 1693 |
^ self preferredHeight |
388 | 1694 |
]. |
1695 |
^ super height |
|
1696 |
! |
|
1697 |
||
2016 | 1698 |
maxExtent |
4110 | 1699 |
|minH info pos| |
1700 |
||
1701 |
maxExtent notNil ifTrue:[^ maxExtent]. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1702 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1703 |
device notNil ifTrue:[ |
4109 | 1704 |
"/ notice, the position-dependent query: if there is a higher secondary screen, |
1705 |
"/ this makes a difference in where a popUpMenu is allowed... |
|
4110 | 1706 |
pos := self origin. |
1707 |
minH := (device usableHeightAt:pos). |
|
1708 |
pos = (0@0) ifTrue:[ |
|
1709 |
"called too early" |
|
1710 |
device monitorHandles do:[:eachHandle | |
|
1711 |
info := device monitorInfoFor:eachHandle. |
|
1712 |
info notNil ifTrue:[ minH := minH min: info workHeight ]. |
|
1713 |
]. |
|
4109 | 1714 |
]. |
1715 |
^ device usableWidth @ (minH - 2) |
|
1716 |
"/ ^ device usableExtent - 5. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1717 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1718 |
superMenu notNil ifTrue:[ |
4109 | 1719 |
^ superMenu maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1720 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1721 |
"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
|
1722 |
self error:'don''t know maxExtent'. |
4109 | 1723 |
|
4110 | 1724 |
"Modified: / 15-02-2012 / 19:22:24 / cg" |
2016 | 1725 |
! |
1726 |
||
388 | 1727 |
preferredExtent |
2715 | 1728 |
"compute and returns my preferred extent" |
1729 |
||
2253 | 1730 |
|maxExtent usedExtent| |
2024 | 1731 |
|
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1732 |
"/ If I have an explicit preferredExtent.. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1733 |
explicitExtent notNil ifTrue:[ |
3938 | 1734 |
^ explicitExtent |
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1735 |
]. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1736 |
"/ If I have a cached preferredExtent value.. |
2016 | 1737 |
preferredExtent notNil ifTrue:[ |
3938 | 1738 |
^ preferredExtent |
2016 | 1739 |
]. |
3837 | 1740 |
|
2024 | 1741 |
usedExtent := self preferredExtentOfItems. |
1742 |
||
1743 |
superView isNil ifTrue:[ |
|
3938 | 1744 |
"/ is standalone |
1745 |
preferredWidth notNil ifTrue:[ |
|
1746 |
usedExtent x < preferredWidth ifTrue:[ |
|
1747 |
usedExtent := preferredWidth @ usedExtent y. |
|
1748 |
] |
|
1749 |
] |
|
1750 |
]. |
|
1751 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1752 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1753 |
maxExtent notNil ifTrue:[ |
3938 | 1754 |
usedExtent := usedExtent min:maxExtent. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1755 |
]. |
3837 | 1756 |
|
1757 |
preferredExtent := usedExtent. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1758 |
^ usedExtent |
2024 | 1759 |
|
1760 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1761 |
! |
1762 |
||
1763 |
preferredExtentOfItems |
|
1764 |
"compute and returns my preferred extent including all items |
|
3938 | 1765 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
2715 | 1766 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1767 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1768 |
x "{ Class:SmallInteger }" |
1769 |
y "{ Class:SmallInteger }" |
|
1770 |
size "{ Class:SmallInteger }" |
|
2883 | 1771 |
buttonInsetX2 "{ Class:SmallInteger }" |
1772 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1773 |
labelInsetX "{ Class:SmallInteger }" |
1774 |
labelInsetY "{ Class:SmallInteger }" |
|
1775 |
itemMargin "{ Class:SmallInteger }" |
|
1776 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1777 |
| |
388 | 1778 |
|
1699 | 1779 |
(size := items size) == 0 ifTrue:[ |
3938 | 1780 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
1781 |
^ 32 @ 32 |
|
2219 | 1782 |
]. |
3131 | 1783 |
stringOffsetX := nil. |
2883 | 1784 |
buttonInsetX2 := 2 * buttonInsetX. |
1785 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1786 |
|
1787 |
self isPopUpView ifFalse:[ |
|
3938 | 1788 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1789 |
] ifTrue:[ |
3938 | 1790 |
labelInsetX := labelInsetY := 0. |
1699 | 1791 |
]. |
1792 |
||
1793 |
x := 0. |
|
1794 |
y := 0. |
|
2219 | 1795 |
groupDividerSize := self groupDividerSize. |
388 | 1796 |
|
1797 |
self verticalLayout ifFalse:[ |
|
3938 | 1798 |
items keysAndValuesDo:[:key :el| |eX eY| |
1799 |
extent := el preferredExtent. |
|
1800 |
||
1801 |
"/ check for visibility (extent x ~~ 0) |
|
1802 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1803 |
eY := extent y. |
|
1804 |
||
1805 |
el isButton ifTrue:[ |
|
1806 |
eX := eX + buttonInsetX2. |
|
1807 |
eY := eY + buttonInsetY2. |
|
1808 |
] ifFalse:[ |
|
1809 |
eX := eX + labelInsetX. |
|
1810 |
eY := eY + labelInsetY. |
|
1811 |
]. |
|
1812 |
key ~~ size ifTrue:[ |
|
1813 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1814 |
x := x + groupDividerSize |
|
1815 |
] ifFalse:[ |
|
1816 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
1817 |
x := x + itemSpace |
|
1818 |
] |
|
1819 |
] |
|
1820 |
]. |
|
1821 |
x := x + eX. |
|
1822 |
y := y max:eY. |
|
1823 |
] |
|
1824 |
] |
|
388 | 1825 |
] ifTrue:[ |
3938 | 1826 |
hasMenu := false. |
1827 |
shCtKey := 0. |
|
1828 |
showAcc := MenuView showAcceleratorKeys == true. |
|
1829 |
y := x. |
|
1830 |
x := 0. |
|
1831 |
itemMargin := 2 * self itemMargin. |
|
1832 |
||
1833 |
items keysAndValuesDo:[:key :el| |eX eY| |
|
1834 |
extent := el preferredExtent. |
|
1835 |
||
1836 |
"/ check for visibility (extent x ~~ 0) |
|
1837 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1838 |
eY := extent y. |
|
1839 |
||
1840 |
el isButton ifTrue:[ |
|
1841 |
eX := eX + buttonInsetX2. |
|
1842 |
eY := eY + buttonInsetY2. |
|
1843 |
] ifFalse:[ |
|
1844 |
eX := eX + labelInsetX. |
|
1845 |
eY := eY + labelInsetY. |
|
1846 |
]. |
|
1847 |
hasMenu ifFalse:[ |
|
1848 |
hasMenu := el hasSubmenu |
|
1849 |
]. |
|
1850 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1851 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1852 |
]. |
|
1853 |
key ~~ size ifTrue:[ |
|
1854 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1855 |
y := y + groupDividerSize |
|
1856 |
] |
|
1857 |
]. |
|
1858 |
y := y + eY. |
|
1859 |
x := x max:eX. |
|
1860 |
]. |
|
1861 |
]. |
|
1862 |
x := x + itemMargin. |
|
1863 |
||
1864 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
|
1865 |
shortKeyInset := x + Item labelRightOffset. |
|
1866 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
|
1867 |
||
1868 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
|
1869 |
x := x + self shortcutKeyOffset. |
|
1870 |
] |
|
1871 |
]. |
|
1699 | 1872 |
"/ to have a small inset |
3938 | 1873 |
y := y + 1. |
1699 | 1874 |
"/ x := x + 1. |
1875 |
]. |
|
1876 |
x := x + margin + margin. |
|
1877 |
y := y + margin + margin. |
|
1878 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1879 |
^ x @ y |
388 | 1880 |
! |
1881 |
||
2253 | 1882 |
preferredWidth:aWidthOrNil |
1883 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1884 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1885 |
If not nil, the width is the maximum from the contained items and the required width." |
1886 |
||
2253 | 1887 |
preferredWidth := aWidthOrNil. |
2024 | 1888 |
! |
1889 |
||
388 | 1890 |
shortKeyInset |
2715 | 1891 |
"left inset of shortcutKey" |
1892 |
||
1893 |
^ shortKeyInset |
|
616 | 1894 |
! |
1895 |
||
3131 | 1896 |
stringOffsetXfor:anItem |
1897 |
"return the x offset for a MenuItem where to draw the text |
|
1898 |
" |
|
1899 |
|label w| |
|
1900 |
||
1901 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
1902 |
||
1903 |
stringOffsetX isNil ifTrue:[ |
|
3938 | 1904 |
stringOffsetX := 0. |
1905 |
||
1906 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
1907 |
self do:[:el| |
|
1908 |
el isVisible ifTrue:[ |
|
1909 |
( (label := el indicatorForm) notNil |
|
1910 |
or:[(label := el choiceForm) notNil] |
|
1911 |
) ifTrue:[ |
|
1912 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
1913 |
] ifFalse:[ |
|
1914 |
label := el displayLabel. |
|
1915 |
label class == LabelAndIcon ifTrue:[ |
|
1916 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
1917 |
]. |
|
1918 |
]. |
|
1919 |
]. |
|
1920 |
]. |
|
1921 |
]. |
|
3131 | 1922 |
]. |
1923 |
w := 0. |
|
1924 |
||
1925 |
( (label := anItem indicatorForm) notNil |
|
1926 |
or:[(label := anItem choiceForm) notNil] |
|
1927 |
) ifTrue:[ |
|
3938 | 1928 |
w := label width + 2. |
3131 | 1929 |
]. |
1930 |
stringOffsetX == 0 ifTrue:[ |
|
3938 | 1931 |
^ w |
3131 | 1932 |
]. |
1933 |
w == 0 ifTrue:[ |
|
3938 | 1934 |
label := anItem displayLabel. |
1935 |
||
1936 |
label class == LabelAndIcon ifTrue:[ |
|
1937 |
^ stringOffsetX - label xOfString |
|
1938 |
]. |
|
3131 | 1939 |
]. |
1940 |
^ stringOffsetX. |
|
1941 |
! |
|
1942 |
||
616 | 1943 |
subMenuIndicationWidth |
2219 | 1944 |
^ self rightArrow width |
388 | 1945 |
! ! |
1946 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1947 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1948 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1949 |
iconIndicationDisabledOff |
2219 | 1950 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1951 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1952 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1953 |
iconIndicationDisabledOn |
2219 | 1954 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1955 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1956 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1957 |
iconIndicationOff |
2219 | 1958 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1959 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1960 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1961 |
iconIndicationOn |
2219 | 1962 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1963 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1964 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1965 |
iconRadioGroupDisabledOff |
2219 | 1966 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1967 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1968 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1969 |
iconRadioGroupDisabledOn |
2219 | 1970 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1971 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1972 |
|
3565 | 1973 |
iconRadioGroupEnteredOff |
1974 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff) |
|
1975 |
! |
|
1976 |
||
1977 |
iconRadioGroupEnteredOn |
|
1978 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn) |
|
1979 |
! |
|
1980 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1981 |
iconRadioGroupOff |
2219 | 1982 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1983 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1984 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1985 |
iconRadioGroupOn |
2219 | 1986 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1987 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1988 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1989 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1990 |
|
1991 |
itemAt:stringOrNumber do:aOneArgBlock |
|
3938 | 1992 |
"evaluate the block for an item and return the result from the block. In case that |
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1993 |
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
|
1994 |
|
388 | 1995 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1996 |
! |
|
1997 |
||
1998 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
3938 | 1999 |
"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
|
2000 |
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
|
2001 |
|
388 | 2002 |
|item| |
2003 |
||
2004 |
item := self itemAt:stringOrNumber. |
|
2005 |
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
|
2006 |
^ exceptionBlock value |
706 | 2007 |
! |
2008 |
||
2009 |
itemAtIndex:anIndex |
|
2715 | 2010 |
"returns item at an index or nil" |
2011 |
||
706 | 2012 |
^ 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
|
2013 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2014 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2015 |
items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2016 |
"returns the list of items or nil. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2017 |
Warning: do not change this list - it is mine !!" |
2715 | 2018 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2019 |
^ items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2020 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2021 |
"Modified: / 09-11-2010 / 10:10:40 / cg" |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2022 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2023 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2024 |
itemsDo:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2025 |
items notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2026 |
items do:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2027 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2028 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2029 |
"Created: / 09-11-2010 / 10:05:54 / cg" |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2030 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2031 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2032 |
itemsDoWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2033 |
items notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2034 |
items doWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2035 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2036 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2037 |
"Created: / 09-11-2010 / 10:06:02 / cg" |
388 | 2038 |
! ! |
2039 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2040 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 2041 |
|
727 | 2042 |
buttonActiveLevel |
2715 | 2043 |
"get the buttons active level" |
2044 |
||
2219 | 2045 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 2046 |
! |
2047 |
||
2048 |
buttonPassiveLevel |
|
2715 | 2049 |
"get the buttons passive level" |
2050 |
||
3987 | 2051 |
^ (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0 |
2052 |
||
2053 |
"Modified: / 19-01-2011 / 21:21:26 / cg" |
|
727 | 2054 |
! |
2055 |
||
2337 | 2056 |
centerItems |
2057 |
^ centerItems ? false |
|
2058 |
! |
|
2059 |
||
2060 |
centerItems:aBoolean |
|
2061 |
centerItems := aBoolean |
|
2062 |
! |
|
2063 |
||
390 | 2064 |
fitFirstPanel |
3938 | 2065 |
"gets true if the first panel in the menu hierarchy must be fit |
390 | 2066 |
to the extent of its superView |
1699 | 2067 |
|
2715 | 2068 |
NOT SUPPORTED" |
2069 |
||
2219 | 2070 |
^ false |
388 | 2071 |
! |
2072 |
||
390 | 2073 |
fitFirstPanel:aState |
3938 | 2074 |
"sets true if the first panel in the menu hierarchy must be fit |
390 | 2075 |
to the extent of its superView |
1699 | 2076 |
|
2715 | 2077 |
NOT SUPPORTED" |
616 | 2078 |
! |
2079 |
||
1093 | 2080 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2081 |
anInt ~~ level ifTrue:[ |
3147 | 2082 |
super level:anInt. |
2083 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2084 |
] |
2052 | 2085 |
|
2086 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 2087 |
! |
2088 |
||
616 | 2089 |
rightArrow |
2374 | 2090 |
rightArrow isNil ifTrue:[ |
3938 | 2091 |
device isNil ifTrue:[ |
2092 |
^ SelectionInListView rightArrowFormOn:Display |
|
2093 |
]. |
|
2094 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
2219 | 2095 |
]. |
616 | 2096 |
^ rightArrow |
2097 |
! |
|
2098 |
||
2099 |
rightArrowShadow |
|
2100 |
^ rightArrowShadow |
|
388 | 2101 |
! |
2102 |
||
390 | 2103 |
showGroupDivider |
2715 | 2104 |
"get the enabled flag for showing groupDiveders" |
2105 |
||
2253 | 2106 |
^ showGroupDivider |
388 | 2107 |
! |
2108 |
||
390 | 2109 |
showGroupDivider:aState |
2715 | 2110 |
"set the enabled flag for showing groupDiveders" |
2111 |
||
2253 | 2112 |
showGroupDivider ~~ aState ifTrue:[ |
3938 | 2113 |
showGroupDivider := aState. |
2114 |
self mustRearrange. |
|
653 | 2115 |
] |
388 | 2116 |
! |
2117 |
||
2118 |
showSeparatingLines |
|
2715 | 2119 |
"gets true if drawing of separating lines is enabled." |
2120 |
||
2253 | 2121 |
^ showSeparatingLines |
388 | 2122 |
! |
2123 |
||
390 | 2124 |
showSeparatingLines:aState |
2715 | 2125 |
"turn on/off drawing of separating lines." |
2126 |
||
2253 | 2127 |
aState ~~ showSeparatingLines ifTrue:[ |
3938 | 2128 |
showSeparatingLines := aState. |
2129 |
self mustRearrange |
|
2253 | 2130 |
]. |
388 | 2131 |
! |
2132 |
||
2133 |
verticalLayout |
|
2715 | 2134 |
"get the layout: vertical( true ) or horizontal( false )" |
2135 |
||
2374 | 2136 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 2137 |
|
2138 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
3938 | 2139 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
2374 | 2140 |
^ verticalLayout |
388 | 2141 |
! |
2142 |
||
2143 |
verticalLayout:aState |
|
2715 | 2144 |
"set the layout: vertical( true ) or horizontal( false )" |
2145 |
||
2253 | 2146 |
aState ~~ verticalLayout ifTrue:[ |
3938 | 2147 |
verticalLayout isNil ifTrue:[ |
2148 |
verticalLayout := aState |
|
2149 |
] ifFalse:[ |
|
2150 |
verticalLayout := aState. |
|
2151 |
self mustRearrange. |
|
2152 |
]. |
|
2253 | 2153 |
]. |
388 | 2154 |
! ! |
2155 |
||
2219 | 2156 |
!MenuPanel methodsFor:'accessing-style'! |
2157 |
||
2158 |
buttonInsetX |
|
2715 | 2159 |
"returns the verical button space" |
2160 |
||
2883 | 2161 |
^ buttonInsetX |
2219 | 2162 |
! |
2163 |
||
2164 |
buttonInsetY |
|
2715 | 2165 |
"returns the verical button space" |
2166 |
||
2883 | 2167 |
^ buttonInsetY |
2219 | 2168 |
! |
2169 |
||
3975 | 2170 |
delayInSecondsBeforeOpeningSubmenu |
2171 |
"answer the seconds a submenu will be delayed before |
|
2172 |
open; an already open submenu than will be closed" |
|
2173 |
||
2174 |
^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu' default:0.2 |
|
2175 |
! |
|
2176 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2177 |
drawMenuIndicatorSeparatorLine |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2178 |
^ true. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2179 |
^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine' default:false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2180 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2181 |
|
2219 | 2182 |
enteredLevel |
2715 | 2183 |
"returns the enter-level for an unselected item moved through" |
2184 |
||
2219 | 2185 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
2186 |
! |
|
2187 |
||
2188 |
groupDividerSize |
|
2715 | 2189 |
"returns the width of a group divider" |
2190 |
||
2219 | 2191 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
2192 |
! |
|
2193 |
||
2194 |
itemMargin |
|
2715 | 2195 |
"returns the margin of an item" |
2196 |
||
2219 | 2197 |
^ styleSheet at:#'menu.itemMargin' default:0 |
2198 |
! |
|
2199 |
||
2200 |
itemSpace |
|
2715 | 2201 |
"returns the additional space for an item in a (vertical) panel" |
2202 |
||
2883 | 2203 |
^ itemSpace |
2219 | 2204 |
! |
2205 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2206 |
menuIndicatorVerticalPosition |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2207 |
"#center, #top or #bottom" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2208 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2209 |
^ #center |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2210 |
"/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2211 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2212 |
|
2219 | 2213 |
selectionFollowsMouse |
2715 | 2214 |
"returns true if the selection follows the mouse" |
2215 |
||
2219 | 2216 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
2217 |
! |
|
2218 |
||
2219 |
shortcutKeyOffset |
|
2715 | 2220 |
"returns the offset for a shortcutKey" |
2221 |
||
2219 | 2222 |
^ 5 |
2223 |
! ! |
|
2224 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2225 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 2226 |
|
2227 |
subMenuAt:stringOrNumber |
|
3192 | 2228 |
"gets the current submenu of an item; if the submenu is nil, the |
2229 |
submenu is generated if specified otherwise nil is returned." |
|
2230 |
||
2231 |
|submenu| |
|
2232 |
||
2233 |
self itemAt:stringOrNumber do:[:anItem| |
|
3938 | 2234 |
submenu := anItem currentSubmenu. |
2235 |
submenu isNil ifTrue:[ |
|
2236 |
submenu := anItem setupSubmenu |
|
2237 |
]. |
|
3192 | 2238 |
]. |
2239 |
^ submenu |
|
3934 | 2240 |
|
2241 |
"Modified: / 22-09-2010 / 13:53:21 / cg" |
|
388 | 2242 |
! |
2243 |
||
2244 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2245 |
"sets the submenu of an item" |
2246 |
||
388 | 2247 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2248 |
! |
|
2249 |
||
2250 |
subMenuShown |
|
2715 | 2251 |
"return the currently visible submenu - or nil if there is none" |
2252 |
||
3192 | 2253 |
|item submenu| |
2254 |
||
2255 |
item := self selection. |
|
2256 |
||
2257 |
item notNil ifTrue:[ |
|
3938 | 2258 |
submenu := item currentSubmenu. |
2259 |
||
2260 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2261 |
^ submenu |
|
2262 |
]. |
|
2715 | 2263 |
]. |
2264 |
^ nil |
|
388 | 2265 |
! ! |
2266 |
||
2504 | 2267 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2268 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2269 |
closeMenus |
2715 | 2270 |
"close all menus without accepting" |
2271 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2272 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2273 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2274 |
|
388 | 2275 |
hide |
2715 | 2276 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2277 |
|
2407 | 2278 |
"/ TODO: replace with LeaveSignal raise. |
2279 |
||
388 | 2280 |
self selection:nil. |
2281 |
self unmap. |
|
2282 |
! |
|
2283 |
||
2284 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2285 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2286 |
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
|
2287 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2288 |
to some performer)" |
2289 |
||
2290 |
^ self showAt:(self origin) resizing:true |
|
388 | 2291 |
! |
2292 |
||
2293 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2294 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2295 |
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
|
2296 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2297 |
to some performer)" |
2298 |
||
3754 | 2299 |
^ self showAt:aPoint resizing:true |
388 | 2300 |
! |
2301 |
||
2302 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2303 |
"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
|
2304 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2305 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2306 |
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
|
2307 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2308 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2309 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2310 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2311 |
|
2312 |
aBoolean ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2313 |
self fixSize. |
388 | 2314 |
]. |
2315 |
self origin:aPoint. |
|
1459 | 2316 |
"/ self makeFullyVisible. -- done in realize |
388 | 2317 |
self openModal:[true]. "realize " |
2318 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2319 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2320 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2321 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2322 |
self topMenu hasPerformed ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2323 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2324 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2325 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2326 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2327 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2328 |
"Modified: / 29-06-2011 / 16:24:22 / cg" |
388 | 2329 |
! |
2330 |
||
2331 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2332 |
"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
|
2333 |
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
|
2334 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2335 |
to some performer)" |
2336 |
||
4064
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2337 |
^ self showAt:(device pointerPosition) resizing:true |
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2338 |
|
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2339 |
"Modified (format): / 22-07-2011 / 15:24:48 / cg" |
388 | 2340 |
! |
2341 |
||
2342 |
showCenteredIn:aView |
|
2343 |
"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
|
2344 |
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
|
2345 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2346 |
to some performer)" |
2347 |
||
388 | 2348 |
|top| |
2349 |
||
2350 |
top := aView topView. |
|
2351 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2352 |
^ 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
|
2353 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2354 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2355 |
! |
2356 |
||
2357 |
startUp |
|
2358 |
"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
|
2359 |
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
|
2360 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2361 |
to some performer)" |
2362 |
||
388 | 2363 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2364 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2365 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2366 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2367 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2368 |
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
|
2369 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2370 |
to some performer)" |
2371 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2372 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2373 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2374 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2375 |
! |
2376 |
||
2332 | 2377 |
startUpFor:originatingWidget |
2378 |
"realize the menu at the current pointer position |
|
2379 |
return the value of the selectedItem or nil, of none was selected |
|
2380 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2381 |
to some performer)" |
2382 |
||
2332 | 2383 |
originator := originatingWidget. |
2384 |
^ self startUp |
|
2385 |
! |
|
2386 |
||
1750 | 2387 |
startUpOrNil |
2388 |
"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
|
2389 |
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
|
2390 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2391 |
to some performer)" |
2392 |
||
1750 | 2393 |
^ self showAtPointer |
388 | 2394 |
! ! |
2395 |
||
2396 |
!MenuPanel methodsFor:'adding & removing'! |
|
2397 |
||
2398 |
createAtIndex:anIndexOrNil |
|
1800 | 2399 |
"create an item and add this item to the index. In case of nil, the item |
2400 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2401 |
otherwise the new created item is returned." |
2402 |
||
4046 | 2403 |
|max item index| |
388 | 2404 |
|
2405 |
max := (items size) + 1. |
|
2406 |
||
4046 | 2407 |
(index := anIndexOrNil) notNil ifTrue:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2408 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
4046 | 2409 |
index := max. |
2410 |
"/ ^ nil |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2411 |
] |
388 | 2412 |
]. |
2413 |
items isNil ifTrue:[ |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2414 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2415 |
] ifFalse:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2416 |
items := items asOrderedCollection |
388 | 2417 |
]. |
2418 |
item := Item in:self. |
|
2419 |
||
4046 | 2420 |
(index isNil or:[index == max]) ifTrue:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2421 |
items add:item |
388 | 2422 |
] ifFalse:[ |
4046 | 2423 |
items add:item beforeIndex:index |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2424 |
]. |
3966 | 2425 |
self mustRearrange. |
388 | 2426 |
^ item |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2427 |
|
4046 | 2428 |
"Modified: / 03-07-2011 / 22:49:47 / cg" |
388 | 2429 |
! |
2430 |
||
2431 |
remove:stringOrNumber |
|
2432 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2433 |
if found, remove and return it" |
2434 |
||
388 | 2435 |
|item| |
2436 |
||
2437 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2438 |
items remove:item. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2439 |
items isEmpty ifTrue:[items := nil]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2440 |
item destroy. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2441 |
self mustRearrange. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2442 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2443 |
^ item |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2444 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2445 |
"Modified: / 09-11-2010 / 10:04:08 / cg" |
388 | 2446 |
! |
2447 |
||
2448 |
removeAll |
|
2715 | 2449 |
"remove all items and submenus" |
2450 |
||
388 | 2451 |
self disabledRedrawDo:[ |
3938 | 2452 |
self selection:nil. |
2453 |
groupSizes := nil. |
|
2454 |
items notNil ifTrue:[ |
|
2455 |
items copy do:[:el| el destroy ]. |
|
2456 |
]. |
|
2457 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2458 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2459 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2460 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2461 |
! ! |
2462 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2463 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2464 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2465 |
update:something with:aParameter from:changedObject |
498 | 2466 |
|
2467 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2468 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2469 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2470 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2471 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2472 |
|
388 | 2473 |
!MenuPanel methodsFor:'converting'! |
2474 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2475 |
asMenu |
3222 | 2476 |
"convert contents to a menu" |
2715 | 2477 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2478 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2479 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2480 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2481 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2482 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2483 |
^ menu |
3222 | 2484 |
|
2485 |
"Modified: / 27-03-2007 / 08:39:48 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2486 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2487 |
|
388 | 2488 |
fromSpec:aMenuSpec |
2715 | 2489 |
"build from spec" |
2490 |
||
3222 | 2491 |
self menu:(Menu decodeFromLiteralArray:aMenuSpec) |
2492 |
||
2493 |
"Modified: / 27-03-2007 / 08:42:43 / cg" |
|
388 | 2494 |
! |
2495 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2496 |
menu:aMenu |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2497 |
"setup from a menu" |
2715 | 2498 |
|
388 | 2499 |
self disabledRedrawDo:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2500 |
|menu newItems menuReceiver| |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2501 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2502 |
self removeAll. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2503 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2504 |
(menu := aMenu) notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2505 |
(aMenu isCollection) ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2506 |
menu := Menu decodeFromLiteralArray:aMenu. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2507 |
] ifFalse:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2508 |
menuReceiver := menu receiver. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2509 |
menuReceiver notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2510 |
self receiver:menuReceiver. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2511 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2512 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2513 |
(newItems := menu menuItems) notEmptyOrNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2514 |
items := newItems collect:[:ni | |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2515 |
|i| |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2516 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2517 |
i:= Item in:self. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2518 |
i menuItem:ni. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2519 |
i. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2520 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2521 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2522 |
self groupSizes:(menu groupSizes). |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2523 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2524 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2525 |
|
3966 | 2526 |
"Modified: / 09-11-2010 / 11:52:28 / cg" |
388 | 2527 |
! ! |
2528 |
||
2681 | 2529 |
!MenuPanel methodsFor:'dependents access'! |
2530 |
||
2531 |
addDependencies |
|
2715 | 2532 |
"add all dependencies" |
2533 |
||
2681 | 2534 |
self do:[:anItem| anItem addDependencies ]. |
2535 |
||
2536 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2537 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2538 |
! |
|
2539 |
||
2540 |
removeDependencies |
|
2715 | 2541 |
"remove all dependencies" |
2542 |
||
2681 | 2543 |
self do:[:anItem| anItem removeDependencies ]. |
2544 |
||
2545 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2546 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2547 |
! ! |
|
2548 |
||
388 | 2549 |
!MenuPanel methodsFor:'drawing'! |
2550 |
||
2551 |
disabledRedrawDo:aBlock |
|
2552 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2553 |
of the block a redraw might be performed" |
2554 |
||
388 | 2555 |
|state| |
2556 |
||
2557 |
state := mustRearrange. |
|
2558 |
mustRearrange := true. |
|
2559 |
aBlock value. |
|
2560 |
mustRearrange := state. |
|
2561 |
self mustRearrange |
|
2562 |
! |
|
2563 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2564 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2565 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2566 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2567 |
aLevel ~~ 0 ifTrue:[ |
3938 | 2568 |
layout := anItem layout. |
2569 |
||
2570 |
styleSheet is3D ifFalse:[ |
|
2571 |
self displayRectangle:layout. |
|
2572 |
] ifTrue:[ |
|
2573 |
self drawEdgesForX:(layout left) |
|
2574 |
y:(layout top) |
|
2575 |
width:(layout width) |
|
2576 |
height:(layout height) |
|
2577 |
level:aLevel |
|
2578 |
shadow:(self buttonShadowColor) |
|
2579 |
light:(self buttonLightColor) |
|
2580 |
halfShadow:(self buttonHalfShadowColor) |
|
2581 |
halfLight:(self buttonHalfLightColor) |
|
2582 |
style:(self buttonEdgeStyle) |
|
2583 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2584 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2585 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2586 |
|
3187 | 2587 |
drawFocusForItem:anItem |
2588 |
|lytItem| |
|
2589 |
||
2590 |
lytItem := anItem layout. |
|
2591 |
self paint:(Color black). |
|
2592 |
||
2593 |
self displayDottedRectangleX:(lytItem left) |
|
3938 | 2594 |
y:(lytItem top) |
2595 |
width:(lytItem width) |
|
2596 |
height:(lytItem height). |
|
3187 | 2597 |
! |
2598 |
||
2016 | 2599 |
drawItemsX:x y:y width:w height:h |
2715 | 2600 |
"redraw items and groups in a damage" |
2601 |
||
2016 | 2602 |
|isVertical item layout prevClip |
2603 |
x1 "{ Class:SmallInteger }" |
|
2604 |
x2 "{ Class:SmallInteger }" |
|
2605 |
y1 "{ Class:SmallInteger }" |
|
2606 |
y2 "{ Class:SmallInteger }" |
|
2607 |
start "{ Class:SmallInteger }" |
|
2608 |
stop "{ Class:SmallInteger }" |
|
2609 |
size "{ Class:SmallInteger }" |
|
2610 |
groupDivInset "{ Class:SmallInteger }" |
|
2611 |
| |
|
2612 |
||
2613 |
size := items size. |
|
2614 |
isVertical := self verticalLayout. |
|
2615 |
||
2616 |
isVertical ifTrue:[ |
|
3938 | 2617 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2618 |
start == 0 ifTrue:[ ^ self ]. |
|
2619 |
y1 := y + h. |
|
2620 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
|
2621 |
startingAt:(start + 1). |
|
2016 | 2622 |
] ifFalse:[ |
3938 | 2623 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2624 |
start == 0 ifTrue:[ ^ self ]. |
|
2625 |
x1 := x + w. |
|
2626 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
|
2627 |
startingAt:(start + 1). |
|
2016 | 2628 |
]. |
2629 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2630 |
||
2253 | 2631 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
3938 | 2632 |
groupDivInset := self groupDividerSize // 2. |
2633 |
||
2634 |
groupDivInset ~~ 0 ifTrue:[ |
|
2635 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2636 |
start := start - 1 |
|
2637 |
] |
|
2638 |
]. |
|
2016 | 2639 |
] ifFalse:[ |
3938 | 2640 |
groupDivInset := 0 |
2016 | 2641 |
]. |
2642 |
||
2643 |
prevClip := clipRect. |
|
2644 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2645 |
||
2646 |
start to:stop do:[:i| |
|
3938 | 2647 |
item := items at:i. |
2648 |
item draw. |
|
2649 |
||
2650 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2651 |
layout := item layout. |
|
2652 |
||
2653 |
isVertical ifTrue:[ |
|
2654 |
x1 := layout left. |
|
2655 |
x2 := layout right. |
|
2656 |
y1 := layout bottom + groupDivInset. |
|
2657 |
y2 := y1. |
|
2658 |
] ifFalse:[ |
|
2659 |
y1 := layout top. |
|
2660 |
y2 := layout bottom. |
|
2661 |
x1 := layout right + groupDivInset. |
|
2662 |
x2 := x1. |
|
2663 |
]. |
|
2664 |
self paint:shadowColor. |
|
2665 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2666 |
self paint:lightColor. |
|
2667 |
||
2668 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2669 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2670 |
||
2671 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2672 |
]. |
|
2673 |
selection == item ifTrue:[ |
|
2674 |
self focusComesByTab ifTrue:[ |
|
2675 |
self drawFocusForItem:item. |
|
2676 |
]. |
|
2677 |
]. |
|
2016 | 2678 |
]. |
2679 |
self clippingRectangle:prevClip. |
|
2680 |
! |
|
2681 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2682 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2683 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2684 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2685 |
isSelected ifTrue:[ |
3938 | 2686 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2687 |
] ifFalse:[ |
3938 | 2688 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2689 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2690 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2691 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2692 |
level ~~ 0 ifTrue:[ |
3938 | 2693 |
layout := anItem layout. |
2694 |
||
2695 |
self drawEdgesForX:(layout left) |
|
2696 |
y:(layout top) |
|
2697 |
width:(layout width) |
|
2698 |
height:(layout height) |
|
2699 |
level:level |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2700 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2701 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2702 |
|
2016 | 2703 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2704 |
"draw a scroller" |
2705 |
||
2016 | 2706 |
|scrolling icon level x y w h| |
2707 |
||
2708 |
x := bounds left. |
|
2709 |
y := bounds top. |
|
2710 |
w := bounds width. |
|
2711 |
h := bounds height. |
|
2712 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2713 |
scrolling := self scrollActivity. |
2016 | 2714 |
|
2715 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
3938 | 2716 |
level := -2 |
2016 | 2717 |
] ifFalse:[ |
3938 | 2718 |
level := 1 |
2016 | 2719 |
]. |
2720 |
||
2721 |
level ~~ 0 ifTrue:[ |
|
3938 | 2722 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2723 |
]. |
2724 |
icon := scrolling iconAt:aDirection on:self. |
|
2725 |
||
2726 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
3938 | 2727 |
y:(y + (h - icon height // 2)). |
2016 | 2728 |
! |
2729 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2730 |
invalidateItem:anItem repairNow:aBool |
2715 | 2731 |
"an item changed; invalidate the items layout" |
2732 |
||
2016 | 2733 |
|layout| |
2734 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2735 |
(mustRearrange not and:[shown]) ifTrue:[ |
3938 | 2736 |
layout := anItem layout. |
2737 |
||
2738 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2739 |
self invalidate:(layout "insetBy:-1") repairNow:aBool |
|
2740 |
] |
|
1728 | 2741 |
]. |
2742 |
||
2743 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2744 |
! |
2745 |
||
388 | 2746 |
mustRearrange |
2715 | 2747 |
"force rearrange (i.e. set the rearrange flag)" |
2748 |
||
2080 | 2749 |
mustRearrange ifFalse:[ |
3938 | 2750 |
mustRearrange := true. |
2751 |
self invalidate "/ RepairNow:true |
|
388 | 2752 |
] |
590 | 2753 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2754 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2755 |
! |
2756 |
||
710 | 2757 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2758 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2759 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2760 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2761 |
|
1699 | 2762 |
|layout point |
710 | 2763 |
dltX "{ Class:SmallInteger }" |
2764 |
start "{ Class:SmallInteger }" |
|
2765 |
| |
|
2766 |
||
2767 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
3938 | 2768 |
^ self |
710 | 2769 |
]. |
2770 |
||
2771 |
layout := items last layout. |
|
3246 | 2772 |
layout notNil ifTrue:[ |
3938 | 2773 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2774 |
^ self "/ no free space |
|
2775 |
]. |
|
710 | 2776 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2777 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2778 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2779 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2780 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2781 |
"/ 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
|
2782 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2783 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
3938 | 2784 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
3148 | 2785 |
] ifFalse:[ |
3938 | 2786 |
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
|
2787 |
]. |
710 | 2788 |
start == 0 ifTrue:[ |
3938 | 2789 |
^ self "/ no right-group item detected |
1699 | 2790 |
]. |
2791 |
point := dltX @ 0. |
|
2792 |
||
2793 |
"/ move items layout to right |
|
710 | 2794 |
items from:start do:[:anItem| |
3938 | 2795 |
anItem isVisible ifTrue:[ |
2796 |
anItem layout moveBy:point. |
|
2797 |
] |
|
710 | 2798 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2799 |
self updateEnteredItem. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2800 |
|
3246 | 2801 |
"Modified: / 10-10-2007 / 00:29:34 / cg" |
710 | 2802 |
! |
2803 |
||
388 | 2804 |
rearrangeItems |
1699 | 2805 |
"recompute the layout of each item |
3938 | 2806 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2715 | 2807 |
|
1791 | 2808 |
|isVertical extent isPopUpMenu |
2219 | 2809 |
x "{ Class:SmallInteger }" |
2810 |
y "{ Class:SmallInteger }" |
|
2811 |
x0 "{ Class:SmallInteger }" |
|
2812 |
y0 "{ Class:SmallInteger }" |
|
2813 |
x1 "{ Class:SmallInteger }" |
|
2814 |
y1 "{ Class:SmallInteger }" |
|
2815 |
size "{ Class:SmallInteger }" |
|
2816 |
insetX "{ Class:SmallInteger }" |
|
2817 |
insetY "{ Class:SmallInteger }" |
|
2818 |
labelInsetX "{ Class:SmallInteger }" |
|
2819 |
labelInsetY "{ Class:SmallInteger }" |
|
2820 |
itemMargin "{ Class:SmallInteger }" |
|
2821 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2822 |
| |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2823 |
|
1699 | 2824 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
3938 | 2825 |
mustRearrange := false. |
2826 |
^ self |
|
390 | 2827 |
]. |
2219 | 2828 |
|
2080 | 2829 |
"/ DON'T SET THIS!! |
3938 | 2830 |
"/ item layout: below of first item -> item invalidate |
2831 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2080 | 2832 |
"/ -> invalidate:rapairDamage: |
2833 |
"/ -> redrawX:y:width:height: |
|
2834 |
"/ tries to get uninitialized layout from second item. |
|
2835 |
"/ This happens in a modal debugger!! |
|
2836 |
"/ mustRearrange := false. |
|
2219 | 2837 |
isVertical := self verticalLayout. |
2838 |
groupDividerSize := self groupDividerSize. |
|
2839 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2840 |
|
2841 |
isPopUpMenu ifFalse:[ |
|
3938 | 2842 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2843 |
] ifTrue:[ |
3938 | 2844 |
labelInsetX := labelInsetY := 0 |
2845 |
]. |
|
2846 |
||
2847 |
(isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ |
|
2848 |
|saveExtent maxExtent extentToSet| |
|
2849 |
||
2850 |
extent := self preferredExtent. |
|
2851 |
||
2852 |
isPopUpMenu ifTrue:[ |
|
2853 |
maxExtent := self maxExtent. |
|
2854 |
maxExtent notNil ifTrue:[ |
|
2855 |
extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] |
|
2856 |
ifFalse:[(extent x min:(maxExtent x)) @ extent y]. |
|
2857 |
]. |
|
2858 |
] ifFalse:[ |
|
2859 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
|
2860 |
]. |
|
2861 |
self extent:extentToSet. |
|
390 | 2862 |
] ifFalse:[ |
3938 | 2863 |
extent := self computeExtent |
390 | 2864 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2865 |
|
1093 | 2866 |
x := y := margin. |
2867 |
||
1699 | 2868 |
isVertical ifFalse:[ |
3938 | 2869 |
y0 := margin. |
2870 |
y1 := extent y - margin. |
|
2871 |
||
2872 |
items keysAndValuesDo:[:anIndex :el| |
|
2873 |
el isVisible ifFalse:[ |
|
2874 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2875 |
] ifTrue:[ |
|
2876 |
el isButton ifTrue:[ |
|
2877 |
insetX := buttonInsetX. |
|
2878 |
insetY := buttonInsetY. |
|
2879 |
] ifFalse:[ |
|
2880 |
insetX := labelInsetX. |
|
2881 |
insetY := labelInsetY. |
|
2882 |
]. |
|
2883 |
x0 := x + insetX. |
|
2884 |
x1 := x0 + (el preferredWidth). |
|
2885 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
|
2886 |
x := x1 + insetX. |
|
2887 |
||
2888 |
size ~~ anIndex ifTrue:[ |
|
2889 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2890 |
x := x + groupDividerSize |
|
2891 |
] ifFalse:[ |
|
2892 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
2893 |
x := x + itemSpace |
|
2894 |
] |
|
2895 |
] |
|
2896 |
] |
|
2897 |
]. |
|
2898 |
]. |
|
1699 | 2899 |
] ifTrue:[ |
3938 | 2900 |
itemMargin := self itemMargin. |
2901 |
x0 := margin. |
|
2902 |
x1 := extent x - margin - itemMargin. "/ -1 |
|
2903 |
||
2904 |
items keysAndValuesDo:[:anIndex :el| |
|
2905 |
el isVisible ifFalse:[ |
|
2906 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2907 |
] ifTrue:[ |
|
2908 |
el isButton ifTrue:[ |
|
2909 |
insetX := buttonInsetX. |
|
2910 |
insetY := buttonInsetY. |
|
2911 |
] ifFalse:[ |
|
2912 |
insetX := labelInsetX. |
|
2913 |
insetY := labelInsetY. |
|
2914 |
]. |
|
2915 |
y0 := y + insetY. |
|
2916 |
y1 := y0 + el preferredHeight. |
|
2917 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
|
2918 |
y := y1 + insetY. |
|
2919 |
||
2920 |
size ~~ anIndex ifTrue:[ |
|
2921 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2922 |
y := y + groupDividerSize |
|
2923 |
] |
|
2924 |
] |
|
2925 |
] |
|
2926 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2927 |
]. |
710 | 2928 |
self rearrangeGroups. |
2048 | 2929 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2930 |
mustRearrange := false. |
2048 | 2931 |
|
2932 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2933 |
! |
2934 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2935 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2936 |
"check for items which can change its visibility; |
2715 | 2937 |
if at least one item exists, rearrange all items" |
2938 |
||
1464 | 2939 |
items isNil ifTrue:[^ self]. |
1699 | 2940 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2941 |
items do:[:item | |
3938 | 2942 |
item canChangeVisibility ifTrue:[ |
2943 |
mustRearrange := true. |
|
2944 |
self rearrangeItems. |
|
2945 |
^ self |
|
2946 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2947 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2948 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2949 |
|
388 | 2950 |
redrawX:x y:y width:w height:h |
2715 | 2951 |
"redraw a damage" |
2952 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2953 |
|y0 y1 x0 x1 prvBound mustDraw nxtBound| |
388 | 2954 |
|
710 | 2955 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2956 |
|
1699 | 2957 |
mustRearrange ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2958 |
self isPopUpView ifFalse:[ self explicitExtent:true]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2959 |
self rearrangeItems. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2960 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2961 |
^ self |
1699 | 2962 |
]. |
2888 | 2963 |
"/ self paint:(self viewBackground). |
1699 | 2964 |
self clearRectangleX:x y:y width:w height:h. |
2965 |
||
2016 | 2966 |
items size == 0 ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2967 |
^ self |
1699 | 2968 |
]. |
2016 | 2969 |
y0 := y. |
2970 |
y1 := y + h. |
|
2018 | 2971 |
x0 := x. |
2972 |
x1 := x + w. |
|
2016 | 2973 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2974 |
"Draw the scroll handles - especially for Popup-Lists" |
3938 | 2975 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2976 |
self hasScrollers ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2977 |
(self hasScrollerAt:#PREV) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2978 |
prvBound := self scrollerBoundsAt:#PREV. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2979 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2980 |
self verticalLayout ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2981 |
(mustDraw := (prvBound bottom > y)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2982 |
y0 := prvBound bottom. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2983 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2984 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2985 |
(mustDraw := (prvBound right > x)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2986 |
x0 := prvBound right. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2987 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2988 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2989 |
mustDraw ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2990 |
self drawScrollerAt:#PREV bounds:prvBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2991 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2992 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2993 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2994 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2995 |
nxtBound := self scrollerBoundsAt:#NEXT. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2996 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2997 |
self verticalLayout ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2998 |
(mustDraw := (nxtBound top < y1)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2999 |
y1 := nxtBound top. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3000 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3001 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3002 |
(mustDraw := (nxtBound left < x1)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3003 |
x1 := nxtBound left. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3004 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3005 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3006 |
mustDraw ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3007 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3008 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3009 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3010 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3011 |
lastDrawnScrollerNextBounds := nxtBound. |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3012 |
|
2018 | 3013 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3014 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3015 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3016 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3017 |
"Modified: / 29-06-2011 / 16:24:34 / cg" |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3018 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3019 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3020 |
updateEnteredItem |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3021 |
|mousePoint| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3022 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3023 |
mousePoint := device translatePoint:(device pointerPosition) |
3938 | 3024 |
fromView:nil |
3025 |
toView:self. |
|
3026 |
||
3027 |
(self containsPoint:mousePoint) ifTrue:[ |
|
3028 |
enteredItem := self itemAtPoint:mousePoint |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3029 |
]. |
388 | 3030 |
! ! |
3031 |
||
3032 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
3033 |
||
3034 |
collect:aOneArgBlock |
|
3035 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 3036 |
and return a collection of the results" |
3037 |
||
388 | 3038 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 3039 |
^ nil |
388 | 3040 |
! |
3041 |
||
3042 |
do:aOneArgBlock |
|
2715 | 3043 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
3044 |
||
388 | 3045 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
3046 |
! |
|
3047 |
||
3048 |
findFirst:aOneArgBlock |
|
3206 | 3049 |
"find the index of the first item, for which evaluation of the argument, aOneArgBlock |
2715 | 3050 |
returns true; return its index or 0 if none detected." |
3051 |
||
388 | 3052 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 3053 |
^ 0 |
388 | 3054 |
! |
3055 |
||
3056 |
findLast:aOneArgBlock |
|
3057 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 3058 |
returns true; return its index or 0 if none detected." |
3059 |
||
388 | 3060 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 3061 |
^ 0 |
388 | 3062 |
! |
3063 |
||
3187 | 3064 |
firstItemSelectable |
3065 |
"returns the first item which is selectable or nil |
|
3066 |
" |
|
3067 |
items size > 0 ifTrue:[ |
|
3938 | 3068 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
3187 | 3069 |
]. |
3070 |
^ nil |
|
3071 |
! |
|
3072 |
||
390 | 3073 |
indexOf:something |
3074 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 3075 |
If no item match 0 is returned. No range checks are performed on a number argument" |
3076 |
||
390 | 3077 |
|i v| |
3078 |
||
3079 |
something isNumber ifTrue:[ ^ something ]. |
|
3080 |
something isNil ifTrue:[ ^ 0 ]. |
|
3081 |
||
1218 | 3082 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 3083 |
|
3084 |
i ~~ 0 ifTrue:[ |
|
3938 | 3085 |
^ i |
388 | 3086 |
]. |
390 | 3087 |
|
3088 |
something isSymbol ifTrue:[ |
|
3938 | 3089 |
i := self findFirst:[:el| |
3090 |
v := el value. |
|
3091 |
v isSymbol and:[v == something] |
|
3092 |
]. |
|
3093 |
i ~~ 0 ifTrue:[ |
|
3094 |
^ i |
|
3095 |
] |
|
390 | 3096 |
]. |
3097 |
||
3098 |
(something respondsTo:#string) ifTrue:[ |
|
3938 | 3099 |
v := something string. |
1218 | 3100 |
^ self findFirst:[:el | el textLabel = v]. |
3101 |
]. |
|
3102 |
^ 0 |
|
388 | 3103 |
! |
3104 |
||
706 | 3105 |
indexOfItem:anItem |
2715 | 3106 |
"returns the index of the item or 0" |
3107 |
||
706 | 3108 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
3109 |
! |
|
3110 |
||
388 | 3111 |
keysAndValuesDo:aTwoArgBlock |
2715 | 3112 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
3113 |
||
388 | 3114 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
3115 |
! ! |
|
3116 |
||
3117 |
!MenuPanel methodsFor:'event handling'! |
|
3118 |
||
3119 |
buttonMotion:state x:x y:y |
|
2715 | 3120 |
"open or close the corresponding submenu" |
3121 |
||
2046 | 3122 |
|menue motionPoint translatedPoint sensor| |
1699 | 3123 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3124 |
self scrollActivity isActive ifTrue:[ |
3938 | 3125 |
^ self |
2016 | 3126 |
]. |
3127 |
||
1699 | 3128 |
sensor := self sensor. |
3129 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
3938 | 3130 |
^ self |
1699 | 3131 |
]. |
3132 |
menue := self detectGrabMenu. |
|
1841 | 3133 |
|
2046 | 3134 |
motionPoint := x@y. |
3135 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 3136 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 3137 |
|
3780 | 3138 |
"/ hideOnRelease := true. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3139 |
|
1699 | 3140 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
3938 | 3141 |
^ self |
1699 | 3142 |
]. |
3143 |
||
3826 | 3144 |
hideOnRelease ifTrue:[ |
3938 | 3145 |
sensor anyButtonPressed ifFalse:[^ self] |
3826 | 3146 |
] ifFalse:[ |
3938 | 3147 |
sensor anyButtonPressed ifTrue:[^ self] |
3826 | 3148 |
]. |
3149 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3150 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
3938 | 3151 |
"/ selection on grabView without a submenu (Button ...); check whether moving out |
3152 |
(self containsPoint:motionPoint) ifFalse:[ |
|
3153 |
^ self accept:nil |
|
3154 |
] |
|
1699 | 3155 |
]. |
3156 |
||
2048 | 3157 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 3158 |
! |
3159 |
||
3160 |
buttonPress:button x:x y:y |
|
2715 | 3161 |
"any button pressed; open or close the corresponding submenus" |
3162 |
||
3921 | 3163 |
|menu point screen screenPoint targetView targetPoint| |
2016 | 3164 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3165 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3166 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3167 |
self scrollActivity stop. |
2016 | 3168 |
point := x@y. |
3169 |
menu := self detectMenuAtGrabPoint:point. |
|
3170 |
||
3171 |
menu isNil ifTrue:[ |
|
4082 | 3172 |
self accept:nil. |
3173 |
||
3174 |
"/ tell underlying view about the click... |
|
3175 |
(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease]) ifTrue:[ |
|
3176 |
screen := self device. |
|
3177 |
screenPoint := screen translatePointToRoot:point fromView:self. |
|
3178 |
targetView := screen viewFromPoint:screenPoint. |
|
3179 |
targetView notNil ifTrue:[ |
|
3180 |
targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView. |
|
3181 |
targetView buttonPress:button x:targetPoint x y:targetPoint y. |
|
3182 |
] |
|
3183 |
]. |
|
2016 | 3184 |
] ifFalse:[ |
4082 | 3185 |
point := menu translateGrabPoint:point. |
3186 |
menu handleButtonPress:button atPoint:point. |
|
2016 | 3187 |
] |
2046 | 3188 |
|
4082 | 3189 |
"Modified: / 02-10-2011 / 09:20:08 / cg" |
1699 | 3190 |
! |
3191 |
||
3192 |
buttonRelease:button x:x y:y |
|
2715 | 3193 |
"button release action; accept selection and close all views" |
3194 |
||
3938 | 3195 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
3203 | 3196 |
releaseTime menuMapTime| |
2199 | 3197 |
|
3780 | 3198 |
hideOnRelease ifFalse:[ |
3938 | 3199 |
^ self |
3780 | 3200 |
]. |
3201 |
||
2199 | 3202 |
topMenu := self topMenu. |
3203 |
topMenu openDelayed:nil. |
|
1699 | 3204 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3205 |
self scrollActivity stop ifTrue:[ |
3938 | 3206 |
^ self |
2016 | 3207 |
]. |
3208 |
||
1699 | 3209 |
dstMenu := topMenu activeMenu. |
3210 |
||
2679 | 3211 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
3212 |
||
3213 |
hideMenuAndPerformAction ifFalse:[ |
|
3938 | 3214 |
hideOnRelease ifTrue:[ |
3215 |
releaseTime := windowGroup lastEvent timeStamp. |
|
3216 |
menuMapTime := dstMenu mapTime ? releaseTime. |
|
3217 |
||
3218 |
hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime) |
|
3219 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
3220 |
]. |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3221 |
]. |
2679 | 3222 |
hideMenuAndPerformAction ifTrue:[ |
3938 | 3223 |
srcPoint := x@y. |
3224 |
||
3225 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
|
3226 |
and:[(item := dstMenu selection) notNil] |
|
3227 |
) ifTrue:[ |
|
3228 |
item visibleSubmenu notNil ifTrue:[ |
|
3229 |
dstMenu selection:nil. |
|
3230 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
|
3231 |
self accept:nil. |
|
3232 |
]. |
|
3233 |
^ self |
|
3234 |
]. |
|
3235 |
subm := item currentSubmenu. |
|
3236 |
||
3237 |
subm notNil ifTrue:[ |
|
3238 |
subm shown ifTrue:[^ self]. |
|
3239 |
"/ test whether any action is assigned to the menu |
|
3240 |
"/ if not ignorre accept |
|
3241 |
item hasDelayedMenu ifFalse:[^ self]. |
|
3242 |
"/ handle action defined for the delayed menu |
|
3243 |
]. |
|
3244 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
3245 |
||
3246 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
|
3247 |
item := nil |
|
3248 |
]. |
|
3249 |
topMenu acceptItem:item inMenu:dstMenu. |
|
3250 |
^ self |
|
3251 |
]. |
|
3252 |
||
3253 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
|
3254 |
selection visibleSubmenu notNil ifTrue:[ |
|
3255 |
^ self |
|
3256 |
] |
|
3257 |
]. |
|
3258 |
self accept:nil. |
|
1699 | 3259 |
]. |
3260 |
! |
|
3261 |
||
2860 | 3262 |
handleSizeChanged:how |
3263 |
"used to handle the scrollers and groups in a none popUpView |
|
3264 |
" |
|
3265 |
|layouts damage isVertical scrollBound| |
|
3266 |
||
3267 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3268 |
^ self |
2860 | 3269 |
]. |
3270 |
mustRearrange := true. |
|
3271 |
||
3272 |
shown ifFalse:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3273 |
^ self |
2860 | 3274 |
]. |
3275 |
layouts := OrderedCollection new. |
|
3276 |
||
3277 |
items do:[:el| |layout| |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3278 |
(layout := el layout) isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3279 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3280 |
^ self. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3281 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3282 |
layouts add:layout. |
2860 | 3283 |
]. |
3284 |
isVertical := self verticalLayout. |
|
3285 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3286 |
||
3287 |
self rearrangeItems. |
|
3288 |
||
3289 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3290 |
damage isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3291 |
newLyt := el layout. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3292 |
oldLyt := layouts at:i ifAbsent:newLyt. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3293 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3294 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3295 |
start := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3296 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3297 |
i > 1 ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3298 |
isVertical ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3299 |
x := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3300 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3301 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3302 |
y := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3303 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3304 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3305 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3306 |
start <= 20 ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3307 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3308 |
^ self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3309 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3310 |
damage := Rectangle left:x top:y extent:(self extent). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3311 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3312 |
]. |
2860 | 3313 |
]. |
3314 |
damage isNil ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3315 |
damage := scrollBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3316 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3317 |
scrollBound := lastDrawnScrollerNextBounds. |
2860 | 3318 |
scrollBound notNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3319 |
damage := damage merge:scrollBound |
2860 | 3320 |
]. |
3321 |
self invalidate:damage. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3322 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3323 |
"Modified: / 29-06-2011 / 16:24:59 / cg" |
2860 | 3324 |
! |
3325 |
||
1699 | 3326 |
keyPress:key x:x y:y |
2715 | 3327 |
"any key is pressed" |
3328 |
||
2869 | 3329 |
<resource: #keyboard (#Escape |
3938 | 3330 |
#Tab #FocusNext #FocusPrevious |
3331 |
#CursorLeft #CursorRight )> |
|
2869 | 3332 |
|
3333 |
|menu menusSuperMenu sensor| |
|
2251 | 3334 |
|
3335 |
sensor := self sensor. |
|
3158 | 3336 |
|
3337 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3338 |
"/ ^ self "/ ignored while any button is pressed |
|
3339 |
"/ ]. |
|
1699 | 3340 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3341 |
self scrollActivity isActive ifTrue:[ |
3938 | 3342 |
key ~~ #Escape ifTrue:[ |
3343 |
^ self |
|
3344 |
]. |
|
3345 |
self scrollActivity stop |
|
3346 |
]. |
|
3347 |
||
3348 |
(key == #Tab |
|
1699 | 3349 |
or:[key == #FocusNext |
3350 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
3938 | 3351 |
self accept:nil. |
3352 |
^ super keyPress:key x:x y:y |
|
1699 | 3353 |
]. |
3354 |
||
3355 |
menu := self detectGrabMenu. |
|
2869 | 3356 |
menusSuperMenu := menu superMenu. |
1699 | 3357 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
3358 |
(key == #Escape) ifTrue:[ |
3938 | 3359 |
"/ must hide the active menu |
3360 |
(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[ |
|
3361 |
"/ hide active menu but keep the grab |
|
3362 |
menusSuperMenu selection:nil |
|
3363 |
] ifFalse:[ |
|
3364 |
"/ hide active menu and ungrab |
|
3365 |
self accept:nil |
|
3366 |
]. |
|
3367 |
^ self |
|
2251 | 3368 |
]. |
3369 |
||
3370 |
menu isViewWrapper ifFalse:[ |
|
3938 | 3371 |
sensor compressKeyPressEventsWithKey:key. |
3372 |
menu handleKeyPress:key. |
|
3373 |
^ self |
|
2251 | 3374 |
]. |
2869 | 3375 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3376 |
|
3377 |
"/ allow cursor movement |
|
3378 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3938 | 3379 |
(self containsPoint:x@y) ifTrue:[ |
3380 |
self handleKeyPress:key. |
|
3381 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3382 |
]. |
1699 | 3383 |
! |
3384 |
||
3834
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3385 |
mapped |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3386 |
super mapped. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3387 |
|
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3388 |
"/ if I come up with a pressed button, react on release instead. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3389 |
self device anyButtonPressed ifTrue:[ hideOnRelease := true ]. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3390 |
! |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3391 |
|
3415 | 3392 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
3393 |
"mousewheel action" |
|
3394 |
||
3395 |
|menu| |
|
3396 |
||
3397 |
menu := self detectGrabMenu. |
|
3398 |
menu isViewWrapper ifTrue:[ |
|
3938 | 3399 |
menu superMenu ~~ self ifTrue:[ |
3400 |
^ self. |
|
3401 |
]. |
|
3402 |
menu := self. |
|
3415 | 3403 |
]. |
3404 |
amount > 0 ifTrue:[ |
|
3938 | 3405 |
menu handleCursorKey:#CursorUp. |
3415 | 3406 |
] ifFalse:[ |
3938 | 3407 |
menu handleCursorKey:#CursorDown. |
3415 | 3408 |
]. |
3409 |
! |
|
3410 |
||
1699 | 3411 |
pointerLeave:state |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3412 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3413 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3414 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3415 |
|
1699 | 3416 |
self detectGrabMenu handlePointerLeave:state. |
3417 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3418 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
3938 | 3419 |
^ self |
2251 | 3420 |
]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3421 |
|
2374 | 3422 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3423 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3424 |
windowGroup focusView ~~ self ifTrue:[ |
3938 | 3425 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3426 |
] ifFalse:[ |
3938 | 3427 |
selection isButton ifTrue:[ |
3428 |
sensor := self sensor. |
|
3429 |
||
3430 |
sensor isNil ifTrue:[ |
|
3431 |
self accept:nil |
|
3432 |
] ifFalse:[ |
|
3433 |
"/ I'have the focus; if no button pressed, than keep the selection |
|
3434 |
sensor anyButtonPressed ifTrue:[ |
|
3435 |
self selection:nil |
|
3436 |
] |
|
3437 |
]. |
|
3438 |
] |
|
1699 | 3439 |
]. |
3440 |
! |
|
3441 |
||
3442 |
sizeChanged:how |
|
2715 | 3443 |
"redraw #right groups" |
3444 |
||
2860 | 3445 |
"/ self isPopUpView ifFalse:[ |
3446 |
"/ mustRearrange := true. |
|
3447 |
"/ self invalidate |
|
3448 |
"/ ]. |
|
3449 |
"/ ^ super sizeChanged:how. |
|
3450 |
||
3451 |
self handleSizeChanged:how. |
|
3452 |
super sizeChanged:how. |
|
1699 | 3453 |
! ! |
3454 |
||
2503 | 3455 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3456 |
|
1767 | 3457 |
clearImplicitGrab |
2253 | 3458 |
implicitGrabView := lastPointerView := nil. |
1767 | 3459 |
! |
3460 |
||
3461 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3462 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3463 |
|
2253 | 3464 |
|view x y p syntheticEvent menu| |
1767 | 3465 |
|
2658 | 3466 |
ev isDamage ifTrue:[ |
3938 | 3467 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
2658 | 3468 |
]. |
3469 |
||
3142 | 3470 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
3938 | 3471 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
3142 | 3472 |
]. |
3473 |
||
1767 | 3474 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3475 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3476 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3477 |
implicitGrabView notNil ifTrue:[ |
|
3938 | 3478 |
self sensor leftButtonPressed ifFalse:[ |
3479 |
self clearImplicitGrab. |
|
3480 |
]. |
|
1767 | 3481 |
]. |
3482 |
||
3483 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
3938 | 3484 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3485 |
]. |
3486 |
||
3487 |
implicitGrabView notNil ifTrue:[ |
|
3938 | 3488 |
ev isButtonEvent ifTrue:[ |
3489 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3490 |
ev view:implicitGrabView. |
|
3491 |
ev arguments at:2 put:p x. |
|
3492 |
ev arguments at:3 put:p y. |
|
3493 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3494 |
||
3495 |
ev isButtonReleaseEvent ifTrue:[ |
|
3496 |
self clearImplicitGrab. |
|
3497 |
]. |
|
3498 |
^ self |
|
3499 |
] |
|
1767 | 3500 |
]. |
3501 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3502 |
||
2016 | 3503 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
3938 | 3504 |
self clearImplicitGrab. |
3505 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
|
1767 | 3506 |
]. |
3507 |
||
3508 |
p := menu translateGrabPoint:(x@y). |
|
3509 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
3630 | 3510 |
view == self ifTrue:[^self]. "MB:changed - recursion" |
3511 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3512 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3513 |
|
3514 |
ev isButtonPressEvent ifTrue:[ |
|
3938 | 3515 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3516 |
view requestFocus. |
|
3517 |
]. |
|
3518 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3519 |
implicitGrabView := view. |
|
3520 |
] |
|
2253 | 3521 |
]. |
1767 | 3522 |
|
3523 |
ev isButtonMotionEvent ifTrue:[ |
|
3938 | 3524 |
lastPointerView ~~ view ifTrue:[ |
3525 |
"/ must generate enter/leave ... (sigh) |
|
3526 |
lastPointerView notNil ifTrue:[ |
|
3527 |
"/ XXX: should be fixed |
|
3528 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3529 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3530 |
]. |
|
3531 |
view notNil ifTrue:[ |
|
3532 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3533 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3534 |
]. |
|
3535 |
lastPointerView := view. |
|
3536 |
]. |
|
1767 | 3537 |
]. |
3538 |
||
3539 |
ev view:view. |
|
3540 |
ev x:p x. |
|
3541 |
ev y:p y. |
|
3542 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3543 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3544 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3545 |
! |
3546 |
||
2048 | 3547 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3548 |
"open or close the corresponding submenus" |
3549 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3550 |
|menu item translatedPoint containsPoint direction| |
2251 | 3551 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3552 |
containsPoint := self containsPoint:motionPoint. |
3975 | 3553 |
|
3554 |
(containsPoint not and:[items size > 0]) ifTrue:[ |
|
3555 |
"/ check if there is still open a menu which is not assigned to the |
|
3556 |
"/ current selection |
|
3557 |
item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil. |
|
3558 |
||
3559 |
item notNil ifTrue:[ |
|
3560 |
|visibleSubmenu point| |
|
3561 |
||
3562 |
visibleSubmenu := item visibleSubmenu. |
|
3563 |
||
3564 |
visibleSubmenu notNil ifTrue:[ |
|
3565 |
point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu. |
|
3566 |
||
3567 |
(visibleSubmenu containsPoint:point) ifTrue:[ |
|
3568 |
selection notNil ifTrue:[ selection invalidate ]. |
|
3569 |
selection := item. |
|
3570 |
selection invalidate. |
|
3571 |
visibleSubmenu becomesActiveMenu. |
|
3572 |
^ self. |
|
3573 |
]. |
|
3574 |
]. |
|
3575 |
item := nil. |
|
3576 |
]. |
|
3577 |
]. |
|
3578 |
||
3938 | 3579 |
containsPoint ifTrue:[ |
3975 | 3580 |
item := self itemAtPoint:motionPoint |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3581 |
]. |
2251 | 3582 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3583 |
"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
|
3584 |
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
|
3585 |
direction notNil ifTrue:[ |
3975 | 3586 |
self pointerEntersItem:nil. |
3587 |
||
3588 |
self sensor anyButtonPressed ifTrue:[ |
|
3589 |
self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false. |
|
3590 |
]. |
|
3591 |
^ self |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3592 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3593 |
|
2251 | 3594 |
self pointerEntersItem:item. |
1699 | 3595 |
|
1910 | 3596 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
3975 | 3597 |
( self selectionFollowsMouse |
3598 |
and:[self topMenu focusComesByTab not] |
|
3599 |
) ifTrue:[ |
|
3600 |
self isPopUpView ifTrue:[ |
|
3601 |
item isNil ifTrue:[ |
|
3602 |
superMenu notNil ifTrue:[ |
|
3603 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3604 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3605 |
] |
|
3606 |
] ifFalse:[ |
|
3607 |
self selectAndOpenDelayed:item. |
|
3608 |
]. |
|
3609 |
] ifFalse:[ "/ processing in the toolbar |
|
3610 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
|
3611 |
self selection:item openMenu:true. |
|
3612 |
]. |
|
3613 |
]. |
|
3614 |
]. |
|
3615 |
^ self |
|
3616 |
]. |
|
2251 | 3617 |
containsPoint ifTrue:[ |
3975 | 3618 |
self selection:item openMenu:true. |
3619 |
^ self |
|
2251 | 3620 |
]. |
3621 |
||
3622 |
menu := self superMenuAtPoint:motionPoint. |
|
3623 |
||
2374 | 3624 |
menu notNil ifTrue:[ |
3975 | 3625 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
3626 |
menu handleButtonMotion:state atPoint:translatedPoint. |
|
3627 |
^ self |
|
2251 | 3628 |
]. |
3629 |
self isPopUpView ifTrue:[ |
|
3975 | 3630 |
self selection:nil |
2251 | 3631 |
]. |
2046 | 3632 |
! |
3633 |
||
3383 | 3634 |
handleButtonPress:button atPoint:aPoint |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3635 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3636 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3637 |
|item scrollerDirectionOrNil wasSelected| |
2016 | 3638 |
|
2046 | 3639 |
item := self itemAtPoint:aPoint. |
2374 | 3640 |
item isNil ifTrue:[ |
3938 | 3641 |
self selection:nil openMenu:false. |
3642 |
^ self |
|
2251 | 3643 |
]. |
3644 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3645 |
"/ is a scroller-button present and hit ? |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3646 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3647 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 3648 |
(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[ |
3649 |
self pointerEntersItem:nil. |
|
3650 |
^ self |
|
3651 |
] |
|
2016 | 3652 |
]. |
2251 | 3653 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3654 |
"/ right button always immediately pulls the delayedMenu |
3383 | 3655 |
button == 2 ifTrue:[ |
3938 | 3656 |
item hasDelayedMenu ifTrue:[ |
3657 |
self selection:item openMenu:false. |
|
3658 |
self openDelayed:item afterSeconds:0. |
|
3659 |
^ self. |
|
3660 |
]. |
|
3383 | 3661 |
]. |
3662 |
||
2251 | 3663 |
wasSelected := (selection == item). |
3664 |
wasSelected ifFalse:[ |
|
3938 | 3665 |
self selection:item openMenu:true |
2251 | 3666 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3667 |
item hasDelayedMenu ifTrue:[ |
3938 | 3668 |
"/ clicked on the arrow icon ? |
3669 |
(item menuIndicatorContains:aPoint) ifTrue:[ |
|
3670 |
self selection:item openMenu:false. |
|
3671 |
self openDelayed:item afterSeconds:0. |
|
3672 |
^ self. |
|
3673 |
]. |
|
3674 |
^ self |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3675 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3676 |
|
2238 | 3677 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
3938 | 3678 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3679 |
item toggleSubmenuVisibility |
|
3680 |
]. |
|
3681 |
^ self |
|
2238 | 3682 |
]. |
3683 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3938 | 3684 |
^ self |
2238 | 3685 |
]. |
3686 |
self invalidateItem:item repairNow:true. |
|
3687 |
self acceptItem:item inMenu:self. |
|
3688 |
||
3233 | 3689 |
[ (device notNil and:[device anyButtonPressed]) ] whileTrue:[ |
3938 | 3690 |
"/ using device - sensor is not updated sometimes |
3691 |
Delay waitForSeconds:0.1. |
|
3233 | 3692 |
]. |
3693 |
self sensor flushUserEvents. |
|
2238 | 3694 |
self selection:nil. |
2046 | 3695 |
|
3696 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3697 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3698 |
! |
3699 |
||
1699 | 3700 |
handleCursorKey:aKey |
2715 | 3701 |
"handle a cursor key" |
3702 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3703 |
|next menu item isVrt backKey p1 p2 |
2354 | 3704 |
idx0 "{ Class:SmallInteger }" |
687 | 3705 |
idx "{ Class:SmallInteger }" |
1705 | 3706 |
size "{ Class:SmallInteger }" |
687 | 3707 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3708 |
(size := items size) == 0 ifTrue:[ |
3938 | 3709 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
3710 |
^ self |
|
388 | 3711 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3712 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3713 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3714 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3715 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3716 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3717 |
) ifTrue:[ |
3938 | 3718 |
selection isNil ifTrue:[ |
3719 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
|
3720 |
^ superMenu handleCursorKey:aKey |
|
3721 |
]. |
|
3722 |
idx := 0. |
|
3723 |
||
3724 |
isVrt ifTrue:[ |
|
3725 |
"/ used because of vertical scrolling |
|
3726 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
3727 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
|
3728 |
]. |
|
3729 |
] ifFalse:[ |
|
3730 |
idx := self indexOf:selection. |
|
3731 |
]. |
|
3732 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
|
3733 |
||
3734 |
idx0 := idx. |
|
3735 |
size timesRepeat:[ |
|
3736 |
|el| |
|
3737 |
||
3738 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3739 |
||
3740 |
idx > size ifTrue:[ |
|
3741 |
idx := 0 "1" |
|
3742 |
] ifFalse:[ |
|
3743 |
idx < 0 ifTrue:[ |
|
3744 |
idx := size |
|
3745 |
] |
|
3746 |
]. |
|
3747 |
||
3748 |
idx == 0 ifTrue:[ |
|
3749 |
self selection:nil. |
|
3750 |
^ self |
|
3751 |
] ifFalse:[ |
|
3752 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3753 |
el canSelect ifTrue:[ |
|
3754 |
el hasDelayedMenu ifTrue:[ |
|
3755 |
"/ do not open menu |
|
3756 |
self selection:el openMenu:false |
|
3757 |
] ifFalse:[ |
|
3758 |
"/ open comes from style-sheet |
|
3759 |
self selection:el. |
|
3760 |
]. |
|
3761 |
^ self |
|
3762 |
]. |
|
3763 |
] |
|
3764 |
]. |
|
3765 |
idx == idx0 ifTrue:[ |
|
3766 |
^ self |
|
3767 |
]. |
|
3768 |
]. |
|
3769 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3770 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3771 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3772 |
superMenu notNil ifTrue:[ |
3938 | 3773 |
p1 := self translateGrabPoint:0. |
3774 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3775 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3776 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3777 |
isVrt ifTrue:[ |
3938 | 3778 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
3779 |
backKey := #CursorRight |
|
3780 |
] ifFalse:[ |
|
3781 |
backKey := #CursorLeft. |
|
3782 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3783 |
] ifFalse:[ |
3938 | 3784 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
3785 |
backKey := #CursorDown |
|
3786 |
] ifFalse:[ |
|
3787 |
backKey := #CursorUp. |
|
3788 |
] |
|
3789 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3790 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3791 |
aKey == backKey ifTrue:[ |
3938 | 3792 |
superMenu isNil ifTrue:[ |
3793 |
self accept:nil |
|
3794 |
] ifFalse:[ |
|
3795 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3796 |
superMenu handleCursorKey:aKey |
|
3797 |
] ifFalse:[ |
|
3798 |
superMenu selection hideSubmenu |
|
3799 |
] |
|
3800 |
]. |
|
3801 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3802 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3803 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3804 |
selection isNil ifTrue:[ |
3938 | 3805 |
superMenu isNil ifTrue:[^ self accept:nil]. |
3806 |
||
3807 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3808 |
superMenu handleCursorKey:aKey |
|
3809 |
] ifFalse:[ |
|
3810 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
|
3811 |
self selectionIndex:item |
|
3812 |
] |
|
3813 |
]. |
|
3814 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3815 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3816 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3817 |
selection hasSubmenu ifTrue:[ |
3938 | 3818 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
3819 |
selection toggleSubmenuVisibility |
|
3820 |
] ifFalse:[ |
|
3821 |
menu selectionIndex:1 |
|
3822 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3823 |
] ifFalse:[ |
3938 | 3824 |
superMenu notNil ifTrue:[ |
3825 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3826 |
superMenu handleCursorKey:aKey |
|
3827 |
] |
|
3828 |
] ifFalse:[ |
|
3829 |
self accept:nil |
|
3830 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3831 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3832 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3833 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3834 |
handleKeyPress:key |
2715 | 3835 |
"any key is pressed" |
3836 |
||
2219 | 3837 |
|item inMenu| |
1699 | 3838 |
|
3839 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
3938 | 3840 |
self handleReturnPressed. |
3841 |
^ true. |
|
3754 | 3842 |
]. |
3843 |
key isCharacter ifTrue:[ |
|
1862 | 3844 |
"/ selection notNil ifTrue:[ |
3845 |
"/ inMenu := self |
|
3846 |
"/ ] ifFalse:[ |
|
3847 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3848 |
"/ ]. |
|
3938 | 3849 |
inMenu := self. |
3850 |
||
3851 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
|
3852 |
inMenu selection:item |
|
3853 |
]. |
|
3854 |
^ true |
|
3855 |
]. |
|
3856 |
(key == #CursorDown |
|
3857 |
or:[key == #CursorUp |
|
3858 |
or:[key == #CursorLeft |
|
3859 |
or:[key == #CursorRight]]]) |
|
3754 | 3860 |
ifTrue:[ |
3938 | 3861 |
self handleCursorKey:key. |
3862 |
^ true |
|
3754 | 3863 |
]. |
3864 |
^ false. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3865 |
! |
1699 | 3866 |
|
3867 |
handlePointerLeave:state |
|
3868 |
self pointerEntersItem:nil. |
|
3869 |
super pointerLeave:state |
|
3870 |
! |
|
3871 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3872 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3873 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3874 |
|
2238 | 3875 |
|sensor subm item| |
3876 |
||
3877 |
(item := selection) isNil ifTrue:[ |
|
4089 | 3878 |
superMenu notNil ifTrue:[ |
3879 |
item := superMenu selection. |
|
3880 |
||
3881 |
item value notNil ifTrue:[ |
|
3882 |
"/ is a delayed menu |
|
3883 |
self accept:item |
|
3884 |
] ifFalse:[ |
|
3885 |
item toggleSubmenuVisibility |
|
3886 |
] |
|
3887 |
] ifFalse:[ |
|
3888 |
self accept |
|
3889 |
]. |
|
3890 |
^ self |
|
1841 | 3891 |
]. |
3892 |
selection hasSubmenu ifTrue:[ |
|
4089 | 3893 |
selection hasDelayedMenu ifFalse:[ |
3894 |
selection toggleSubmenuVisibility. |
|
3895 |
^ self |
|
3896 |
]. |
|
3897 |
subm := selection currentSubmenu. |
|
3898 |
||
3899 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
3900 |
selection toggleSubmenuVisibility. |
|
3901 |
^ self |
|
3902 |
]. |
|
3903 |
self openDelayed:nil |
|
1841 | 3904 |
]. |
3905 |
self accept. |
|
3906 |
||
2238 | 3907 |
" test for toggle " |
3908 |
item isToggle ifTrue:[ |
|
4089 | 3909 |
self selection:item. |
2238 | 3910 |
] ifFalse:[ |
4089 | 3911 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
3912 |
^ self |
|
3913 |
] |
|
3938 | 3914 |
]. |
1841 | 3915 |
|
3916 |
(sensor := self sensor) isNil ifTrue:[ |
|
4089 | 3917 |
^ self |
3938 | 3918 |
]. |
3919 |
||
3920 |
[ |
|
4089 | 3921 |
sensor flushKeyboardFor:nil. |
3922 |
Delay waitForSeconds:0.1. |
|
3923 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3924 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3925 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3926 |
|
1699 | 3927 |
pointerEntersItem:anItemOrNil |
3928 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3929 |
redraw the new item highlighted." |
3930 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3931 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3932 |
|
1699 | 3933 |
( anItemOrNil notNil |
3934 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3935 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3936 |
and:[self isPopUpView not]]]) ifTrue:[ |
3938 | 3937 |
anItemOrNil isButton ifTrue:[ |
3938 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
|
3939 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
3940 |
) ifTrue:[ |
|
3941 |
newItem := anItemOrNil |
|
3942 |
] |
|
3943 |
] ifFalse:[ |
|
3944 |
(self enteredLevel ~~ 0 |
|
3945 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3946 |
) ifTrue:[ |
|
3947 |
newItem := anItemOrNil |
|
3948 |
] |
|
3949 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3950 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3951 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3952 |
newItem ~~ enteredItem ifTrue:[ |
3938 | 3953 |
oldItem := enteredItem. |
3954 |
enteredItem := newItem. |
|
3955 |
||
3956 |
oldItem notNil ifTrue:[ |
|
3957 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
|
3958 |
]. |
|
3959 |
||
3960 |
enteredItem notNil ifTrue:[ |
|
3961 |
self invalidateItem:enteredItem repairNow:true. |
|
3962 |
]. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3963 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3964 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3965 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3966 |
processHideMenuEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3967 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3968 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3969 |
"Modified: / 29-06-2011 / 16:39:36 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3970 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3971 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3972 |
processMenuEnterItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3973 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3974 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3975 |
"Created: / 29-06-2011 / 13:18:05 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3976 |
"Modified: / 29-06-2011 / 16:39:29 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3977 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3978 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3979 |
processMenuSelectItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3980 |
|winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3981 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3982 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3983 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3984 |
masterGroup := winGrp previousGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3985 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3986 |
winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3987 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3988 |
item := ev item. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3989 |
itemIndex := ev itemIndex. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3990 |
itemValue := ev itemValue. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3991 |
menuReceiver := ev menuReceiver. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3992 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3993 |
acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3994 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3995 |
(item showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3996 |
and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3997 |
ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3998 |
winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3999 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4000 |
acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4001 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4002 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4003 |
"Modified: / 29-06-2011 / 16:32:36 / cg" |
388 | 4004 |
! ! |
4005 |
||
2251 | 4006 |
!MenuPanel methodsFor:'focus handling'! |
4007 |
||
3187 | 4008 |
canTab |
4009 |
"depends whether I'am a toolbar and selectable items exists |
|
4010 |
" |
|
4011 |
|selectableItem| |
|
4012 |
||
4013 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3938 | 4014 |
selectableItem := self firstItemSelectable. |
4015 |
^ selectableItem notNil |
|
3187 | 4016 |
]. |
4017 |
^ false |
|
4018 |
! |
|
4019 |
||
4020 |
focusComesByTab |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4021 |
"returns true if focus comes by tab and should be drawn" |
3187 | 4022 |
|
4023 |
focusComesByTab == true ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4024 |
(shown and:[self hasFocus]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4025 |
^ true |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4026 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4027 |
focusComesByTab := false. |
3187 | 4028 |
]. |
4029 |
^ false |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4030 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4031 |
"Modified: / 29-06-2011 / 16:23:09 / cg" |
3187 | 4032 |
! |
4033 |
||
4034 |
focusComesByTab:aBoolean |
|
4035 |
"only handled for toolBars" |
|
4036 |
||
4037 |
|selectableItem| |
|
4038 |
||
4039 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4040 |
focusComesByTab := aBoolean. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4041 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4042 |
self hasSelection ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4043 |
^ self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4044 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4045 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4046 |
aBoolean ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4047 |
selectableItem := self firstItemSelectable. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4048 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4049 |
self selection:selectableItem openMenu:false. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4050 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4051 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4052 |
"Modified: / 29-06-2011 / 16:23:19 / cg" |
3187 | 4053 |
! |
4054 |
||
2251 | 4055 |
hasKeyboardFocus:aBoolean |
2715 | 4056 |
"notification from the windowGroup that I got/lost the keyboard focus." |
4057 |
||
2251 | 4058 |
|focusView| |
4059 |
||
4060 |
self isPopUpView ifTrue:[ |
|
3938 | 4061 |
"/ not visible for popup menus |
4062 |
^ super hasKeyboardFocus:aBoolean |
|
2251 | 4063 |
]. |
4064 |
||
4065 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3938 | 4066 |
hasImplicitGrap ~~ true ifTrue:[ |
4067 |
focusView := windowGroup focusView. |
|
4068 |
||
4069 |
focusView == self ifFalse:[ |
|
4070 |
self selection:nil. |
|
4071 |
] |
|
4072 |
] |
|
4073 |
]. |
|
2251 | 4074 |
super hasKeyboardFocus:aBoolean. |
3142 | 4075 |
! |
4076 |
||
3187 | 4077 |
showFocus:focusComesByTab |
4078 |
self focusComesByTab:focusComesByTab. |
|
4079 |
super showFocus:focusComesByTab. |
|
4080 |
! |
|
4081 |
||
4082 |
showNoFocus:focusByTab |
|
4083 |
self focusComesByTab:false. |
|
4084 |
super showNoFocus:focusByTab. |
|
4085 |
! |
|
4086 |
||
4087 |
supportsFocusOnTab |
|
4088 |
"returns true if focus is supported |
|
4089 |
" |
|
4090 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 4091 |
! |
4092 |
||
4093 |
wantsFocusWithButtonPress |
|
3187 | 4094 |
"needs only the focus if I'am a toolbar; all events are delegated |
4095 |
to my subMenus" |
|
4096 |
||
4097 |
^ self isPopUpView not |
|
2251 | 4098 |
! ! |
4099 |
||
388 | 4100 |
!MenuPanel methodsFor:'grabbing'! |
4101 |
||
1699 | 4102 |
doGrab |
4103 |
relativeGrabOrigin := nil. |
|
4104 |
||
4105 |
superMenu notNil ifTrue:[ |
|
3938 | 4106 |
superMenu doGrab |
1699 | 4107 |
] ifFalse:[ |
3938 | 4108 |
hasImplicitGrap ~~ true ifTrue:[ |
4109 |
self grabMouseAndKeyboard. |
|
4110 |
hasImplicitGrap := true |
|
4111 |
] |
|
1699 | 4112 |
] |
4113 |
! |
|
4114 |
||
4115 |
doUngrab:forceDo |
|
4116 |
||
4117 |
relativeGrabOrigin := nil. |
|
1767 | 4118 |
self clearImplicitGrab. |
1699 | 4119 |
|
4120 |
superMenu notNil ifTrue:[ |
|
3938 | 4121 |
forceDo ifTrue:[ |
4122 |
superMenu doUngrab:true |
|
4123 |
]. |
|
4124 |
^ self |
|
1699 | 4125 |
]. |
4126 |
||
4127 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3938 | 4128 |
^ self |
1699 | 4129 |
]. |
4130 |
||
4131 |
forceDo ifFalse:[ |
|
3938 | 4132 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
4133 |
^ self |
|
4134 |
]. |
|
1699 | 4135 |
]. |
4136 |
self ungrabMouseAndKeyboard. |
|
4137 |
self selection:nil. |
|
4138 |
hasImplicitGrap := nil. |
|
1703 | 4139 |
prevFocusView := nil. |
1699 | 4140 |
! |
4141 |
||
1630 | 4142 |
grabKeyboard |
2715 | 4143 |
"grap the keyboard; keep previous grab" |
4144 |
||
1630 | 4145 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 4146 |
^ super grabKeyboard |
1630 | 4147 |
! |
4148 |
||
388 | 4149 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4150 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4151 |
|
3754 | 4152 |
|winGroup sensor activeGrab| |
3142 | 4153 |
|
4154 |
winGroup := self windowGroup. |
|
4155 |
||
4156 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
3938 | 4157 |
prevFocusView isNil ifTrue:[ |
4158 |
prevFocusView := winGroup focusView. |
|
4159 |
]. |
|
4160 |
sensor := self sensor. |
|
4161 |
||
4162 |
device activePointerGrab ~~ self ifTrue:[ |
|
4163 |
sensor flushMotionEventsFor:nil. |
|
4164 |
||
4165 |
(self grabPointer) ifFalse:[ |
|
4166 |
Delay waitForSeconds:0.1. |
|
4167 |
(self grabPointer) ifFalse:[ |
|
4168 |
"give up" |
|
4169 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
|
4170 |
self unmap |
|
4171 |
] |
|
4172 |
] |
|
4173 |
]. |
|
4174 |
||
4175 |
(activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[ |
|
4176 |
device sync. |
|
4177 |
"/ cg: mhmh - should we flush for all or for the activeGrab only ? |
|
3754 | 4178 |
"/ activeGrab notNil ifTrue:[ |
4179 |
"/ sensor flushKeyboardFor:activeGrab. |
|
4180 |
"/ ]. |
|
3938 | 4181 |
sensor flushKeyboardFor:nil. |
4182 |
self grabKeyboard. |
|
4183 |
] |
|
388 | 4184 |
] |
4185 |
||
3158 | 4186 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4187 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 4188 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 4189 |
! |
4190 |
||
1630 | 4191 |
grabPointerWithCursor:aCursorOrNil |
2715 | 4192 |
"grap the pointer; keep previous grab" |
4193 |
||
1630 | 4194 |
previousPointerGrab := device activePointerGrab. |
1699 | 4195 |
hasImplicitGrap := true. |
2715 | 4196 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 4197 |
! |
4198 |
||
4199 |
ungrabKeyboard |
|
2715 | 4200 |
"ungrap the keyboard; restore previous grab" |
4201 |
||
1630 | 4202 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4203 |
|
2579 | 4204 |
(previousKeyboardGrab notNil |
4205 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3938 | 4206 |
device grabKeyboardInView:previousKeyboardGrab. |
2579 | 4207 |
]. |
1630 | 4208 |
! |
4209 |
||
388 | 4210 |
ungrabMouseAndKeyboard |
2715 | 4211 |
"ungrab resources (mouse and keyboard)" |
4212 |
||
1630 | 4213 |
self ungrabPointer. |
4214 |
self ungrabKeyboard. |
|
4215 |
! |
|
4216 |
||
4217 |
ungrabPointer |
|
2715 | 4218 |
"ungrap the pointer; restore previous grab" |
4219 |
||
1630 | 4220 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4221 |
|
2579 | 4222 |
(previousPointerGrab notNil |
4223 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3938 | 4224 |
device grabPointerInView:previousPointerGrab. |
1630 | 4225 |
]. |
388 | 4226 |
! ! |
4227 |
||
1251 | 4228 |
!MenuPanel methodsFor:'help'! |
4229 |
||
3441 | 4230 |
flyByHelpSpec |
4231 |
"allows subclasses to provide texts" |
|
4232 |
||
4233 |
^ IdentityDictionary new |
|
4234 |
! |
|
4235 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4236 |
flyByHelpTextAt:aPoint |
2058 | 4237 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4238 |
If there is a selection, that items helpText is used (ignoring the given point)." |
4239 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4240 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4241 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4242 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4243 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4244 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4245 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4246 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4247 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4248 |
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
|
4249 |
^ nil |
2058 | 4250 |
! |
4251 |
||
4252 |
flyByHelpTextForItem:anItem |
|
2715 | 4253 |
"returns the helpText for an item (empty if none)" |
4254 |
||
2063 | 4255 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4256 |
^ anItem flyByHelpText. |
2058 | 4257 |
! |
4258 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4259 |
flyByHelpTextForKey:aKey |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4260 |
|app text| |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4261 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4262 |
app := self application. |
3441 | 4263 |
app notNil ifTrue:[ |
3938 | 4264 |
text := self application flyByHelpTextForKey:aKey. |
4265 |
text notNil ifTrue:[^ text]. |
|
3441 | 4266 |
]. |
4267 |
^ 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
|
4268 |
! |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4269 |
|
1251 | 4270 |
helpText |
2715 | 4271 |
"return the helpText for the currently selected item (empty if none)" |
4272 |
||
1613 | 4273 |
^ self helpTextForItem:selection |
1251 | 4274 |
! |
4275 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4276 |
helpTextAt:aPoint |
1252 | 4277 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4278 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
4279 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4280 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4281 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4282 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4283 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4284 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4285 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4286 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4287 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4288 |
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
|
4289 |
^ nil |
1613 | 4290 |
! |
4291 |
||
4292 |
helpTextForItem:anItem |
|
2715 | 4293 |
"returns the helpText for an item (empty if none)" |
4294 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4295 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4296 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4297 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4298 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4299 |
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
|
4300 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4301 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4302 |
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
|
4303 |
dstMenu notNil ifTrue:[ |
3938 | 4304 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
4305 |
item := dstMenu itemAtPoint:dstPoint. |
|
4306 |
aBlock value:dstMenu value:item. |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4307 |
] |
1251 | 4308 |
! ! |
4309 |
||
794 | 4310 |
!MenuPanel methodsFor:'image registration'! |
4311 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
4312 |
imageOnMyDevice:anImage |
2715 | 4313 |
"returns image registered on device" |
4314 |
||
2770 | 4315 |
^ self class image:anImage value onDevice:device |
794 | 4316 |
! |
4317 |
||
4318 |
lightenedImageOnDevice:anImage |
|
2715 | 4319 |
"returns lightened image registered on device" |
4320 |
||
794 | 4321 |
^ self class lightenedImage:anImage onDevice:device |
4322 |
! ! |
|
4323 |
||
1688 | 4324 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 4325 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4326 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4327 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4328 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4329 |
|
388 | 4330 |
create |
2715 | 4331 |
"create the shadow view for a none contained submenu" |
4332 |
||
388 | 4333 |
super create. |
4334 |
||
4335 |
self isPopUpView ifTrue:[ |
|
3938 | 4336 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
4337 |
shadowView isNil ifTrue:[ |
|
4338 |
shadowView := (ShadowView onDevice:device) for:self |
|
4339 |
] ifFalse:[ |
|
4340 |
self saveUnder:true. |
|
4341 |
]. |
|
4342 |
] |
|
388 | 4343 |
] ifFalse:[ |
3938 | 4344 |
self hasExplicitExtent ifTrue:[ |
4345 |
(self width) == (superView width) ifTrue:[ |
|
4346 |
self verticalLayout:false |
|
4347 |
] |
|
4348 |
] |
|
388 | 4349 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4350 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4351 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 4352 |
! |
4353 |
||
4354 |
destroy |
|
2715 | 4355 |
"destroy items and shadowView; remove dependencies" |
4356 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4357 |
self clearLastActiveMenu. |
2051 | 4358 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 4359 |
items := nil. |
4360 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4361 |
|
388 | 4362 |
super destroy. |
3142 | 4363 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4364 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4365 |
|
2051 | 4366 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4367 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4368 |
|
616 | 4369 |
fetchDeviceResources |
2715 | 4370 |
"fetch device colors, to avoid reallocation at redraw time" |
4371 |
||
2219 | 4372 |
|style| |
4373 |
||
2374 | 4374 |
superMenu notNil ifTrue:[ |
3938 | 4375 |
styleSheet := superMenu styleSheet |
2219 | 4376 |
]. |
616 | 4377 |
|
4378 |
super fetchDeviceResources. |
|
4379 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4380 |
"/ 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
|
4381 |
"/ (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
|
4382 |
|
616 | 4383 |
superMenu isNil ifTrue:[ |
3938 | 4384 |
rightArrow isNil ifTrue:[ |
4385 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
|
4386 |
]. |
|
4387 |
fgColor := fgColor onDevice:device. |
|
4388 |
style := styleSheet name. |
|
4389 |
||
4390 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
|
4391 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
4392 |
] ifFalse:[ |
|
4393 |
rightArrowShadow := nil |
|
4394 |
]. |
|
616 | 4395 |
] ifFalse:[ |
3938 | 4396 |
rightArrow := superMenu rightArrow. |
4397 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4398 |
||
4399 |
self foregroundColor:(superMenu foregroundColor). |
|
4400 |
self font:(superMenu font). |
|
2761 | 4401 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4402 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4403 |
|
1829 | 4404 |
items notNil ifTrue:[ |
3938 | 4405 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 4406 |
]. |
4407 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4408 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 4409 |
! |
4410 |
||
580 | 4411 |
initStyle |
4412 |
"initialize style specific stuff" |
|
4413 |
||
2919 | 4414 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
4061 | 4415 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
4416 |
#'menu.itemHorizontalSpace' |
|
4417 |
#'popup.hideOnRelease' |
|
4418 |
)> |
|
2609 | 4419 |
|fn| |
4420 |
||
580 | 4421 |
super initStyle. |
616 | 4422 |
|
2883 | 4423 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
4424 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4425 |
buttonInsetX := buttonInsetX abs. |
|
4426 |
||
4427 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
4428 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4429 |
buttonInsetY := buttonInsetY abs. |
|
4430 |
||
4431 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
4432 |
itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ]. |
|
4433 |
||
4434 |
||
4061 | 4435 |
fgColor := DefaultForegroundColor. |
4436 |
fgColor isNil ifTrue:[ fgColor := Color black ]. |
|
2609 | 4437 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
4438 |
fn := self class defaultFont. |
|
2610 | 4439 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 4440 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4441 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4442 |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4443 |
buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4444 |
buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4445 |
buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4446 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4447 |
self updateLevelAndBorder. |
4061 | 4448 |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4449 |
"Modified (format): / 19-01-2012 / 13:19:19 / cg" |
580 | 4450 |
! |
4451 |
||
388 | 4452 |
initialize |
2715 | 4453 |
"set default configuration" |
4454 |
||
388 | 4455 |
super initialize. |
616 | 4456 |
|
2877 | 4457 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4458 |
enabled := true. |
3881 | 4459 |
self originChangedFlag:false extentChangedFlag:false. |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4460 |
"/ explicitExtent := nil. |
2253 | 4461 |
shortKeyInset := 0. |
4462 |
mustRearrange := false. |
|
4463 |
showSeparatingLines := false. |
|
4464 |
showGroupDivider := true. |
|
3780 | 4465 |
hideOnRelease := defaultHideOnRelease. |
388 | 4466 |
! |
4467 |
||
1573 | 4468 |
map |
3938 | 4469 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4470 |
If the grab fails, try again and unmap myself if that fails too." |
4471 |
||
1791 | 4472 |
|loIndices loItems| |
388 | 4473 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4474 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4475 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4476 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4477 |
self becomesActiveMenu. |
1573 | 4478 |
super map. |
2681 | 4479 |
self addDependencies. |
388 | 4480 |
|
1785 | 4481 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4482 |
loItems := items ? #[]. |
4483 |
||
4484 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4485 |
|
388 | 4486 |
self isPopUpView ifTrue:[ |
3938 | 4487 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4488 |
] ifFalse:[ |
3938 | 4489 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4490 |
]. |
1791 | 4491 |
loItems do:[:el| el updateIndicators ]. |
388 | 4492 |
|
1785 | 4493 |
loIndices size > 0 ifTrue:[ |
3938 | 4494 |
self redrawX:0 y:0 width:width height:height. |
4495 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4496 |
]. |
4497 |
||
1177 | 4498 |
"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
|
4499 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4500 |
! |
4501 |
||
4502 |
realize |
|
2715 | 4503 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4504 |
|
2761 | 4505 |
|bgColor| |
4506 |
||
388 | 4507 |
self isPopUpView ifTrue:[ |
3938 | 4508 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4509 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4510 |
||
4511 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
|
4512 |
shadowView must be realized before self" |
|
4513 |
self hiddenOnRealize:true. |
|
4514 |
super realize. |
|
4515 |
self resize. |
|
4516 |
self makeFullyVisible. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4517 |
"/ self mustRearrange. |
3938 | 4518 |
shadowView notNil ifTrue:[ |
4519 |
shadowView realize. |
|
4520 |
]. |
|
4521 |
self raise. |
|
4522 |
self map. |
|
736 | 4523 |
] ifFalse:[ |
3938 | 4524 |
super realize. |
1767 | 4525 |
]. |
4526 |
self allSubViewsDo:[:aView| aView realize ]. |
|
3780 | 4527 |
"/ hideOnRelease := defaultHideOnRelease. |
388 | 4528 |
! |
4529 |
||
4530 |
recreate |
|
1832 | 4531 |
"this is called after a snapin or a migration. |
2715 | 4532 |
If the image was saved with an active menu, hide the menu" |
4533 |
||
1455 | 4534 |
selection := nil. |
388 | 4535 |
super recreate. |
4536 |
! |
|
4537 |
||
1130 | 4538 |
reinitStyle |
4539 |
"handle style change while being open (win32 only - for now)" |
|
4540 |
||
4541 |
super reinitStyle. |
|
4542 |
||
4543 |
self fetchDeviceResources. |
|
1811 | 4544 |
self mustRearrange. "/ care for changed font sizes etc. |
4545 |
||
4546 |
self do:[:anItem | |
|
3938 | 4547 |
anItem reinitStyle |
1811 | 4548 |
]. |
1130 | 4549 |
|
4550 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4551 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4552 |
! |
4553 |
||
388 | 4554 |
unmap |
1330 | 4555 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4556 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4557 |
|
3203 | 4558 |
mapTime := nil. |
4559 |
||
3975 | 4560 |
"hide all submenus opened within the menu" |
4561 |
self itemsDo:[:eachItem| |
|
4562 |
eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ]. |
|
4563 |
]. |
|
4564 |
||
2681 | 4565 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4566 |
self clearLastActiveMenu. |
1699 | 4567 |
self doUngrab:(superMenu isNil). |
4568 |
"/ self isPopUpView ifTrue:[ |
|
4569 |
"/ self doUngrab:(superMenu isNil) |
|
4570 |
"/ ]. |
|
3142 | 4571 |
prevFocusView := nil. |
388 | 4572 |
super unmap. |
4573 |
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
|
4574 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4575 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4576 |
updateLevelAndBorder |
3820 | 4577 |
"update level & border" |
4578 |
||
4579 |
<resource: #style (#'popup.borderWidth' |
|
3938 | 4580 |
#'popup.borderColor' |
4581 |
#'popup.level' |
|
4582 |
#'pullDownMenu.level' |
|
4583 |
)> |
|
3820 | 4584 |
|
4585 |
|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
|
4586 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4587 |
self isPopUpView ifTrue:[ |
3938 | 4588 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
4589 |
lvl := styleSheet at:#'popup.level' default:0. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4590 |
] ifFalse:[ |
3938 | 4591 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
4592 |
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
|
4593 |
]. |
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4594 |
bw ~~ 0 ifTrue:[ |
3938 | 4595 |
bc := styleSheet at:#'popup.borderColor' default:Color black. |
4596 |
self borderColor:bc |
|
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4597 |
]. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4598 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4599 |
self level:lvl. |
388 | 4600 |
! ! |
4601 |
||
1878 | 4602 |
!MenuPanel methodsFor:'keyboard control'! |
4603 |
||
4604 |
mnemonicViewNext:aKeyEvent |
|
4605 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4606 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4607 |
return the topMenu otherwise nil." |
4608 |
||
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4609 |
|menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel| |
2112 | 4610 |
|
4611 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4612 |
shown ifFalse:[^ nil]. |
4613 |
||
4614 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4615 |
lKey := uKey asLowercase. |
|
2112 | 4616 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4617 |
accessCharacterMatchQuery := |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4618 |
[:el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4619 |
|k| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4620 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4621 |
k := el accessCharacter. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4622 |
k == uKey or:[k == lKey] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4623 |
]. |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4624 |
maxShortCutSearchLevel := self class maxShortCutSearchLevel. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4625 |
|
2112 | 4626 |
selection notNil ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4627 |
"first lookup the current grapMenu before starting in the topMenu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4628 |
" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4629 |
menu := self detectGrabMenu. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4630 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4631 |
[ menu ~~ self ] whileTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4632 |
index := menu selectionIndex. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4633 |
list := menu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4634 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4635 |
maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4636 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4637 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4638 |
list size ~~ 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4639 |
"/ has item which responds to the mnemonic |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4640 |
menu processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4641 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4642 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4643 |
menu := menu superMenu. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4644 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4645 |
index := self selectionIndex. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4646 |
list := self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4647 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4648 |
maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4649 |
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
|
4650 |
|
2112 | 4651 |
] ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4652 |
index := 99999. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4653 |
list := nil. |
3938 | 4654 |
]. |
2112 | 4655 |
|
2374 | 4656 |
list isNil ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4657 |
list := self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4658 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4659 |
maxDepth:maxShortCutSearchLevel from:1 to:index |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4660 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4661 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4662 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4663 |
list isNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4664 |
"/ must clear existing selection |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4665 |
self selection:nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4666 |
^ nil |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4667 |
] |
2112 | 4668 |
]. |
4669 |
||
4670 |
"/ has item which responds to the mnemonic |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4671 |
self processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4672 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4673 |
"Modified: / 06-10-2011 / 16:25:21 / cg" |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4674 |
! |
1878 | 4675 |
|
4676 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4677 |
"open all menus derived from sequence of item indices" |
4678 |
||
1878 | 4679 |
|item| |
4680 |
||
4681 |
anItemIndiceList size == 0 ifTrue:[ |
|
3938 | 4682 |
^ self |
1878 | 4683 |
]. |
4684 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4685 |
||
4686 |
(item notNil and:[item enabled]) ifTrue:[ |
|
3938 | 4687 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4688 |
self selection:item openMenu:true. |
|
4689 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4690 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4691 |
! |
1878 | 4692 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4693 |
processCollectedShortcutIndices:indices |
1878 | 4694 |
|menu item| |
4695 |
||
4696 |
indices size == 0 ifTrue:[ |
|
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4697 |
^ self |
1878 | 4698 |
]. |
4699 |
menu := self. |
|
4700 |
||
3192 | 4701 |
"/ first lookup in current open submenus |
1878 | 4702 |
[menu selectionIndex == indices first] whileTrue:[ |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4703 |
( (item := menu selection) isNil |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4704 |
or:[(menu := item currentSubmenu) isNil] |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4705 |
) ifTrue:[ "/ selected but no submenu open - not handled |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4706 |
^ self |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4707 |
]. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4708 |
indices removeFirst. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4709 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4710 |
indices isEmpty ifTrue:[ |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4711 |
menu selection:nil. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4712 |
^ self |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4713 |
] |
1878 | 4714 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4715 |
menu openMenusFromItemIndices:indices. |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4716 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4717 |
"Modified: / 24-03-2011 / 11:19:38 / cg" |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4718 |
"Created: / 06-10-2011 / 16:19:30 / cg" |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4719 |
! |
1878 | 4720 |
|
4721 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4722 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4723 |
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
|
4724 |
Otherwise return false." |
2715 | 4725 |
|
3431 | 4726 |
|menu rawKey logicalKey list item selectableItem| |
1878 | 4727 |
|
4728 |
superMenu notNil ifTrue:[ |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4729 |
^ superMenu processShortcut:aKeyEvent |
1878 | 4730 |
]. |
4731 |
shown ifFalse:[^ false]. |
|
4732 |
||
3431 | 4733 |
logicalKey := aKeyEvent key. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4734 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4735 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4736 |
|
3192 | 4737 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
3431 | 4738 |
) includes:logicalKey |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4739 |
) ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4740 |
^ false. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4741 |
]. |
3431 | 4742 |
rawKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4743 |
item := nil. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4744 |
menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu |
1878 | 4745 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4746 |
"/ 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
|
4747 |
aKeyEvent isKeyReleaseEvent ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4748 |
selection isNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4749 |
prevFocusView := self windowGroup focusView. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4750 |
self requestFocus. "/ self windowGroup focusView:self. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4751 |
selectableItem := self firstItemSelectable. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4752 |
self selection:selectableItem openMenu:false. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4753 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4754 |
prevFocusView requestFocus. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4755 |
self selection:nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4756 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4757 |
^ true |
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4758 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4759 |
|
1878 | 4760 |
[true] whileTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4761 |
list := menu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4762 |
selectItemIndicesFor:[:el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4763 |
|skey| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4764 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4765 |
item := el. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4766 |
el ignoreShortcutKeys ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4767 |
false |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4768 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4769 |
skey := el shortcutKey. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4770 |
skey == rawKey or:[skey == logicalKey] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4771 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4772 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4773 |
maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4774 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4775 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4776 |
list size ~~ 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4777 |
"/ has item which responds to the shortcut |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4778 |
item hasSubmenu ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4779 |
menu accept:item |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4780 |
] ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4781 |
menu processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4782 |
self requestFocus. "/ self windowGroup focusView:self. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4783 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4784 |
^ true |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4785 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4786 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4787 |
menu == self ifTrue:[ ^ false ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4788 |
menu := self. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4789 |
]. |
2219 | 4790 |
^ false "/ never reached |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4791 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4792 |
"Modified: / 06-10-2011 / 16:19:27 / cg" |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4793 |
! |
1878 | 4794 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4795 |
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
|
4796 |
"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
|
4797 |
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
|
4798 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4799 |
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
|
4800 |
is created and passed through if the block returns false. |
2715 | 4801 |
Otherwise the item is not asked for its submenu." |
4802 |
||
2112 | 4803 |
|start stop| |
4804 |
||
4805 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4806 |
||
4807 |
start := aStart max:1. |
|
4808 |
stop := aStop min:(items size). |
|
4809 |
||
3938 | 4810 |
start to:stop do:[:i| |
4811 |
|item menu result| |
|
4812 |
||
4813 |
item := items at:i. |
|
4814 |
(item enabled and:[item isVisible]) ifTrue:[ |
|
4815 |
(aOneArgBlock value:item) ifTrue:[ |
|
4816 |
^ OrderedCollection with:i |
|
4817 |
]. |
|
4818 |
||
4819 |
maxDepth > 1 ifTrue:[ |
|
4820 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
|
4821 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
|
4822 |
menu := item setupSubmenu. |
|
4823 |
||
4824 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
|
4825 |
result := menu |
|
4826 |
selectItemIndicesFor:aOneArgBlock |
|
4827 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
|
4828 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
|
4829 |
||
4830 |
result notNil ifTrue:[ |
|
4831 |
result addFirst:i. |
|
4832 |
^ result |
|
4833 |
]. |
|
4834 |
]. |
|
4835 |
]. |
|
4836 |
]. |
|
4837 |
]. |
|
4838 |
]. |
|
1878 | 4839 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4840 |
^ nil |
3128 | 4841 |
|
4842 |
"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
|
4843 |
! ! |
1878 | 4844 |
|
388 | 4845 |
!MenuPanel methodsFor:'misc'! |
4846 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4847 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4848 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4849 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4850 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4851 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4852 |
|
388 | 4853 |
superMenu |
2715 | 4854 |
"returns supermenu or nil" |
4855 |
||
388 | 4856 |
^ superMenu |
4857 |
! |
|
4858 |
||
4859 |
topMenu |
|
2715 | 4860 |
"returns the topMenu; the one having no superMenu" |
4861 |
||
1791 | 4862 |
|menu smenu| |
4863 |
||
4864 |
menu := self. |
|
4865 |
||
4866 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
3938 | 4867 |
menu := smenu |
1791 | 4868 |
]. |
4869 |
^ menu |
|
388 | 4870 |
! ! |
4871 |
||
1825 | 4872 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4873 |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4874 |
printOn:aStream |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4875 |
|label| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4876 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4877 |
aStream nextPutAll:'Menu:'. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4878 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4879 |
self do:[:eachItem| |
3938 | 4880 |
label := eachItem label. |
4881 |
label notEmptyOrNil ifTrue:[ |
|
4882 |
aStream nextPutAll:' '. |
|
4883 |
label printOn:aStream. |
|
4884 |
]. |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4885 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4886 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4887 |
|
388 | 4888 |
!MenuPanel methodsFor:'private'! |
4889 |
||
434 | 4890 |
application |
2715 | 4891 |
"optimize access to retrive the application" |
4892 |
||
2374 | 4893 |
application notNil ifTrue:[^ application ]. |
434 | 4894 |
|
4895 |
superMenu notNil ifTrue:[ |
|
3938 | 4896 |
application := superMenu application. |
4897 |
^ application |
|
2253 | 4898 |
]. |
4899 |
application := super application. |
|
2374 | 4900 |
^ application |
1872 | 4901 |
! |
434 | 4902 |
|
3725 | 4903 |
detectItem:aBlock |
4904 |
"returns the item for which aBlock returns true." |
|
4905 |
||
4906 |
items notNil ifTrue:[ |
|
3938 | 4907 |
items keysAndValuesDo:[:anIndex :anItem| |
4908 |
(aBlock value:anItem) ifTrue:[^ anItem]. |
|
4909 |
]. |
|
3725 | 4910 |
]. |
4911 |
^ nil |
|
4912 |
! |
|
4913 |
||
1572 | 4914 |
detectItemForKey:aKey |
4915 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4916 |
if no item is detected nil is returned." |
4917 |
||
1572 | 4918 |
|cIdx uKey lKey item| |
4919 |
||
1699 | 4920 |
items isNil ifTrue:[^ nil]. |
4921 |
||
1572 | 4922 |
cIdx := self selectionIndex. |
4923 |
uKey := aKey asUppercase. |
|
4924 |
lKey := aKey asLowercase. |
|
4925 |
||
3938 | 4926 |
items keysAndValuesDo:[:anIndex :anItem| |
4927 |
|char label| |
|
4928 |
||
4929 |
( anIndex ~~ cIdx |
|
4930 |
and:[anItem canSelect |
|
4931 |
and:[(label := anItem textLabel) notNil |
|
4932 |
and:[label size ~~ 0]]] |
|
4933 |
) ifTrue:[ |
|
4934 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4935 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4936 |
^ anItem |
|
4937 |
] |
|
4938 |
] ifFalse:[ |
|
4939 |
char := label at:1. |
|
4940 |
||
4941 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4942 |
anIndex > cIdx ifTrue:[ |
|
4943 |
^ anItem |
|
4944 |
]. |
|
4945 |
item isNil ifTrue:[item := anItem] |
|
4946 |
] |
|
4947 |
] |
|
4948 |
] |
|
1572 | 4949 |
]. |
4950 |
^ item |
|
4951 |
! |
|
4952 |
||
3725 | 4953 |
detectItemForLabel:aLabel |
4954 |
^ self detectItem:[:anItem | anItem label = aLabel]. |
|
4955 |
! |
|
4956 |
||
4957 |
detectItemForNameKey:aKey |
|
4958 |
^ self detectItem:[:anItem | anItem nameKey == aKey]. |
|
4959 |
! |
|
4960 |
||
388 | 4961 |
onEachPerform:aSelector withArgList:aList |
2715 | 4962 |
"on each item perform selector with an argument derived from aList" |
4963 |
||
388 | 4964 |
aList isCollection ifTrue:[ |
3938 | 4965 |
items size >= aList size ifTrue:[ |
4966 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4967 |
(items at:anIndex) perform:aSelector with:anArg |
|
4968 |
] |
|
4969 |
] |
|
388 | 4970 |
] ifFalse:[ |
3938 | 4971 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4972 |
] |
4973 |
! |
|
4974 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4975 |
registerImageOnDevice:anImage |
2269 | 4976 |
|
4977 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4978 |
^ self class image:anImage onDevice:device |
|
4979 |
||
4980 |
"/ |image| |
|
4981 |
"/ |
|
4982 |
"/ (image := anImage) notNil ifTrue:[ |
|
4983 |
"/ image device ~~ device ifTrue:[ |
|
4984 |
"/ image := image copy. |
|
4985 |
"/ ]. |
|
4986 |
"/ image := image onDevice:device. |
|
4987 |
"/ image := image clearMaskedPixels. |
|
4988 |
"/ ]. |
|
4989 |
"/ ^ image |
|
2355 | 4990 |
! |
4991 |
||
4992 |
superMenu:aSuperMenu |
|
2715 | 4993 |
"set my supermenu from which i'am activated" |
4994 |
||
2355 | 4995 |
superMenu := aSuperMenu. |
4996 |
||
2374 | 4997 |
superMenu notNil ifTrue:[ |
3938 | 4998 |
styleSheet := superMenu styleSheet. |
4999 |
rightArrow := superMenu rightArrow. |
|
5000 |
rightArrowShadow := superMenu rightArrowShadow. |
|
2355 | 5001 |
]. |
388 | 5002 |
! ! |
5003 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5004 |
!MenuPanel methodsFor:'private-activation'! |
687 | 5005 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5006 |
activeMenu |
2715 | 5007 |
"returns the current active menu or self (the top menu)" |
5008 |
||
687 | 5009 |
^ lastActiveMenu ? self |
5010 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5011 |
"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
|
5012 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5013 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5014 |
activeMenu:aMenu |
2715 | 5015 |
"set the current active menu" |
5016 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5017 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5018 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5019 |
"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
|
5020 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5021 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5022 |
becomesActiveMenu |
2715 | 5023 |
"submenu becomes the active menu" |
5024 |
||
3224 | 5025 |
mapTime isNil ifTrue:[ |
3938 | 5026 |
"/ set the mapTime if not yet done |
5027 |
mapTime := AbsoluteTime now. |
|
3224 | 5028 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5029 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5030 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5031 |
"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
|
5032 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5033 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5034 |
clearLastActiveMenu |
2715 | 5035 |
"reset the current active menu" |
5036 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5037 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5038 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5039 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5040 |
|
2251 | 5041 |
"/ prevFocusView notNil ifTrue:[ |
5042 |
"/ self windowGroup focusView:prevFocusView. |
|
5043 |
"/ prevFocusView := nil. |
|
5044 |
"/ ]. |
|
5045 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5046 |
top activeMenu == self ifTrue:[ |
3938 | 5047 |
top activeMenu:nil |
687 | 5048 |
] |
5049 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5050 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 5051 |
! |
5052 |
||
5053 |
mapTime |
|
3203 | 5054 |
"get the time the menu was activated or nil" |
2715 | 5055 |
|
687 | 5056 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5057 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5058 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
3203 | 5059 |
! |
5060 |
||
5061 |
mapTime:aTimestamp |
|
5062 |
"set the time the menu was activated" |
|
5063 |
||
5064 |
mapTime := aTimestamp. |
|
5065 |
||
5066 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
|
687 | 5067 |
! ! |
5068 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5069 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 5070 |
|
5071 |
hasScrollerAt:aDirection |
|
2715 | 5072 |
"returns true if a visible scroller at a direction exists" |
5073 |
||
2016 | 5074 |
|layout| |
5075 |
||
5076 |
self hasScrollers ifFalse:[ |
|
3938 | 5077 |
^ false |
2016 | 5078 |
]. |
5079 |
||
5080 |
aDirection == #PREV ifTrue:[ |
|
3938 | 5081 |
layout := items first layout. |
2016 | 5082 |
|
5083 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
3938 | 5084 |
ifFalse:[ layout left < margin] |
2016 | 5085 |
]. |
5086 |
layout := items last layout. |
|
5087 |
||
5088 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
3938 | 5089 |
ifFalse:[ layout right > (width - margin)] |
2016 | 5090 |
! |
5091 |
||
5092 |
hasScrollers |
|
2715 | 5093 |
"returns true if scrollers are needed" |
5094 |
||
2018 | 5095 |
|maxExtent first last isVert| |
5096 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5097 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 5098 |
|
5099 |
isVert := self verticalLayout. |
|
5100 |
||
5101 |
superView notNil ifTrue:[ |
|
3938 | 5102 |
((first := items first layout) isNil |
5103 |
or:[(last := items last layout) isNil] |
|
5104 |
) ifTrue:[ |
|
5105 |
^ false |
|
5106 |
]. |
|
5107 |
isVert ifTrue:[ |
|
5108 |
^ first top < 0 or:[last bottom > height] |
|
5109 |
]. |
|
5110 |
^ first left < 0 or:[last right > width] |
|
2018 | 5111 |
]. |
5112 |
maxExtent := self maxExtent. |
|
5113 |
isVert ifTrue:[ |
|
3938 | 5114 |
^ (height >= maxExtent y) |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5115 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5116 |
^ (width >= maxExtent x) |
2016 | 5117 |
! |
5118 |
||
5119 |
indexOfItemAtScroller:aDirection |
|
2715 | 5120 |
"returns the index of the item under the scroller or 0" |
5121 |
||
2016 | 5122 |
|bounds min max layout| |
5123 |
||
2860 | 5124 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 5125 |
bounds := self scrollerBoundsAt:aDirection. |
5126 |
||
5127 |
self verticalLayout ifTrue:[ |
|
3938 | 5128 |
min := bounds top. |
5129 |
max := bounds bottom. |
|
5130 |
||
5131 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5132 |
anItem isVisible ifTrue:[ |
|
5133 |
layout := anItem layout. |
|
5134 |
||
5135 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
5136 |
^ anIndex |
|
5137 |
]. |
|
5138 |
]. |
|
5139 |
]. |
|
2016 | 5140 |
] ifFalse:[ |
3938 | 5141 |
min := bounds left. |
5142 |
max := bounds right. |
|
5143 |
||
5144 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5145 |
anItem isVisible ifTrue:[ |
|
5146 |
layout := anItem layout. |
|
5147 |
||
5148 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
5149 |
^ anIndex |
|
5150 |
]. |
|
5151 |
]. |
|
5152 |
] |
|
2016 | 5153 |
]. |
5154 |
^ 0 |
|
5155 |
! |
|
5156 |
||
5157 |
makeItemVisible:anItem |
|
2715 | 5158 |
"make an item visible" |
5159 |
||
2018 | 5160 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
5161 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 5162 |
inv1 inv2| |
2018 | 5163 |
|
5164 |
( anItem notNil |
|
5165 |
and:[self hasScrollers |
|
5166 |
and:[(layout := anItem layout) notNil]] |
|
5167 |
) ifFalse:[ |
|
3938 | 5168 |
^ self |
2016 | 5169 |
]. |
2018 | 5170 |
index := self indexOfItem:anItem. |
2016 | 5171 |
boundsPREV := self scrollerBoundsAt:#PREV. |
5172 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
5173 |
||
2018 | 5174 |
isVertical := self verticalLayout. |
5175 |
||
5176 |
isVertical ifTrue:[ |
|
3938 | 5177 |
boundsMin := boundsPREV bottom. |
5178 |
boundsMax := boundsNEXT top. |
|
5179 |
layoutMin := layout top. |
|
5180 |
layoutMax := layout bottom. |
|
5181 |
windowSz := height. |
|
2018 | 5182 |
] ifFalse:[ |
3938 | 5183 |
boundsMin := boundsPREV right. |
5184 |
boundsMax := boundsNEXT left. |
|
5185 |
layoutMin := layout left. |
|
5186 |
layoutMax := layout right. |
|
5187 |
windowSz := width. |
|
2018 | 5188 |
]. |
5189 |
||
5190 |
||
5191 |
layoutMin < boundsMin ifTrue:[ |
|
3938 | 5192 |
layoutMin >= 0 ifTrue:[ |
5193 |
^ self |
|
5194 |
]. |
|
5195 |
"/ test whether is first visible item |
|
5196 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
5197 |
||
5198 |
index == 0 ifTrue:[ scr0 := margin ] |
|
5199 |
ifFalse:[ scr0 := boundsMin ]. |
|
5200 |
||
5201 |
delta := layoutMin negated + scr0. |
|
2016 | 5202 |
] ifFalse:[ |
3938 | 5203 |
layoutMax > boundsMax ifFalse:[ |
5204 |
^ self |
|
5205 |
]. |
|
5206 |
"/ test whether is last visible item |
|
5207 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
5208 |
||
5209 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
|
5210 |
ifFalse:[ scr0 := boundsMax ]. |
|
5211 |
||
5212 |
delta := scr0 - layoutMax. |
|
2018 | 5213 |
]. |
5214 |
delta == 0 ifTrue:[ ^ self ]. |
|
5215 |
||
2016 | 5216 |
doScroll := false. |
5217 |
||
5218 |
shown ifTrue:[ |
|
3938 | 5219 |
delta abs < (windowSz / 2) ifTrue:[ |
5220 |
doScroll := true. |
|
5221 |
self repairDamage |
|
5222 |
] |
|
2016 | 5223 |
]. |
2018 | 5224 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
5225 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 5226 |
|
5227 |
doScroll ifFalse:[ |
|
3938 | 5228 |
self invalidate. |
5229 |
^ self |
|
2016 | 5230 |
]. |
5231 |
||
2018 | 5232 |
windowSz := windowSz - margin - margin. |
5233 |
||
5234 |
scr0 := boundsMin. |
|
5235 |
scr1 := scr0 + delta abs. |
|
5236 |
scrSz := boundsMax - scr1. |
|
5237 |
||
5238 |
delta < 0 ifTrue:[ |
|
3938 | 5239 |
isVertical ifTrue:[ |
5240 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
5241 |
width:windowSz height:scrSz async:false. |
|
5242 |
||
5243 |
scr1 := scr0 + scrSz. |
|
5244 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
|
5245 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
5246 |
] ifFalse:[ |
|
5247 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
5248 |
width:scrSz height:windowSz async:false. |
|
5249 |
||
5250 |
scr1 := scr0 + scrSz. |
|
5251 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
|
5252 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
5253 |
]. |
|
5254 |
inv1 := boundsPREV. |
|
2016 | 5255 |
] ifFalse:[ |
3938 | 5256 |
isVertical ifTrue:[ |
5257 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
5258 |
width:windowSz height:scrSz async:false. |
|
5259 |
||
5260 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
|
5261 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
5262 |
] ifFalse:[ |
|
5263 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
5264 |
width:scrSz height:windowSz async:false. |
|
5265 |
||
5266 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
|
5267 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
5268 |
]. |
|
5269 |
inv1 := boundsNEXT. |
|
2042 | 5270 |
]. |
5271 |
self invalidate:inv1. |
|
5272 |
self invalidate:inv2. |
|
2048 | 5273 |
|
5274 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 5275 |
! |
5276 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5277 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5278 |
"returns the one and only scrollActivity - data holder |
2715 | 5279 |
for a menu and all contained submenus" |
5280 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5281 |
superMenu notNil ifTrue:[ |
3938 | 5282 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5283 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5284 |
scrollActivity isNil ifTrue:[ |
3938 | 5285 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5286 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5287 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5288 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5289 |
|
2016 | 5290 |
scrollerBoundsAt:aDirection |
2860 | 5291 |
"returns the bounds of the scroller at a direction" |
2715 | 5292 |
|
2016 | 5293 |
|y x w h inset| |
5294 |
||
5295 |
inset := 0. |
|
5296 |
x := y := inset. |
|
5297 |
w := h := 15. |
|
5298 |
||
5299 |
self verticalLayout ifTrue:[ |
|
3938 | 5300 |
aDirection == #NEXT ifTrue:[ |
5301 |
y := height - h - inset. |
|
5302 |
]. |
|
5303 |
w := width - inset - inset. |
|
2016 | 5304 |
] ifFalse:[ |
3938 | 5305 |
aDirection == #NEXT ifTrue:[ |
5306 |
x := width - w - inset. |
|
5307 |
]. |
|
5308 |
h := height - inset - inset. |
|
2016 | 5309 |
]. |
5310 |
^ Rectangle left:x top:y width:w height:h |
|
5311 |
! |
|
5312 |
||
2046 | 5313 |
scrollerDirectionAtPoint:aPoint |
2715 | 5314 |
"returns the scroller-direction at aPoint, or nil" |
5315 |
||
2046 | 5316 |
self hasScrollers ifTrue:[ |
3938 | 5317 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
5318 |
bounds := self scrollerBoundsAt:aDirection. |
|
5319 |
||
5320 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
5321 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
5322 |
] |
|
5323 |
] |
|
2046 | 5324 |
]. |
5325 |
^ nil |
|
5326 |
||
5327 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 5328 |
! ! |
5329 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5330 |
!MenuPanel methodsFor:'private-searching'! |
388 | 5331 |
|
1699 | 5332 |
detectGrabMenu |
2715 | 5333 |
"returns the menu which is responsible for the grap; the last opened menu" |
5334 |
||
1699 | 5335 |
|subMenu| |
5336 |
||
5337 |
selection notNil ifTrue:[ |
|
3938 | 5338 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
5339 |
^ subMenu detectGrabMenu |
|
5340 |
] |
|
1699 | 5341 |
]. |
5342 |
^ self |
|
5343 |
! |
|
5344 |
||
5345 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 5346 |
"returns the menu which contains the grab-point" |
5347 |
||
1699 | 5348 |
|dstMenu dstPoint firstMenu| |
5349 |
||
5350 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
5351 |
||
5352 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
3938 | 5353 |
firstMenu := self. |
1699 | 5354 |
]. |
5355 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5356 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
3938 | 5357 |
^ firstMenu |
1699 | 5358 |
]. |
5359 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 5360 |
^ dstMenu ? firstMenu |
1699 | 5361 |
! |
5362 |
||
1767 | 5363 |
detectViewAtX:x y:y in:aTopView |
2715 | 5364 |
"detect view at x@y" |
5365 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5366 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5367 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5368 |
"/ 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
|
5369 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5370 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5371 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5372 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5373 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5374 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5375 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5376 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5377 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5378 |
"/ 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
|
5379 |
"/ ^ 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
|
5380 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5381 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5382 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5383 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5384 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5385 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5386 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 5387 |
! |
5388 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5389 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5390 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 5391 |
If no item match nil is returned." |
5392 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5393 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5394 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5395 |
stringOrNumberOrPoint isPoint ifTrue:[ |
3938 | 5396 |
^ self itemAtPoint:stringOrNumberOrPoint |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5397 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5398 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5399 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 5400 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5401 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5402 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5403 |
itemAtPoint:aPoint |
2715 | 5404 |
"returns the item at aPoint or nil if none detected" |
5405 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5406 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5407 |
|
1699 | 5408 |
items notNil ifTrue:[ |
3938 | 5409 |
x := aPoint x. |
5410 |
y := aPoint y. |
|
5411 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
|
1699 | 5412 |
]. |
5413 |
^ nil |
|
388 | 5414 |
! |
5415 |
||
2048 | 5416 |
superMenuAtPoint:aPoint |
2715 | 5417 |
"returns the superMenu which contains aPoint, or nil if none detected" |
5418 |
||
1699 | 5419 |
|grabPoint superMenu| |
5420 |
||
2048 | 5421 |
(self containsPoint:aPoint) ifTrue:[ |
3938 | 5422 |
^ self |
1699 | 5423 |
]. |
5424 |
||
2048 | 5425 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 5426 |
superMenu := self. |
5427 |
||
5428 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
3938 | 5429 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
5430 |
^ superMenu |
|
5431 |
] |
|
2715 | 5432 |
]. |
5433 |
^ nil |
|
1699 | 5434 |
|
2048 | 5435 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 5436 |
! ! |
5437 |
||
5438 |
!MenuPanel methodsFor:'queries'! |
|
5439 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5440 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5441 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5442 |
aView notNil ifTrue:[ |
3147 | 5443 |
"/ I am no longer a popUpView |
5444 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5445 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5446 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5447 |
|
388 | 5448 |
containsPoint:aPoint |
2715 | 5449 |
"returns true if the argument, aPoint is contained by the view" |
5450 |
||
388 | 5451 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
5452 |
! |
|
5453 |
||
5454 |
containsPointX:x y:y |
|
2715 | 5455 |
"returns true if point is contained by the view" |
5456 |
||
708 | 5457 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 5458 |
! |
5459 |
||
390 | 5460 |
hasGroupDividerAt:anIndex |
2715 | 5461 |
"returns true if a divider is defined at an index" |
5462 |
||
388 | 5463 |
|i| |
5464 |
||
5465 |
groupSizes size ~~ 0 ifTrue:[ |
|
3938 | 5466 |
i := 0. |
5467 |
||
5468 |
groupSizes do:[:t| |
|
5469 |
(i := i + t) == anIndex ifTrue:[ |
|
5470 |
^ true |
|
5471 |
] |
|
5472 |
] |
|
2715 | 5473 |
]. |
5474 |
^ false |
|
388 | 5475 |
! |
5476 |
||
390 | 5477 |
hasGroupDividers |
2715 | 5478 |
"returns true if any group divider exists" |
5479 |
||
5480 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 5481 |
! |
5482 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5483 |
hasPerformed |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5484 |
^ hasPerformed ? false |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5485 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5486 |
"Created: / 29-06-2011 / 16:24:14 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5487 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5488 |
|
3457
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5489 |
isActive |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5490 |
"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
|
5491 |
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
|
5492 |
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
|
5493 |
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
|
5494 |
|
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5495 |
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
|
5496 |
|
3938 | 5497 |
^ windowGroup notNil and:[windowGroup anyViewHasFocus] |
3457
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5498 |
! |
6f19c84f9ff8
Sonce MenuPanel is used as a TopView - without inheriting from TopView -
Stefan Vogel <sv@exept.de>
parents:
3454
diff
changeset
|
5499 |
|
390 | 5500 |
isFitPanel |
5501 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 5502 |
be fit to the extent of its superView; |
2715 | 5503 |
NOT SUPPORTED" |
5504 |
||
1699 | 5505 |
^ false |
390 | 5506 |
! |
5507 |
||
388 | 5508 |
isPopUpView |
5509 |
"return true if view is a popup view; without decoration |
|
2715 | 5510 |
and popUp to top immediately" |
5511 |
||
388 | 5512 |
^ superView isNil |
5513 |
! |
|
5514 |
||
5515 |
isVerticalLayout |
|
2715 | 5516 |
"returns true if vertical layout otherwise false( horizontal layout )" |
5517 |
||
1699 | 5518 |
^ self verticalLayout |
416 | 5519 |
! |
5520 |
||
1793 | 5521 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
5522 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 5523 |
! |
5524 |
||
416 | 5525 |
type |
428 | 5526 |
^ nil. |
416 | 5527 |
|
388 | 5528 |
! ! |
5529 |
||
5530 |
!MenuPanel methodsFor:'selection'! |
|
5531 |
||
5532 |
hasSelection |
|
2715 | 5533 |
"returns true if a selection exists" |
5534 |
||
388 | 5535 |
^ self selection notNil |
5536 |
! |
|
5537 |
||
2199 | 5538 |
openDelayed:anItem |
3187 | 5539 |
self openDelayed:anItem afterSeconds:0.5. |
5540 |
! |
|
5541 |
||
5542 |
openDelayed:anItem afterSeconds:seconds |
|
2199 | 5543 |
|
2374 | 5544 |
superMenu notNil ifTrue:[ |
3938 | 5545 |
superMenu openDelayed:anItem afterSeconds:seconds. |
5546 |
^ self |
|
2374 | 5547 |
]. |
5548 |
openDelayedMenuBlock notNil ifTrue:[ |
|
3938 | 5549 |
Processor removeTimedBlock:openDelayedMenuBlock. |
5550 |
openDelayedMenuBlock := nil. |
|
2253 | 5551 |
]. |
3187 | 5552 |
(anItem notNil and:[anItem hasSubmenu]) ifFalse:[ |
3938 | 5553 |
openDelayedMenuBlock := nil. |
5554 |
^ self |
|
2253 | 5555 |
]. |
5556 |
openDelayedMenuBlock := [ |
|
3938 | 5557 |
openDelayedMenuBlock := nil. |
5558 |
anItem openDelayedSubmenu |
|
2253 | 5559 |
]. |
5560 |
||
3187 | 5561 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
2199 | 5562 |
! |
5563 |
||
3975 | 5564 |
selectAndOpenDelayed:anItemOrNil |
5565 |
"change selection to an item or nil" |
|
5566 |
||
5567 |
|helpListener oldSelect delayedOpenSeconds| |
|
5568 |
||
5569 |
delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu. |
|
5570 |
||
5571 |
anItemOrNil == selection ifTrue:[ ^ self ]. |
|
5572 |
self openDelayed:nil. |
|
5573 |
||
5574 |
oldSelect := selection. |
|
5575 |
selection := nil. |
|
5576 |
delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu. |
|
5577 |
||
5578 |
oldSelect notNil ifTrue:[ |
|
5579 |
"/ clear current selection |
|
5580 |
|oldSubmenu| |
|
5581 |
oldSubmenu := oldSelect visibleSubmenu. |
|
5582 |
||
5583 |
oldSubmenu notNil ifTrue:[ |
|
5584 |
Processor addTimedBlock:[ |
|
5585 |
selection ~~ oldSelect ifTrue:[ |
|
5586 |
"cancels the current delayed opertion" |
|
5587 |
oldSelect hideSubmenu. |
|
5588 |
||
5589 |
( selection notNil |
|
5590 |
and:[selection hasSubmenu |
|
5591 |
and:[selection visibleSubmenu isNil]] |
|
5592 |
) ifTrue:[ |
|
5593 |
"setup new delayed opertion.." |
|
5594 |
self openDelayed:selection afterSeconds:0.1 |
|
5595 |
]. |
|
5596 |
]. |
|
5597 |
] afterSeconds:delayedOpenSeconds. |
|
5598 |
]. |
|
5599 |
oldSelect invalidate. |
|
5600 |
]. |
|
5601 |
||
5602 |
anItemOrNil notNil ifTrue:[ |
|
5603 |
self makeItemVisible:anItemOrNil. |
|
5604 |
anItemOrNil canSelect ifTrue:[ |
|
5605 |
selection := anItemOrNil |
|
5606 |
]. |
|
5607 |
]. |
|
5608 |
selection isNil ifTrue:[^ self]. |
|
5609 |
||
5610 |
ActiveHelp isActive ifTrue:[ |
|
5611 |
helpListener := ActiveHelp currentHelpListener. |
|
5612 |
helpListener initiateHelpFor:self at:nil now:true. |
|
5613 |
]. |
|
5614 |
shown ifTrue:[ |
|
5615 |
"/ self rearrangeItems. |
|
5616 |
selection invalidate. |
|
5617 |
||
5618 |
selection hasSubmenu ifTrue:[ |
|
5619 |
self openDelayed:selection afterSeconds:delayedOpenSeconds. |
|
5620 |
]. |
|
5621 |
]. |
|
5622 |
! |
|
5623 |
||
388 | 5624 |
selection |
2715 | 5625 |
"returns current selected item or nil" |
5626 |
||
388 | 5627 |
^ selection |
5628 |
! |
|
5629 |
||
5630 |
selection:anItemOrNil |
|
2016 | 5631 |
"change selection to an item or nil |
2715 | 5632 |
if the item has a submenu the first item might be selected (style-sheet)" |
5633 |
||
2249 | 5634 |
|openMenu openOnSelect submenu item| |
5635 |
||
5636 |
selection == anItemOrNil ifTrue:[^ self]. |
|
5637 |
||
5638 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
3938 | 5639 |
self selection:anItemOrNil openMenu:false. |
5640 |
^ self |
|
2249 | 5641 |
]. |
5642 |
||
5643 |
openMenu := self isPopUpView not. |
|
5644 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
5645 |
||
5646 |
openMenu ifFalse:[ |
|
3938 | 5647 |
openMenu := openOnSelect. |
2249 | 5648 |
]. |
5649 |
self selection:anItemOrNil openMenu:openMenu. |
|
5650 |
||
5651 |
openOnSelect ifFalse:[ |
|
3938 | 5652 |
"/ select first item in submenu |
5653 |
||
5654 |
submenu := anItemOrNil currentSubmenu. |
|
5655 |
||
5656 |
submenu notNil ifTrue:[ |
|
5657 |
item := submenu itemAt:1. |
|
5658 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
|
5659 |
submenu selection:item openMenu:false |
|
5660 |
] |
|
5661 |
]. |
|
2249 | 5662 |
]. |
5663 |
! |
|
5664 |
||
5665 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 5666 |
"change selection to an item or nil" |
5667 |
||
2251 | 5668 |
|helpListener oldSelect| |
2249 | 5669 |
|
5670 |
anItemOrNil == selection ifTrue:[ |
|
3938 | 5671 |
^ self |
2016 | 5672 |
]. |
2199 | 5673 |
self openDelayed:nil. |
388 | 5674 |
|
2251 | 5675 |
oldSelect := selection. |
5676 |
selection := nil. |
|
2249 | 5677 |
|
2374 | 5678 |
anItemOrNil notNil ifTrue:[ |
3938 | 5679 |
self makeItemVisible:anItemOrNil. |
5680 |
anItemOrNil canSelect ifTrue:[ |
|
5681 |
selection := anItemOrNil |
|
5682 |
] ifFalse:[ |
|
5683 |
oldSelect isNil ifTrue:[^ self]. |
|
5684 |
]. |
|
2249 | 5685 |
]. |
2374 | 5686 |
oldSelect notNil ifTrue:[ |
3938 | 5687 |
"/ clear current selection |
5688 |
oldSelect isSelected:false. |
|
2251 | 5689 |
]. |
2374 | 5690 |
selection isNil ifTrue:[^ self]. |
2251 | 5691 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5692 |
"/ selection == enteredItem ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5693 |
"/ enteredItem := nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5694 |
"/ ] ifFalse:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5695 |
"/ self pointerEntersItem:nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5696 |
"/ ]. |
2016 | 5697 |
ActiveHelp isActive ifTrue:[ |
3938 | 5698 |
helpListener := ActiveHelp currentHelpListener. |
5699 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 5700 |
]. |
5701 |
shown ifTrue:[ |
|
3938 | 5702 |
"/ self rearrangeItems. |
5703 |
||
5704 |
openMenu ifFalse:[ |
|
5705 |
selection invalidate. |
|
5706 |
] |
|
2249 | 5707 |
]. |
5708 |
openMenu ifTrue:[ |
|
3938 | 5709 |
selection isSelected:true. |
2249 | 5710 |
]. |
388 | 5711 |
! |
5712 |
||
5713 |
selectionIndex |
|
2715 | 5714 |
"returns index of current selection or 0" |
5715 |
||
388 | 5716 |
|item| |
5717 |
||
5718 |
(item := self selection) notNil ifTrue:[ |
|
3938 | 5719 |
^ self findFirst:[:el| el == item ] |
388 | 5720 |
]. |
5721 |
^ 0 |
|
5722 |
! |
|
5723 |
||
5724 |
selectionIndex:anIndex |
|
2715 | 5725 |
"set selection at an index" |
5726 |
||
388 | 5727 |
self selection:(self itemAt:anIndex) |
5728 |
! ! |
|
5729 |
||
1791 | 5730 |
!MenuPanel methodsFor:'translation'! |
5731 |
||
5732 |
translateGrabPoint:aGrabPoint |
|
2715 | 5733 |
"translate the grab point into self" |
5734 |
||
1791 | 5735 |
superMenu isNil ifTrue:[ |
3938 | 5736 |
"I am the grabView" |
5737 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5738 |
^ aGrabPoint |
|
1791 | 5739 |
]. |
5740 |
||
5741 |
relativeGrabOrigin isNil ifTrue:[ |
|
3938 | 5742 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
5743 |
relativeGrabOrigin isNil ifTrue:[ |
|
5744 |
"I am the grabView" |
|
5745 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5746 |
^ aGrabPoint |
|
5747 |
]. |
|
1791 | 5748 |
]. |
5749 |
^ relativeGrabOrigin + aGrabPoint |
|
5750 |
! |
|
5751 |
||
5752 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 5753 |
"translate a point into another menu its point" |
5754 |
||
1791 | 5755 |
|grapPoint| |
5756 |
||
5757 |
aMenu == self ifTrue:[ |
|
3938 | 5758 |
^ aPoint |
1791 | 5759 |
]. |
5760 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
5761 |
||
2715 | 5762 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 5763 |
! |
5764 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5765 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 5766 |
"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
|
5767 |
|
3938 | 5768 |
^ device |
5769 |
translatePoint:aPoint asPoint |
|
5770 |
fromView:self |
|
5771 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5772 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5773 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 5774 |
! ! |
5775 |
||
388 | 5776 |
!MenuPanel::Item class methodsFor:'accessing'! |
5777 |
||
689 | 5778 |
horizontalInset |
5779 |
^ HorizontalInset |
|
5780 |
! |
|
5781 |
||
388 | 5782 |
labelRightOffset |
5783 |
^ LabelRightOffset |
|
5784 |
! |
|
5785 |
||
689 | 5786 |
verticalInset |
5787 |
^ VerticalInset |
|
1765 | 5788 |
! |
5789 |
||
5790 |
verticalPopUpInset |
|
5791 |
^ VerticalPopUpInset |
|
388 | 5792 |
! ! |
5793 |
||
616 | 5794 |
!MenuPanel::Item class methodsFor:'defaults'! |
5795 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5796 |
halfSeparatorSize |
2870 | 5797 |
"returns the size of a space-separator" |
5798 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5799 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5800 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5801 |
|
1699 | 5802 |
separatorSize |
2870 | 5803 |
"returns the size of a separator" |
5804 |
||
1699 | 5805 |
^ 10 |
616 | 5806 |
! |
5807 |
||
5808 |
updateStyleCache |
|
2777 | 5809 |
"extract values from the styleSheet and cache them in class variables" |
5810 |
||
1765 | 5811 |
<resource: #style (#'menuPanel.verticalInset')> |
5812 |
||
1699 | 5813 |
HorizontalInset := 2. |
1765 | 5814 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5815 |
VerticalPopUpInset := 2. |
|
727 | 5816 |
|
5817 |
HorizontalButtonInset := 3. |
|
5818 |
VerticalButtonInset := 3. |
|
5819 |
||
681 | 5820 |
LabelRightOffset := 15. |
1765 | 5821 |
|
2777 | 5822 |
" |
5823 |
self updateStyleCache |
|
5824 |
" |
|
1124 | 5825 |
! ! |
1078 | 5826 |
|
388 | 5827 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5828 |
||
5829 |
in:aSuperMenu |
|
5830 |
^ self in:aSuperMenu label:nil |
|
5831 |
! |
|
5832 |
||
5833 |
in:aSuperMenu label:aLabel |
|
5834 |
|item| |
|
5835 |
||
5836 |
item := self new in:aSuperMenu. |
|
5837 |
item label:aLabel. |
|
2870 | 5838 |
^ item |
388 | 5839 |
! |
5840 |
||
5841 |
in:aSuperMenu menuItem:aMenuItem |
|
5842 |
|item| |
|
5843 |
||
5844 |
item := self in:aSuperMenu. |
|
5845 |
item menuItem:aMenuItem. |
|
2870 | 5846 |
^ item. |
2359 | 5847 |
! |
5848 |
||
5849 |
new |
|
5850 |
^ self basicNew initialize |
|
388 | 5851 |
! ! |
5852 |
||
1808 | 5853 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5854 |
|
420 | 5855 |
canAccept |
2870 | 5856 |
"returns true if item is acceptable" |
5857 |
||
2199 | 5858 |
self enabled ifFalse:[ ^ false]. |
5859 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5860 |
||
5861 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
3558 | 5862 |
^ subMenu isNil or:[subMenu shown not] |
524 | 5863 |
! |
5864 |
||
5865 |
toggleIndication |
|
2870 | 5866 |
"toggle indication or choice" |
5867 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5868 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5869 |
|
3938 | 5870 |
indication notNil ifTrue:[ |
5871 |
arg := self indicationValue not. |
|
5872 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5873 |
] ifFalse:[ |
3938 | 5874 |
choice notNil ifTrue:[ |
5875 |
choice value:(menuItem choiceValue). |
|
5876 |
^ true |
|
5877 |
] |
|
524 | 5878 |
]. |
5879 |
^ arg |
|
389 | 5880 |
! ! |
5881 |
||
388 | 5882 |
!MenuPanel::Item methodsFor:'accessing'! |
5883 |
||
5884 |
accessCharacter |
|
2870 | 5885 |
"returns my accessCharacter or nil" |
5886 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5887 |
^ accessCharacter |
388 | 5888 |
! |
5889 |
||
5890 |
accessCharacterPosition |
|
2870 | 5891 |
"get the access character position or nil" |
5892 |
||
2359 | 5893 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5894 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5895 |
|
3938 | 5896 |
accessCharacterPosition:anIndex |
2870 | 5897 |
"set the access character position or nil" |
5898 |
||
2359 | 5899 |
menuItem accessCharacterPosition:anIndex. |
388 | 5900 |
! |
5901 |
||
5902 |
argument |
|
2870 | 5903 |
"gets the argument" |
5904 |
||
2359 | 5905 |
^ menuItem argument |
388 | 5906 |
! |
5907 |
||
5908 |
argument:anArgument |
|
2870 | 5909 |
"sets the argument" |
5910 |
||
2359 | 5911 |
menuItem argument:anArgument. |
389 | 5912 |
! |
5913 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5914 |
displayLabel |
2870 | 5915 |
"returns my printable Label" |
5916 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5917 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5918 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5919 |
|
2614 | 5920 |
displayLabelExtent |
2870 | 5921 |
"returns the labels extent" |
5922 |
||
3837 | 5923 |
|myFont prevFont w h| |
2614 | 5924 |
|
5925 |
displayLabelExtent notNil ifTrue:[ |
|
3938 | 5926 |
^ displayLabelExtent |
2614 | 5927 |
]. |
5928 |
||
5929 |
displayLabel isNil ifTrue:[ |
|
3938 | 5930 |
displayLabelExtent := 0@0. |
5931 |
^ displayLabelExtent |
|
2614 | 5932 |
]. |
3837 | 5933 |
|
5934 |
myFont := self font. |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5935 |
myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ]. |
3837 | 5936 |
myFont := myFont onDevice:menuPanel device. |
5937 |
||
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5938 |
prevFont := menuPanel setFont:myFont. |
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5939 |
|
3837 | 5940 |
displayLabel isString ifTrue:[ |
3938 | 5941 |
w := displayLabel widthOn:menuPanel. |
5942 |
h := displayLabel heightOn:menuPanel. |
|
5943 |
"/ w := myFont widthOf:displayLabel. |
|
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5944 |
"/ h := myFont heightOf:displayLabel. |
3938 | 5945 |
] ifFalse:[ |
5946 |
displayLabel isArray ifTrue:[ |
|
5947 |
w := h := 0. |
|
5948 |
||
5949 |
displayLabel do:[:aSubLabel| |
|
5950 |
aSubLabel notNil ifTrue:[ |
|
5951 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5952 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5953 |
] ifFalse:[ |
|
5954 |
h := h + (self spaceBetweenEmptyLines) |
|
5955 |
] |
|
5956 |
] |
|
5957 |
] ifFalse:[ |
|
5958 |
w := displayLabel widthOn:menuPanel. |
|
5959 |
h := displayLabel heightOn:menuPanel. |
|
5960 |
]. |
|
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5961 |
]. |
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5962 |
|
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5963 |
menuPanel setFont:prevFont. "/ restore previous font |
3837 | 5964 |
|
2614 | 5965 |
"/ care for italic fonts - give a few more pixels at the end |
3837 | 5966 |
myFont italic ifTrue:[ |
3938 | 5967 |
w := w + 2. |
2614 | 5968 |
]. |
5969 |
displayLabelExtent := w@h. |
|
5970 |
^ displayLabelExtent |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5971 |
|
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5972 |
"Modified: / 17-08-2010 / 10:46:06 / cg" |
2614 | 5973 |
! |
5974 |
||
1727 | 5975 |
font |
2870 | 5976 |
"returns the user configured font or nil (default menu font)" |
5977 |
||
2373 | 5978 |
|font| |
5979 |
||
5980 |
menuPanel isNil ifTrue:[^ nil]. |
|
5981 |
||
5982 |
font := menuItem font. |
|
5983 |
||
5984 |
font notNil ifTrue:[ |
|
3938 | 5985 |
font := font onDevice:(menuPanel device). |
5986 |
menuItem font:font. |
|
2373 | 5987 |
]. |
1727 | 5988 |
^ font |
5989 |
! |
|
5990 |
||
5991 |
font:aFont |
|
2870 | 5992 |
"returns the user configured font or nil (default menu font)" |
5993 |
||
2373 | 5994 |
menuItem font:aFont. |
1727 | 5995 |
! |
5996 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5997 |
ignoreMnemonicKeys |
4076 | 5998 |
"if true, mnemonic (access character) in the submenus under the item are ignored. |
5999 |
Set this to speedup accelerator key processing for slow dynamci menus" |
|
2870 | 6000 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6001 |
^ menuItem ignoreMnemonicKeys |
4076 | 6002 |
|
6003 |
"Modified (comment): / 08-09-2011 / 04:29:47 / cg" |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6004 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6005 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6006 |
ignoreMnemonicKeys:aBoolean |
2870 | 6007 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
6008 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6009 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6010 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6011 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6012 |
ignoreShortcutKeys |
2870 | 6013 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
6014 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6015 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6016 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6017 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6018 |
ignoreShortcutKeys:aBoolean |
2870 | 6019 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
6020 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6021 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6022 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6023 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6024 |
itemValue |
2870 | 6025 |
"gets the items value" |
6026 |
||
2360 | 6027 |
^ menuItem itemValue |
6028 |
! |
|
6029 |
||
6030 |
itemValue:aValue |
|
2870 | 6031 |
"argument could be a value holder, an action or selector" |
6032 |
||
2360 | 6033 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6034 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6035 |
|
388 | 6036 |
label |
2870 | 6037 |
"returns the label" |
6038 |
||
388 | 6039 |
^ label |
6040 |
! |
|
6041 |
||
6042 |
label:aLabel |
|
399 | 6043 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 6044 |
handle characters $& (ST-80 compatibility)" |
6045 |
||
2614 | 6046 |
|size char oldExtent| |
6047 |
||
6048 |
oldExtent := displayLabelExtent. |
|
6049 |
displayLabelExtent := nil. "/ force a recomputation |
|
6050 |
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
|
6051 |
|
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
6052 |
"Stefan: Why do we use #value two times??" |
2614 | 6053 |
label := aLabel value. |
6054 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6055 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6056 |
displayLabel isString ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6057 |
"CHECK FOR SEPARATOR" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6058 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6059 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6060 |
size := displayLabel size. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6061 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6062 |
size == 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6063 |
displayLabel := nil. "blank separator" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6064 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6065 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6066 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6067 |
size == 1 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6068 |
char := displayLabel first. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6069 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6070 |
(char == $- or:[char == $=]) ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6071 |
label := displayLabel. "line separator" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6072 |
displayLabel := nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6073 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6074 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6075 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6076 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6077 |
] ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6078 |
displayLabel isCollection ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6079 |
displayLabel := displayLabel asArray. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6080 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6081 |
]. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
6082 |
menuPanel doAccessCharacterTranslation ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6083 |
displayLabel notNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6084 |
displayLabel isArray ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6085 |
displayLabel keysAndValuesDo:[:i :el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6086 |
el notNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6087 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6088 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6089 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6090 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6091 |
displayLabel isImageOrForm ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6092 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6093 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6094 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6095 |
]. |
2614 | 6096 |
]. |
6097 |
||
6098 |
menuPanel shown ifTrue:[ |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6099 |
self fetchImages. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6100 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6101 |
oldExtent = self displayLabelExtent ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6102 |
self invalidate |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6103 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6104 |
menuPanel mustRearrange |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6105 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6106 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6107 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6108 |
"Modified: / 06-10-2011 / 16:36:53 / cg" |
388 | 6109 |
! |
6110 |
||
6111 |
menuPanel |
|
2870 | 6112 |
"returns my menuPanel" |
6113 |
||
399 | 6114 |
^ menuPanel |
388 | 6115 |
! |
6116 |
||
6117 |
nameKey |
|
2870 | 6118 |
"gets the nameKey" |
6119 |
||
2359 | 6120 |
^ menuItem nameKey |
388 | 6121 |
! |
6122 |
||
6123 |
nameKey:aNameKey |
|
2870 | 6124 |
"sets the nameKey" |
6125 |
||
2359 | 6126 |
menuItem nameKey:aNameKey. |
388 | 6127 |
! |
6128 |
||
6129 |
rawLabel |
|
2870 | 6130 |
"returns my raw, unprocessed label" |
6131 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6132 |
^ menuItem rawLabel |
388 | 6133 |
! |
6134 |
||
6135 |
shortcutKey |
|
6136 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 6137 |
no submenu exists evaluate the action assigned to the item (accept)." |
6138 |
||
2359 | 6139 |
^ menuItem shortcutKey |
388 | 6140 |
! |
6141 |
||
6142 |
shortcutKey:aKey |
|
6143 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 6144 |
no submenu exists evaluate the action assigned to the item (accept)." |
6145 |
||
2359 | 6146 |
menuItem shortcutKey ~= aKey ifTrue:[ |
3938 | 6147 |
menuItem shortcutKey:aKey. |
6148 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6149 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6150 |
! |
388 | 6151 |
|
710 | 6152 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6153 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6154 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6155 |
|
2359 | 6156 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6157 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6158 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 6159 |
! |
6160 |
||
6161 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6162 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6163 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6164 |
|
2359 | 6165 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6166 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6167 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 6168 |
! |
6169 |
||
388 | 6170 |
submenu |
3133 | 6171 |
"returns my submenu or creates it if its defined via a selector or channel. |
6172 |
May return nil, if there is really no menu" |
|
6173 |
||
6174 |
subMenu isNil ifTrue:[ |
|
3938 | 6175 |
self setupSubmenu |
3133 | 6176 |
]. |
6177 |
^ subMenu |
|
6178 |
||
6179 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 6180 |
! |
6181 |
||
6182 |
submenu:aSubMenu |
|
3938 | 6183 |
"set a new submenu; an existing submenu will be destroyed. |
2870 | 6184 |
This might lead to a redraw if 'hasSubmenu' changed" |
6185 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6186 |
|widget| |
1767 | 6187 |
|
6188 |
aSubMenu isNil ifTrue:[ |
|
3938 | 6189 |
subMenu notNil ifTrue:[ |
6190 |
subMenu destroy. |
|
6191 |
subMenu := nil. |
|
6192 |
]. |
|
6193 |
^ self |
|
1767 | 6194 |
]. |
6195 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6196 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
3938 | 6197 |
subMenu := MenuPanel new. |
6198 |
||
6199 |
menuPanel notNil ifTrue:[ |
|
6200 |
subMenu receiver:menuPanel receiver. |
|
6201 |
]. |
|
6202 |
subMenu superMenu:menuPanel. |
|
6203 |
||
6204 |
menuItem horizontalLayout == true ifTrue:[ |
|
6205 |
subMenu verticalLayout:false |
|
6206 |
]. |
|
6207 |
subMenu menu:aSubMenu. |
|
1767 | 6208 |
] ifFalse:[ |
3938 | 6209 |
aSubMenu isView ifFalse:[ |
6210 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
6211 |
"/ ... mhhhh .... |
|
6212 |
^ menuItem submenuChannel:aSubMenu |
|
6213 |
]. |
|
6214 |
widget := SimpleView new. |
|
6215 |
widget client:aSubMenu. |
|
6216 |
] ifTrue:[ |
|
6217 |
widget := aSubMenu. |
|
6218 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
6219 |
]. |
|
6220 |
||
6221 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
6222 |
subMenu := widget. |
|
6223 |
||
6224 |
menuItem horizontalLayout == true ifTrue:[ |
|
6225 |
subMenu verticalLayout:false |
|
6226 |
]. |
|
6227 |
] ifFalse:[ |
|
6228 |
subMenu := MenuPanel new. |
|
6229 |
subMenu receiver:menuPanel receiver. |
|
6230 |
subMenu addSubView:widget. |
|
6231 |
subMenu extent:(widget preferredExtent). |
|
6232 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
6233 |
]. |
|
6234 |
subMenu superMenu:menuPanel. |
|
2360 | 6235 |
]. |
389 | 6236 |
! |
6237 |
||
3133 | 6238 |
submenuOrNil |
6239 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
6240 |
||
6241 |
^ subMenu |
|
6242 |
||
6243 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
6244 |
! |
|
6245 |
||
390 | 6246 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6247 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6248 |
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
|
6249 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6250 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6251 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6252 |
displayLabel notNil ifTrue:[ |
3938 | 6253 |
displayLabel isArray ifFalse:[ |
6254 |
^ displayLabel perform:#string ifNotUnderstood:nil |
|
6255 |
]. |
|
6256 |
||
6257 |
displayLabel do:[:el| |
|
6258 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
|
6259 |
^ txt |
|
6260 |
] |
|
6261 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6262 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6263 |
^ nil |
390 | 6264 |
! |
6265 |
||
1841 | 6266 |
triggerOnDown |
2870 | 6267 |
"return true if triggering the action if pressed" |
6268 |
||
2359 | 6269 |
menuItem triggerOnDown ifTrue:[ |
3938 | 6270 |
self hasSubmenu ifFalse:[^ true]. |
1841 | 6271 |
]. |
6272 |
^ false |
|
6273 |
! |
|
6274 |
||
6275 |
triggerOnDown:aBool |
|
2870 | 6276 |
"setup to trigger the action if pressed" |
6277 |
||
2359 | 6278 |
menuItem triggerOnDown:aBool. |
1841 | 6279 |
! |
6280 |
||
389 | 6281 |
value |
2870 | 6282 |
"gets the items value |
6283 |
Left here for ST80 compatibility - value is a bad name" |
|
6284 |
||
2360 | 6285 |
^ menuItem itemValue |
6286 |
! |
|
6287 |
||
6288 |
value:aValue |
|
389 | 6289 |
"could be a value holder, an action or selector |
2870 | 6290 |
Left here for ST80 compatibility - value: is a bad name" |
6291 |
||
2360 | 6292 |
menuItem itemValue:aValue. |
502 | 6293 |
! |
6294 |
||
6295 |
value:aValue argument:anArgument |
|
2870 | 6296 |
"set the value and an argument" |
6297 |
||
2360 | 6298 |
menuItem itemValue:aValue. |
6299 |
menuItem argument:anArgument. |
|
388 | 6300 |
! ! |
6301 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6302 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 6303 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6304 |
choice |
2870 | 6305 |
"implements a radio group; the field" |
6306 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6307 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6308 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6309 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6310 |
choice:something |
2870 | 6311 |
"set choice indication" |
6312 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6313 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6314 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6315 |
choice isValueModel ifTrue:[ |
3938 | 6316 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6317 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6318 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6319 |
(choice := something) notNil ifTrue:[ |
3938 | 6320 |
choice isSymbol ifTrue:[ |
6321 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
6322 |
choice := something |
|
6323 |
] |
|
6324 |
]. |
|
6325 |
choice isValueModel ifTrue:[ |
|
6326 |
choice addDependent:self |
|
6327 |
] |
|
1699 | 6328 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6329 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6330 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6331 |
choiceValue |
2870 | 6332 |
"implements a radio group; the value writen to the choice if selected" |
6333 |
||
2359 | 6334 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6335 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6336 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6337 |
choiceValue:something |
2870 | 6338 |
"implements a radio group; the value writen to the choice if selected" |
6339 |
||
2359 | 6340 |
menuItem choiceValue ~= something ifTrue:[ |
3938 | 6341 |
menuItem choiceValue:something. |
6342 |
choice notNil ifTrue:[ self invalidate ]. |
|
2359 | 6343 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6344 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6345 |
|
388 | 6346 |
enabled |
2870 | 6347 |
"returns the enabled state" |
6348 |
||
524 | 6349 |
|state| |
6350 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6351 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6352 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6353 |
enableChannel isSymbol ifTrue:[ |
3938 | 6354 |
state := self aspectAt:enableChannel. |
6355 |
||
6356 |
state isNil ifTrue:[ |
|
6357 |
self ifNotInUIBuilderInfoPrintCR: |
|
6358 |
('MenuPanel::Item [info]: no aspect for %1 (in %2)' |
|
6359 |
bindWith:enableChannel |
|
6360 |
with:label). |
|
6361 |
^ true |
|
6362 |
]. |
|
6363 |
||
6364 |
state isValueModel ifTrue:[ |
|
6365 |
enableChannel := state. |
|
6366 |
enableChannel addDependent:self. |
|
6367 |
state := enableChannel value. |
|
6368 |
] ifFalse:[ |
|
6369 |
state := state value |
|
6370 |
] |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6371 |
] ifFalse:[ |
3938 | 6372 |
state := enableChannel value |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6373 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6374 |
^ state ~~ false |
388 | 6375 |
! |
6376 |
||
389 | 6377 |
enabled:something |
2870 | 6378 |
"change the enabled state; if the state changed, a redraw is performed" |
6379 |
||
390 | 6380 |
|oldState newState| |
6381 |
||
6382 |
enableChannel isNil ifTrue:[ |
|
3938 | 6383 |
oldState := true |
390 | 6384 |
] ifFalse:[ |
3938 | 6385 |
oldState := enableChannel value. |
6386 |
enableChannel isValueModel ifTrue:[ |
|
6387 |
enableChannel removeDependent:self |
|
6388 |
] |
|
388 | 6389 |
]. |
390 | 6390 |
enableChannel := something. |
6391 |
||
6392 |
enableChannel isNil ifTrue:[ |
|
3938 | 6393 |
menuPanel shown ifFalse:[^ self]. |
6394 |
newState := true |
|
390 | 6395 |
] ifFalse:[ |
3938 | 6396 |
enableChannel isValueModel ifTrue:[ |
6397 |
enableChannel addDependent:self |
|
6398 |
] ifFalse:[ |
|
6399 |
enableChannel isSymbol ifTrue:[^ self] |
|
6400 |
]. |
|
6401 |
menuPanel shown ifFalse:[^ self]. |
|
6402 |
newState := enableChannel value. |
|
390 | 6403 |
]. |
6404 |
||
6405 |
newState ~~ oldState ifTrue:[ |
|
3938 | 6406 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6407 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6408 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6409 |
|
1670 | 6410 |
hideMenuOnActivated |
2870 | 6411 |
"hide the menu when the item was activated; the default is true" |
6412 |
||
2359 | 6413 |
^ menuItem hideMenuOnActivated |
1670 | 6414 |
! |
6415 |
||
6416 |
hideMenuOnActivated:aBool |
|
2870 | 6417 |
"hide the menu when the item was activated; the default is true" |
6418 |
||
2359 | 6419 |
menuItem hideMenuOnActivated:aBool. |
1670 | 6420 |
! |
6421 |
||
2216 | 6422 |
ifNotInUIBuilderInfoPrintCR:aMessage |
6423 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
6424 |
||
3732 | 6425 |
|app| |
6426 |
||
6427 |
app := menuPanel application. |
|
6428 |
||
2216 | 6429 |
(menuPanel receiver isNil |
3732 | 6430 |
and:[ app notNil |
6431 |
and:[ app askFor:#isUIPainter]]) |
|
2216 | 6432 |
ifTrue:[ |
3938 | 6433 |
^ self "/ suppressed |
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6434 |
]. |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6435 |
aMessage infoPrint. |
3833 | 6436 |
"/ app notNil ifTrue:[ |
6437 |
"/ ' Application: ' infoPrint. app infoPrint |
|
6438 |
"/ ]. |
|
3444
b7d2f3fe5055
avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents:
3441
diff
changeset
|
6439 |
'' infoPrintCR. |
2216 | 6440 |
! |
6441 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6442 |
indication |
2870 | 6443 |
"get on/off indication" |
6444 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6445 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6446 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6447 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6448 |
indication:something |
2870 | 6449 |
"set on/off indication" |
6450 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6451 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6452 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6453 |
indication isValueModel ifTrue:[ |
3938 | 6454 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6455 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6456 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6457 |
(indication := something) notNil ifTrue:[ |
3938 | 6458 |
indication isValueModel ifTrue:[ |
6459 |
indication addDependent:self |
|
6460 |
] ifFalse:[ |
|
6461 |
"/ to force an update of the value |
|
6462 |
self indicationValue |
|
6463 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6464 |
]. |
464 | 6465 |
! |
6466 |
||
1767 | 6467 |
keepLinkedMenu |
2870 | 6468 |
"get the keepLinkedMenu flag" |
6469 |
||
2359 | 6470 |
^ menuItem keepLinkedMenu |
6471 |
! |
|
6472 |
||
6473 |
keepLinkedMenu:aBool |
|
2870 | 6474 |
"get the keepLinkedMenu flag" |
6475 |
||
2359 | 6476 |
menuItem keepLinkedMenu:aBool. |
1767 | 6477 |
! |
6478 |
||
2331 | 6479 |
sendToOriginator |
6480 |
"if true, the message is sent to the originating widget; |
|
6481 |
otherwise (the default), it it sent to the receiver/application." |
|
6482 |
||
2359 | 6483 |
^ menuItem sendToOriginator |
2331 | 6484 |
! |
6485 |
||
6486 |
sendToOriginator:aBoolean |
|
6487 |
"if true, the message is sent to the originating widget; |
|
6488 |
otherwise (the default), it it sent to the receiver/application." |
|
6489 |
||
2359 | 6490 |
menuItem sendToOriginator:aBoolean. |
2331 | 6491 |
! |
6492 |
||
464 | 6493 |
submenuChannel |
2870 | 6494 |
"get the submenu channel" |
6495 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6496 |
^ menuItem submenuChannel |
464 | 6497 |
! |
6498 |
||
6499 |
submenuChannel:aSelectorOrNil |
|
2870 | 6500 |
"returns the submenu channel" |
6501 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6502 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 6503 |
! ! |
6504 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6505 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 6506 |
|
2016 | 6507 |
moveBy:aPoint |
2870 | 6508 |
"move the layouts origin" |
6509 |
||
2016 | 6510 |
layout moveBy:aPoint. |
6511 |
! |
|
6512 |
||
1699 | 6513 |
preferredExtent |
2870 | 6514 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
6515 |
||
2614 | 6516 |
|isVertical icon wIcon isButton labelExtent |
1699 | 6517 |
x "{ Class:SmallInteger }" |
6518 |
y "{ Class:SmallInteger }" |
|
6519 |
s "{ Class:SmallInteger }" |
|
6520 |
| |
|
6521 |
self isVisible ifFalse:[^ 0@0 ]. |
|
6522 |
||
2359 | 6523 |
isButton := menuItem isButton. |
6524 |
||
1699 | 6525 |
isButton ifTrue:[ |
3987 | 6526 |
s := menuPanel maxAbsoluteButtonLevel ? 0. |
6527 |
x := s + HorizontalButtonInset. |
|
6528 |
y := s + VerticalButtonInset. |
|
1699 | 6529 |
] ifFalse:[ |
3987 | 6530 |
x := HorizontalInset. |
6531 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
|
1699 | 6532 |
]. |
6533 |
x := x * 2. |
|
6534 |
y := y * 2. |
|
6535 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6536 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6537 |
|
2362 | 6538 |
self isSeparator ifTrue:[ |
3987 | 6539 |
s := self class separatorSize. |
6540 |
label = '' ifTrue:[ |
|
6541 |
s := self class halfSeparatorSize. |
|
6542 |
]. |
|
6543 |
||
6544 |
"width of doubleSeparator is 5 !!!!" |
|
6545 |
isVertical ifFalse:[ |
|
6546 |
x := x max:s. |
|
6547 |
y := y + 5. |
|
6548 |
] ifTrue:[ |
|
6549 |
y := y max:s. |
|
6550 |
x := x + 5. |
|
6551 |
]. |
|
1699 | 6552 |
] ifFalse:[ |
3987 | 6553 |
labelExtent := self displayLabelExtent. |
6554 |
||
6555 |
x := x + labelExtent x. |
|
6556 |
y := y + labelExtent y. |
|
6557 |
x := x + (menuPanel stringOffsetXfor:self). |
|
6558 |
||
6559 |
isButton ifFalse:[ |
|
6560 |
menuPanel showSeparatingLines ifTrue:[ |
|
6561 |
"width of separator is 2 plus right offset 1 := 3" |
|
6562 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
|
6563 |
]. |
|
6564 |
]. |
|
6565 |
wIcon := 0. |
|
6566 |
self hasMenuIndicator ifTrue:[ |
|
6567 |
icon := MenuPanel menuIndicator. |
|
6568 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
|
6569 |
] ifFalse:[ |
|
6570 |
self hasDelayedMenuIndicator ifTrue:[ |
|
6571 |
icon := MenuPanel delayedMenuIndicator. |
|
6572 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
|
6573 |
] |
|
6574 |
]. |
|
6575 |
x := x + wIcon. |
|
1699 | 6576 |
]. |
6577 |
^ x@y |
|
3987 | 6578 |
|
6579 |
"Modified: / 19-01-2011 / 21:20:35 / cg" |
|
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6580 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6581 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6582 |
preferredHeight |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6583 |
^ self preferredExtent y |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6584 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6585 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6586 |
preferredWidth |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6587 |
^ self preferredExtent x |
388 | 6588 |
! ! |
6589 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6590 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 6591 |
|
6592 |
activeHelpKey |
|
2870 | 6593 |
"get the active helpKey; the key to retrieve the helpText from the application" |
6594 |
||
2359 | 6595 |
^ menuItem activeHelpKey |
1613 | 6596 |
! |
6597 |
||
6598 |
activeHelpKey:aHelpKey |
|
2870 | 6599 |
"set the active helpKey; the key to retrieve the helpText from the application" |
6600 |
||
2359 | 6601 |
menuItem activeHelpKey:aHelpKey. |
6602 |
activeHelpText := nil. |
|
1613 | 6603 |
! |
6604 |
||
6605 |
activeHelpText |
|
2870 | 6606 |
"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
|
6607 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6608 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6609 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6610 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6611 |
|
3938 | 6612 |
((key := self activeHelpKey) notNil |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6613 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
3938 | 6614 |
^ app helpTextForKey:key. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6615 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6616 |
^ nil |
1613 | 6617 |
! |
6618 |
||
6619 |
activeHelpText:aText |
|
2870 | 6620 |
"set the active helpText" |
6621 |
||
1613 | 6622 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6623 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6624 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6625 |
flyByHelpText |
2870 | 6626 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6627 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6628 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6629 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6630 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6631 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6632 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6633 |
|
2471 | 6634 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
6635 |
"/ (if you have an argument for that let us know..) |
|
6636 |
"/ self isButton ifFalse:[^ nil]. |
|
6637 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6638 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6639 |
"/ if an activeHelpKey was explicitely given, use that one |
3938 | 6640 |
key := self activeHelpKey. |
2895 | 6641 |
app := menuPanel application. |
6642 |
||
6643 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
6644 |
(key isAssociation) ifTrue:[ |
|
3938 | 6645 |
app := key key. |
6646 |
key := key value. |
|
2895 | 6647 |
]. |
6648 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6649 |
key notNil ifTrue:[ |
3938 | 6650 |
app notNil ifTrue:[ |
6651 |
text := app flyByHelpTextForKey:key. |
|
6652 |
]. |
|
6653 |
text isNil ifTrue:[ |
|
6654 |
text := menuPanel flyByHelpTextForKey:key. |
|
6655 |
]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6656 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6657 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6658 |
"/ 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
|
6659 |
text isNil ifTrue:[ |
3938 | 6660 |
self hasSubmenu ifTrue:[ |
6661 |
^ key |
|
6662 |
]. |
|
6663 |
||
6664 |
text := key. |
|
6665 |
text isNil ifTrue:[ |
|
6666 |
displayLabel isString ifTrue:[ |
|
6667 |
text := displayLabel string. |
|
6668 |
]. |
|
6669 |
]. |
|
6670 |
text isNil ifTrue:[ |
|
6671 |
text := self rawLabel. |
|
6672 |
text isString ifFalse:[ |
|
6673 |
text := menuItem rawLabel. |
|
6674 |
text isString ifFalse:[ |
|
6675 |
text := nil. |
|
6676 |
] |
|
6677 |
]. |
|
6678 |
text notNil ifTrue:[ |
|
6679 |
(text includes:$&) ifTrue:[ |
|
6680 |
text := (self updateAccessCharacterFor:text) string. |
|
6681 |
]. |
|
6682 |
]. |
|
6683 |
]. |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6684 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6685 |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6686 |
(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
|
6687 |
text = displayLabel ifTrue:[ |
3938 | 6688 |
"for text menus: it does not make sense to show the labels string again |
6689 |
(i.e. in a pull down menu)" |
|
6690 |
^ nil |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6691 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6692 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6693 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6694 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6695 |
flyByHelpText:aText |
2870 | 6696 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
6697 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6698 |
flyByHelpText := aText. |
1613 | 6699 |
! ! |
6700 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6701 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6702 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6703 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6704 |
"on default submenus has a vertical layout; |
2870 | 6705 |
true, the submenu has a horizontal layout." |
6706 |
||
2360 | 6707 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6708 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6709 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6710 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6711 |
"on default submenus has a vertical layout; |
2870 | 6712 |
true, the submenu has a horizontal layout." |
6713 |
||
2360 | 6714 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6715 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6716 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6717 |
isButton |
2870 | 6718 |
"returns whether the item looks like a Button" |
6719 |
||
2359 | 6720 |
^ menuItem isButton |
6721 |
! |
|
6722 |
||
6723 |
isButton:aBool |
|
2870 | 6724 |
"set/clear the item to look like a Button" |
6725 |
||
2359 | 6726 |
menuItem isButton ~~ aBool ifTrue:[ |
3938 | 6727 |
menuItem isButton:aBool. |
6728 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6729 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6730 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6731 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6732 |
layout |
2870 | 6733 |
"returns my layout ( Rectangle )" |
6734 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6735 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6736 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6737 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6738 |
layout:aLayout |
2870 | 6739 |
"set a new layout ( Rectangle )" |
6740 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6741 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6742 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6743 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6744 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6745 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6746 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 6747 |
while performing the menu action. Defaults to false." |
6748 |
||
2359 | 6749 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6750 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6751 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6752 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6753 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 6754 |
while performing the menu action. Defaults to false." |
6755 |
||
2359 | 6756 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6757 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6758 |
|
2504 | 6759 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 6760 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6761 |
currentSubmenu |
2870 | 6762 |
"returns the current submenu or nil" |
6763 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6764 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6765 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6766 |
|
1705 | 6767 |
hideSubmenu |
2870 | 6768 |
"hide submenu" |
6769 |
||
2199 | 6770 |
self hideSubmenu:subMenu. |
6771 |
! |
|
6772 |
||
6773 |
hideSubmenu:aSubmenu |
|
2870 | 6774 |
"hide submenu" |
6775 |
||
2871 | 6776 |
|id wg| |
1705 | 6777 |
|
2374 | 6778 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 6779 |
aSubmenu removeDependencies. |
2199 | 6780 |
|
6781 |
aSubmenu realized ifFalse:[ |
|
3938 | 6782 |
id := aSubmenu id. |
6783 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
|
2199 | 6784 |
] ifTrue:[ |
3938 | 6785 |
aSubmenu hide |
2199 | 6786 |
]. |
6787 |
||
2870 | 6788 |
aSubmenu windowGroup:nil. |
2871 | 6789 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
3938 | 6790 |
wg removeView:aSubmenu. |
2871 | 6791 |
]. |
2199 | 6792 |
|
6793 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6794 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
3938 | 6795 |
menuItem keepLinkedMenu ifFalse:[ |
6796 |
subMenu := nil |
|
6797 |
] |
|
2199 | 6798 |
]. |
6799 |
! |
|
6800 |
||
6801 |
openDelayedSubmenu |
|
2870 | 6802 |
"called to open now my delayed submenu" |
6803 |
||
3133 | 6804 |
|subMenuBeforeOpening| |
2199 | 6805 |
|
6806 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
6807 |
||
2374 | 6808 |
subMenu notNil ifTrue:[ |
3938 | 6809 |
subMenu realized ifTrue:[ |
6810 |
"/ already open |
|
6811 |
^ self |
|
6812 |
]. |
|
2199 | 6813 |
]. |
3133 | 6814 |
self setupSubmenu. |
6815 |
subMenu isNil ifTrue:[^ self]. |
|
6816 |
subMenuBeforeOpening := subMenu. |
|
2199 | 6817 |
self openSubmenu. |
6818 |
||
3133 | 6819 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
3938 | 6820 |
"/ closed during building or opening the submenu |
6821 |
self hideSubmenu:subMenuBeforeOpening. |
|
3133 | 6822 |
]. |
6823 |
||
6824 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 6825 |
! |
1701 | 6826 |
|
6827 |
openSubmenu |
|
6828 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
6829 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 6830 |
nescessary." |
6831 |
||
3203 | 6832 |
|p o device isVertical topMenu windGrp prefExtent lastEvent |
1701 | 6833 |
devBot "{ Class:SmallInteger }" |
6834 |
devRight "{ Class:SmallInteger }" |
|
6835 |
width "{ Class:SmallInteger }" |
|
6836 |
height "{ Class:SmallInteger }" |
|
6837 |
top "{ Class:SmallInteger }" |
|
6838 |
left "{ Class:SmallInteger }" |
|
6839 |
| |
|
6840 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
6841 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
3975 | 6842 |
^ self |
6843 |
]. |
|
6844 |
"close all other open submenus assigned to the menuPanel I'am located in" |
|
6845 |
||
6846 |
menuPanel itemsDo:[:eachItem| |
|
6847 |
(eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[ |
|
6848 |
eachItem hideSubmenu. |
|
6849 |
]. |
|
6850 |
]. |
|
1701 | 6851 |
topMenu := menuPanel topMenu. |
1829 | 6852 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
3975 | 6853 |
subMenu releaseDeviceResources. |
6854 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
6855 |
subMenu recreate. |
|
1829 | 6856 |
]. |
6857 |
||
1701 | 6858 |
windGrp := topMenu windowGroup. |
3203 | 6859 |
windGrp notNil ifTrue:[ |
3975 | 6860 |
lastEvent := windGrp lastEvent. |
6861 |
||
6862 |
(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[ |
|
6863 |
subMenu mapTime:(lastEvent timeStamp). |
|
6864 |
]. |
|
3203 | 6865 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6866 |
subMenu superMenu:menuPanel. |
1701 | 6867 |
subMenu becomesActiveMenu. |
6868 |
subMenu cursor:Cursor hand. |
|
6869 |
||
6870 |
windGrp notNil ifTrue:[ |
|
3975 | 6871 |
subMenu windowGroup:windGrp. |
6872 |
windGrp addTopView:subMenu. |
|
1701 | 6873 |
]. |
6874 |
||
2111 | 6875 |
"Q&D kludge - test whether the layout is nil; |
3975 | 6876 |
if true recompute the layouts |
2111 | 6877 |
" |
2374 | 6878 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6879 |
|
1701 | 6880 |
" Q&D kludge - if any visibility attributes are blocks; |
6881 |
TODO: only invoke mustRearrange if any are blocks |
|
3975 | 6882 |
(since I react correctly on valueHolder changes) |
1701 | 6883 |
" |
6884 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6885 |
subMenu fixSize. |
|
6886 |
||
6887 |
"compute origin of subMenu |
|
6888 |
" |
|
6889 |
isVertical := menuPanel verticalLayout. |
|
6890 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6891 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6892 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6893 |
width := prefExtent x. |
1701 | 6894 |
devBot := device usableHeight. |
6895 |
devRight := device usableWidth. |
|
6896 |
||
6897 |
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
|
6898 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6899 |
menuPanel isPopUpView ifTrue:[ |
3975 | 6900 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6901 |
] ifFalse:[ |
3975 | 6902 |
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
|
6903 |
]. |
1701 | 6904 |
left := o x. |
6905 |
top := o y. |
|
6906 |
||
2016 | 6907 |
top + height > devBot ifTrue:[ |
3975 | 6908 |
top := isVertical ifTrue:[devBot - height] |
6909 |
ifFalse:[top - layout height - height + 2] |
|
3938 | 6910 |
]. |
2016 | 6911 |
|
6912 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6913 |
"/ top < menuPanel bottom ifTrue:[ |
|
6914 |
"/ left := left + layout width. |
|
6915 |
"/ ]. |
|
6916 |
"/ left + width > devRight ifTrue:[ |
|
6917 |
"/ left := o x - width - 2 |
|
6918 |
"/ ]. |
|
6919 |
"/ ]. |
|
3938 | 6920 |
|
1701 | 6921 |
left + width > devRight ifTrue:[ |
3975 | 6922 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6923 |
ifFalse:[devRight - width] |
|
3938 | 6924 |
]. |
6925 |
||
6926 |
"/ ***** MULTI SCREEN |
|
6927 |
"/ top := top max:0. |
|
6928 |
"/ left := left max:0. |
|
1701 | 6929 |
|
6930 |
subMenu origin:(left@top). |
|
6931 |
||
6932 |
subMenu realized ifFalse:[ |
|
3975 | 6933 |
subMenu realize. |
1701 | 6934 |
] ifTrue:[ |
3975 | 6935 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6936 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6937 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6938 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6939 |
toggleSubmenuVisibility |
2870 | 6940 |
"toggle the visibility of the submenu" |
6941 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6942 |
subMenu notNil ifTrue:[ |
3938 | 6943 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6944 |
] ifFalse:[ |
3938 | 6945 |
self setupSubmenu. |
6946 |
subMenu isNil ifTrue:[ |
|
6947 |
"/ cannot open a submenu |
|
6948 |
^ self |
|
6949 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6950 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6951 |
self openSubmenu. |
3133 | 6952 |
|
6953 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6954 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6955 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6956 |
visibleSubmenu |
2870 | 6957 |
"returns the current visible submenu or nil" |
6958 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6959 |
subMenu notNil ifTrue:[ |
3938 | 6960 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6961 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6962 |
^ nil |
1701 | 6963 |
! ! |
6964 |
||
524 | 6965 |
!MenuPanel::Item methodsFor:'building'! |
6966 |
||
6967 |
aspectAt:aKey |
|
3092 | 6968 |
"returns the value assigned to key or nil" |
2870 | 6969 |
|
524 | 6970 |
|appl value| |
6971 |
||
6972 |
appl := menuPanel receiver. |
|
6973 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6974 |
(appl isValueModel) ifTrue:[ |
3938 | 6975 |
^ appl value:aKey |
524 | 6976 |
]. |
6977 |
||
2123 | 6978 |
appl isNil ifTrue:[ |
3938 | 6979 |
appl := menuPanel application. |
2123 | 6980 |
]. |
6981 |
appl isNil ifTrue:[ ^ nil]. |
|
6982 |
||
6983 |
MessageNotUnderstood handle:[:ex| |
|
3938 | 6984 |
ex selector == aKey ifFalse:[ |
6985 |
ex reject |
|
6986 |
]. |
|
6987 |
self ifNotInUIBuilderInfoPrintCR: |
|
6988 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' |
|
6989 |
bindWith:appl classNameWithArticle |
|
6990 |
with:aKey). |
|
2123 | 6991 |
] do:[ |
3938 | 6992 |
aKey numArgs == 1 ifTrue:[ |
6993 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6994 |
] ifFalse:[ |
|
6995 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6996 |
value := appl aspectFor:aKey |
|
6997 |
] ifFalse:[ |
|
6998 |
value := appl perform:aKey |
|
6999 |
] |
|
7000 |
] |
|
524 | 7001 |
]. |
7002 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
7003 |
|
3092 | 7004 |
"Modified: / 05-10-2006 / 03:10:20 / cg" |
524 | 7005 |
! ! |
7006 |
||
390 | 7007 |
!MenuPanel::Item methodsFor:'change & update'! |
7008 |
||
2614 | 7009 |
fontChanged |
2870 | 7010 |
"called whenever the font changed" |
7011 |
||
2614 | 7012 |
displayLabel notNil ifTrue:[ |
3938 | 7013 |
displayLabelExtent := nil. |
7014 |
||
7015 |
subMenu notNil ifTrue:[ |
|
7016 |
subMenu font:(menuPanel font). |
|
7017 |
]. |
|
2614 | 7018 |
]. |
7019 |
! |
|
7020 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7021 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7022 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7023 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7024 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7025 |
(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
|
7026 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7027 |
self isSeparator ifFalse:[ |
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7028 |
"/ NOT A SEPARATOR |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7029 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7030 |
menuPanel shown ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7031 |
changedObject == enableChannel ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7032 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7033 |
^ menuPanel selection:nil. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7034 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7035 |
^ self invalidate |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7036 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7037 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7038 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7039 |
menuItem isButton ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7040 |
self invalidate |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7041 |
] ifFalse:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7042 |
"/ invalidate the interactor only |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7043 |
"/ take any interactor; interactors has the same extent |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7044 |
form := menuPanel iconIndicationOff. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7045 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7046 |
rect := Rectangle left:(layout left + HorizontalInset) |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7047 |
top:(layout top) |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7048 |
width:(form width) |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7049 |
height:(layout height). |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7050 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7051 |
menuPanel invalidate:rect repairNow:false |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7052 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7053 |
^ self |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7054 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7055 |
self invalidate. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7056 |
]. |
498 | 7057 |
]. |
712 | 7058 |
|
7059 |
changedObject == isVisible ifTrue:[ |
|
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7060 |
menuPanel mustRearrange. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7061 |
"/ actually: the following is wrong, because we have to delay the rearrangement |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7062 |
"/ until the next redraw event comes. Otherwise, we might compute new layouts |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7063 |
"/ too early if more items change their visibility. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7064 |
"/ redraw will call rearrangeItems, if the mustRearrange is set. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7065 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7066 |
"/ menuPanel rearrangeItems. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7067 |
^ self. |
712 | 7068 |
]. |
7069 |
||
498 | 7070 |
super update:something with:aParameter from:changedObject |
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7071 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7072 |
"Modified (comment): / 24-11-2011 / 19:01:42 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7073 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7074 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7075 |
updateIndicators |
2870 | 7076 |
"update indicators " |
7077 |
||
2934 | 7078 |
indication notNil ifTrue:[ |
3938 | 7079 |
(indication isSymbol |
7080 |
or:[menuItem hideMenuOnActivated not]) |
|
7081 |
ifTrue:[ |
|
7082 |
"indication is a selector; |
|
7083 |
otherwise no need to redraw, because |
|
7084 |
a change notification is raised from the model !!!!" |
|
7085 |
self update:nil with:nil from:indication |
|
7086 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
7087 |
] |
390 | 7088 |
! ! |
7089 |
||
388 | 7090 |
!MenuPanel::Item methodsFor:'converting'! |
7091 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7092 |
asMenuItem |
2870 | 7093 |
"convert to a MenuItem" |
7094 |
||
2359 | 7095 |
^ menuItem |
388 | 7096 |
! |
7097 |
||
2827 | 7098 |
menuItem |
7099 |
^ menuItem |
|
7100 |
! |
|
7101 |
||
388 | 7102 |
menuItem:aMenuItem |
2870 | 7103 |
"setup attributes from a MenuItem" |
7104 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7105 |
|lbl| |
389 | 7106 |
|
388 | 7107 |
menuPanel disabledRedrawDo:[ |
3938 | 7108 |
menuItem := aMenuItem. |
7109 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
7110 |
||
7111 |
label := displayLabel := activeHelpText := nil. |
|
7112 |
||
7113 |
self enabled:(menuItem enabled). |
|
7114 |
self indication:(menuItem indication). |
|
7115 |
self choice:(menuItem choice). |
|
7116 |
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
|
7117 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7118 |
"/ 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
|
7119 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7120 |
|
3938 | 7121 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
7122 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
7123 |
]. |
|
7124 |
||
7125 |
self submenu:(menuItem submenu). |
|
7126 |
self label:lbl. |
|
388 | 7127 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
7128 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
7129 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 7130 |
! ! |
7131 |
||
2681 | 7132 |
!MenuPanel::Item methodsFor:'dependents access'! |
7133 |
||
7134 |
addDependencies |
|
2870 | 7135 |
"add all dependencies" |
7136 |
||
2681 | 7137 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
7138 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
7139 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
7140 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
7141 |
! |
|
7142 |
||
7143 |
removeDependencies |
|
2870 | 7144 |
"remove all dependencies" |
7145 |
||
2681 | 7146 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
7147 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
7148 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
7149 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
7150 |
! ! |
|
7151 |
||
388 | 7152 |
!MenuPanel::Item methodsFor:'drawing'! |
7153 |
||
2768 | 7154 |
choiceForm |
2870 | 7155 |
"returns choice form or nil" |
7156 |
||
2768 | 7157 |
|isOn| |
7158 |
||
7159 |
choice isNil ifTrue:[^ nil]. |
|
7160 |
||
7161 |
isOn := (choice value = menuItem choiceValue). |
|
7162 |
self enabled ifFalse:[ |
|
3938 | 7163 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
7164 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
2768 | 7165 |
]. |
3565 | 7166 |
self isSelected ifTrue:[ |
3938 | 7167 |
^ isOn == true |
7168 |
ifTrue:[menuPanel iconRadioGroupEnteredOn] |
|
7169 |
ifFalse:[menuPanel iconRadioGroupEnteredOff] |
|
3565 | 7170 |
]. |
2768 | 7171 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
3938 | 7172 |
ifFalse:[menuPanel iconRadioGroupOff] |
2768 | 7173 |
! |
7174 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7175 |
draw |
2870 | 7176 |
"redraw this item" |
7177 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7178 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7179 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7180 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7181 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7182 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7183 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7184 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7185 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7186 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7187 |
self isSeparator ifTrue:[ |
3938 | 7188 |
self drawSeparator. |
7189 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7190 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7191 |
menuItem isButton ifTrue:[ |
3938 | 7192 |
self drawButton. |
7193 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7194 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7195 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7196 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7197 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7198 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7199 |
bgColor := menuPanel backgroundColor. |
3938 | 7200 |
paint := isSelected |
7201 |
ifTrue:[self activeBackgroundColor] |
|
7202 |
ifFalse:[ |
|
7203 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
|
7204 |
menuPanel enteredBackgroundColor |
|
7205 |
] ifFalse:[ |
|
7206 |
bgColor |
|
7207 |
]]. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7208 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7209 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
3938 | 7210 |
paint := ownBgCol |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7211 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7212 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7213 |
paint ~= bgColor ifTrue:[ |
3938 | 7214 |
menuPanel paint:paint. |
7215 |
menuPanel fillRectangle:layout. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7216 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7217 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7218 |
menuPanel showSeparatingLines ifTrue:[ |
3938 | 7219 |
self drawSeparatingLines |
7220 |
]. |
|
7221 |
||
7222 |
self drawLabel. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7223 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7224 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
3938 | 7225 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
7226 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
|
7227 |
||
7228 |
x := layout left. |
|
7229 |
y := layout top. |
|
7230 |
w := layout width. |
|
7231 |
h := layout height. |
|
7232 |
||
7233 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
|
7234 |
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4). |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7235 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7236 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7237 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7238 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7239 |
drawButton |
2870 | 7240 |
"draw as button" |
7241 |
||
2362 | 7242 |
|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
|
7243 |
x "{ Class:SmallInteger }" |
2143 | 7244 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7245 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7246 |
drawObject := displayLabel. |
2362 | 7247 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7248 |
isSelected := self isSelected. |
2362 | 7249 |
|
7250 |
isSelected ifFalse:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7251 |
"/ test whether button has pressed toggle behaviour |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7252 |
showSelected := (self isToggle and:[self indicationValue]). |
2362 | 7253 |
] ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7254 |
showSelected := isSelected |
2362 | 7255 |
]. |
7256 |
||
7257 |
showSelected ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7258 |
bg := self activeBackgroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7259 |
fg := self activeForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7260 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7261 |
self isEntered ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7262 |
bg := self buttonEnteredBackgroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7263 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7264 |
bg := self backgroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7265 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7266 |
isEnabled ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7267 |
fg := menuPanel foregroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7268 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7269 |
fg := menuPanel disabledForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7270 |
etchFg := menuPanel disabledEtchedForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7271 |
drawObject := self disabledRawLabel |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7272 |
] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7273 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7274 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7275 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7276 |
bg := ownBgCol |
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7277 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7278 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7279 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7280 |
bg ~= menuPanel backgroundColor ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7281 |
menuPanel paint:bg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7282 |
menuPanel fillRectangle:layout. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7283 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7284 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7285 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 7286 |
|
7287 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7288 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
2337 | 7289 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7290 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7291 |
isSelected ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7292 |
"check whether button should be drawn selected; indicator or radio button" |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7293 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7294 |
indication notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7295 |
"button is indicator and set" |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7296 |
isSelected := self indicationValue |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7297 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7298 |
isSelected := (choice notNil and:[choice value = menuItem choiceValue]). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7299 |
] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7300 |
]. |
2143 | 7301 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7302 |
|
3938 | 7303 |
isSelected ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7304 |
level := menuPanel buttonActiveLevel. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7305 |
x := x + 1 "level abs". |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7306 |
y := y + 1 "level abs". |
3938 | 7307 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7308 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7309 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 7310 |
]. |
7311 |
||
2817 | 7312 |
drawObject notEmptyOrNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7313 |
etchFg notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7314 |
"/ donot draw images twice.. images are shown lightened |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7315 |
drawObject isImageOrForm ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7316 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7317 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7318 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7319 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
2362 | 7320 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7321 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7322 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7323 |
level ~~ 0 ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7324 |
menuPanel drawButtonEdgesFor:self level:level |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7325 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7326 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7327 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7328 |
drawLabel |
2870 | 7329 |
"draw a labeled entry; no button, no separator." |
7330 |
||
3938 | 7331 |
|scKey cLb cLa drawObject fg etchFg arrow |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7332 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7333 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7334 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7335 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7336 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7337 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7338 |
drawObject := displayLabel. |
2362 | 7339 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7340 |
isSelected := self isSelected. |
2362 | 7341 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7342 |
isSelected ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7343 |
fg := self activeForegroundColor |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7344 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7345 |
isEnabled ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7346 |
self isEntered ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7347 |
fg := menuPanel enteredForegroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7348 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7349 |
fg := menuPanel foregroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7350 |
] |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7351 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7352 |
fg := menuPanel disabledForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7353 |
etchFg := menuPanel disabledEtchedForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7354 |
drawObject := self disabledRawLabel |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7355 |
] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7356 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7357 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7358 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7359 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7360 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7361 |
|
3131 | 7362 |
( (form := self indicatorForm) notNil |
7363 |
or:[(form := self choiceForm) notNil] |
|
7364 |
) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7365 |
y := t + ((h - form height) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7366 |
form displayOn:menuPanel x:x y:y. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7367 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7368 |
|
2817 | 7369 |
drawObject notEmptyOrNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7370 |
x := x + (menuPanel stringOffsetXfor:self). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7371 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7372 |
etchFg notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7373 |
"/ donot draw images twice.. images are shown lightened |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7374 |
drawObject isImageOrForm ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7375 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7376 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7377 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7378 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
2362 | 7379 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7380 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7381 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7382 |
"/ DRAW SHORTCUT KEY |
2359 | 7383 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7384 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7385 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7386 |
) ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7387 |
x := layout left + x. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7388 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7389 |
y := y + menuPanel font ascent. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7390 |
scKey displayOn:menuPanel x:x y:y. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7391 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7392 |
|
3403 | 7393 |
"/ DRAW SUBMENU INDICATION (if a vertical menu with submenu) |
7394 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7395 |
arrow := menuPanel rightArrow. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7396 |
x := layout right - arrow width - HorizontalInset. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7397 |
y := t + ((h - arrow height) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7398 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7399 |
(menuPanel styleSheet is3D not |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7400 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7401 |
menuPanel displayForm:arrow x:x y:y. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7402 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7403 |
cLa := menuPanel shadowColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7404 |
cLb := menuPanel lightColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7405 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7406 |
isSelected ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7407 |
fg := cLa. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7408 |
cLa := cLb. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7409 |
cLb := fg |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7410 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7411 |
menuPanel paint:cLa. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7412 |
menuPanel displayForm:arrow x:x y:y. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7413 |
menuPanel paint:cLb. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7414 |
menuPanel displayForm:drawObject x:x y:y. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7415 |
]. |
3403 | 7416 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7417 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7418 |
"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
|
7419 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7420 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7421 |
drawMenuIndicator |
2870 | 7422 |
"draw a menu indicator if the item has a menu or delayed menu." |
7423 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7424 |
|x y icon bAbsLevel verticalPosition| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7425 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7426 |
icon := self menuIndicatorIcon. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7427 |
icon isNil ifTrue:[ |
3938 | 7428 |
^ self |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7429 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7430 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7431 |
x := layout right - icon width. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7432 |
verticalPosition := menuPanel menuIndicatorVerticalPosition. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7433 |
verticalPosition == #center ifTrue:[ |
3938 | 7434 |
y := (layout height - icon height) // 2 + layout top. |
2220 | 7435 |
] ifFalse:[ |
3938 | 7436 |
verticalPosition == #top ifTrue:[ |
7437 |
y := layout top + 2. |
|
7438 |
] ifFalse:[ |
|
7439 |
y := layout bottom - icon height - 2. |
|
7440 |
] |
|
2220 | 7441 |
]. |
7442 |
||
7443 |
bAbsLevel := 0. |
|
2359 | 7444 |
menuItem isButton ifTrue:[ |
3938 | 7445 |
self isSelected ifTrue:[ |
7446 |
x := x + 1. |
|
7447 |
y := y + 1. |
|
7448 |
]. |
|
7449 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
7450 |
x := x - bAbsLevel. |
|
7451 |
y := y - bAbsLevel. |
|
2220 | 7452 |
]. |
7453 |
x := x - 1 "- HorizontalInset". |
|
7454 |
||
7455 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
3938 | 7456 |
icon := menuPanel lightenedImageOnDevice:icon |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7457 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7458 |
icon displayOn:menuPanel x:x y:y. |
2220 | 7459 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7460 |
(menuPanel drawMenuIndicatorSeparatorLine |
3938 | 7461 |
and:[ self isEntered |
7462 |
and:[ menuPanel buttonEnteredLevel ~~ 0] ]) |
|
7463 |
ifTrue:[ |
|
7464 |
menuPanel paint:menuPanel buttonShadowColor. |
|
7465 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
7466 |
menuPanel paint:menuPanel buttonLightColor. |
|
7467 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
2220 | 7468 |
]. |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7469 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7470 |
|
2059 | 7471 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 7472 |
"draw a labeled entry; no button, no separator." |
7473 |
||
3486 | 7474 |
|oldFont labelExtent |
1727 | 7475 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7476 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7477 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7478 |
| |
2059 | 7479 |
|
3486 | 7480 |
oldFont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7481 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7482 |
menuPanel paint:fg. |
2614 | 7483 |
labelExtent := self displayLabelExtent. |
7484 |
||
7485 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 7486 |
"/ menuPanel centerItems ifTrue:[self halt]. |
3938 | 7487 |
aLabel isArray ifFalse:[ |
7488 |
|printLabel| |
|
7489 |
||
7490 |
aLabel isText ifTrue:[ |
|
7491 |
"/ background of label has already been drawn |
|
7492 |
printLabel := aLabel withoutBackgroundColorEmphasis. |
|
7493 |
] ifFalse:[ |
|
7494 |
printLabel := aLabel. |
|
7495 |
]. |
|
7496 |
y := y + (printLabel ascentOn:menuPanel). |
|
7497 |
printLabel displayOn:menuPanel x:x y:y. |
|
1727 | 7498 |
] ifTrue:[ |
3938 | 7499 |
aLabel do:[:el| |
7500 |
el notNil ifTrue:[ |
|
7501 |
y0 := y + (el ascentOn:menuPanel). |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7502 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7503 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7504 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7505 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7506 |
"/ ]. |
3938 | 7507 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
7508 |
el displayOn:menuPanel x:x0 y:y0. |
|
7509 |
y := y + 1 + (el heightOn:menuPanel) |
|
7510 |
] ifFalse:[ |
|
7511 |
y := y + (self spaceBetweenEmptyLines) |
|
7512 |
] |
|
7513 |
]. |
|
1727 | 7514 |
]. |
3486 | 7515 |
menuPanel setFont:oldFont |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7516 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7517 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7518 |
drawSeparatingLines |
2870 | 7519 |
"draw separating lines" |
7520 |
||
2059 | 7521 |
|myIndex lfSep rtSep items prevItem nextItem |
7522 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7523 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7524 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7525 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7526 |
b "{ Class:SmallInteger }" |
706 | 7527 |
| |
2059 | 7528 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7529 |
items := menuPanel items. |
2059 | 7530 |
myIndex := items identityIndexOf:self. |
7531 |
||
7532 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
7533 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
7534 |
||
7535 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
7536 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
7537 |
||
7538 |
(lfSep or:[rtSep]) ifFalse:[ |
|
3938 | 7539 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7540 |
]. |
2059 | 7541 |
|
7542 |
lightColor := menuPanel lightColor. |
|
7543 |
shadowColor := menuPanel shadowColor. |
|
7544 |
||
7545 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7546 |
|
608 | 7547 |
l := layout left. |
7548 |
t := layout top. |
|
7549 |
r := layout right. |
|
7550 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7551 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7552 |
menuPanel verticalLayout ifTrue:[ |
3938 | 7553 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
7554 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
7555 |
||
7556 |
menuPanel paint:shadowColor. |
|
7557 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
7558 |
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
|
7559 |
] ifFalse:[ |
3938 | 7560 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
7561 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
7562 |
||
7563 |
menuPanel paint:shadowColor. |
|
7564 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
7565 |
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
|
7566 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7567 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7568 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7569 |
drawSeparator |
2870 | 7570 |
"draw as separator" |
7571 |
||
2059 | 7572 |
|type lightColor shadowColor isDouble |
7573 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7574 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7575 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7576 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7577 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7578 |
| |
2059 | 7579 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7580 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7581 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
3938 | 7582 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7583 |
]. |
2059 | 7584 |
|
7585 |
isDouble := type == #doubleLine. |
|
7586 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7587 |
lightColor := menuPanel lightColor. |
2059 | 7588 |
shadowColor := menuPanel shadowColor. |
7589 |
menuPanel paint:shadowColor. |
|
7590 |
||
7591 |
left := layout left. |
|
7592 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7593 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7594 |
menuPanel verticalLayout ifTrue:[ |
3938 | 7595 |
x0 := left + HorizontalInset. |
7596 |
x1 := layout right - HorizontalInset. |
|
7597 |
y0 := top - 1 + (layout height // 2). |
|
7598 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
7599 |
||
7600 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
7601 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
7602 |
||
7603 |
menuPanel paint:lightColor. |
|
7604 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
7605 |
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
|
7606 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7607 |
] ifFalse:[ |
3938 | 7608 |
y1 := layout bottom. |
7609 |
x0 := left - 1 + (layout width // 2). |
|
7610 |
y0 := top. |
|
7611 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
7612 |
||
7613 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
7614 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
7615 |
||
7616 |
menuPanel paint:lightColor. |
|
7617 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
7618 |
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
|
7619 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7620 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7621 |
|
2768 | 7622 |
indicatorForm |
2870 | 7623 |
"returns indication form or nil" |
7624 |
||
3565 | 7625 |
|isOn| |
2768 | 7626 |
|
7627 |
indication isNil ifTrue:[^ nil]. |
|
7628 |
||
3565 | 7629 |
isOn := self indicationValue. |
2768 | 7630 |
self enabled ifFalse:[ |
3938 | 7631 |
^ isOn == true |
7632 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
7633 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 7634 |
]. |
3565 | 7635 |
"/ self isSelected ifTrue:[ |
3938 | 7636 |
"/ ^ isOn == true |
3565 | 7637 |
"/ ifTrue:[menuPanel iconIndicationEnteredOn] |
7638 |
"/ ifFalse:[menuPanel iconIndicationEnteredOff] |
|
7639 |
"/ ]. |
|
7640 |
||
3938 | 7641 |
^ isOn == true |
7642 |
ifTrue:[menuPanel iconIndicationOn] |
|
7643 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 7644 |
! |
7645 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7646 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7647 |
|
2362 | 7648 |
layout isNil ifTrue:[^ self]. |
7649 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7650 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
3938 | 7651 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7652 |
] |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7653 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7654 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7655 |
menuIndicatorIcon |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7656 |
"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
|
7657 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7658 |
self hasDelayedMenuIndicator ifTrue:[ |
3938 | 7659 |
^ MenuPanel delayedMenuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7660 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7661 |
self hasMenuIndicator ifTrue:[ |
3938 | 7662 |
^ MenuPanel menuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7663 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7664 |
^ nil |
388 | 7665 |
! ! |
7666 |
||
7667 |
!MenuPanel::Item methodsFor:'initialization'! |
|
7668 |
||
7669 |
destroy |
|
2870 | 7670 |
"destroy submenus, remove dependencies" |
7671 |
||
616 | 7672 |
self submenu:nil. |
2681 | 7673 |
self removeDependencies. |
616 | 7674 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7675 |
menuPanel := nil. |
616 | 7676 |
! |
7677 |
||
794 | 7678 |
in:aPanel |
2870 | 7679 |
"create item in a menuPanel" |
7680 |
||
794 | 7681 |
menuPanel := aPanel. |
2359 | 7682 |
|
7683 |
menuItem isNil ifTrue:[ |
|
3938 | 7684 |
self breakPoint:#ca. |
7685 |
menuItem := MenuItem new |
|
2359 | 7686 |
]. |
7687 |
! |
|
7688 |
||
7689 |
initialize |
|
7690 |
menuItem := MenuItem new. |
|
1811 | 7691 |
! |
7692 |
||
7693 |
reinitStyle |
|
7694 |
||
7695 |
subMenu notNil ifTrue:[ |
|
3147 | 7696 |
subMenu reinitStyle |
1811 | 7697 |
]. |
7698 |
||
7699 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
7700 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 7701 |
! ! |
7702 |
||
7703 |
!MenuPanel::Item methodsFor:'label basics'! |
|
7704 |
||
7705 |
disabledRawLabel |
|
2870 | 7706 |
"returns the label used if the item is disabled" |
7707 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7708 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7709 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7710 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7711 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7712 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7713 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7714 |
disabledDisplayLabel isString ifTrue:[ |
3938 | 7715 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7716 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7717 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7718 |
block := [:el| |rslt| |
3938 | 7719 |
(rslt := el) notNil ifTrue:[ |
7720 |
el isImageOrForm ifTrue:[ |
|
7721 |
el colorMap notNil ifTrue:[ |
|
7722 |
rslt := menuPanel lightenedImageOnDevice:el |
|
7723 |
] |
|
7724 |
] ifFalse:[ |
|
7725 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
|
7726 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
|
7727 |
form := menuPanel lightenedImageOnDevice:form |
|
7728 |
]. |
|
7729 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
|
7730 |
image := menuPanel lightenedImageOnDevice:image |
|
7731 |
]. |
|
7732 |
rslt := LabelAndIcon form:form image:image string:(el string). |
|
7733 |
] |
|
7734 |
] |
|
7735 |
]. |
|
7736 |
rslt |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7737 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7738 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7739 |
displayLabel isArray ifTrue:[ |
3938 | 7740 |
disabledDisplayLabel := Array new:(displayLabel size). |
7741 |
||
7742 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
|
7743 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
|
7744 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7745 |
] ifFalse:[ |
3938 | 7746 |
disabledDisplayLabel := block value:displayLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7747 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7748 |
^ disabledDisplayLabel |
794 | 7749 |
! |
7750 |
||
1829 | 7751 |
fetchDeviceResources |
2373 | 7752 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7753 |
disabledDisplayLabel := nil. |
1829 | 7754 |
self fetchImages. |
7755 |
! |
|
7756 |
||
616 | 7757 |
fetchImages |
2870 | 7758 |
"fetch my icon images" |
7759 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7760 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7761 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7762 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
3938 | 7763 |
^ self |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7764 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7765 |
displayLabel isImageOrForm ifTrue:[ |
3938 | 7766 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
7767 |
^ self. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7768 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7769 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7770 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
3938 | 7771 |
(icon := displayLabel image) notNil ifTrue:[ |
7772 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
|
7773 |
]. |
|
7774 |
(icon := displayLabel icon) notNil ifTrue:[ |
|
7775 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
|
7776 |
]. |
|
7777 |
^ self |
|
7778 |
]. |
|
7779 |
||
7780 |
displayLabel isArray ifFalse:[^ self]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7781 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7782 |
displayLabel keysAndValuesDo:[:i :el| |
3938 | 7783 |
(el notNil and:[el isString not]) ifTrue:[ |
7784 |
el isImageOrForm ifTrue:[ |
|
7785 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
|
7786 |
] ifFalse:[ |
|
7787 |
el class == LabelAndIcon ifTrue:[ |
|
7788 |
(icon := el image) notNil ifTrue:[ |
|
7789 |
el image:(menuPanel imageOnMyDevice:icon) |
|
7790 |
]. |
|
7791 |
(icon := el icon) notNil ifTrue:[ |
|
7792 |
el icon:(menuPanel imageOnMyDevice:icon) |
|
7793 |
] |
|
7794 |
] |
|
7795 |
] |
|
7796 |
] |
|
1078 | 7797 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7798 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7799 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7800 |
updateAccessCharacterFor:aLabel |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7801 |
"replace &x by the short-key attribute (i.e. remove & and underline x)" |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7802 |
|
3192 | 7803 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7804 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7805 |
aLabel isString ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7806 |
aLabel class == LabelAndIcon ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7807 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7808 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7809 |
^ aLabel |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7810 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7811 |
|
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7812 |
^ MenuPanel |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7813 |
processAmpersandCharactersFor:aLabel |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7814 |
withAccessCharacterPosition:(menuItem accessCharacterPosition). |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7815 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7816 |
"Modified: / 15-02-2012 / 18:53:11 / cg" |
388 | 7817 |
! ! |
7818 |
||
1573 | 7819 |
!MenuPanel::Item methodsFor:'printing & storing'! |
7820 |
||
7821 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7822 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7823 |
|
1573 | 7824 |
! ! |
7825 |
||
388 | 7826 |
!MenuPanel::Item methodsFor:'private'! |
7827 |
||
650 | 7828 |
activeBackgroundColor |
2870 | 7829 |
"returns the active background color derived from menuPanel" |
7830 |
||
2359 | 7831 |
menuItem isButton ifTrue:[ |
3938 | 7832 |
^ menuPanel buttonActiveBackgroundColor |
2359 | 7833 |
]. |
7834 |
^ menuPanel activeBackgroundColor |
|
650 | 7835 |
! |
7836 |
||
7837 |
activeForegroundColor |
|
2870 | 7838 |
"returns the active foreground color derived from menuPanel" |
650 | 7839 |
|
3441 | 7840 |
menuItem isButton ifTrue:[ |
3938 | 7841 |
^ menuPanel buttonActiveForegroundColor |
3441 | 7842 |
]. |
650 | 7843 |
^menuPanel activeForegroundColor |
7844 |
! |
|
7845 |
||
727 | 7846 |
backgroundColor |
2870 | 7847 |
"returns the background color derived from menuPanel" |
7848 |
||
2359 | 7849 |
menuItem isButton ifTrue:[ |
3938 | 7850 |
^ menuPanel buttonPassiveBackgroundColor |
2359 | 7851 |
]. |
7852 |
^ menuPanel backgroundColor |
|
727 | 7853 |
! |
7854 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7855 |
backgroundColorFromLabel |
2870 | 7856 |
"returns the background color derived from label or nil" |
7857 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7858 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7859 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7860 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7861 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7862 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7863 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7864 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7865 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7866 |
run size == 0 ifTrue:[ |
3938 | 7867 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
7868 |
^ run value |
|
7869 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7870 |
] ifFalse:[ |
3938 | 7871 |
run do:[:r| |
7872 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
7873 |
^ r value |
|
7874 |
] |
|
7875 |
] |
|
388 | 7876 |
]. |
7877 |
^ nil |
|
7878 |
! |
|
7879 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7880 |
buttonEnteredBackgroundColor |
3938 | 7881 |
"returns the background color to use when thhe mouse has entered |
2870 | 7882 |
derived from menuPanel" |
7883 |
||
2359 | 7884 |
menuItem isButton ifTrue:[ |
3938 | 7885 |
^ menuPanel buttonEnteredBackgroundColor |
2359 | 7886 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7887 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7888 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7889 |
|
663 | 7890 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7891 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7892 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7893 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7894 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7895 |
|
3866
fbdbf71489d8
show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
7896 |
|subm sel numArgs gotMenu| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7897 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7898 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7899 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7900 |
sel := menuItem submenuChannel. |
3934 | 7901 |
(sel isString or:[sel isSymbol]) ifFalse:[^ nil]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7902 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7903 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7904 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7905 |
numArgs == 0 ifTrue:[ |
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7906 |
gotMenu := false. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7907 |
MessageNotUnderstood handle:[:ex | |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7908 |
|selector| |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7909 |
|
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7910 |
((selector := ex selector) == sel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7911 |
or:[selector == #aspectFor:]) ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7912 |
ex reject |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7913 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7914 |
] do:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7915 |
subm := aRecv aspectFor:sel. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7916 |
gotMenu := true. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7917 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7918 |
"/ used to be subm notNil; however, this is a bad test, |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7919 |
"/ as it does not allow for the app to return nil for no-menu. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7920 |
gotMenu ifTrue:[^ subm]. |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7921 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7922 |
|
2043 | 7923 |
(Array with:(aRecv) with:(aRecv class)) |
7924 |
do:[:aPossibleReceiver | |
|
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7925 |
MessageNotUnderstood handle:[:ex| |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7926 |
ex message selector == sel ifFalse:[ ex reject ] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7927 |
] do:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7928 |
numArgs == 0 ifTrue:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7929 |
subm := aPossibleReceiver perform:sel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7930 |
] ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7931 |
numArgs == 1 ifTrue:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7932 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7933 |
] ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7934 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7935 |
] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7936 |
] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7937 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7938 |
subm notNil ifTrue:[^ subm]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7939 |
Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
4027 | 7940 |
"/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR. |
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7941 |
] |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7942 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7943 |
|
663 | 7944 |
^ subm |
2043 | 7945 |
|
4027 | 7946 |
"Modified: / 24-03-2011 / 11:20:24 / cg" |
663 | 7947 |
! |
7948 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7949 |
indicationValue |
2870 | 7950 |
"returns indication value or nil in case of no indication" |
7951 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7952 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7953 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7954 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7955 |
|
3938 | 7956 |
indication isSymbol ifFalse:[ |
7957 |
^ indication value == true "block or model" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7958 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7959 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7960 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
3938 | 7961 |
recv := menuPanel receiver. |
7962 |
||
7963 |
(recv isValueModel) ifFalse:[ |
|
7964 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
7965 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
7966 |
sel := sel asSymbol. |
|
7967 |
||
7968 |
MessageNotUnderstood handle:[:ex| |
|
7969 |
ex selector == sel ifFalse:[ |
|
7970 |
ex reject |
|
7971 |
]. |
|
7972 |
] do:[ |
|
7973 |
sel := recv perform:sel with:(menuItem argument) |
|
7974 |
] |
|
7975 |
]. |
|
7976 |
]. |
|
7977 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7978 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7979 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7980 |
numArgs ~~ 0 ifTrue:[ |
3938 | 7981 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7982 |
] ifFalse:[ |
3938 | 7983 |
sel := indication |
7984 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7985 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7986 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7987 |
sel isValueModel ifTrue:[ |
3938 | 7988 |
indication := sel. |
7989 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7990 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7991 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7992 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7993 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7994 |
indicationValue:aValue |
2870 | 7995 |
"set the indication value" |
7996 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7997 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7998 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7999 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8000 |
|
3938 | 8001 |
indication isSymbol ifFalse:[ |
8002 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
|
8003 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8004 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8005 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8006 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
3938 | 8007 |
^ self |
1218 | 8008 |
]. |
8009 |
||
524 | 8010 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8011 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8012 |
|
1218 | 8013 |
recv isNil ifTrue:[ |
3938 | 8014 |
recv := menuPanel application. |
8015 |
recv isNil ifTrue:[^ self]. |
|
8016 |
]. |
|
8017 |
||
8018 |
MessageNotUnderstood handle:[:ex| |
|
8019 |
(ex selector ~~ indication) ifTrue:[ |
|
8020 |
ex reject |
|
8021 |
]. |
|
8022 |
self ifNotInUIBuilderInfoPrintCR: |
|
8023 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
|
8024 |
bindWith:recv classNameWithArticle with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8025 |
] do:[ |
3938 | 8026 |
numArgs == 1 ifTrue:[ |
8027 |
recv perform:indication with:aValue |
|
8028 |
] ifFalse:[ |
|
8029 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
8030 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8031 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8032 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8033 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8034 |
isEntered |
2870 | 8035 |
"returns true if the mouse pointer is over the item" |
8036 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8037 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8038 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8039 |
"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
|
8040 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8041 |
|
464 | 8042 |
separatorType |
2870 | 8043 |
"returns type of separator line or nil" |
8044 |
||
390 | 8045 |
|c lbl| |
388 | 8046 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8047 |
self isSeparator ifFalse:[ |
3938 | 8048 |
^ nil |
388 | 8049 |
]. |
8050 |
||
390 | 8051 |
(lbl := label value) isNil ifTrue:[ |
3938 | 8052 |
^ #singleLine |
388 | 8053 |
]. |
8054 |
||
390 | 8055 |
lbl size == 1 ifTrue:[ |
3938 | 8056 |
c := lbl first. |
8057 |
c == $- ifTrue:[^ #singleLine]. |
|
8058 |
c == $= ifTrue:[^ #doubleLine]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8059 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8060 |
^ #blankLine |
1130 | 8061 |
! |
8062 |
||
8063 |
setupSubmenu |
|
3938 | 8064 |
|appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding |
3934 | 8065 |
channel whoProvidedMenu t| |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8066 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8067 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8068 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8069 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8070 |
subMenu notNil ifTrue:[ |
3938 | 8071 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8072 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8073 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8074 |
channel isSymbol ifFalse:[ |
3938 | 8075 |
submenuHolder := channel |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8076 |
] ifTrue:[ |
3938 | 8077 |
"/ submenu is specified by a selector in submenuChannel. |
8078 |
"/ who gets me the menu: |
|
8079 |
"/ 1) submenuProvider (if not nil) |
|
8080 |
"/ 2) menuPanel application |
|
8081 |
"/ 3) menuPanel receiver |
|
8082 |
"/ 4) menuPanel application master-chain |
|
8083 |
"/ 5) menuPanel receiver master-chain |
|
8084 |
||
8085 |
(submenuProvider := menuItem submenuProvider) notNil ifTrue:[ |
|
8086 |
submenuHolder := self findSubMenuIn:submenuProvider. |
|
8087 |
whoProvidedMenu := submenuProvider. |
|
8088 |
]. |
|
8089 |
submenuHolder isNil ifTrue:[ |
|
8090 |
appl := menuPanel application. |
|
8091 |
(appl notNil and:[appl ~~ submenuProvider]) ifTrue:[ |
|
8092 |
submenuHolder := self findSubMenuIn:appl. |
|
8093 |
whoProvidedMenu := appl. |
|
8094 |
]. |
|
8095 |
submenuHolder isNil ifTrue:[ |
|
8096 |
recv := menuPanel receiver. |
|
8097 |
(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[ |
|
8098 |
submenuHolder := self findSubMenuIn:recv. |
|
8099 |
whoProvidedMenu := recv. |
|
8100 |
]. |
|
8101 |
(submenuHolder isNil and:[appl notNil]) ifTrue:[ |
|
8102 |
t := appl. |
|
8103 |
[ submenuHolder isNil |
|
8104 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8105 |
] whileTrue:[ |
|
8106 |
( master ~~ appl |
|
8107 |
and:[ master ~~ recv |
|
8108 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8109 |
submenuHolder := self findSubMenuIn:master. |
|
8110 |
]. |
|
8111 |
t := master. |
|
8112 |
whoProvidedMenu := master. |
|
8113 |
] |
|
8114 |
]. |
|
8115 |
(submenuHolder isNil and:[recv notNil]) ifTrue:[ |
|
8116 |
t := recv. |
|
8117 |
[ submenuHolder isNil |
|
8118 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8119 |
] whileTrue:[ |
|
8120 |
( master ~~ appl |
|
8121 |
and:[ master ~~ recv |
|
8122 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8123 |
submenuHolder := self findSubMenuIn:master. |
|
8124 |
]. |
|
8125 |
t := master. |
|
8126 |
whoProvidedMenu := master. |
|
8127 |
] |
|
8128 |
]. |
|
8129 |
]. |
|
8130 |
]. |
|
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8131 |
"/ submenuHolder isNil ifTrue:[ |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8132 |
"/ self halt:'did not find any menu' |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8133 |
"/ ]. |
3934 | 8134 |
|
8135 |
"/ appl := menuPanel application. |
|
8136 |
"/ appl isNil ifTrue:[ |
|
8137 |
"/ appl := menuPanel receiver. |
|
8138 |
"/ appl notNil ifTrue:[ |
|
8139 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
|
3938 | 8140 |
"/ [submenuHolder isNil |
3934 | 8141 |
"/ and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
8142 |
"/ and:[master ~~ appl]]] whileTrue:[ |
|
8143 |
"/ appl := master. |
|
8144 |
"/ submenuHolder := self findSubMenuIn:appl. |
|
8145 |
"/ ]. |
|
8146 |
"/ ] |
|
8147 |
"/ ]. |
|
8148 |
"/ ]. |
|
3938 | 8149 |
"/ submenuHolder isNil ifTrue:[ |
3934 | 8150 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
8151 |
"/ (recv := menuPanel receiver) ~~ appl ifTrue:[ |
|
8152 |
"/ appl := recv. |
|
8153 |
"/ submenuHolder := self findSubMenuIn:appl |
|
8154 |
"/ ] |
|
8155 |
"/ ] |
|
8156 |
"/ ] |
|
8157 |
]. |
|
8158 |
||
8159 |
(newSubmenu := submenuHolder value) isArray ifTrue:[ |
|
3938 | 8160 |
submenuEncoding := newSubmenu. |
8161 |
newSubmenu := Menu decodeFromLiteralArray:submenuEncoding. |
|
8162 |
"/ cg: linked menus also may contain translations ... |
|
8163 |
newSubmenu notNil ifTrue:[ |
|
8164 |
whoProvidedMenu "appl" notNil ifTrue:[ |
|
8165 |
newSubmenu findGuiResourcesIn:whoProvidedMenu "appl". |
|
8166 |
] |
|
8167 |
]. |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8168 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8169 |
"/ appl notNil ifTrue:[submenu application:appl]. |
3934 | 8170 |
self submenu:newSubmenu. |
1130 | 8171 |
^ subMenu |
8172 |
||
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8173 |
"Modified: / 22-09-2010 / 14:37:46 / cg" |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8174 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8175 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8176 |
spaceBetweenEmptyLines |
3938 | 8177 |
^ 3 |
388 | 8178 |
! ! |
8179 |
||
8180 |
!MenuPanel::Item methodsFor:'queries'! |
|
8181 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8182 |
canChangeVisibility |
1699 | 8183 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 8184 |
otherwise there is a change notification raised if the model changed" |
8185 |
||
3122 | 8186 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 8187 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 8188 |
|
8189 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 8190 |
"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
|
8191 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8192 |
|
388 | 8193 |
canSelect |
1699 | 8194 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 8195 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
8196 |
||
2362 | 8197 |
self isSeparator ifTrue:[^ false]. |
8198 |
||
8199 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
3938 | 8200 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
8201 |
^ true |
|
8202 |
]. |
|
1078 | 8203 |
]. |
8204 |
^ false |
|
388 | 8205 |
! |
8206 |
||
2046 | 8207 |
containsPoint:aPoint |
2870 | 8208 |
"returns true if aPoint is contained in my layout" |
8209 |
||
2046 | 8210 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8211 |
^ layout containsPoint:aPoint |
2046 | 8212 |
]. |
8213 |
^ false |
|
8214 |
||
8215 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
8216 |
! |
|
8217 |
||
388 | 8218 |
containsPointX:x y:y |
2870 | 8219 |
"returns true if point is contained in my layout" |
8220 |
||
712 | 8221 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8222 |
^ layout containsPointX:x y:y |
505 | 8223 |
]. |
8224 |
^ false |
|
388 | 8225 |
! |
8226 |
||
2199 | 8227 |
hasDelayedMenu |
2870 | 8228 |
"returns true if a delayed menu exists" |
8229 |
||
2360 | 8230 |
self hasSubmenu ifFalse:[ |
3938 | 8231 |
^ false |
2199 | 8232 |
]. |
2360 | 8233 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
8234 |
||
8235 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
3938 | 8236 |
^ false |
2199 | 8237 |
]. |
8238 |
^ true |
|
8239 |
! |
|
8240 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8241 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8242 |
"returns true if the item has a delayed menu |
2870 | 8243 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8244 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8245 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8246 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8247 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8248 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8249 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8250 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8251 |
hasIndication |
2870 | 8252 |
"returns true if on/off indication exists" |
8253 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8254 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8255 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8256 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8257 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8258 |
"returns true if the item has a delayed menu |
2870 | 8259 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8260 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8261 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8262 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8263 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8264 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8265 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8266 |
|
388 | 8267 |
hasSubmenu |
2870 | 8268 |
"returns true if the item is configured as an subMenu entry" |
3938 | 8269 |
|
2870 | 8270 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
388 | 8271 |
! |
8272 |
||
8273 |
isEnabled |
|
2870 | 8274 |
"returns the enabled state" |
8275 |
||
388 | 8276 |
^ self enabled |
8277 |
! |
|
8278 |
||
608 | 8279 |
isSeparator |
2870 | 8280 |
"returns true if item is a separator" |
8281 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8282 |
^ displayLabel isNil |
608 | 8283 |
! |
8284 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8285 |
isToggle |
2870 | 8286 |
"returns true if on/off indication exists" |
8287 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8288 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8289 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8290 |
|
712 | 8291 |
isVisible |
2870 | 8292 |
"returns the visibility state" |
8293 |
||
712 | 8294 |
|state| |
8295 |
||
8296 |
isVisible isSymbol ifTrue:[ |
|
3938 | 8297 |
state := self aspectAt:isVisible. |
8298 |
||
8299 |
state isValueModel ifTrue:[ |
|
8300 |
isVisible := state. |
|
8301 |
isVisible addDependent:self. |
|
8302 |
state := isVisible. |
|
8303 |
] |
|
712 | 8304 |
] ifFalse:[ |
3938 | 8305 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8306 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8307 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8308 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8309 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 8310 |
! |
8311 |
||
8312 |
isVisible:something |
|
2870 | 8313 |
"change the visibility state; if the state changed, a redraw is performed" |
8314 |
||
712 | 8315 |
|oldState newState| |
8316 |
||
8317 |
isVisible isNil ifTrue:[ |
|
3938 | 8318 |
oldState := true |
712 | 8319 |
] ifFalse:[ |
3938 | 8320 |
oldState := isVisible value. |
8321 |
isVisible isValueModel ifTrue:[ |
|
8322 |
isVisible removeDependent:self |
|
8323 |
] |
|
712 | 8324 |
]. |
8325 |
isVisible := something. |
|
8326 |
||
8327 |
isVisible isNil ifTrue:[ |
|
3938 | 8328 |
newState := true |
712 | 8329 |
] ifFalse:[ |
3938 | 8330 |
isVisible isValueModel ifTrue:[ |
8331 |
isVisible addDependent:self |
|
8332 |
] ifFalse:[ |
|
8333 |
isVisible isSymbol ifTrue:[^ self] |
|
8334 |
]. |
|
8335 |
menuPanel shown ifFalse:[^ self]. |
|
8336 |
newState := isVisible value. |
|
712 | 8337 |
]. |
8338 |
||
8339 |
newState ~~ oldState ifTrue:[ |
|
3938 | 8340 |
menuPanel mustRearrange |
712 | 8341 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8342 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8343 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 8344 |
! |
8345 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8346 |
menuIndicatorContains:aPoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8347 |
"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
|
8348 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8349 |
|icon xSep| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8350 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8351 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8352 |
(layout containsPoint:aPoint) ifTrue:[ |
8353 |
icon := self menuIndicatorIcon. |
|
8354 |
icon notNil ifTrue:[ |
|
8355 |
xSep := layout right - icon width. |
|
8356 |
^ aPoint x >= xSep |
|
8357 |
] |
|
8358 |
] |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8359 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8360 |
^ false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8361 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8362 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8363 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8364 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8365 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8366 |
|
388 | 8367 |
shortcutKeyAsString |
3601 | 8368 |
"converts shortcutKey to a text object for the menu-label-hint. |
8369 |
returns nil, if the key has no assignment." |
|
2870 | 8370 |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8371 |
|shortcutKey| |
2359 | 8372 |
|
8373 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 8374 |
|
8375 |
shortcutKey isNil ifTrue:[ |
|
3938 | 8376 |
^ nil |
1609 | 8377 |
]. |
8378 |
shortcutKey isCharacter ifTrue:[ |
|
3938 | 8379 |
shortcutKey == Character space ifFalse:[ |
8380 |
^ 'Space' |
|
8381 |
]. |
|
8382 |
^ shortcutKey asString |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8383 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8384 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8385 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8386 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 8387 |
! ! |
8388 |
||
8389 |
!MenuPanel::Item methodsFor:'selection'! |
|
8390 |
||
8391 |
isSelected |
|
2870 | 8392 |
"returns true if item is selected" |
1998 | 8393 |
|
8394 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 8395 |
! |
8396 |
||
2249 | 8397 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
8398 |
"change selection to a state. Dependant on the state open or hide an existing |
2870 | 8399 |
submenu and perform a redraw" |
8400 |
||
2249 | 8401 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
3938 | 8402 |
self invalidate. |
8403 |
self hideSubmenu. |
|
8404 |
^ self |
|
2249 | 8405 |
]. |
8406 |
||
2199 | 8407 |
menuPanel realized ifFalse:[ ^ self ]. |
8408 |
||
2359 | 8409 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
3938 | 8410 |
self invalidate |
2199 | 8411 |
]. |
8412 |
self hasSubmenu ifFalse:[ ^ self]. |
|
8413 |
||
8414 |
self hasDelayedMenu ifTrue:[ |
|
3938 | 8415 |
menuPanel openDelayed:self |
2199 | 8416 |
] ifFalse:[ |
3938 | 8417 |
self setupSubmenu. |
8418 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
|
1701 | 8419 |
]. |
3133 | 8420 |
|
8421 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 8422 |
! ! |
8423 |
||
2692 | 8424 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
8425 |
||
8426 |
argument2 |
|
8427 |
||
8428 |
^ argument2 |
|
8429 |
! |
|
8430 |
||
8431 |
argument2:anArgumentOrNil |
|
8432 |
||
8433 |
argument2 := anArgumentOrNil |
|
8434 |
! ! |
|
8435 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8436 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 8437 |
|
2018 | 8438 |
icon |
2016 | 8439 |
"This resource specification was automatically generated |
8440 |
by the ImageEditor of ST/X." |
|
8441 |
||
8442 |
"Do not manually edit this!! If it is corrupted, |
|
8443 |
the ImageEditor may not be able to read the specification." |
|
8444 |
||
8445 |
" |
|
2018 | 8446 |
self icon inspect |
8447 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 8448 |
" |
8449 |
||
8450 |
<resource: #image> |
|
8451 |
||
8452 |
^Icon |
|
3938 | 8453 |
constantNamed:#'MenuPanel::ScrollActivity class icon' |
8454 |
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 | 8455 |
! ! |
8456 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8457 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 8458 |
|
8459 |
new |
|
8460 |
^ self basicNew initialize |
|
8461 |
! ! |
|
8462 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8463 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 8464 |
|
8465 |
activeMenu |
|
8466 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 8467 |
is returned if scrolling is deactivated" |
8468 |
||
2016 | 8469 |
^ activeMenu |
8470 |
! |
|
8471 |
||
8472 |
direction |
|
2870 | 8473 |
"returns the scroll-direction" |
8474 |
||
2016 | 8475 |
^ direction |
8476 |
! |
|
8477 |
||
8478 |
iconAt:aDirection on:aMenu |
|
2018 | 8479 |
|icon device index| |
2016 | 8480 |
|
8481 |
device := aMenu device. |
|
8482 |
||
8483 |
aDirection == #PREV ifTrue:[ |
|
3147 | 8484 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
3938 | 8485 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
2018 | 8486 |
] ifFalse:[ |
3147 | 8487 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
8488 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 8489 |
]. |
8490 |
||
8491 |
icon := icons at:index. |
|
8492 |
||
8493 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
3147 | 8494 |
icon := self class icon. |
8495 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
8496 |
ifFalse:[ icon := icon copy ]. |
|
8497 |
||
8498 |
icon := icon onDevice:device. |
|
8499 |
icon clearMaskedPixels. |
|
8500 |
icons at:index put:icon |
|
2018 | 8501 |
]. |
8502 |
^ icon |
|
2016 | 8503 |
! ! |
8504 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8505 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 8506 |
|
8507 |
initialize |
|
8508 |
||
8509 |
semaLock := RecursionLock new. |
|
2018 | 8510 |
icons := Array new:4. |
2016 | 8511 |
! ! |
8512 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8513 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 8514 |
|
8515 |
isActive |
|
2870 | 8516 |
"returns true if scrolling is activated" |
8517 |
||
2016 | 8518 |
^ activeMenu notNil |
8519 |
! ! |
|
8520 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8521 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 8522 |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8523 |
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress |
2870 | 8524 |
"start scrolling; returns true if scrolling is activated" |
8525 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8526 |
|bounds index isScrolledMenu boundsOnRoot| |
2860 | 8527 |
|
8528 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 8529 |
|
8530 |
semaLock critical:[ |
|
3938 | 8531 |
self stop. |
8532 |
||
8533 |
isScrolledMenu ifTrue:[ |
|
8534 |
bounds := aMenu scrollerBoundsAt:aDirection. |
|
8535 |
||
8536 |
comesViaButtonPress ifFalse:[ |
|
8537 |
boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu) |
|
8538 |
extent:(bounds extent). |
|
8539 |
]. |
|
8540 |
||
8541 |
activeMenu := aMenu. |
|
8542 |
direction := aDirection. |
|
8543 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
8544 |
||
8545 |
index ~~ 0 ifTrue:[ |
|
8546 |
scrollTask := |
|
8547 |
[ |
|
8548 |
|item step continue| |
|
8549 |
||
8550 |
[ |
|
8551 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
8552 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
8553 |
aMenu makeItemVisible:item. |
|
8554 |
index := index + step. |
|
8555 |
]. |
|
8556 |
||
8557 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
8558 |
||
8559 |
[ |
|
8560 |
continue := (aMenu shown and:[(item := aMenu itemAt:index) notNil]). |
|
8561 |
||
8562 |
boundsOnRoot notNil ifTrue:[ |
|
8563 |
continue ifTrue:[ |
|
8564 |
continue := boundsOnRoot containsPoint:aMenu sensor mousePoint. |
|
8565 |
] ifFalse:[ |
|
8566 |
boundsOnRoot := nil. |
|
8567 |
] |
|
8568 |
]. |
|
8569 |
continue |
|
8570 |
] whileTrue:[ |
|
8571 |
aMenu makeItemVisible:item. |
|
8572 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
8573 |
index := index + step. |
|
8574 |
]. |
|
8575 |
item := nil. |
|
8576 |
] ensure:[ |
|
8577 |
activeMenu := direction := scrollTask := nil. |
|
8578 |
||
8579 |
item notNil ifTrue:[ |
|
8580 |
"/ process was killed |
|
8581 |
aMenu invalidate:bounds |
|
8582 |
] |
|
8583 |
]. |
|
8584 |
boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ]. |
|
8585 |
] forkAt:8. |
|
8586 |
] |
|
8587 |
] |
|
2016 | 8588 |
]. |
8589 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
8590 |
|
2048 | 8591 |
"Created: ca" |
8592 |
||
8593 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 8594 |
! |
8595 |
||
8596 |
stop |
|
2870 | 8597 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
8598 |
||
2016 | 8599 |
|task resp| |
8600 |
||
8601 |
activeMenu isNil ifTrue:[ |
|
3938 | 8602 |
^ false |
2016 | 8603 |
]. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8604 |
|
2016 | 8605 |
semaLock critical:[ |
3938 | 8606 |
resp := activeMenu notNil. |
8607 |
||
8608 |
(task := scrollTask) notNil ifTrue:[ |
|
8609 |
scrollTask := nil. |
|
8610 |
||
8611 |
Error handle:[:ex| |
|
8612 |
] do:[ |
|
8613 |
task terminateWithAllSubprocessesInGroup. |
|
8614 |
task waitUntilTerminated. |
|
8615 |
]. |
|
8616 |
]. |
|
8617 |
activeMenu := direction := nil. |
|
2016 | 8618 |
]. |
8619 |
^ resp |
|
8620 |
! ! |
|
8621 |
||
388 | 8622 |
!MenuPanel class methodsFor:'documentation'! |
8623 |
||
4109 | 8624 |
version |
4110 | 8625 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.534 2012-02-15 21:32:09 cg Exp $' |
4109 | 8626 |
! |
8627 |
||
3780 | 8628 |
version_CVS |
4110 | 8629 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.534 2012-02-15 21:32:09 cg Exp $' |
388 | 8630 |
! ! |
2199 | 8631 |
|
388 | 8632 |
MenuPanel initialize! |