author | Claus Gittinger <cg@exept.de> |
Thu, 28 Nov 2013 16:30:02 +0100 | |
changeset 4453 | 20778fc5b77e |
parent 4424 | 6a1849cb889f |
child 4454 | a22c7578f7ac |
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 |
||
4244 | 83 |
Due to some historic leftover, there are two mechanisms for menus: |
84 |
1) the (very) old MenuView (which inherits from SelectionInListView) |
|
85 |
2) this new MenuPanel. |
|
86 |
||
2170 | 87 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
4244 | 88 |
(and hopefully be ST-80 compatible...) |
89 |
||
90 |
To create a menu, there exists a MenuEditor which can generate |
|
91 |
menu specifications, from which a MenuPanel can be dynamically created. |
|
502 | 92 |
|
93 |
||
2061 | 94 |
Notice: |
4244 | 95 |
This is going to replace the obsolete MenuView. |
2061 | 96 |
|
388 | 97 |
[author:] |
4244 | 98 |
Claus Atzkern |
388 | 99 |
|
100 |
[see also:] |
|
4244 | 101 |
Menu |
102 |
MenuItem |
|
103 |
MenuEditor |
|
2170 | 104 |
|
105 |
cg: this code is so ugly - needs a complete rewrite... |
|
106 |
||
388 | 107 |
" |
108 |
! |
|
109 |
||
110 |
examples |
|
111 |
||
112 |
" |
|
4081 | 113 |
a PullDownMenu |
114 |
[exBegin] |
|
388 | 115 |
|top subView mview desc s1 s2 s3 img lbs labels| |
116 |
||
117 |
top := StandardSystemView new. |
|
118 |
||
436 | 119 |
mview := MenuPanel in:top. |
388 | 120 |
|
502 | 121 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 122 |
mview level:2. |
123 |
mview verticalLayout:false. |
|
124 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 125 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 126 |
mview labels:lbs. |
127 |
mview shortcutKeyAt:2 put:#Cut. |
|
128 |
mview accessCharacterPositionAt:1 put:1. |
|
129 |
mview accessCharacterPositionAt:2 put:2. |
|
130 |
||
131 |
mview enabledAt:5 put:false. |
|
132 |
mview groupSizes:#( 2 2 ). |
|
436 | 133 |
s1 := MenuPanel labels:labels. |
388 | 134 |
s1 accessCharacterPositionAt:1 put:1. |
135 |
s1 accessCharacterPositionAt:2 put:2. |
|
136 |
s1 groupSizes:#( 2 2 ). |
|
436 | 137 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
138 |
s3 := MenuPanel labels:lbs. |
|
388 | 139 |
|
140 |
s1 subMenuAt:2 put:s2. |
|
436 | 141 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 142 |
s2 subMenuAt:3 put:s3. |
436 | 143 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 144 |
s3 shortcutKeyAt:3 put:$q. |
145 |
||
146 |
mview subMenuAt:1 put:s1. |
|
436 | 147 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 148 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
149 |
s1 shortcutKeyAt:1 put:#Copy. |
|
150 |
s1 shortcutKeyAt:3 put:#Paste. |
|
151 |
||
436 | 152 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 153 |
top extent:(mview preferredExtent). |
388 | 154 |
top open. |
4081 | 155 |
[exEnd] |
156 |
||
157 |
a PullDownMenu with applications |
|
158 |
[exBegin] |
|
1767 | 159 |
|top menu view item| |
160 |
||
161 |
top := StandardSystemView extent:240@100. |
|
162 |
menu := MenuPanel in:top. |
|
163 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
164 |
menu verticalLayout:false. |
|
165 |
||
166 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
167 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
168 |
||
169 |
view := ClockView new. |
|
170 |
view preferredExtent:100@100. |
|
171 |
item := menu itemAt:3. |
|
172 |
item submenu:view. |
|
173 |
||
4081 | 174 |
view := ImageView new. |
175 |
view image:(Image fromScreen:(0@0 corner:200@200)). |
|
176 |
view preferredExtent:(200@200). |
|
1767 | 177 |
item := menu itemAt:2. |
178 |
item submenu:view. |
|
179 |
||
180 |
menu origin:0@0 corner:1.0@30. |
|
181 |
top open. |
|
4081 | 182 |
[exEnd] |
183 |
||
184 |
||
185 |
a PopUpMenu |
|
186 |
[exBegin] |
|
388 | 187 |
|subView mview desc s1 s2 s3 img lbs labels| |
188 |
||
436 | 189 |
mview := MenuPanel new. |
502 | 190 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 191 |
mview level:2. |
192 |
||
193 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 194 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 195 |
mview labels:lbs. |
196 |
||
436 | 197 |
s1 := MenuPanel labels:labels. |
198 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
199 |
s3 := MenuPanel labels:lbs. |
|
388 | 200 |
s1 subMenuAt:2 put:s2. |
436 | 201 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 202 |
s2 subMenuAt:3 put:s3. |
436 | 203 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 204 |
s3 shortcutKeyAt:3 put:$q. |
205 |
||
206 |
mview subMenuAt:1 put:s1. |
|
436 | 207 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 208 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
209 |
s1 shortcutKeyAt:1 put:#Copy. |
|
210 |
s1 shortcutKeyAt:3 put:#Paste. |
|
211 |
||
436 | 212 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 213 |
mview startUp |
4081 | 214 |
[exEnd] |
215 |
||
216 |
||
217 |
a menu spec |
|
218 |
[exBegin] |
|
388 | 219 |
|menu| |
220 |
||
436 | 221 |
menu := MenuPanel menu: |
4081 | 222 |
#(#Menu #( #(#MenuItem |
223 |
#label: 'File' |
|
224 |
#submenu: |
|
225 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
226 |
(#MenuItem |
|
227 |
#label: 'edit' |
|
228 |
#submenu: |
|
229 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
230 |
#(#MenuItem #label: 'close' #value:#close) |
|
231 |
) |
|
232 |
nil |
|
233 |
nil |
|
234 |
) |
|
235 |
) |
|
236 |
#(#MenuItem #label: 'help' #value:#help ) |
|
237 |
) |
|
238 |
nil |
|
239 |
nil |
|
240 |
) |
|
241 |
) |
|
242 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
243 |
#(#MenuItem #label: 'Bar' |
|
244 |
#submenu: |
|
245 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
246 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
247 |
) |
|
248 |
nil |
|
249 |
nil |
|
250 |
) |
|
251 |
) |
|
252 |
) |
|
253 |
#( 2 ) |
|
254 |
nil |
|
255 |
) decodeAsLiteralArray. |
|
388 | 256 |
|
257 |
menu verticalLayout:false. |
|
258 |
Transcript showCR:(menu startUp). |
|
4081 | 259 |
[exEnd] |
388 | 260 |
|
261 |
" |
|
262 |
! ! |
|
263 |
||
264 |
!MenuPanel class methodsFor:'instance creation'! |
|
265 |
||
266 |
fromSpec:aSpec |
|
267 |
^ self fromSpec:aSpec receiver:nil |
|
268 |
! |
|
269 |
||
270 |
fromSpec:aSpec receiver:aReceiver |
|
271 |
|menu| |
|
272 |
||
273 |
aSpec notNil ifTrue:[ |
|
3147 | 274 |
menu := Menu new. |
275 |
menu receiver:aReceiver. |
|
276 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 277 |
]. |
278 |
^ self menu:menu receiver:aReceiver |
|
279 |
! |
|
280 |
||
281 |
labels:labels |
|
282 |
^ self labels:labels nameKeys:nil receiver:nil |
|
283 |
! |
|
284 |
||
285 |
labels:labels nameKeys:nameKeys |
|
286 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
287 |
! |
|
288 |
||
289 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
290 |
|mview| |
|
291 |
||
292 |
mview := self menu:nil receiver:aReceiver. |
|
293 |
mview labels:labels. |
|
294 |
mview nameKeys:nameKeys. |
|
295 |
^ mview |
|
296 |
||
297 |
! |
|
298 |
||
502 | 299 |
labels:labels receiver:aReceiver |
300 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
301 |
! |
|
302 |
||
388 | 303 |
menu:aMenu |
304 |
^ self menu:aMenu receiver:nil |
|
305 |
! |
|
306 |
||
307 |
menu:aMenu receiver:aReceiver |
|
308 |
|mview| |
|
309 |
||
310 |
mview := self new. |
|
1955 | 311 |
|
312 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
3147 | 313 |
"/ no receiver specified in the menu; thus set the receiver immediately |
314 |
mview receiver:aReceiver |
|
1955 | 315 |
]. |
316 |
||
388 | 317 |
mview menu:aMenu. |
318 |
||
1955 | 319 |
|
388 | 320 |
"/ a menu itself may contain a receiver |
321 |
"/ thus we do not overwrite the receiver |
|
322 |
||
323 |
aReceiver notNil ifTrue:[ |
|
3147 | 324 |
mview receiver:aReceiver |
388 | 325 |
]. |
326 |
^ mview |
|
327 |
! ! |
|
328 |
||
329 |
!MenuPanel class methodsFor:'class initialization'! |
|
330 |
||
331 |
initialize |
|
332 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
3938 | 333 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 334 |
]. |
335 |
||
2715 | 336 |
" |
337 |
self initialize |
|
338 |
" |
|
339 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
340 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 341 |
! |
342 |
||
343 |
preSnapshot |
|
2715 | 344 |
"remove all resources" |
345 |
||
794 | 346 |
Images := nil. |
347 |
LigthenedImages := nil. |
|
616 | 348 |
! ! |
349 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
350 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
351 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
352 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
353 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
by the ImageEditor of ST/X." |
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 |
"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
|
357 |
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
|
358 |
|
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 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
361 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
362 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
363 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
364 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
365 |
<resource: #image> |
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 |
^Icon |
3938 | 368 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
369 |
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
|
370 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
371 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
372 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
373 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
by the ImageEditor of ST/X." |
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 |
"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
|
377 |
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
|
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 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
381 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
382 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
383 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
384 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
385 |
|
2755 | 386 |
IconDisabledIndicationOff isNil ifTrue:[ |
3938 | 387 |
IconDisabledIndicationOff := Icon |
388 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
|
389 |
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 | 390 |
]. |
391 |
^ IconDisabledIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
392 |
! |
1798
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 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
395 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
396 |
by the ImageEditor of ST/X." |
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 |
"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
|
399 |
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
|
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 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
403 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
404 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
405 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
406 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
407 |
|
2755 | 408 |
IconDisabledIndicationOn isNil ifTrue:[ |
3938 | 409 |
IconDisabledIndicationOn := Icon |
410 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
|
411 |
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 | 412 |
]. |
413 |
^ IconDisabledIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
414 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
415 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
416 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
417 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
418 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
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
|
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 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
425 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
426 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
427 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
428 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
429 |
|
2752 | 430 |
IconIndicationOff isNil ifTrue:[ |
3938 | 431 |
IconIndicationOff := Icon |
432 |
constantNamed:#'MenuPanel iconIndicationOff' |
|
433 |
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 | 434 |
]. |
435 |
^ IconIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
436 |
! |
1726
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 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
439 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
440 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
443 |
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
|
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 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
447 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
448 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
449 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
450 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
451 |
|
2752 | 452 |
IconIndicationOn isNil ifTrue:[ |
3938 | 453 |
IconIndicationOn := Icon |
454 |
constantNamed:#'MenuPanel iconIndicationOn' |
|
455 |
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 | 456 |
]. |
457 |
^ IconIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
458 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
459 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
460 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
461 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
462 |
by the ImageEditor of ST/X." |
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 |
"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
|
465 |
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
|
466 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
467 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
468 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
469 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
470 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
471 |
|
3565 | 472 |
"/ <resource: #image> |
473 |
"/ |
|
474 |
"/ IconDisabledRadioOff isNil ifTrue:[ |
|
475 |
"/ IconDisabledRadioOff := Icon |
|
476 |
"/ constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
|
477 |
"/ 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] |
|
478 |
"/ ]. |
|
479 |
"/ ^ IconDisabledRadioOff |
|
480 |
||
481 |
<resource: #programImage> |
|
482 |
^ RadioButton disabledPassiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
483 |
! |
1798
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 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
486 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
487 |
by the ImageEditor of ST/X." |
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 |
"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
|
490 |
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
|
491 |
|
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 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
494 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 495 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
496 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
497 |
|
3565 | 498 |
"/ <resource: #image> |
499 |
"/ |
|
500 |
"/ IconDisabledRadioOn isNil ifTrue:[ |
|
501 |
"/ IconDisabledRadioOn := Icon |
|
502 |
"/ constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
503 |
"/ 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] |
|
504 |
"/ ]. |
|
505 |
"/ ^ IconDisabledRadioOn |
|
506 |
||
507 |
<resource: #programImage> |
|
508 |
^ RadioButton disabledActiveForm |
|
509 |
! |
|
510 |
||
511 |
iconRadioGroupEnteredOff |
|
512 |
<resource: #programImage> |
|
513 |
^ RadioButton enteredPassiveForm |
|
514 |
! |
|
515 |
||
516 |
iconRadioGroupEnteredOn |
|
517 |
<resource: #programImage> |
|
518 |
^ RadioButton enteredActiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
519 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
520 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
521 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
522 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
523 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
526 |
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
|
527 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
528 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
529 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
530 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
531 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
532 |
|
3565 | 533 |
"/ <resource: #image> |
534 |
"/ |
|
535 |
"/ IconRadioOff isNil ifTrue:[ |
|
536 |
"/ IconRadioOff := Icon |
|
537 |
"/ constantNamed:#'MenuPanel iconRadioGroupOff' |
|
538 |
"/ 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] |
|
539 |
"/ ]. |
|
540 |
"/ ^ IconRadioOff |
|
541 |
||
542 |
<resource: #programImage> |
|
543 |
^ RadioButton passiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
544 |
! |
1726
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 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
547 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
548 |
by the ImageEditor of ST/X." |
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 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
551 |
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
|
552 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
553 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
554 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
555 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
556 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
557 |
|
3565 | 558 |
"/ <resource: #image> |
559 |
"/ |
|
560 |
"/ IconRadioOn isNil ifTrue:[ |
|
561 |
"/ IconRadioOn := Icon |
|
562 |
"/ constantNamed:#'MenuPanel iconRadioGroupOn' |
|
563 |
"/ 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] |
|
564 |
"/ ]. |
|
565 |
"/ ^ IconRadioOn |
|
566 |
||
567 |
<resource: #programImage> |
|
568 |
^ RadioButton activeForm |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
569 |
! |
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 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
572 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
573 |
by the ImageEditor of ST/X." |
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 |
"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
|
576 |
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
|
577 |
|
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 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
580 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
581 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
582 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
583 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
584 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
585 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
586 |
^Icon |
3938 | 587 |
constantNamed:#'MenuPanel class menuIndicator' |
588 |
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
|
589 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
590 |
|
616 | 591 |
!MenuPanel class methodsFor:'defaults'! |
450 | 592 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
593 |
defaultBackgroundColor |
2609 | 594 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 595 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
596 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
597 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
598 |
defaultLevel |
2372 | 599 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
600 |
" |
|
601 |
self defaultLevel |
|
602 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
603 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
604 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
605 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
606 |
"returns an additional offset between the label and the |
2715 | 607 |
delayedMenu indication (i.e. the down-arrow icon)" |
608 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
609 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
610 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
611 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
612 |
maxShortCutSearchLevel |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
613 |
"1 means: only search in top items. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
614 |
2 means: search one level of menus. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
615 |
used to be 10" |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
616 |
|
3384 | 617 |
MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.]. |
618 |
^ MaxShortCutSearchLevel |
|
619 |
! |
|
620 |
||
621 |
maxShortCutSearchLevel: anInteger |
|
622 |
"1 means: only search in top items. |
|
623 |
2 means: search one level of menus." |
|
624 |
||
625 |
MaxShortCutSearchLevel := anInteger |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
626 |
! |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
627 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
628 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
629 |
"returns an additional offset between the label and the |
2715 | 630 |
delayedMenu indication (i.e. the down-arrow icon)" |
631 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
632 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
633 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
634 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
635 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
636 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
637 |
ex: |
3938 | 638 |
&File mnemonic := Cmdf |
639 |
F&ile mnemonic := Cmdi |
|
640 |
....." |
|
2715 | 641 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
642 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
643 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
644 |
|
450 | 645 |
updateStyleCache |
2777 | 646 |
"extract values from the styleSheet and cache them in class variables" |
657 | 647 |
|
2219 | 648 |
<resource: #style ( |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
649 |
#'selection.disabledForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
650 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
651 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
652 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
653 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
654 |
#'menu.hilightLevel' #'menu.enteredLevel' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
655 |
#'menu.groupDividerSize' #'menu.itemMargin' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
656 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
657 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
658 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
659 |
#'menu.selectionFollowsMouse' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
660 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
661 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
662 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
663 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
664 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
665 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
666 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
667 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
668 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
669 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
670 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
671 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
2219 | 672 |
)> |
673 |
||
674 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 675 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 676 |
|
2611 | 677 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
678 |
which returns the default cashed DefaultBackgroundColor |
|
679 |
" |
|
680 |
DefaultBackgroundColor := nil. |
|
681 |
||
2219 | 682 |
MenuView updateStyleCache. |
683 |
SelectionInListView updateStyleCache. |
|
1699 | 684 |
|
2372 | 685 |
styleSheet := StyleSheet. |
686 |
style := styleSheet name. |
|
687 |
||
2607 | 688 |
DefaultFont := MenuView defaultFont. |
3938 | 689 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
690 |
default:[styleSheet |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
691 |
colorAt:#'menu.foregroundColor' |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
692 |
default:Color black]. |
2609 | 693 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 694 |
|
695 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 696 |
var isNil ifTrue:[ |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
697 |
style == #motif ifTrue:[ var := backgroundColor ] |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
698 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
2219 | 699 |
]. |
700 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
701 |
||
702 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 703 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 704 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
705 |
||
706 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 707 |
var isNil ifTrue:[ |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
708 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
709 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 710 |
]. |
711 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
712 |
||
713 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 714 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 715 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
716 |
||
717 |
||
718 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 719 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 720 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
721 |
||
722 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 723 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 724 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
725 |
||
726 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
727 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
728 |
||
729 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
730 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
731 |
||
732 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 733 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
734 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
2219 | 735 |
]. |
736 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
737 |
||
738 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 739 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 740 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
741 |
||
742 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 743 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 744 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
745 |
||
746 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 747 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 748 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
749 |
||
750 |
Item updateStyleCache. |
|
2607 | 751 |
|
2754 | 752 |
getBitmapOrFile := [:key :fileKey | |
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
753 |
|var| |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
754 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
755 |
var := styleSheet at:key ifAbsent:nil. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
756 |
var isNil ifTrue:[ |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
757 |
var := styleSheet at:fileKey ifAbsent:nil. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
758 |
var notNil ifTrue:[ |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
759 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
760 |
]. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
761 |
]. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
762 |
var |
2754 | 763 |
]. |
764 |
||
2883 | 765 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
766 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
767 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
768 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
769 |
||
770 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
771 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
772 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
773 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 774 |
|
2607 | 775 |
" |
776 |
self updateStyleCache |
|
777 |
" |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
778 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
779 |
"Modified: / 19-01-2012 / 13:17:59 / cg" |
388 | 780 |
! ! |
781 |
||
794 | 782 |
!MenuPanel class methodsFor:'image registration'! |
783 |
||
784 |
image:anImage onDevice:aDevice |
|
785 |
" |
|
786 |
Images := nil |
|
787 |
" |
|
2269 | 788 |
|deviceImages| |
794 | 789 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
790 |
anImage device == aDevice ifTrue:[ |
3938 | 791 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
792 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
793 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
794 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 795 |
|
1097 | 796 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
3938 | 797 |
Images at:aDevice put:(deviceImages := Dictionary new) |
2269 | 798 |
]. |
799 |
||
800 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
3938 | 801 |
image := anImage copy onDevice:aDevice. |
802 |
image clearMaskedPixels. |
|
803 |
deviceImages at:anImage put:image. |
|
804 |
image |
|
2269 | 805 |
]. |
794 | 806 |
! |
807 |
||
808 |
lightenedImage:anImage onDevice:aDevice |
|
809 |
" |
|
810 |
LigthenedImages := nil |
|
811 |
" |
|
2374 | 812 |
|deviceImages image colorMap| |
794 | 813 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
814 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 815 |
|
1097 | 816 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
3938 | 817 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 818 |
]. |
819 |
||
820 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
3938 | 821 |
^ image |
2374 | 822 |
]. |
823 |
||
824 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
825 |
||
826 |
colorMap notNil ifTrue:[ |
|
3938 | 827 |
image := anImage copy lightened onDevice:aDevice. |
828 |
image clearMaskedPixels. |
|
794 | 829 |
] ifFalse:[ |
3938 | 830 |
image := self image:anImage onDevice:aDevice |
794 | 831 |
]. |
1097 | 832 |
deviceImages at:anImage put:image. |
794 | 833 |
^ image |
834 |
! ! |
|
835 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
836 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
837 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
838 |
subMenu:aSubMenu |
2715 | 839 |
"create a submenu; can be redifined in derived classes" |
840 |
||
841 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
842 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
843 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
844 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
845 |
|
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
846 |
!MenuPanel class methodsFor:'utilities'! |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
847 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
848 |
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
849 |
"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
|
850 |
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
|
851 |
or fix), or by an ampersand escape. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
852 |
Double ampersands are replaced by a single one." |
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 |
|i label nextChar rest pos size accessCharacter| |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
855 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
856 |
pos := accessCharacterPositionOrNil. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
857 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
858 |
label := aLabel. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
859 |
size := aLabel size. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
860 |
i := 1. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
861 |
[((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
|
862 |
nextChar := label at:(i+1). |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
863 |
nextChar isSeparator ifTrue:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
864 |
i := i + 1 |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
865 |
] ifFalse:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
866 |
rest := label copyFrom:(i+1). |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
867 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
868 |
i == 1 ifTrue:[label := rest] |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
869 |
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
|
870 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
871 |
(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
|
872 |
size := size - 1. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
873 |
]. |
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 |
(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
|
877 |
^ 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 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
880 |
label isText ifFalse:[ |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
881 |
label := Text string:label |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
882 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
883 |
label emphasisAt:pos add:#underline. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
884 |
^ label |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
885 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
886 |
"Created: / 15-02-2012 / 18:50:58 / cg" |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
887 |
! ! |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
888 |
|
1808 | 889 |
!MenuPanel methodsFor:'accepting'! |
389 | 890 |
|
891 |
accept |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
892 |
"accept the current selected item" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
893 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
894 |
|item| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
895 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
896 |
(item := self selection) isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
897 |
self topMenu |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
898 |
openDelayed:nil; |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
899 |
accept:nil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
900 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
901 |
self acceptItem:item inMenu:self |
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 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
904 |
"Modified: / 29-06-2011 / 16:14:26 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
905 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
906 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
907 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
908 |
"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
|
909 |
|
4089 | 910 |
|itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor| |
1630 | 911 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
912 |
self superMenu notNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
913 |
^ self topMenu accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
914 |
]. |
3142 | 915 |
prevFocusView ~~ self ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
916 |
focusView := prevFocusView. |
3142 | 917 |
]. |
918 |
prevFocusView := nil. |
|
919 |
||
2199 | 920 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
921 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
922 |
self selection:nil. |
420 | 923 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
924 |
(anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
925 |
tgState := anItemOrNil toggleIndication. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
926 |
panel := anItemOrNil menuPanel. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
927 |
itemIdx := panel findFirst:[:el| el == anItemOrNil ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
928 |
itemAcceptedOrNil := anItemOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
929 |
recv := panel receiver. |
389 | 930 |
]. |
1699 | 931 |
self doUngrab:true. |
389 | 932 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
933 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
934 |
|
510 | 935 |
self isPopUpView ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
936 |
self do:[:el| el updateIndicators]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
937 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
938 |
winGrp processExposeEvents. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
939 |
]. |
524 | 940 |
] ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
941 |
self unmap. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
942 |
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
|
943 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
944 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
945 |
"/ give expose event a chance to arrive |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
946 |
[shown and:[realized]] whileTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
947 |
winGrp processExposeEventsFor:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
948 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
949 |
masterGroup := winGrp previousGroup. |
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 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
952 |
"/ self destroy. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
953 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
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 |
(focusView notNil and:[winGrp notNil]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
957 |
winGrp focusView:focusView. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
958 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
959 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
960 |
itemAcceptedOrNil isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
961 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
962 |
self isPopUpView ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
963 |
lastItem := itemAcceptedOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
964 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
965 |
^ itemAcceptedOrNil. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
966 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
967 |
|
4089 | 968 |
"/ using master maingroup, sensor in my current windowgroup |
969 |
"/ flushes its events if the window goes |
|
970 |
winGrp notNil ifTrue:[ |
|
971 |
winGrp mainGroup notNil ifTrue:[ |
|
972 |
sensor := winGrp mainGroup sensor. |
|
973 |
]. |
|
974 |
]. |
|
975 |
sensor isNil ifTrue:[sensor := self sensor ]. |
|
976 |
||
977 |
sensor pushEvent:( |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
978 |
MenuEvent |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
979 |
selectMenuItem:itemAcceptedOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
980 |
index:itemIdx |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
981 |
text:nil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
982 |
value:tgState |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
983 |
inMenu:self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
984 |
menuReceiver:recv). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
985 |
|
4053 | 986 |
^ anItemOrNil. "/ stupid convention |
987 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
988 |
"/ acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
989 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
990 |
"/ winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
991 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
992 |
"/ (itemAcceptedOrNil showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
993 |
"/ and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
994 |
"/ ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
995 |
"/ winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
996 |
"/ ] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
997 |
"/ acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
998 |
"/ ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
999 |
|
4053 | 1000 |
"Modified: / 07-07-2011 / 18:08:41 / cg" |
524 | 1001 |
! |
1002 |
||
1003 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1004 |
"really accept an item" |
2715 | 1005 |
|
3938 | 1006 |
|selectorOrBlock argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
1007 |
app master fallBack| |
524 | 1008 |
|
2253 | 1009 |
isValueModel := aReceiver isValueModel. |
1010 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1011 |
hasPerformed := isValueModel. |
524 | 1012 |
|
3558 | 1013 |
(selectorOrBlock := anItem value) isNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1014 |
^ self "/ ^ anIndex |
524 | 1015 |
]. |
1016 |
||
1017 |
(argument := anItem argument) isNil ifTrue:[ |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1018 |
argument := aState ? anItem |
389 | 1019 |
]. |
524 | 1020 |
|
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1021 |
(selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1022 |
"/ a valueHolder or block |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1023 |
(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[ |
4262 | 1024 |
'MenuPanel [warning]: menuItem''s value does not respond to #value protocol' infoPrintCR. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1025 |
^ self "/ ^ selectorOrBlock |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1026 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1027 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1028 |
numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1029 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1030 |
numArgs == 0 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1031 |
args := nil |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1032 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1033 |
numArgs == 1 ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1034 |
args := Array with:argument |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1035 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1036 |
args := Array with:argument with:self |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1037 |
] |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1038 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1039 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1040 |
selectorOrBlock valueWithArguments:args. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1041 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1042 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1043 |
^ self "/ ^ anIndex |
524 | 1044 |
]. |
1045 |
||
2331 | 1046 |
anItem sendToOriginator ifTrue:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1047 |
rec := self originator. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1048 |
rec isNil ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1049 |
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
|
1050 |
]. |
2331 | 1051 |
] ifFalse:[ |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1052 |
rec := aReceiver |
2331 | 1053 |
]. |
1054 |
||
1055 |
rec isNil ifTrue:[ |
|
4262 | 1056 |
'MenuPanel [warning]: menu has no receiver defined' infoPrintCR. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1057 |
^ self "/ ^ selectorOrBlock |
2253 | 1058 |
]. |
1059 |
||
1060 |
isValueModel ifTrue:[ |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1061 |
rec value:selectorOrBlock |
465 | 1062 |
] ifFalse:[ |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1063 |
selectorOrBlock isArray ifTrue:[ |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1064 |
"/ a hack !!!!!! Must be compatible to old MenuView |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1065 |
args := selectorOrBlock copyFrom:2. |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1066 |
selectorOrBlock := selectorOrBlock first. |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1067 |
] ifFalse:[ |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1068 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1069 |
arg2 := self. |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1070 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1071 |
"/ support for ST80 style applications |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1072 |
"/ (expecting the message to go to the application |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1073 |
"/ if not understood by the view) |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1074 |
"/ These expect the controller to be passed as argument. |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1075 |
"/ sigh. |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1076 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1077 |
(rec isView |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1078 |
and:[(rec respondsTo:selectorOrBlock) not |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1079 |
and:[(app := rec application) ~~ rec |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1080 |
and:[app notNil]]]) ifTrue:[ |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1081 |
arg2 := rec controller. "/ the Views controller |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1082 |
rec := app. |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1083 |
]. |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1084 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1085 |
(numArgs := selectorOrBlock numArgs) == 0 ifTrue:[ |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1086 |
args := nil |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1087 |
] ifFalse:[ |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1088 |
numArgs == 1 ifTrue:[ |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1089 |
args := Array with:argument |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1090 |
] ifFalse:[ |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1091 |
args := Array with:argument with:arg2 |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1092 |
] |
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1093 |
]. |
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1094 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1095 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1096 |
fallBack := |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1097 |
[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1098 |
|val| |
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 |
"/ mhmh - the receiver did not respond to that message; |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1101 |
"/ if there is a master-application, try that one |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1102 |
"/ (recursive) |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1103 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1104 |
master notNil ifTrue:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1105 |
rec := master. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1106 |
val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1107 |
] ifFalse:[ |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1108 |
self |
4424 | 1109 |
error:('Unimplemented (or error in) menu message: %1 for %2' |
1110 |
bindWith:selectorOrBlock |
|
1111 |
with:aReceiver printString) |
|
4033
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1112 |
mayProceed:true. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1113 |
val := nil. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1114 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1115 |
val |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1116 |
]. |
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1117 |
|
2d2492fd2805
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4027
diff
changeset
|
1118 |
rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack. |
420 | 1119 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1120 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1121 |
^ self "/ ^ selectorOrBlock |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1122 |
|
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1123 |
"Modified: / 06-03-2012 / 14:49:00 / cg" |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1124 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1125 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1126 |
acceptItem:anItemOrNil inMenu:aMenu |
2199 | 1127 |
|tgState topMenu| |
1128 |
||
1129 |
topMenu := self topMenu. |
|
1130 |
topMenu openDelayed:nil. |
|
1670 | 1131 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1132 |
(anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1133 |
topMenu accept:anItemOrNil |
1670 | 1134 |
] ifFalse:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1135 |
anItemOrNil canAccept ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1136 |
tgState := anItemOrNil toggleIndication. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1137 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1138 |
self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1139 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1140 |
index:(aMenu selectionIndex) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1141 |
toggle:tgState |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1142 |
receiver:(aMenu receiver). |
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 |
aMenu do:[:el| el updateIndicators]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1145 |
anItemOrNil hideMenuOnActivated ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1146 |
aMenu invalidate |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1147 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1148 |
] |
1670 | 1149 |
] |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1150 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1151 |
"Modified: / 29-06-2011 / 14:34:45 / cg" |
1670 | 1152 |
! |
1153 |
||
389 | 1154 |
lastItemAccepted |
2715 | 1155 |
"returns last item selected or nil" |
1156 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1157 |
^ lastItem |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1158 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1159 |
"Modified: / 29-06-2011 / 16:24:48 / cg" |
389 | 1160 |
! |
1161 |
||
1162 |
lastValueAccepted |
|
2715 | 1163 |
"returns last value accepted or nil" |
1164 |
||
2253 | 1165 |
^ self lastItemAccepted value |
389 | 1166 |
! ! |
1167 |
||
388 | 1168 |
!MenuPanel methodsFor:'accessing'! |
1169 |
||
1170 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1171 |
"get the access character position for a textLabel" |
1172 |
||
2059 | 1173 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1174 |
! |
1175 |
||
1176 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1177 |
"get the access character position for a textLabel" |
1178 |
||
388 | 1179 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1180 |
! |
|
1181 |
||
1182 |
accessCharacterPositions |
|
2715 | 1183 |
"returns a collection of accessCharacterPositions or nil" |
1184 |
||
388 | 1185 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1186 |
! |
|
1187 |
||
1188 |
accessCharacterPositions:something |
|
2715 | 1189 |
"define accessCharacterPositions for each item" |
1190 |
||
388 | 1191 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1192 |
! |
|
1193 |
||
1194 |
args |
|
2715 | 1195 |
"returns a collection of arguments or nil" |
1196 |
||
388 | 1197 |
^ self collect:[:anItem| anItem argument ] |
1198 |
! |
|
1199 |
||
1200 |
args:something |
|
2715 | 1201 |
"define arguments for each item" |
1202 |
||
388 | 1203 |
self onEachPerform:#argument: withArgList:something |
1204 |
! |
|
1205 |
||
1206 |
argsAt:stringOrNumber |
|
2715 | 1207 |
"gets the argument of an item or nil" |
1208 |
||
2059 | 1209 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1210 |
! |
1211 |
||
1212 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1213 |
"sets the argument of an item" |
1214 |
||
388 | 1215 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1216 |
! |
|
1217 |
||
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1218 |
doAccessCharacterTranslation |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1219 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1220 |
Can be set to false to leave accessCharacter unchanged" |
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1221 |
|
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1222 |
^ doAccessCharacterTranslation ? true |
3958 | 1223 |
|
1224 |
"Modified: / 02-11-2010 / 10:19:09 / cg" |
|
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1225 |
! |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1226 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1227 |
doAccessCharacterTranslation:aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1228 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1229 |
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
|
1230 |
|
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1231 |
doAccessCharacterTranslation := aBoolean |
3958 | 1232 |
|
1233 |
"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
|
1234 |
! |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1235 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1236 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1237 |
"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
|
1238 |
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
|
1239 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1240 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1241 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1242 |
"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
|
1243 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1244 |
|
388 | 1245 |
groupSizes |
2715 | 1246 |
"gets collection of group sizes" |
1247 |
||
388 | 1248 |
^ groupSizes |
1249 |
! |
|
1250 |
||
1251 |
groupSizes:aGroupSizes |
|
2715 | 1252 |
"sets collection of group sizes" |
1253 |
||
388 | 1254 |
aGroupSizes = groupSizes ifFalse:[ |
3938 | 1255 |
groupSizes := aGroupSizes copy. |
1256 |
self mustRearrange. |
|
388 | 1257 |
]. |
1258 |
! |
|
1259 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1260 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1261 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1262 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1263 |
|
3725 | 1264 |
hideOnRelease:aBoolean |
1265 |
hideOnRelease := aBoolean |
|
1266 |
! |
|
1267 |
||
388 | 1268 |
labelAt:stringOrNumber |
2715 | 1269 |
"gets the label of an item or nil" |
1270 |
||
388 | 1271 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1272 |
! |
|
1273 |
||
1274 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1275 |
"sets the label of an item" |
1276 |
||
388 | 1277 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1278 |
! |
|
1279 |
||
1280 |
labels |
|
2715 | 1281 |
"returns a collection of labels's or nil" |
1282 |
||
388 | 1283 |
^ self collect:[:anItem| anItem label ] |
1284 |
! |
|
1285 |
||
1286 |
labels:labels |
|
2715 | 1287 |
"define labels for each item" |
1288 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1289 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1290 |
|
388 | 1291 |
self disabledRedrawDo:[ |
3938 | 1292 |
self removeAll. |
1293 |
size := labels size. |
|
1294 |
||
1295 |
size > 0 ifTrue:[ |
|
1296 |
items := OrderedCollection new:size. |
|
1297 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1298 |
] |
|
1299 |
]. |
|
1300 |
! |
|
1301 |
||
1302 |
menuPerformer:anObject |
|
1999 | 1303 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1304 |
from all submenus no specific receiver is defined )." |
1305 |
||
1999 | 1306 |
^ self receiver:anObject |
1307 |
! |
|
1308 |
||
388 | 1309 |
nameKeyAt:stringOrNumber |
2715 | 1310 |
"gets the nameKey of an item or nil" |
1311 |
||
1312 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1313 |
! |
1314 |
||
1315 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1316 |
"sets the nameKey of an item" |
1317 |
||
388 | 1318 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1319 |
! |
|
1320 |
||
1321 |
nameKeys |
|
2715 | 1322 |
"returns a collection of nameKeyss or nil" |
1323 |
||
388 | 1324 |
^ self collect:[:anItem| anItem nameKey ] |
1325 |
! |
|
1326 |
||
1327 |
nameKeys:something |
|
2715 | 1328 |
"define nameKeys for each item" |
1329 |
||
388 | 1330 |
self onEachPerform:#nameKey: withArgList:something |
1331 |
! |
|
1332 |
||
1333 |
numberOfItems |
|
2715 | 1334 |
"gets number of items" |
1335 |
||
388 | 1336 |
^ items size |
1337 |
! |
|
1338 |
||
2331 | 1339 |
originator |
1340 |
originator notNil ifTrue:[^ originator]. |
|
1341 |
superMenu notNil ifTrue:[ |
|
3938 | 1342 |
^ superMenu originator |
2331 | 1343 |
]. |
1344 |
^ nil |
|
1345 |
! |
|
1346 |
||
388 | 1347 |
receiver |
1348 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1349 |
from all submenus no specific receiver is defined )." |
1350 |
||
389 | 1351 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
3938 | 1352 |
^ superMenu receiver |
388 | 1353 |
]. |
389 | 1354 |
^ receiver |
388 | 1355 |
! |
1356 |
||
3938 | 1357 |
receiver:anObject |
388 | 1358 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1359 |
from all submenus no specific receiver is defined )." |
1360 |
||
389 | 1361 |
receiver := anObject |
388 | 1362 |
! |
1363 |
||
1364 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1365 |
"gets the shortCutKey of an item or nil" |
1366 |
||
1367 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1368 |
! |
1369 |
||
1370 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1371 |
"sets the shortCutKey of an item" |
1372 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1373 |
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
|
1374 |
! |
388 | 1375 |
|
1376 |
shortcutKeys |
|
2715 | 1377 |
"returns a collection of shortcutKeys or nil" |
1378 |
||
388 | 1379 |
^ self collect:[:anItem| anItem shortcutKey ] |
1380 |
! |
|
1381 |
||
1382 |
shortcutKeys:something |
|
2715 | 1383 |
"define shortcutKeys for each item" |
1384 |
||
388 | 1385 |
self onEachPerform:#shortcutKey: withArgList:something |
1386 |
! |
|
1387 |
||
1388 |
valueAt:stringOrNumber |
|
2715 | 1389 |
"gets value of an item; a block, valueHolder, ..." |
1390 |
||
1391 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1392 |
! |
1393 |
||
4226 | 1394 |
valueAt:stringOrNumber put:aBlockOrValueHolderOrSelector |
2715 | 1395 |
"sets value of an item; a block, valueHolder, ..." |
1396 |
||
4226 | 1397 |
self itemAt:stringOrNumber do:[:el| el value:aBlockOrValueHolderOrSelector ] |
388 | 1398 |
! |
1399 |
||
1400 |
values:something |
|
2715 | 1401 |
"define values for each item" |
1402 |
||
388 | 1403 |
self onEachPerform:#value: withArgList:something |
1404 |
! ! |
|
1405 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1406 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1407 |
|
1408 |
disableAll |
|
2715 | 1409 |
"disable all items; not the menu in case of enabled" |
1410 |
||
498 | 1411 |
self do:[:anItem| anItem enabled:false] |
388 | 1412 |
! |
1413 |
||
1414 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1415 |
"disable an collection of items" |
1416 |
||
388 | 1417 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1418 |
! |
|
1419 |
||
1420 |
enableAll |
|
2715 | 1421 |
"enable all items; not the menu in case of disabled" |
1422 |
||
498 | 1423 |
self do:[:anItem| anItem enabled:true] |
388 | 1424 |
! |
1425 |
||
1426 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1427 |
"enable an collection of items" |
1428 |
||
388 | 1429 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1430 |
! |
|
1431 |
||
1432 |
enabled |
|
2715 | 1433 |
"returns enabled state" |
1434 |
||
498 | 1435 |
^ enabled |
388 | 1436 |
! |
1437 |
||
1438 |
enabled:aState |
|
2715 | 1439 |
"change enabled state of menu" |
1440 |
||
545 | 1441 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1442 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1443 |
state := aState ? true. |
388 | 1444 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1445 |
enabled ~~ state ifTrue:[ |
3938 | 1446 |
enabled := state. |
1447 |
self invalidate. |
|
498 | 1448 |
]. |
388 | 1449 |
! |
1450 |
||
1451 |
enabledAt:stringOrNumber |
|
2715 | 1452 |
"gets the enabled state of an item or false" |
1453 |
||
388 | 1454 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1455 |
! |
|
1456 |
||
1457 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1458 |
"sets the enabled state of an item" |
1459 |
||
388 | 1460 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1461 |
! |
|
1462 |
||
3725 | 1463 |
exclusivePointer:aBoolean |
1464 |
"Do nothing here. Compatibility with PopUpListController" |
|
1465 |
||
1466 |
^ self |
|
1467 |
! |
|
1468 |
||
388 | 1469 |
isEnabled:stringOrNumber |
2715 | 1470 |
"gets the enabled state of an item or false" |
1471 |
||
388 | 1472 |
^ self enabledAt:stringOrNumber |
1473 |
! ! |
|
1474 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1475 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1476 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1477 |
enableChannel:aValueHolder |
2715 | 1478 |
"set my enableChannel" |
1479 |
||
498 | 1480 |
enableChannel notNil ifTrue:[ |
3938 | 1481 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1482 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1483 |
|
498 | 1484 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
3938 | 1485 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1486 |
]. |
498 | 1487 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1488 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1489 |
|
3222 | 1490 |
menuChannel |
1491 |
^ self menuHolder |
|
1492 |
||
1493 |
"Created: / 27-03-2007 / 08:38:31 / cg" |
|
1494 |
! |
|
1495 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1496 |
menuHolder:aValueHolder |
2715 | 1497 |
"set my menuHolder" |
1498 |
||
498 | 1499 |
menuHolder notNil ifTrue:[ |
3938 | 1500 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1501 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1502 |
|
498 | 1503 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
3938 | 1504 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1505 |
]. |
498 | 1506 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1507 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1508 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1509 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1510 |
|
616 | 1511 |
activeBackgroundColor |
2715 | 1512 |
"get the background drawing color used to highlight selection" |
1513 |
||
2219 | 1514 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1515 |
! |
1516 |
||
1517 |
activeForegroundColor |
|
2715 | 1518 |
"get the foreground color used to highlight selections" |
1519 |
||
2219 | 1520 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1521 |
! |
1522 |
||
390 | 1523 |
backgroundColor |
2715 | 1524 |
"return the background color" |
1525 |
||
502 | 1526 |
^ super viewBackground |
390 | 1527 |
! |
1528 |
||
1529 |
backgroundColor:aColor |
|
1530 |
"set the background drawing color. You should not use this method; |
|
2715 | 1531 |
instead, leave the value as defined in the styleSheet." |
1532 |
||
1533 |
self backgroundColor ~~ aColor ifTrue:[ |
|
3938 | 1534 |
super viewBackground:aColor. |
1535 |
self invalidate "/ RepairNow:true |
|
616 | 1536 |
] |
1537 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1538 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1539 |
! |
1540 |
||
727 | 1541 |
buttonActiveBackgroundColor |
2715 | 1542 |
"get the background drawing color used to highlight button selection" |
1543 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1544 |
^ buttonActiveBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1545 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1546 |
"Modified: / 19-01-2012 / 11:51:46 / cg" |
727 | 1547 |
! |
1548 |
||
3441 | 1549 |
buttonActiveForegroundColor |
1550 |
"get the foreground drawing color used to highlight button selection" |
|
1551 |
||
1552 |
^ styleSheet colorAt:#'button.activeForegroundColor' |
|
3938 | 1553 |
default:(self foregroundColor) |
3441 | 1554 |
! |
1555 |
||
730 | 1556 |
buttonEdgeStyle |
2715 | 1557 |
"get the button edge style" |
1558 |
||
2219 | 1559 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1560 |
! |
1561 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1562 |
buttonEnteredBackgroundColor |
2715 | 1563 |
"get the background drawing color used to highlight entered button items" |
1564 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1565 |
^ buttonEnteredBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1566 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1567 |
"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
|
1568 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1569 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1570 |
buttonEnteredLevel |
2715 | 1571 |
"get the 3D-level used to highlight entered button items" |
1572 |
||
2219 | 1573 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1574 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1575 |
|
730 | 1576 |
buttonHalfLightColor |
2715 | 1577 |
"get the background drawing color used to half light button frame" |
1578 |
||
2219 | 1579 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1580 |
! |
1581 |
||
1582 |
buttonHalfShadowColor |
|
2715 | 1583 |
"get the background drawing color used to half shadow button frame" |
1584 |
||
2219 | 1585 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1586 |
! |
1587 |
||
1588 |
buttonLightColor |
|
2715 | 1589 |
"get the background drawing color used to light button frame" |
1590 |
||
2219 | 1591 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1592 |
! |
1593 |
||
1594 |
buttonPassiveBackgroundColor |
|
2715 | 1595 |
"get the background drawing color used for button" |
1596 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1597 |
^ buttonPassiveBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1598 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1599 |
"Modified: / 19-01-2012 / 13:13:59 / cg" |
727 | 1600 |
! |
1601 |
||
1602 |
buttonShadowColor |
|
2715 | 1603 |
"get the background drawing color used to shadow button frame" |
1604 |
||
2219 | 1605 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1606 |
! |
1607 |
||
1608 |
disabledEtchedForegroundColor |
|
1609 |
"return the color used for etching disabled items. |
|
2715 | 1610 |
If nil, no 3D effect is drawn." |
1611 |
||
4453 | 1612 |
|bg| |
1613 |
||
1614 |
(bg := self backgroundColor) = DefaultBackgroundColor ifFalse:[ |
|
1615 |
^ bg mixed:0.5 with:Color white |
|
1616 |
]. |
|
2219 | 1617 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
4453 | 1618 |
|
1619 |
"Modified: / 28-11-2013 / 16:28:25 / cg" |
|
727 | 1620 |
! |
1621 |
||
390 | 1622 |
disabledForegroundColor |
2715 | 1623 |
"return the foreground color used by disabled items" |
1624 |
||
2219 | 1625 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1626 |
! |
1627 |
||
2170 | 1628 |
enteredBackgroundColor |
2715 | 1629 |
"return the background color for entered items" |
1630 |
||
2219 | 1631 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
3938 | 1632 |
default:(self backgroundColor) |
2170 | 1633 |
! |
1634 |
||
1635 |
enteredForegroundColor |
|
2715 | 1636 |
"return the foreground color for entered items" |
1637 |
||
2219 | 1638 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1639 |
! |
1640 |
||
390 | 1641 |
font:aFont |
2715 | 1642 |
"set the font" |
1643 |
||
2614 | 1644 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1645 |
||
1646 |
super font:aFont. |
|
1647 |
self do:[:anItem| anItem fontChanged ]. |
|
1648 |
||
1649 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
3938 | 1650 |
self extent:(self preferredExtent) |
2614 | 1651 |
]. |
1652 |
self mustRearrange. |
|
390 | 1653 |
! |
1654 |
||
1655 |
foregroundColor |
|
2715 | 1656 |
"return the passive foreground color" |
1657 |
||
2059 | 1658 |
^ fgColor |
390 | 1659 |
! |
1660 |
||
1661 |
foregroundColor:aColor |
|
1662 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1663 |
instead leave the value as defined in the styleSheet." |
1664 |
||
2219 | 1665 |
aColor ~= fgColor ifTrue:[ |
3938 | 1666 |
fgColor := aColor onDevice:device. |
1667 |
self invalidate |
|
2219 | 1668 |
]. |
580 | 1669 |
! |
1670 |
||
1699 | 1671 |
maxAbsoluteButtonLevel |
1672 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1673 |
extent of a button" |
1674 |
||
3987 | 1675 |
^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0 |
1676 |
||
1677 |
"Modified: / 19-01-2011 / 21:21:53 / cg" |
|
390 | 1678 |
! |
1679 |
||
730 | 1680 |
selectionFrameBrightColor |
2715 | 1681 |
"get the selection frame bright color" |
1682 |
||
2219 | 1683 |
^ Color white |
730 | 1684 |
! |
1685 |
||
1686 |
selectionFrameDarkColor |
|
2715 | 1687 |
"get the selection frame dark color" |
1688 |
||
2219 | 1689 |
^ Color black |
730 | 1690 |
! |
1691 |
||
1727 | 1692 |
setFont:aFont |
3938 | 1693 |
"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
|
1694 |
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
|
1695 |
|
1727 | 1696 |
|currentFont| |
1697 |
||
1698 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
3938 | 1699 |
currentFont := font. |
1700 |
super font:aFont. |
|
1727 | 1701 |
]. |
1702 |
^ currentFont |
|
390 | 1703 |
! ! |
1704 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1705 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1706 |
|
1707 |
height |
|
2715 | 1708 |
"default height" |
1709 |
||
3886 | 1710 |
self hasExplicitExtent ifFalse:[ |
3938 | 1711 |
^ self preferredHeight |
388 | 1712 |
]. |
1713 |
^ super height |
|
1714 |
! |
|
1715 |
||
2016 | 1716 |
maxExtent |
4113 | 1717 |
|minH pos| |
4110 | 1718 |
|
1719 |
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
|
1720 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1721 |
device notNil ifTrue:[ |
4109 | 1722 |
"/ notice, the position-dependent query: if there is a higher secondary screen, |
1723 |
"/ this makes a difference in where a popUpMenu is allowed... |
|
4110 | 1724 |
pos := self origin. |
1725 |
pos = (0@0) ifTrue:[ |
|
1726 |
"called too early" |
|
4113 | 1727 |
minH := device smallestMonitorHeight. |
1728 |
] ifFalse:[ |
|
1729 |
minH := device usableHeightAt:pos. |
|
4109 | 1730 |
]. |
1731 |
^ device usableWidth @ (minH - 2) |
|
1732 |
"/ ^ device usableExtent - 5. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1733 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1734 |
superMenu notNil ifTrue:[ |
4109 | 1735 |
^ superMenu maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1736 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1737 |
"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
|
1738 |
self error:'don''t know maxExtent'. |
4109 | 1739 |
|
4110 | 1740 |
"Modified: / 15-02-2012 / 19:22:24 / cg" |
2016 | 1741 |
! |
1742 |
||
388 | 1743 |
preferredExtent |
2715 | 1744 |
"compute and returns my preferred extent" |
1745 |
||
2253 | 1746 |
|maxExtent usedExtent| |
2024 | 1747 |
|
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1748 |
"/ If I have an explicit preferredExtent.. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1749 |
explicitExtent notNil ifTrue:[ |
3938 | 1750 |
^ explicitExtent |
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1751 |
]. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1752 |
"/ If I have a cached preferredExtent value.. |
2016 | 1753 |
preferredExtent notNil ifTrue:[ |
3938 | 1754 |
^ preferredExtent |
2016 | 1755 |
]. |
3837 | 1756 |
|
2024 | 1757 |
usedExtent := self preferredExtentOfItems. |
1758 |
||
1759 |
superView isNil ifTrue:[ |
|
3938 | 1760 |
"/ is standalone |
1761 |
preferredWidth notNil ifTrue:[ |
|
1762 |
usedExtent x < preferredWidth ifTrue:[ |
|
1763 |
usedExtent := preferredWidth @ usedExtent y. |
|
1764 |
] |
|
1765 |
] |
|
1766 |
]. |
|
1767 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1768 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1769 |
maxExtent notNil ifTrue:[ |
3938 | 1770 |
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
|
1771 |
]. |
3837 | 1772 |
|
1773 |
preferredExtent := usedExtent. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1774 |
^ usedExtent |
2024 | 1775 |
|
1776 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1777 |
! |
1778 |
||
1779 |
preferredExtentOfItems |
|
1780 |
"compute and returns my preferred extent including all items |
|
3938 | 1781 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
2715 | 1782 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1783 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1784 |
x "{ Class:SmallInteger }" |
1785 |
y "{ Class:SmallInteger }" |
|
1786 |
size "{ Class:SmallInteger }" |
|
2883 | 1787 |
buttonInsetX2 "{ Class:SmallInteger }" |
1788 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1789 |
labelInsetX "{ Class:SmallInteger }" |
1790 |
labelInsetY "{ Class:SmallInteger }" |
|
1791 |
itemMargin "{ Class:SmallInteger }" |
|
1792 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1793 |
| |
388 | 1794 |
|
1699 | 1795 |
(size := items size) == 0 ifTrue:[ |
3938 | 1796 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
1797 |
^ 32 @ 32 |
|
2219 | 1798 |
]. |
3131 | 1799 |
stringOffsetX := nil. |
2883 | 1800 |
buttonInsetX2 := 2 * buttonInsetX. |
1801 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1802 |
|
1803 |
self isPopUpView ifFalse:[ |
|
3938 | 1804 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1805 |
] ifTrue:[ |
3938 | 1806 |
labelInsetX := labelInsetY := 0. |
1699 | 1807 |
]. |
1808 |
||
1809 |
x := 0. |
|
1810 |
y := 0. |
|
2219 | 1811 |
groupDividerSize := self groupDividerSize. |
388 | 1812 |
|
1813 |
self verticalLayout ifFalse:[ |
|
3938 | 1814 |
items keysAndValuesDo:[:key :el| |eX eY| |
1815 |
extent := el preferredExtent. |
|
1816 |
||
1817 |
"/ check for visibility (extent x ~~ 0) |
|
1818 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1819 |
eY := extent y. |
|
1820 |
||
1821 |
el isButton ifTrue:[ |
|
1822 |
eX := eX + buttonInsetX2. |
|
1823 |
eY := eY + buttonInsetY2. |
|
1824 |
] ifFalse:[ |
|
1825 |
eX := eX + labelInsetX. |
|
1826 |
eY := eY + labelInsetY. |
|
1827 |
]. |
|
1828 |
key ~~ size ifTrue:[ |
|
1829 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1830 |
x := x + groupDividerSize |
|
1831 |
] ifFalse:[ |
|
1832 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
1833 |
x := x + itemSpace |
|
1834 |
] |
|
1835 |
] |
|
1836 |
]. |
|
1837 |
x := x + eX. |
|
1838 |
y := y max:eY. |
|
1839 |
] |
|
1840 |
] |
|
388 | 1841 |
] ifTrue:[ |
3938 | 1842 |
hasMenu := false. |
1843 |
shCtKey := 0. |
|
1844 |
showAcc := MenuView showAcceleratorKeys == true. |
|
1845 |
y := x. |
|
1846 |
x := 0. |
|
1847 |
itemMargin := 2 * self itemMargin. |
|
1848 |
||
1849 |
items keysAndValuesDo:[:key :el| |eX eY| |
|
1850 |
extent := el preferredExtent. |
|
1851 |
||
1852 |
"/ check for visibility (extent x ~~ 0) |
|
1853 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1854 |
eY := extent y. |
|
1855 |
||
1856 |
el isButton ifTrue:[ |
|
1857 |
eX := eX + buttonInsetX2. |
|
1858 |
eY := eY + buttonInsetY2. |
|
1859 |
] ifFalse:[ |
|
1860 |
eX := eX + labelInsetX. |
|
1861 |
eY := eY + labelInsetY. |
|
1862 |
]. |
|
1863 |
hasMenu ifFalse:[ |
|
1864 |
hasMenu := el hasSubmenu |
|
1865 |
]. |
|
1866 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1867 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1868 |
]. |
|
1869 |
key ~~ size ifTrue:[ |
|
1870 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1871 |
y := y + groupDividerSize |
|
1872 |
] |
|
1873 |
]. |
|
1874 |
y := y + eY. |
|
1875 |
x := x max:eX. |
|
1876 |
]. |
|
1877 |
]. |
|
1878 |
x := x + itemMargin. |
|
1879 |
||
1880 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
|
1881 |
shortKeyInset := x + Item labelRightOffset. |
|
1882 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
|
1883 |
||
1884 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
|
1885 |
x := x + self shortcutKeyOffset. |
|
1886 |
] |
|
1887 |
]. |
|
1699 | 1888 |
"/ to have a small inset |
3938 | 1889 |
y := y + 1. |
1699 | 1890 |
"/ x := x + 1. |
1891 |
]. |
|
1892 |
x := x + margin + margin. |
|
1893 |
y := y + margin + margin. |
|
1894 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1895 |
^ x @ y |
388 | 1896 |
! |
1897 |
||
2253 | 1898 |
preferredWidth:aWidthOrNil |
1899 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1900 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1901 |
If not nil, the width is the maximum from the contained items and the required width." |
1902 |
||
2253 | 1903 |
preferredWidth := aWidthOrNil. |
2024 | 1904 |
! |
1905 |
||
388 | 1906 |
shortKeyInset |
2715 | 1907 |
"left inset of shortcutKey" |
1908 |
||
1909 |
^ shortKeyInset |
|
616 | 1910 |
! |
1911 |
||
3131 | 1912 |
stringOffsetXfor:anItem |
1913 |
"return the x offset for a MenuItem where to draw the text |
|
1914 |
" |
|
1915 |
|label w| |
|
1916 |
||
1917 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
1918 |
||
1919 |
stringOffsetX isNil ifTrue:[ |
|
3938 | 1920 |
stringOffsetX := 0. |
1921 |
||
1922 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
1923 |
self do:[:el| |
|
1924 |
el isVisible ifTrue:[ |
|
1925 |
( (label := el indicatorForm) notNil |
|
1926 |
or:[(label := el choiceForm) notNil] |
|
1927 |
) ifTrue:[ |
|
1928 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
1929 |
] ifFalse:[ |
|
1930 |
label := el displayLabel. |
|
1931 |
label class == LabelAndIcon ifTrue:[ |
|
1932 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
1933 |
]. |
|
1934 |
]. |
|
1935 |
]. |
|
1936 |
]. |
|
1937 |
]. |
|
3131 | 1938 |
]. |
1939 |
w := 0. |
|
1940 |
||
1941 |
( (label := anItem indicatorForm) notNil |
|
1942 |
or:[(label := anItem choiceForm) notNil] |
|
1943 |
) ifTrue:[ |
|
3938 | 1944 |
w := label width + 2. |
3131 | 1945 |
]. |
1946 |
stringOffsetX == 0 ifTrue:[ |
|
3938 | 1947 |
^ w |
3131 | 1948 |
]. |
1949 |
w == 0 ifTrue:[ |
|
3938 | 1950 |
label := anItem displayLabel. |
1951 |
||
1952 |
label class == LabelAndIcon ifTrue:[ |
|
1953 |
^ stringOffsetX - label xOfString |
|
1954 |
]. |
|
3131 | 1955 |
]. |
1956 |
^ stringOffsetX. |
|
1957 |
! |
|
1958 |
||
616 | 1959 |
subMenuIndicationWidth |
2219 | 1960 |
^ self rightArrow width |
388 | 1961 |
! ! |
1962 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1963 |
!MenuPanel methodsFor:'accessing-interactors'! |
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 |
iconIndicationDisabledOff |
2219 | 1966 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
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 |
iconIndicationDisabledOn |
2219 | 1970 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
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 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1973 |
iconIndicationOff |
2219 | 1974 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1975 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1976 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1977 |
iconIndicationOn |
2219 | 1978 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1979 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1980 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1981 |
iconRadioGroupDisabledOff |
2219 | 1982 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1983 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1984 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1985 |
iconRadioGroupDisabledOn |
2219 | 1986 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1987 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1988 |
|
3565 | 1989 |
iconRadioGroupEnteredOff |
1990 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff) |
|
1991 |
! |
|
1992 |
||
1993 |
iconRadioGroupEnteredOn |
|
1994 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn) |
|
1995 |
! |
|
1996 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1997 |
iconRadioGroupOff |
2219 | 1998 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1999 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2000 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2001 |
iconRadioGroupOn |
2219 | 2002 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2003 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2004 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2005 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 2006 |
|
4240 | 2007 |
hasItems |
2008 |
"return true, if I have items" |
|
2009 |
||
2010 |
^ items notEmptyOrNil |
|
2011 |
! |
|
2012 |
||
388 | 2013 |
itemAt:stringOrNumber do:aOneArgBlock |
3938 | 2014 |
"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
|
2015 |
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
|
2016 |
|
388 | 2017 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
2018 |
! |
|
2019 |
||
2020 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
3938 | 2021 |
"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
|
2022 |
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
|
2023 |
|
388 | 2024 |
|item| |
2025 |
||
2026 |
item := self itemAt:stringOrNumber. |
|
2027 |
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
|
2028 |
^ exceptionBlock value |
706 | 2029 |
! |
2030 |
||
2031 |
itemAtIndex:anIndex |
|
2715 | 2032 |
"returns item at an index or nil" |
2033 |
||
706 | 2034 |
^ 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
|
2035 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2036 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2037 |
items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2038 |
"returns the list of items or nil. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2039 |
Warning: do not change this list - it is mine !!" |
2715 | 2040 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2041 |
^ items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2042 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2043 |
"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
|
2044 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2045 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2046 |
itemsDo:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2047 |
items notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2048 |
items do:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2049 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2050 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2051 |
"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
|
2052 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2053 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2054 |
itemsDoWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2055 |
items notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2056 |
items doWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2057 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2058 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2059 |
"Created: / 09-11-2010 / 10:06:02 / cg" |
388 | 2060 |
! ! |
2061 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2062 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 2063 |
|
727 | 2064 |
buttonActiveLevel |
2715 | 2065 |
"get the buttons active level" |
2066 |
||
2219 | 2067 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 2068 |
! |
2069 |
||
2070 |
buttonPassiveLevel |
|
2715 | 2071 |
"get the buttons passive level" |
2072 |
||
3987 | 2073 |
^ (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0 |
2074 |
||
2075 |
"Modified: / 19-01-2011 / 21:21:26 / cg" |
|
727 | 2076 |
! |
2077 |
||
2337 | 2078 |
centerItems |
2079 |
^ centerItems ? false |
|
2080 |
! |
|
2081 |
||
2082 |
centerItems:aBoolean |
|
2083 |
centerItems := aBoolean |
|
2084 |
! |
|
2085 |
||
390 | 2086 |
fitFirstPanel |
3938 | 2087 |
"gets true if the first panel in the menu hierarchy must be fit |
390 | 2088 |
to the extent of its superView |
1699 | 2089 |
|
2715 | 2090 |
NOT SUPPORTED" |
2091 |
||
2219 | 2092 |
^ false |
388 | 2093 |
! |
2094 |
||
390 | 2095 |
fitFirstPanel:aState |
3938 | 2096 |
"sets true if the first panel in the menu hierarchy must be fit |
390 | 2097 |
to the extent of its superView |
1699 | 2098 |
|
2715 | 2099 |
NOT SUPPORTED" |
616 | 2100 |
! |
2101 |
||
1093 | 2102 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2103 |
anInt ~~ level ifTrue:[ |
3147 | 2104 |
super level:anInt. |
2105 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2106 |
] |
2052 | 2107 |
|
2108 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 2109 |
! |
2110 |
||
616 | 2111 |
rightArrow |
2374 | 2112 |
rightArrow isNil ifTrue:[ |
3938 | 2113 |
device isNil ifTrue:[ |
2114 |
^ SelectionInListView rightArrowFormOn:Display |
|
2115 |
]. |
|
2116 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
2219 | 2117 |
]. |
616 | 2118 |
^ rightArrow |
2119 |
! |
|
2120 |
||
2121 |
rightArrowShadow |
|
2122 |
^ rightArrowShadow |
|
388 | 2123 |
! |
2124 |
||
390 | 2125 |
showGroupDivider |
2715 | 2126 |
"get the enabled flag for showing groupDiveders" |
2127 |
||
2253 | 2128 |
^ showGroupDivider |
388 | 2129 |
! |
2130 |
||
390 | 2131 |
showGroupDivider:aState |
2715 | 2132 |
"set the enabled flag for showing groupDiveders" |
2133 |
||
2253 | 2134 |
showGroupDivider ~~ aState ifTrue:[ |
3938 | 2135 |
showGroupDivider := aState. |
2136 |
self mustRearrange. |
|
653 | 2137 |
] |
388 | 2138 |
! |
2139 |
||
2140 |
showSeparatingLines |
|
2715 | 2141 |
"gets true if drawing of separating lines is enabled." |
2142 |
||
2253 | 2143 |
^ showSeparatingLines |
388 | 2144 |
! |
2145 |
||
390 | 2146 |
showSeparatingLines:aState |
2715 | 2147 |
"turn on/off drawing of separating lines." |
2148 |
||
2253 | 2149 |
aState ~~ showSeparatingLines ifTrue:[ |
3938 | 2150 |
showSeparatingLines := aState. |
2151 |
self mustRearrange |
|
2253 | 2152 |
]. |
388 | 2153 |
! |
2154 |
||
2155 |
verticalLayout |
|
2715 | 2156 |
"get the layout: vertical( true ) or horizontal( false )" |
2157 |
||
2374 | 2158 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 2159 |
|
2160 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
3938 | 2161 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
2374 | 2162 |
^ verticalLayout |
388 | 2163 |
! |
2164 |
||
2165 |
verticalLayout:aState |
|
2715 | 2166 |
"set the layout: vertical( true ) or horizontal( false )" |
2167 |
||
2253 | 2168 |
aState ~~ verticalLayout ifTrue:[ |
3938 | 2169 |
verticalLayout isNil ifTrue:[ |
2170 |
verticalLayout := aState |
|
2171 |
] ifFalse:[ |
|
2172 |
verticalLayout := aState. |
|
2173 |
self mustRearrange. |
|
2174 |
]. |
|
2253 | 2175 |
]. |
388 | 2176 |
! ! |
2177 |
||
2219 | 2178 |
!MenuPanel methodsFor:'accessing-style'! |
2179 |
||
2180 |
buttonInsetX |
|
2715 | 2181 |
"returns the verical button space" |
2182 |
||
2883 | 2183 |
^ buttonInsetX |
2219 | 2184 |
! |
2185 |
||
2186 |
buttonInsetY |
|
2715 | 2187 |
"returns the verical button space" |
2188 |
||
2883 | 2189 |
^ buttonInsetY |
2219 | 2190 |
! |
2191 |
||
3975 | 2192 |
delayInSecondsBeforeOpeningSubmenu |
2193 |
"answer the seconds a submenu will be delayed before |
|
2194 |
open; an already open submenu than will be closed" |
|
2195 |
||
4342 | 2196 |
^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu' default:0.3 |
3975 | 2197 |
! |
2198 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2199 |
drawMenuIndicatorSeparatorLine |
4235 | 2200 |
^ true. |
2201 |
"/ ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine' default:false |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2202 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2203 |
|
2219 | 2204 |
enteredLevel |
2715 | 2205 |
"returns the enter-level for an unselected item moved through" |
2206 |
||
2219 | 2207 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
2208 |
! |
|
2209 |
||
2210 |
groupDividerSize |
|
2715 | 2211 |
"returns the width of a group divider" |
2212 |
||
2219 | 2213 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
2214 |
! |
|
2215 |
||
2216 |
itemMargin |
|
2715 | 2217 |
"returns the margin of an item" |
2218 |
||
2219 | 2219 |
^ styleSheet at:#'menu.itemMargin' default:0 |
2220 |
! |
|
2221 |
||
2222 |
itemSpace |
|
2715 | 2223 |
"returns the additional space for an item in a (vertical) panel" |
2224 |
||
2883 | 2225 |
^ itemSpace |
2219 | 2226 |
! |
2227 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2228 |
menuIndicatorVerticalPosition |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2229 |
"#center, #top or #bottom" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2230 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2231 |
^ #center |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2232 |
"/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2233 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2234 |
|
2219 | 2235 |
selectionFollowsMouse |
2715 | 2236 |
"returns true if the selection follows the mouse" |
2237 |
||
2219 | 2238 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
2239 |
! |
|
2240 |
||
2241 |
shortcutKeyOffset |
|
2715 | 2242 |
"returns the offset for a shortcutKey" |
2243 |
||
2219 | 2244 |
^ 5 |
2245 |
! ! |
|
2246 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2247 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 2248 |
|
2249 |
subMenuAt:stringOrNumber |
|
3192 | 2250 |
"gets the current submenu of an item; if the submenu is nil, the |
2251 |
submenu is generated if specified otherwise nil is returned." |
|
2252 |
||
2253 |
|submenu| |
|
2254 |
||
2255 |
self itemAt:stringOrNumber do:[:anItem| |
|
3938 | 2256 |
submenu := anItem currentSubmenu. |
2257 |
submenu isNil ifTrue:[ |
|
2258 |
submenu := anItem setupSubmenu |
|
2259 |
]. |
|
3192 | 2260 |
]. |
2261 |
^ submenu |
|
3934 | 2262 |
|
2263 |
"Modified: / 22-09-2010 / 13:53:21 / cg" |
|
388 | 2264 |
! |
2265 |
||
2266 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2267 |
"sets the submenu of an item" |
2268 |
||
388 | 2269 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2270 |
! |
|
2271 |
||
2272 |
subMenuShown |
|
2715 | 2273 |
"return the currently visible submenu - or nil if there is none" |
2274 |
||
3192 | 2275 |
|item submenu| |
2276 |
||
2277 |
item := self selection. |
|
2278 |
||
2279 |
item notNil ifTrue:[ |
|
3938 | 2280 |
submenu := item currentSubmenu. |
2281 |
||
2282 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2283 |
^ submenu |
|
2284 |
]. |
|
2715 | 2285 |
]. |
2286 |
^ nil |
|
388 | 2287 |
! ! |
2288 |
||
2504 | 2289 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2290 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2291 |
closeMenus |
2715 | 2292 |
"close all menus without accepting" |
2293 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2294 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2295 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2296 |
|
388 | 2297 |
hide |
2715 | 2298 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2299 |
|
2407 | 2300 |
"/ TODO: replace with LeaveSignal raise. |
2301 |
||
388 | 2302 |
self selection:nil. |
2303 |
self unmap. |
|
2304 |
! |
|
2305 |
||
2306 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2307 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2308 |
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
|
2309 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2310 |
to some performer)" |
2311 |
||
2312 |
^ self showAt:(self origin) resizing:true |
|
388 | 2313 |
! |
2314 |
||
2315 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2316 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2317 |
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
|
2318 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2319 |
to some performer)" |
2320 |
||
3754 | 2321 |
^ self showAt:aPoint resizing:true |
388 | 2322 |
! |
2323 |
||
2324 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2325 |
"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
|
2326 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2327 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2328 |
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
|
2329 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2330 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2331 |
|
4150 | 2332 |
self origin:aPoint. |
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2333 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2334 |
|
2335 |
aBoolean ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2336 |
self fixSize. |
388 | 2337 |
]. |
1459 | 2338 |
"/ self makeFullyVisible. -- done in realize |
388 | 2339 |
self openModal:[true]. "realize " |
2340 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2341 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2342 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2343 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2344 |
self topMenu hasPerformed ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2345 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2346 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2347 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2348 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2349 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2350 |
"Modified: / 29-06-2011 / 16:24:22 / cg" |
388 | 2351 |
! |
2352 |
||
2353 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2354 |
"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
|
2355 |
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
|
2356 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2357 |
to some performer)" |
2358 |
||
4064
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2359 |
^ self showAt:(device pointerPosition) resizing:true |
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2360 |
|
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2361 |
"Modified (format): / 22-07-2011 / 15:24:48 / cg" |
388 | 2362 |
! |
2363 |
||
2364 |
showCenteredIn:aView |
|
2365 |
"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
|
2366 |
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
|
2367 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2368 |
to some performer)" |
2369 |
||
388 | 2370 |
|top| |
2371 |
||
2372 |
top := aView topView. |
|
2373 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2374 |
^ 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
|
2375 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2376 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2377 |
! |
2378 |
||
2379 |
startUp |
|
2380 |
"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
|
2381 |
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
|
2382 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2383 |
to some performer)" |
2384 |
||
388 | 2385 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2386 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2387 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2388 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2389 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2390 |
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
|
2391 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2392 |
to some performer)" |
2393 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2394 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2395 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2396 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2397 |
! |
2398 |
||
2332 | 2399 |
startUpFor:originatingWidget |
2400 |
"realize the menu at the current pointer position |
|
2401 |
return the value of the selectedItem or nil, of none was selected |
|
2402 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2403 |
to some performer)" |
2404 |
||
2332 | 2405 |
originator := originatingWidget. |
2406 |
^ self startUp |
|
2407 |
! |
|
2408 |
||
1750 | 2409 |
startUpOrNil |
2410 |
"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
|
2411 |
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
|
2412 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2413 |
to some performer)" |
2414 |
||
1750 | 2415 |
^ self showAtPointer |
388 | 2416 |
! ! |
2417 |
||
2418 |
!MenuPanel methodsFor:'adding & removing'! |
|
2419 |
||
2420 |
createAtIndex:anIndexOrNil |
|
1800 | 2421 |
"create an item and add this item to the index. In case of nil, the item |
2422 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2423 |
otherwise the new created item is returned." |
2424 |
||
4046 | 2425 |
|max item index| |
388 | 2426 |
|
2427 |
max := (items size) + 1. |
|
2428 |
||
4046 | 2429 |
(index := anIndexOrNil) notNil ifTrue:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2430 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
4046 | 2431 |
index := max. |
2432 |
"/ ^ nil |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2433 |
] |
388 | 2434 |
]. |
2435 |
items isNil ifTrue:[ |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2436 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2437 |
] ifFalse:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2438 |
items := items asOrderedCollection |
388 | 2439 |
]. |
2440 |
item := Item in:self. |
|
2441 |
||
4046 | 2442 |
(index isNil or:[index == max]) ifTrue:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2443 |
items add:item |
388 | 2444 |
] ifFalse:[ |
4046 | 2445 |
items add:item beforeIndex:index |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2446 |
]. |
3966 | 2447 |
self mustRearrange. |
388 | 2448 |
^ item |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2449 |
|
4046 | 2450 |
"Modified: / 03-07-2011 / 22:49:47 / cg" |
388 | 2451 |
! |
2452 |
||
2453 |
remove:stringOrNumber |
|
2454 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2455 |
if found, remove and return it" |
2456 |
||
388 | 2457 |
|item| |
2458 |
||
2459 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2460 |
items remove:item. |
4274 | 2461 |
items := items asNilIfEmpty. |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2462 |
item destroy. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2463 |
self mustRearrange. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2464 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2465 |
^ item |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2466 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2467 |
"Modified: / 09-11-2010 / 10:04:08 / cg" |
388 | 2468 |
! |
2469 |
||
2470 |
removeAll |
|
2715 | 2471 |
"remove all items and submenus" |
2472 |
||
388 | 2473 |
self disabledRedrawDo:[ |
3938 | 2474 |
self selection:nil. |
2475 |
groupSizes := nil. |
|
2476 |
items notNil ifTrue:[ |
|
2477 |
items copy do:[:el| el destroy ]. |
|
2478 |
]. |
|
2479 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2480 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2481 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2482 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2483 |
! ! |
2484 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2485 |
!MenuPanel methodsFor:'change & update'! |
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 |
update:something with:aParameter from:changedObject |
498 | 2488 |
|
2489 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2490 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2491 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2492 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2493 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2494 |
|
388 | 2495 |
!MenuPanel methodsFor:'converting'! |
2496 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2497 |
asMenu |
3222 | 2498 |
"convert contents to a menu" |
2715 | 2499 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2500 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2501 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2502 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2503 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2504 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2505 |
^ menu |
3222 | 2506 |
|
2507 |
"Modified: / 27-03-2007 / 08:39:48 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2508 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2509 |
|
388 | 2510 |
fromSpec:aMenuSpec |
2715 | 2511 |
"build from spec" |
2512 |
||
3222 | 2513 |
self menu:(Menu decodeFromLiteralArray:aMenuSpec) |
2514 |
||
2515 |
"Modified: / 27-03-2007 / 08:42:43 / cg" |
|
388 | 2516 |
! |
2517 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2518 |
menu:aMenu |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2519 |
"setup from a menu" |
2715 | 2520 |
|
388 | 2521 |
self disabledRedrawDo:[ |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2522 |
|menu newItems menuReceiver| |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2523 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2524 |
self removeAll. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2525 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2526 |
(menu := aMenu) notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2527 |
(aMenu isCollection) ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2528 |
menu := Menu decodeFromLiteralArray:aMenu. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2529 |
] ifFalse:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2530 |
menuReceiver := menu receiver. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2531 |
menuReceiver notNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2532 |
self receiver:menuReceiver. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2533 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2534 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2535 |
(newItems := menu menuItems) notEmptyOrNil ifTrue:[ |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2536 |
items := newItems collect:[:ni | |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2537 |
|i| |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2538 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2539 |
i:= Item in:self. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2540 |
i menuItem:ni. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2541 |
i. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2542 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2543 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2544 |
self groupSizes:(menu groupSizes). |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2545 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2546 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2547 |
|
3966 | 2548 |
"Modified: / 09-11-2010 / 11:52:28 / cg" |
388 | 2549 |
! ! |
2550 |
||
2681 | 2551 |
!MenuPanel methodsFor:'dependents access'! |
2552 |
||
2553 |
addDependencies |
|
2715 | 2554 |
"add all dependencies" |
2555 |
||
2681 | 2556 |
self do:[:anItem| anItem addDependencies ]. |
2557 |
||
2558 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2559 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2560 |
! |
|
2561 |
||
2562 |
removeDependencies |
|
2715 | 2563 |
"remove all dependencies" |
2564 |
||
2681 | 2565 |
self do:[:anItem| anItem removeDependencies ]. |
2566 |
||
2567 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2568 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2569 |
! ! |
|
2570 |
||
388 | 2571 |
!MenuPanel methodsFor:'drawing'! |
2572 |
||
2573 |
disabledRedrawDo:aBlock |
|
2574 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2575 |
of the block a redraw might be performed" |
2576 |
||
388 | 2577 |
|state| |
2578 |
||
2579 |
state := mustRearrange. |
|
2580 |
mustRearrange := true. |
|
2581 |
aBlock value. |
|
2582 |
mustRearrange := state. |
|
2583 |
self mustRearrange |
|
2584 |
! |
|
2585 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2586 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2587 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2588 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2589 |
aLevel ~~ 0 ifTrue:[ |
3938 | 2590 |
layout := anItem layout. |
2591 |
||
2592 |
styleSheet is3D ifFalse:[ |
|
2593 |
self displayRectangle:layout. |
|
2594 |
] ifTrue:[ |
|
2595 |
self drawEdgesForX:(layout left) |
|
2596 |
y:(layout top) |
|
2597 |
width:(layout width) |
|
2598 |
height:(layout height) |
|
2599 |
level:aLevel |
|
2600 |
shadow:(self buttonShadowColor) |
|
2601 |
light:(self buttonLightColor) |
|
2602 |
halfShadow:(self buttonHalfShadowColor) |
|
2603 |
halfLight:(self buttonHalfLightColor) |
|
2604 |
style:(self buttonEdgeStyle) |
|
2605 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2606 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2607 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2608 |
|
3187 | 2609 |
drawFocusForItem:anItem |
2610 |
|lytItem| |
|
2611 |
||
2612 |
lytItem := anItem layout. |
|
2613 |
self paint:(Color black). |
|
2614 |
||
2615 |
self displayDottedRectangleX:(lytItem left) |
|
3938 | 2616 |
y:(lytItem top) |
2617 |
width:(lytItem width) |
|
2618 |
height:(lytItem height). |
|
3187 | 2619 |
! |
2620 |
||
2016 | 2621 |
drawItemsX:x y:y width:w height:h |
2715 | 2622 |
"redraw items and groups in a damage" |
2623 |
||
2016 | 2624 |
|isVertical item layout prevClip |
2625 |
x1 "{ Class:SmallInteger }" |
|
2626 |
x2 "{ Class:SmallInteger }" |
|
2627 |
y1 "{ Class:SmallInteger }" |
|
2628 |
y2 "{ Class:SmallInteger }" |
|
2629 |
start "{ Class:SmallInteger }" |
|
2630 |
stop "{ Class:SmallInteger }" |
|
2631 |
size "{ Class:SmallInteger }" |
|
2632 |
groupDivInset "{ Class:SmallInteger }" |
|
2633 |
| |
|
2634 |
||
2635 |
size := items size. |
|
2636 |
isVertical := self verticalLayout. |
|
2637 |
||
2638 |
isVertical ifTrue:[ |
|
3938 | 2639 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2640 |
start == 0 ifTrue:[ ^ self ]. |
|
2641 |
y1 := y + h. |
|
2642 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
|
2643 |
startingAt:(start + 1). |
|
2016 | 2644 |
] ifFalse:[ |
3938 | 2645 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2646 |
start == 0 ifTrue:[ ^ self ]. |
|
2647 |
x1 := x + w. |
|
2648 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
|
2649 |
startingAt:(start + 1). |
|
2016 | 2650 |
]. |
2651 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2652 |
||
2253 | 2653 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
3938 | 2654 |
groupDivInset := self groupDividerSize // 2. |
2655 |
||
2656 |
groupDivInset ~~ 0 ifTrue:[ |
|
2657 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2658 |
start := start - 1 |
|
2659 |
] |
|
2660 |
]. |
|
2016 | 2661 |
] ifFalse:[ |
3938 | 2662 |
groupDivInset := 0 |
2016 | 2663 |
]. |
2664 |
||
2665 |
prevClip := clipRect. |
|
2666 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2667 |
||
2668 |
start to:stop do:[:i| |
|
3938 | 2669 |
item := items at:i. |
2670 |
item draw. |
|
2671 |
||
2672 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2673 |
layout := item layout. |
|
2674 |
||
2675 |
isVertical ifTrue:[ |
|
2676 |
x1 := layout left. |
|
2677 |
x2 := layout right. |
|
2678 |
y1 := layout bottom + groupDivInset. |
|
2679 |
y2 := y1. |
|
2680 |
] ifFalse:[ |
|
2681 |
y1 := layout top. |
|
2682 |
y2 := layout bottom. |
|
2683 |
x1 := layout right + groupDivInset. |
|
2684 |
x2 := x1. |
|
2685 |
]. |
|
2686 |
self paint:shadowColor. |
|
2687 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2688 |
self paint:lightColor. |
|
2689 |
||
2690 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2691 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2692 |
||
2693 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2694 |
]. |
|
2695 |
selection == item ifTrue:[ |
|
2696 |
self focusComesByTab ifTrue:[ |
|
2697 |
self drawFocusForItem:item. |
|
2698 |
]. |
|
2699 |
]. |
|
2016 | 2700 |
]. |
2701 |
self clippingRectangle:prevClip. |
|
2702 |
! |
|
2703 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2704 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2705 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2706 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2707 |
isSelected ifTrue:[ |
3938 | 2708 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2709 |
] ifFalse:[ |
3938 | 2710 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2711 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2712 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2713 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2714 |
level ~~ 0 ifTrue:[ |
3938 | 2715 |
layout := anItem layout. |
2716 |
||
2717 |
self drawEdgesForX:(layout left) |
|
2718 |
y:(layout top) |
|
2719 |
width:(layout width) |
|
2720 |
height:(layout height) |
|
2721 |
level:level |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2722 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2723 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2724 |
|
2016 | 2725 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2726 |
"draw a scroller" |
2727 |
||
2016 | 2728 |
|scrolling icon level x y w h| |
2729 |
||
2730 |
x := bounds left. |
|
2731 |
y := bounds top. |
|
2732 |
w := bounds width. |
|
2733 |
h := bounds height. |
|
2734 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2735 |
scrolling := self scrollActivity. |
2016 | 2736 |
|
2737 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
3938 | 2738 |
level := -2 |
2016 | 2739 |
] ifFalse:[ |
3938 | 2740 |
level := 1 |
2016 | 2741 |
]. |
2742 |
||
2743 |
level ~~ 0 ifTrue:[ |
|
3938 | 2744 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2745 |
]. |
2746 |
icon := scrolling iconAt:aDirection on:self. |
|
2747 |
||
2748 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
3938 | 2749 |
y:(y + (h - icon height // 2)). |
2016 | 2750 |
! |
2751 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2752 |
invalidateItem:anItem repairNow:aBool |
2715 | 2753 |
"an item changed; invalidate the items layout" |
2754 |
||
2016 | 2755 |
|layout| |
2756 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2757 |
(mustRearrange not and:[shown]) ifTrue:[ |
3938 | 2758 |
layout := anItem layout. |
2759 |
||
2760 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2761 |
self invalidate:(layout "insetBy:-1") repairNow:aBool |
|
2762 |
] |
|
1728 | 2763 |
]. |
2764 |
||
2765 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2766 |
! |
2767 |
||
388 | 2768 |
mustRearrange |
2715 | 2769 |
"force rearrange (i.e. set the rearrange flag)" |
2770 |
||
2080 | 2771 |
mustRearrange ifFalse:[ |
3938 | 2772 |
mustRearrange := true. |
2773 |
self invalidate "/ RepairNow:true |
|
388 | 2774 |
] |
590 | 2775 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2776 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2777 |
! |
2778 |
||
710 | 2779 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2780 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2781 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2782 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2783 |
|
1699 | 2784 |
|layout point |
710 | 2785 |
dltX "{ Class:SmallInteger }" |
2786 |
start "{ Class:SmallInteger }" |
|
2787 |
| |
|
2788 |
||
2789 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
3938 | 2790 |
^ self |
710 | 2791 |
]. |
2792 |
||
2793 |
layout := items last layout. |
|
3246 | 2794 |
layout notNil ifTrue:[ |
3938 | 2795 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2796 |
^ self "/ no free space |
|
2797 |
]. |
|
710 | 2798 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2799 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2800 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2801 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2802 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2803 |
"/ 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
|
2804 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2805 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
3938 | 2806 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
3148 | 2807 |
] ifFalse:[ |
3938 | 2808 |
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
|
2809 |
]. |
710 | 2810 |
start == 0 ifTrue:[ |
3938 | 2811 |
^ self "/ no right-group item detected |
1699 | 2812 |
]. |
2813 |
point := dltX @ 0. |
|
2814 |
||
2815 |
"/ move items layout to right |
|
710 | 2816 |
items from:start do:[:anItem| |
3938 | 2817 |
anItem isVisible ifTrue:[ |
2818 |
anItem layout moveBy:point. |
|
2819 |
] |
|
710 | 2820 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2821 |
self updateEnteredItem. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2822 |
|
3246 | 2823 |
"Modified: / 10-10-2007 / 00:29:34 / cg" |
710 | 2824 |
! |
2825 |
||
388 | 2826 |
rearrangeItems |
1699 | 2827 |
"recompute the layout of each item |
3938 | 2828 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2715 | 2829 |
|
1791 | 2830 |
|isVertical extent isPopUpMenu |
2219 | 2831 |
x "{ Class:SmallInteger }" |
2832 |
y "{ Class:SmallInteger }" |
|
2833 |
x0 "{ Class:SmallInteger }" |
|
2834 |
y0 "{ Class:SmallInteger }" |
|
2835 |
x1 "{ Class:SmallInteger }" |
|
2836 |
y1 "{ Class:SmallInteger }" |
|
2837 |
size "{ Class:SmallInteger }" |
|
2838 |
insetX "{ Class:SmallInteger }" |
|
2839 |
insetY "{ Class:SmallInteger }" |
|
2840 |
labelInsetX "{ Class:SmallInteger }" |
|
2841 |
labelInsetY "{ Class:SmallInteger }" |
|
2842 |
itemMargin "{ Class:SmallInteger }" |
|
2843 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2844 |
| |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2845 |
|
1699 | 2846 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
3938 | 2847 |
mustRearrange := false. |
2848 |
^ self |
|
390 | 2849 |
]. |
2219 | 2850 |
|
2080 | 2851 |
"/ DON'T SET THIS!! |
3938 | 2852 |
"/ item layout: below of first item -> item invalidate |
2853 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2080 | 2854 |
"/ -> invalidate:rapairDamage: |
2855 |
"/ -> redrawX:y:width:height: |
|
2856 |
"/ tries to get uninitialized layout from second item. |
|
2857 |
"/ This happens in a modal debugger!! |
|
2858 |
"/ mustRearrange := false. |
|
2219 | 2859 |
isVertical := self verticalLayout. |
2860 |
groupDividerSize := self groupDividerSize. |
|
2861 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2862 |
|
2863 |
isPopUpMenu ifFalse:[ |
|
3938 | 2864 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2865 |
] ifTrue:[ |
3938 | 2866 |
labelInsetX := labelInsetY := 0 |
2867 |
]. |
|
2868 |
||
2869 |
(isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ |
|
2870 |
|saveExtent maxExtent extentToSet| |
|
2871 |
||
2872 |
extent := self preferredExtent. |
|
2873 |
||
2874 |
isPopUpMenu ifTrue:[ |
|
2875 |
maxExtent := self maxExtent. |
|
2876 |
maxExtent notNil ifTrue:[ |
|
2877 |
extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] |
|
2878 |
ifFalse:[(extent x min:(maxExtent x)) @ extent y]. |
|
2879 |
]. |
|
2880 |
] ifFalse:[ |
|
2881 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
|
2882 |
]. |
|
2883 |
self extent:extentToSet. |
|
390 | 2884 |
] ifFalse:[ |
3938 | 2885 |
extent := self computeExtent |
390 | 2886 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2887 |
|
1093 | 2888 |
x := y := margin. |
2889 |
||
1699 | 2890 |
isVertical ifFalse:[ |
3938 | 2891 |
y0 := margin. |
2892 |
y1 := extent y - margin. |
|
2893 |
||
2894 |
items keysAndValuesDo:[:anIndex :el| |
|
2895 |
el isVisible ifFalse:[ |
|
2896 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2897 |
] ifTrue:[ |
|
2898 |
el isButton ifTrue:[ |
|
2899 |
insetX := buttonInsetX. |
|
2900 |
insetY := buttonInsetY. |
|
2901 |
] ifFalse:[ |
|
2902 |
insetX := labelInsetX. |
|
2903 |
insetY := labelInsetY. |
|
2904 |
]. |
|
2905 |
x0 := x + insetX. |
|
2906 |
x1 := x0 + (el preferredWidth). |
|
2907 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
|
2908 |
x := x1 + insetX. |
|
2909 |
||
2910 |
size ~~ anIndex ifTrue:[ |
|
2911 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2912 |
x := x + groupDividerSize |
|
2913 |
] ifFalse:[ |
|
2914 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
2915 |
x := x + itemSpace |
|
2916 |
] |
|
2917 |
] |
|
2918 |
] |
|
2919 |
]. |
|
2920 |
]. |
|
1699 | 2921 |
] ifTrue:[ |
3938 | 2922 |
itemMargin := self itemMargin. |
2923 |
x0 := margin. |
|
2924 |
x1 := extent x - margin - itemMargin. "/ -1 |
|
2925 |
||
2926 |
items keysAndValuesDo:[:anIndex :el| |
|
2927 |
el isVisible ifFalse:[ |
|
2928 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2929 |
] ifTrue:[ |
|
2930 |
el isButton ifTrue:[ |
|
2931 |
insetX := buttonInsetX. |
|
2932 |
insetY := buttonInsetY. |
|
2933 |
] ifFalse:[ |
|
2934 |
insetX := labelInsetX. |
|
2935 |
insetY := labelInsetY. |
|
2936 |
]. |
|
2937 |
y0 := y + insetY. |
|
2938 |
y1 := y0 + el preferredHeight. |
|
2939 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
|
2940 |
y := y1 + insetY. |
|
2941 |
||
2942 |
size ~~ anIndex ifTrue:[ |
|
2943 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2944 |
y := y + groupDividerSize |
|
2945 |
] |
|
2946 |
] |
|
2947 |
] |
|
2948 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2949 |
]. |
710 | 2950 |
self rearrangeGroups. |
2048 | 2951 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2952 |
mustRearrange := false. |
2048 | 2953 |
|
2954 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2955 |
! |
2956 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2957 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2958 |
"check for items which can change its visibility; |
2715 | 2959 |
if at least one item exists, rearrange all items" |
2960 |
||
1464 | 2961 |
items isNil ifTrue:[^ self]. |
1699 | 2962 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2963 |
items do:[:item | |
3938 | 2964 |
item canChangeVisibility ifTrue:[ |
2965 |
mustRearrange := true. |
|
2966 |
self rearrangeItems. |
|
2967 |
^ self |
|
2968 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2969 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2970 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2971 |
|
388 | 2972 |
redrawX:x y:y width:w height:h |
2715 | 2973 |
"redraw a damage" |
2974 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2975 |
|y0 y1 x0 x1 prvBound mustDraw nxtBound| |
388 | 2976 |
|
710 | 2977 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2978 |
|
1699 | 2979 |
mustRearrange ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2980 |
self isPopUpView ifFalse:[ self explicitExtent:true]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2981 |
self rearrangeItems. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2982 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2983 |
^ self |
1699 | 2984 |
]. |
2888 | 2985 |
"/ self paint:(self viewBackground). |
1699 | 2986 |
self clearRectangleX:x y:y width:w height:h. |
2987 |
||
2016 | 2988 |
items size == 0 ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2989 |
^ self |
1699 | 2990 |
]. |
2016 | 2991 |
y0 := y. |
2992 |
y1 := y + h. |
|
2018 | 2993 |
x0 := x. |
2994 |
x1 := x + w. |
|
2016 | 2995 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2996 |
"Draw the scroll handles - especially for Popup-Lists" |
3938 | 2997 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
2998 |
self hasScrollers ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2999 |
(self hasScrollerAt:#PREV) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3000 |
prvBound := self scrollerBoundsAt:#PREV. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3001 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3002 |
self verticalLayout ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3003 |
(mustDraw := (prvBound bottom > y)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3004 |
y0 := prvBound bottom. |
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 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3007 |
(mustDraw := (prvBound right > x)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3008 |
x0 := prvBound right. |
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 |
mustDraw ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3012 |
self drawScrollerAt:#PREV bounds:prvBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3013 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3014 |
]. |
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 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3017 |
nxtBound := self scrollerBoundsAt:#NEXT. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3018 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3019 |
self verticalLayout ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3020 |
(mustDraw := (nxtBound top < y1)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3021 |
y1 := nxtBound top. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3022 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3023 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3024 |
(mustDraw := (nxtBound left < x1)) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3025 |
x1 := nxtBound left. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3026 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3027 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3028 |
mustDraw ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3029 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3030 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3031 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3032 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3033 |
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
|
3034 |
|
2018 | 3035 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3036 |
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
|
3037 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3038 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3039 |
"Modified: / 29-06-2011 / 16:24:34 / cg" |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3040 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3041 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3042 |
updateEnteredItem |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3043 |
|mousePoint| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3044 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3045 |
mousePoint := device translatePoint:(device pointerPosition) |
3938 | 3046 |
fromView:nil |
3047 |
toView:self. |
|
3048 |
||
3049 |
(self containsPoint:mousePoint) ifTrue:[ |
|
3050 |
enteredItem := self itemAtPoint:mousePoint |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3051 |
]. |
388 | 3052 |
! ! |
3053 |
||
3054 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
3055 |
||
3056 |
collect:aOneArgBlock |
|
3057 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 3058 |
and return a collection of the results" |
3059 |
||
388 | 3060 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 3061 |
^ nil |
388 | 3062 |
! |
3063 |
||
3064 |
do:aOneArgBlock |
|
2715 | 3065 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
3066 |
||
388 | 3067 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
3068 |
! |
|
3069 |
||
3070 |
findFirst:aOneArgBlock |
|
3206 | 3071 |
"find the index of the first item, for which evaluation of the argument, aOneArgBlock |
2715 | 3072 |
returns true; return its index or 0 if none detected." |
3073 |
||
388 | 3074 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 3075 |
^ 0 |
388 | 3076 |
! |
3077 |
||
3078 |
findLast:aOneArgBlock |
|
3079 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 3080 |
returns true; return its index or 0 if none detected." |
3081 |
||
388 | 3082 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 3083 |
^ 0 |
388 | 3084 |
! |
3085 |
||
3187 | 3086 |
firstItemSelectable |
3087 |
"returns the first item which is selectable or nil |
|
3088 |
" |
|
3089 |
items size > 0 ifTrue:[ |
|
3938 | 3090 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
3187 | 3091 |
]. |
3092 |
^ nil |
|
3093 |
! |
|
3094 |
||
390 | 3095 |
indexOf:something |
3096 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 3097 |
If no item match 0 is returned. No range checks are performed on a number argument" |
3098 |
||
390 | 3099 |
|i v| |
3100 |
||
3101 |
something isNumber ifTrue:[ ^ something ]. |
|
3102 |
something isNil ifTrue:[ ^ 0 ]. |
|
3103 |
||
1218 | 3104 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 3105 |
|
3106 |
i ~~ 0 ifTrue:[ |
|
3938 | 3107 |
^ i |
388 | 3108 |
]. |
390 | 3109 |
|
3110 |
something isSymbol ifTrue:[ |
|
3938 | 3111 |
i := self findFirst:[:el| |
3112 |
v := el value. |
|
3113 |
v isSymbol and:[v == something] |
|
3114 |
]. |
|
3115 |
i ~~ 0 ifTrue:[ |
|
3116 |
^ i |
|
3117 |
] |
|
390 | 3118 |
]. |
3119 |
||
3120 |
(something respondsTo:#string) ifTrue:[ |
|
3938 | 3121 |
v := something string. |
1218 | 3122 |
^ self findFirst:[:el | el textLabel = v]. |
3123 |
]. |
|
3124 |
^ 0 |
|
388 | 3125 |
! |
3126 |
||
706 | 3127 |
indexOfItem:anItem |
2715 | 3128 |
"returns the index of the item or 0" |
3129 |
||
706 | 3130 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
3131 |
! |
|
3132 |
||
388 | 3133 |
keysAndValuesDo:aTwoArgBlock |
2715 | 3134 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
3135 |
||
388 | 3136 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
3137 |
! ! |
|
3138 |
||
3139 |
!MenuPanel methodsFor:'event handling'! |
|
3140 |
||
3141 |
buttonMotion:state x:x y:y |
|
2715 | 3142 |
"open or close the corresponding submenu" |
3143 |
||
2046 | 3144 |
|menue motionPoint translatedPoint sensor| |
1699 | 3145 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3146 |
self scrollActivity isActive ifTrue:[ |
3938 | 3147 |
^ self |
2016 | 3148 |
]. |
3149 |
||
1699 | 3150 |
sensor := self sensor. |
3151 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
3938 | 3152 |
^ self |
1699 | 3153 |
]. |
3154 |
menue := self detectGrabMenu. |
|
1841 | 3155 |
|
2046 | 3156 |
motionPoint := x@y. |
3157 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 3158 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 3159 |
|
3780 | 3160 |
"/ hideOnRelease := true. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3161 |
|
1699 | 3162 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
3938 | 3163 |
^ self |
1699 | 3164 |
]. |
3165 |
||
3826 | 3166 |
hideOnRelease ifTrue:[ |
3938 | 3167 |
sensor anyButtonPressed ifFalse:[^ self] |
3826 | 3168 |
] ifFalse:[ |
3938 | 3169 |
sensor anyButtonPressed ifTrue:[^ self] |
3826 | 3170 |
]. |
3171 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3172 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
3938 | 3173 |
"/ selection on grabView without a submenu (Button ...); check whether moving out |
3174 |
(self containsPoint:motionPoint) ifFalse:[ |
|
3175 |
^ self accept:nil |
|
3176 |
] |
|
1699 | 3177 |
]. |
3178 |
||
2048 | 3179 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 3180 |
! |
3181 |
||
3182 |
buttonPress:button x:x y:y |
|
2715 | 3183 |
"any button pressed; open or close the corresponding submenus" |
3184 |
||
3921 | 3185 |
|menu point screen screenPoint targetView targetPoint| |
2016 | 3186 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3187 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3188 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3189 |
self scrollActivity stop. |
2016 | 3190 |
point := x@y. |
3191 |
menu := self detectMenuAtGrabPoint:point. |
|
3192 |
||
3193 |
menu isNil ifTrue:[ |
|
4082 | 3194 |
self accept:nil. |
3195 |
||
3196 |
"/ tell underlying view about the click... |
|
4237 | 3197 |
((button ~~ 2) |
3198 |
or:[(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease])]) ifTrue:[ |
|
4082 | 3199 |
screen := self device. |
3200 |
screenPoint := screen translatePointToRoot:point fromView:self. |
|
3201 |
targetView := screen viewFromPoint:screenPoint. |
|
3202 |
targetView notNil ifTrue:[ |
|
3203 |
targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView. |
|
3204 |
targetView buttonPress:button x:targetPoint x y:targetPoint y. |
|
3205 |
] |
|
3206 |
]. |
|
2016 | 3207 |
] ifFalse:[ |
4082 | 3208 |
point := menu translateGrabPoint:point. |
3209 |
menu handleButtonPress:button atPoint:point. |
|
2016 | 3210 |
] |
2046 | 3211 |
|
4082 | 3212 |
"Modified: / 02-10-2011 / 09:20:08 / cg" |
1699 | 3213 |
! |
3214 |
||
3215 |
buttonRelease:button x:x y:y |
|
2715 | 3216 |
"button release action; accept selection and close all views" |
3217 |
||
3938 | 3218 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
3203 | 3219 |
releaseTime menuMapTime| |
2199 | 3220 |
|
3780 | 3221 |
hideOnRelease ifFalse:[ |
3938 | 3222 |
^ self |
3780 | 3223 |
]. |
3224 |
||
2199 | 3225 |
topMenu := self topMenu. |
3226 |
topMenu openDelayed:nil. |
|
1699 | 3227 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3228 |
self scrollActivity stop ifTrue:[ |
3938 | 3229 |
^ self |
2016 | 3230 |
]. |
3231 |
||
1699 | 3232 |
dstMenu := topMenu activeMenu. |
3233 |
||
2679 | 3234 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
3235 |
||
3236 |
hideMenuAndPerformAction ifFalse:[ |
|
3938 | 3237 |
hideOnRelease ifTrue:[ |
3238 |
releaseTime := windowGroup lastEvent timeStamp. |
|
3239 |
menuMapTime := dstMenu mapTime ? releaseTime. |
|
3240 |
||
3241 |
hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime) |
|
3242 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
3243 |
]. |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3244 |
]. |
2679 | 3245 |
hideMenuAndPerformAction ifTrue:[ |
3938 | 3246 |
srcPoint := x@y. |
3247 |
||
3248 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
|
3249 |
and:[(item := dstMenu selection) notNil] |
|
3250 |
) ifTrue:[ |
|
3251 |
item visibleSubmenu notNil ifTrue:[ |
|
3252 |
dstMenu selection:nil. |
|
3253 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
|
3254 |
self accept:nil. |
|
3255 |
]. |
|
3256 |
^ self |
|
3257 |
]. |
|
3258 |
subm := item currentSubmenu. |
|
3259 |
||
3260 |
subm notNil ifTrue:[ |
|
3261 |
subm shown ifTrue:[^ self]. |
|
3262 |
"/ test whether any action is assigned to the menu |
|
3263 |
"/ if not ignorre accept |
|
3264 |
item hasDelayedMenu ifFalse:[^ self]. |
|
3265 |
"/ handle action defined for the delayed menu |
|
3266 |
]. |
|
3267 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
3268 |
||
3269 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
|
3270 |
item := nil |
|
3271 |
]. |
|
3272 |
topMenu acceptItem:item inMenu:dstMenu. |
|
3273 |
^ self |
|
3274 |
]. |
|
3275 |
||
3276 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
|
3277 |
selection visibleSubmenu notNil ifTrue:[ |
|
3278 |
^ self |
|
3279 |
] |
|
3280 |
]. |
|
3281 |
self accept:nil. |
|
1699 | 3282 |
]. |
3283 |
! |
|
3284 |
||
2860 | 3285 |
handleSizeChanged:how |
3286 |
"used to handle the scrollers and groups in a none popUpView |
|
3287 |
" |
|
3288 |
|layouts damage isVertical scrollBound| |
|
3289 |
||
3290 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3291 |
^ self |
2860 | 3292 |
]. |
3293 |
mustRearrange := true. |
|
3294 |
||
3295 |
shown ifFalse:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3296 |
^ self |
2860 | 3297 |
]. |
3298 |
layouts := OrderedCollection new. |
|
3299 |
||
3300 |
items do:[:el| |layout| |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3301 |
(layout := el layout) isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3302 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3303 |
^ self. |
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 |
layouts add:layout. |
2860 | 3306 |
]. |
3307 |
isVertical := self verticalLayout. |
|
3308 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3309 |
||
3310 |
self rearrangeItems. |
|
3311 |
||
3312 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3313 |
damage isNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3314 |
newLyt := el layout. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3315 |
oldLyt := layouts at:i ifAbsent:newLyt. |
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 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3318 |
start := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3319 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3320 |
i > 1 ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3321 |
isVertical ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3322 |
x := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3323 |
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
|
3324 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3325 |
y := 0. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3326 |
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
|
3327 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3328 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3329 |
start <= 20 ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3330 |
self invalidate. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3331 |
^ self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3332 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3333 |
damage := Rectangle left:x top:y extent:(self extent). |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3334 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3335 |
]. |
2860 | 3336 |
]. |
3337 |
damage isNil ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3338 |
damage := scrollBound. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3339 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3340 |
scrollBound := lastDrawnScrollerNextBounds. |
2860 | 3341 |
scrollBound notNil ifTrue:[ |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3342 |
damage := damage merge:scrollBound |
2860 | 3343 |
]. |
3344 |
self invalidate:damage. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3345 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3346 |
"Modified: / 29-06-2011 / 16:24:59 / cg" |
2860 | 3347 |
! |
3348 |
||
1699 | 3349 |
keyPress:key x:x y:y |
2715 | 3350 |
"any key is pressed" |
3351 |
||
2869 | 3352 |
<resource: #keyboard (#Escape |
3938 | 3353 |
#Tab #FocusNext #FocusPrevious |
3354 |
#CursorLeft #CursorRight )> |
|
2869 | 3355 |
|
3356 |
|menu menusSuperMenu sensor| |
|
2251 | 3357 |
|
3358 |
sensor := self sensor. |
|
3158 | 3359 |
|
3360 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3361 |
"/ ^ self "/ ignored while any button is pressed |
|
3362 |
"/ ]. |
|
1699 | 3363 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3364 |
self scrollActivity isActive ifTrue:[ |
3938 | 3365 |
key ~~ #Escape ifTrue:[ |
3366 |
^ self |
|
3367 |
]. |
|
3368 |
self scrollActivity stop |
|
3369 |
]. |
|
3370 |
||
3371 |
(key == #Tab |
|
1699 | 3372 |
or:[key == #FocusNext |
3373 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
3938 | 3374 |
self accept:nil. |
3375 |
^ super keyPress:key x:x y:y |
|
1699 | 3376 |
]. |
3377 |
||
3378 |
menu := self detectGrabMenu. |
|
2869 | 3379 |
menusSuperMenu := menu superMenu. |
1699 | 3380 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
3381 |
(key == #Escape) ifTrue:[ |
3938 | 3382 |
"/ must hide the active menu |
3383 |
(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[ |
|
3384 |
"/ hide active menu but keep the grab |
|
3385 |
menusSuperMenu selection:nil |
|
3386 |
] ifFalse:[ |
|
3387 |
"/ hide active menu and ungrab |
|
3388 |
self accept:nil |
|
3389 |
]. |
|
3390 |
^ self |
|
2251 | 3391 |
]. |
3392 |
||
3393 |
menu isViewWrapper ifFalse:[ |
|
3938 | 3394 |
sensor compressKeyPressEventsWithKey:key. |
3395 |
menu handleKeyPress:key. |
|
3396 |
^ self |
|
2251 | 3397 |
]. |
2869 | 3398 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3399 |
|
3400 |
"/ allow cursor movement |
|
3401 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3938 | 3402 |
(self containsPoint:x@y) ifTrue:[ |
3403 |
self handleKeyPress:key. |
|
3404 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3405 |
]. |
1699 | 3406 |
! |
3407 |
||
3834
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3408 |
mapped |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3409 |
super mapped. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3410 |
|
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3411 |
"/ 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
|
3412 |
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
|
3413 |
! |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3414 |
|
3415 | 3415 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
3416 |
"mousewheel action" |
|
3417 |
||
3418 |
|menu| |
|
3419 |
||
3420 |
menu := self detectGrabMenu. |
|
3421 |
menu isViewWrapper ifTrue:[ |
|
3938 | 3422 |
menu superMenu ~~ self ifTrue:[ |
3423 |
^ self. |
|
3424 |
]. |
|
3425 |
menu := self. |
|
3415 | 3426 |
]. |
3427 |
amount > 0 ifTrue:[ |
|
3938 | 3428 |
menu handleCursorKey:#CursorUp. |
3415 | 3429 |
] ifFalse:[ |
3938 | 3430 |
menu handleCursorKey:#CursorDown. |
3415 | 3431 |
]. |
3432 |
! |
|
3433 |
||
1699 | 3434 |
pointerLeave:state |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3435 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3436 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3437 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3438 |
|
1699 | 3439 |
self detectGrabMenu handlePointerLeave:state. |
3440 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3441 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
3938 | 3442 |
^ self |
2251 | 3443 |
]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3444 |
|
2374 | 3445 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3446 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3447 |
windowGroup focusView ~~ self ifTrue:[ |
3938 | 3448 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3449 |
] ifFalse:[ |
3938 | 3450 |
selection isButton ifTrue:[ |
3451 |
sensor := self sensor. |
|
3452 |
||
3453 |
sensor isNil ifTrue:[ |
|
3454 |
self accept:nil |
|
3455 |
] ifFalse:[ |
|
3456 |
"/ I'have the focus; if no button pressed, than keep the selection |
|
3457 |
sensor anyButtonPressed ifTrue:[ |
|
3458 |
self selection:nil |
|
3459 |
] |
|
3460 |
]. |
|
3461 |
] |
|
1699 | 3462 |
]. |
3463 |
! |
|
3464 |
||
3465 |
sizeChanged:how |
|
2715 | 3466 |
"redraw #right groups" |
3467 |
||
2860 | 3468 |
"/ self isPopUpView ifFalse:[ |
3469 |
"/ mustRearrange := true. |
|
3470 |
"/ self invalidate |
|
3471 |
"/ ]. |
|
3472 |
"/ ^ super sizeChanged:how. |
|
3473 |
||
3474 |
self handleSizeChanged:how. |
|
3475 |
super sizeChanged:how. |
|
1699 | 3476 |
! ! |
3477 |
||
2503 | 3478 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3479 |
|
1767 | 3480 |
clearImplicitGrab |
2253 | 3481 |
implicitGrabView := lastPointerView := nil. |
1767 | 3482 |
! |
3483 |
||
3484 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3485 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3486 |
|
2253 | 3487 |
|view x y p syntheticEvent menu| |
1767 | 3488 |
|
2658 | 3489 |
ev isDamage ifTrue:[ |
3938 | 3490 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
2658 | 3491 |
]. |
3492 |
||
3142 | 3493 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
3938 | 3494 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
3142 | 3495 |
]. |
3496 |
||
1767 | 3497 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3498 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3499 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3500 |
implicitGrabView notNil ifTrue:[ |
|
3938 | 3501 |
self sensor leftButtonPressed ifFalse:[ |
3502 |
self clearImplicitGrab. |
|
3503 |
]. |
|
1767 | 3504 |
]. |
3505 |
||
3506 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
3938 | 3507 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3508 |
]. |
3509 |
||
3510 |
implicitGrabView notNil ifTrue:[ |
|
3938 | 3511 |
ev isButtonEvent ifTrue:[ |
3512 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3513 |
ev view:implicitGrabView. |
|
3514 |
ev arguments at:2 put:p x. |
|
3515 |
ev arguments at:3 put:p y. |
|
3516 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3517 |
||
3518 |
ev isButtonReleaseEvent ifTrue:[ |
|
3519 |
self clearImplicitGrab. |
|
3520 |
]. |
|
3521 |
^ self |
|
3522 |
] |
|
1767 | 3523 |
]. |
3524 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3525 |
||
2016 | 3526 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
3938 | 3527 |
self clearImplicitGrab. |
3528 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
|
1767 | 3529 |
]. |
3530 |
||
3531 |
p := menu translateGrabPoint:(x@y). |
|
3532 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
3630 | 3533 |
view == self ifTrue:[^self]. "MB:changed - recursion" |
3534 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3535 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3536 |
|
3537 |
ev isButtonPressEvent ifTrue:[ |
|
3938 | 3538 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3539 |
view requestFocus. |
|
3540 |
]. |
|
3541 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3542 |
implicitGrabView := view. |
|
3543 |
] |
|
2253 | 3544 |
]. |
1767 | 3545 |
|
3546 |
ev isButtonMotionEvent ifTrue:[ |
|
3938 | 3547 |
lastPointerView ~~ view ifTrue:[ |
3548 |
"/ must generate enter/leave ... (sigh) |
|
3549 |
lastPointerView notNil ifTrue:[ |
|
3550 |
"/ XXX: should be fixed |
|
3551 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3552 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3553 |
]. |
|
3554 |
view notNil ifTrue:[ |
|
3555 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3556 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3557 |
]. |
|
3558 |
lastPointerView := view. |
|
3559 |
]. |
|
1767 | 3560 |
]. |
3561 |
||
3562 |
ev view:view. |
|
3563 |
ev x:p x. |
|
3564 |
ev y:p y. |
|
3565 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3566 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3567 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3568 |
! |
3569 |
||
2048 | 3570 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3571 |
"open or close the corresponding submenus" |
3572 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3573 |
|menu item translatedPoint containsPoint direction| |
2251 | 3574 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3575 |
containsPoint := self containsPoint:motionPoint. |
3975 | 3576 |
(containsPoint not and:[items size > 0]) ifTrue:[ |
3577 |
"/ check if there is still open a menu which is not assigned to the |
|
3578 |
"/ current selection |
|
3579 |
item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil. |
|
3580 |
item notNil ifTrue:[ |
|
3581 |
|visibleSubmenu point| |
|
3582 |
||
3583 |
visibleSubmenu := item visibleSubmenu. |
|
3584 |
visibleSubmenu notNil ifTrue:[ |
|
3585 |
point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu. |
|
3586 |
||
3587 |
(visibleSubmenu containsPoint:point) ifTrue:[ |
|
3588 |
selection notNil ifTrue:[ selection invalidate ]. |
|
3589 |
selection := item. |
|
3590 |
selection invalidate. |
|
3591 |
visibleSubmenu becomesActiveMenu. |
|
3592 |
^ self. |
|
3593 |
]. |
|
3594 |
]. |
|
3595 |
item := nil. |
|
3596 |
]. |
|
3597 |
]. |
|
3938 | 3598 |
containsPoint ifTrue:[ |
3975 | 3599 |
item := self itemAtPoint:motionPoint |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3600 |
]. |
2251 | 3601 |
|
4183 | 3602 |
"no autoscroll, if the mouse pointer is inside the scroll button" |
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3603 |
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
|
3604 |
direction notNil ifTrue:[ |
3975 | 3605 |
self pointerEntersItem:nil. |
3606 |
||
3607 |
self sensor anyButtonPressed ifTrue:[ |
|
3608 |
self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false. |
|
3609 |
]. |
|
3610 |
^ 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
|
3611 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3612 |
|
4193 | 3613 |
"/ self pointerEntersItem:item. |
1699 | 3614 |
|
1910 | 3615 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
4193 | 3616 |
(self selectionFollowsMouse |
3975 | 3617 |
and:[self topMenu focusComesByTab not] |
3618 |
) ifTrue:[ |
|
3619 |
self isPopUpView ifTrue:[ |
|
3620 |
item isNil ifTrue:[ |
|
3621 |
superMenu notNil ifTrue:[ |
|
3622 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3623 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3624 |
] |
|
3625 |
] ifFalse:[ |
|
3626 |
self selectAndOpenDelayed:item. |
|
3627 |
]. |
|
4191 | 3628 |
] ifFalse:[ |
3629 |
"/ processing in the toolbar |
|
3975 | 3630 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
4193 | 3631 |
self selectAndOpenDelayed:item. |
3632 |
"/ self selection:item openMenu:true. |
|
3975 | 3633 |
]. |
3634 |
]. |
|
3635 |
]. |
|
3636 |
^ self |
|
3637 |
]. |
|
4193 | 3638 |
|
2251 | 3639 |
containsPoint ifTrue:[ |
4185 | 3640 |
self isPopUpView ifTrue:[ |
3641 |
self selectAndOpenDelayed:item. |
|
3642 |
] ifFalse:[ |
|
4191 | 3643 |
"/ also open delayed if I am the top-menu |
3644 |
self selectAndOpenDelayed:item. |
|
3645 |
"/ self selection:item openMenu:true. |
|
4185 | 3646 |
]. |
3975 | 3647 |
^ self |
2251 | 3648 |
]. |
3649 |
||
3650 |
menu := self superMenuAtPoint:motionPoint. |
|
2374 | 3651 |
menu notNil ifTrue:[ |
3975 | 3652 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
3653 |
menu handleButtonMotion:state atPoint:translatedPoint. |
|
3654 |
^ self |
|
2251 | 3655 |
]. |
3656 |
self isPopUpView ifTrue:[ |
|
3975 | 3657 |
self selection:nil |
2251 | 3658 |
]. |
2046 | 3659 |
! |
3660 |
||
3383 | 3661 |
handleButtonPress:button atPoint:aPoint |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3662 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3663 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3664 |
|item scrollerDirectionOrNil wasSelected| |
2016 | 3665 |
|
2046 | 3666 |
item := self itemAtPoint:aPoint. |
2374 | 3667 |
item isNil ifTrue:[ |
3938 | 3668 |
self selection:nil openMenu:false. |
3669 |
^ self |
|
2251 | 3670 |
]. |
3671 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3672 |
"/ is a scroller-button present and hit ? |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3673 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3674 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 3675 |
(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[ |
3676 |
self pointerEntersItem:nil. |
|
3677 |
^ self |
|
3678 |
] |
|
2016 | 3679 |
]. |
2251 | 3680 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3681 |
"/ right button always immediately pulls the delayedMenu |
3383 | 3682 |
button == 2 ifTrue:[ |
3938 | 3683 |
item hasDelayedMenu ifTrue:[ |
3684 |
self selection:item openMenu:false. |
|
3685 |
self openDelayed:item afterSeconds:0. |
|
3686 |
^ self. |
|
3687 |
]. |
|
3383 | 3688 |
]. |
3689 |
||
2251 | 3690 |
wasSelected := (selection == item). |
3691 |
wasSelected ifFalse:[ |
|
3938 | 3692 |
self selection:item openMenu:true |
2251 | 3693 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3694 |
item hasDelayedMenu ifTrue:[ |
3938 | 3695 |
"/ clicked on the arrow icon ? |
3696 |
(item menuIndicatorContains:aPoint) ifTrue:[ |
|
3697 |
self selection:item openMenu:false. |
|
3698 |
self openDelayed:item afterSeconds:0. |
|
3699 |
^ self. |
|
3700 |
]. |
|
3701 |
^ self |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3702 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3703 |
|
2238 | 3704 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
3938 | 3705 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3706 |
item toggleSubmenuVisibility |
|
3707 |
]. |
|
3708 |
^ self |
|
2238 | 3709 |
]. |
3710 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3938 | 3711 |
^ self |
2238 | 3712 |
]. |
3713 |
self invalidateItem:item repairNow:true. |
|
3714 |
self acceptItem:item inMenu:self. |
|
3715 |
||
3233 | 3716 |
[ (device notNil and:[device anyButtonPressed]) ] whileTrue:[ |
3938 | 3717 |
"/ using device - sensor is not updated sometimes |
3718 |
Delay waitForSeconds:0.1. |
|
3233 | 3719 |
]. |
3720 |
self sensor flushUserEvents. |
|
2238 | 3721 |
self selection:nil. |
2046 | 3722 |
|
3723 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3724 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3725 |
! |
3726 |
||
1699 | 3727 |
handleCursorKey:aKey |
2715 | 3728 |
"handle a cursor key" |
3729 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3730 |
|next menu item isVrt backKey p1 p2 |
2354 | 3731 |
idx0 "{ Class:SmallInteger }" |
687 | 3732 |
idx "{ Class:SmallInteger }" |
1705 | 3733 |
size "{ Class:SmallInteger }" |
687 | 3734 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3735 |
(size := items size) == 0 ifTrue:[ |
4172 | 3736 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
3737 |
^ self |
|
388 | 3738 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3739 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3740 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3741 |
|
4172 | 3742 |
selection isNil ifTrue:[ |
3743 |
(isVrt and:[aKey == #CursorDown]) ifTrue:[ |
|
3744 |
idx := items findFirst:[:el | el notNil and:[ el canSelect ]]. |
|
3745 |
idx ~~ 0 ifTrue:[ |
|
3746 |
self selection:(items at:idx). |
|
3747 |
^ self |
|
3748 |
] |
|
3749 |
]. |
|
3750 |
(isVrt and:[aKey == #CursorUp]) ifTrue:[ |
|
3751 |
idx := items findLast:[:el | el notNil and:[ el canSelect ]]. |
|
3752 |
idx ~~ 0 ifTrue:[ |
|
3753 |
self selection:(items at:idx). |
|
3754 |
^ self |
|
3755 |
] |
|
3756 |
] |
|
3757 |
]. |
|
3758 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3759 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3760 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3761 |
) ifTrue:[ |
4172 | 3762 |
selection isNil ifTrue:[ |
3763 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
|
3764 |
^ superMenu handleCursorKey:aKey |
|
3765 |
]. |
|
3766 |
idx := 0. |
|
3767 |
||
3768 |
isVrt ifTrue:[ |
|
3769 |
"/ used because of vertical scrolling |
|
3770 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
3771 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
|
3772 |
]. |
|
3773 |
] ifFalse:[ |
|
3774 |
idx := self indexOf:selection. |
|
3775 |
]. |
|
3776 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
|
3777 |
||
3778 |
idx0 := idx. |
|
3779 |
size timesRepeat:[ |
|
3780 |
|el| |
|
3781 |
||
3782 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3783 |
||
3784 |
idx > size ifTrue:[ |
|
3785 |
idx := 0 "1" |
|
3786 |
] ifFalse:[ |
|
3787 |
idx < 0 ifTrue:[ |
|
3788 |
idx := size |
|
3789 |
] |
|
3790 |
]. |
|
3791 |
||
3792 |
idx == 0 ifTrue:[ |
|
3793 |
self selection:nil. |
|
3794 |
^ self |
|
3795 |
] ifFalse:[ |
|
3796 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3797 |
el canSelect ifTrue:[ |
|
3798 |
el hasDelayedMenu ifTrue:[ |
|
3799 |
"/ do not open menu |
|
3800 |
self selection:el openMenu:false |
|
3801 |
] ifFalse:[ |
|
3802 |
"/ open comes from style-sheet |
|
3803 |
self selection:el. |
|
3804 |
]. |
|
3805 |
^ self |
|
3806 |
]. |
|
3807 |
] |
|
3808 |
]. |
|
3809 |
idx == idx0 ifTrue:[ |
|
3810 |
^ self |
|
3811 |
]. |
|
3812 |
]. |
|
3813 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3814 |
]. |
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 |
superMenu notNil ifTrue:[ |
4172 | 3817 |
p1 := self translateGrabPoint:0. |
3818 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3819 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3820 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3821 |
isVrt ifTrue:[ |
4172 | 3822 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
3823 |
backKey := #CursorRight |
|
3824 |
] ifFalse:[ |
|
3825 |
backKey := #CursorLeft. |
|
3826 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3827 |
] ifFalse:[ |
4172 | 3828 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
3829 |
backKey := #CursorDown |
|
3830 |
] ifFalse:[ |
|
3831 |
backKey := #CursorUp. |
|
3832 |
] |
|
3938 | 3833 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3834 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3835 |
aKey == backKey ifTrue:[ |
4172 | 3836 |
superMenu isNil ifTrue:[ |
3837 |
self accept:nil |
|
3838 |
] ifFalse:[ |
|
3839 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3840 |
superMenu handleCursorKey:aKey |
|
3841 |
] ifFalse:[ |
|
3842 |
superMenu selection hideSubmenu |
|
3843 |
] |
|
3844 |
]. |
|
3845 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3846 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3847 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3848 |
selection isNil ifTrue:[ |
4172 | 3849 |
superMenu isNil ifTrue:[^ self accept:nil]. |
3850 |
||
3851 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3852 |
superMenu handleCursorKey:aKey |
|
3853 |
] ifFalse:[ |
|
3854 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
|
3855 |
self selectionIndex:item |
|
3856 |
] |
|
3857 |
]. |
|
3858 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3859 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3860 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3861 |
selection hasSubmenu ifTrue:[ |
4172 | 3862 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
3863 |
selection toggleSubmenuVisibility |
|
3864 |
] ifFalse:[ |
|
3865 |
menu selectionIndex:1 |
|
3866 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3867 |
] ifFalse:[ |
4172 | 3868 |
superMenu notNil ifTrue:[ |
3869 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
3870 |
superMenu handleCursorKey:aKey |
|
3871 |
] |
|
3872 |
] ifFalse:[ |
|
3873 |
self accept:nil |
|
3874 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3875 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3876 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3877 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3878 |
handleKeyPress:key |
4167 | 3879 |
<resource: #keyboard (#CursorDown #CursorUp #CursorLeft #CursorRight #Return)> |
3880 |
||
2715 | 3881 |
"any key is pressed" |
3882 |
||
2219 | 3883 |
|item inMenu| |
1699 | 3884 |
|
3885 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
4167 | 3886 |
self handleReturnPressed. |
3887 |
^ true. |
|
3754 | 3888 |
]. |
3889 |
key isCharacter ifTrue:[ |
|
1862 | 3890 |
"/ selection notNil ifTrue:[ |
3891 |
"/ inMenu := self |
|
3892 |
"/ ] ifFalse:[ |
|
3893 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3894 |
"/ ]. |
|
4167 | 3895 |
inMenu := self. |
3896 |
||
3897 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
|
3898 |
inMenu selection:item |
|
3899 |
]. |
|
3900 |
^ true |
|
3938 | 3901 |
]. |
3902 |
(key == #CursorDown |
|
4167 | 3903 |
or:[key == #CursorUp |
3904 |
or:[key == #CursorLeft |
|
3905 |
or:[key == #CursorRight]]]) |
|
3754 | 3906 |
ifTrue:[ |
4167 | 3907 |
self handleCursorKey:key. |
3908 |
^ true |
|
3754 | 3909 |
]. |
3910 |
^ false. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3911 |
! |
1699 | 3912 |
|
3913 |
handlePointerLeave:state |
|
3914 |
self pointerEntersItem:nil. |
|
3915 |
super pointerLeave:state |
|
3916 |
! |
|
3917 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3918 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3919 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3920 |
|
2238 | 3921 |
|sensor subm item| |
3922 |
||
3923 |
(item := selection) isNil ifTrue:[ |
|
4089 | 3924 |
superMenu notNil ifTrue:[ |
3925 |
item := superMenu selection. |
|
3926 |
||
3927 |
item value notNil ifTrue:[ |
|
3928 |
"/ is a delayed menu |
|
3929 |
self accept:item |
|
3930 |
] ifFalse:[ |
|
3931 |
item toggleSubmenuVisibility |
|
3932 |
] |
|
3933 |
] ifFalse:[ |
|
3934 |
self accept |
|
3935 |
]. |
|
3936 |
^ self |
|
1841 | 3937 |
]. |
3938 |
selection hasSubmenu ifTrue:[ |
|
4089 | 3939 |
selection hasDelayedMenu ifFalse:[ |
3940 |
selection toggleSubmenuVisibility. |
|
3941 |
^ self |
|
3942 |
]. |
|
3943 |
subm := selection currentSubmenu. |
|
3944 |
||
3945 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
3946 |
selection toggleSubmenuVisibility. |
|
3947 |
^ self |
|
3948 |
]. |
|
3949 |
self openDelayed:nil |
|
1841 | 3950 |
]. |
3951 |
self accept. |
|
3952 |
||
2238 | 3953 |
" test for toggle " |
3954 |
item isToggle ifTrue:[ |
|
4089 | 3955 |
self selection:item. |
2238 | 3956 |
] ifFalse:[ |
4089 | 3957 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
3958 |
^ self |
|
3959 |
] |
|
3938 | 3960 |
]. |
1841 | 3961 |
|
3962 |
(sensor := self sensor) isNil ifTrue:[ |
|
4089 | 3963 |
^ self |
3938 | 3964 |
]. |
3965 |
||
3966 |
[ |
|
4089 | 3967 |
sensor flushKeyboardFor:nil. |
3968 |
Delay waitForSeconds:0.1. |
|
3969 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3970 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3971 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3972 |
|
1699 | 3973 |
pointerEntersItem:anItemOrNil |
3974 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3975 |
redraw the new item highlighted." |
3976 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3977 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3978 |
|
1699 | 3979 |
( anItemOrNil notNil |
3980 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3981 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3982 |
and:[self isPopUpView not]]]) ifTrue:[ |
3938 | 3983 |
anItemOrNil isButton ifTrue:[ |
3984 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
|
3985 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
3986 |
) ifTrue:[ |
|
3987 |
newItem := anItemOrNil |
|
3988 |
] |
|
3989 |
] ifFalse:[ |
|
3990 |
(self enteredLevel ~~ 0 |
|
3991 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3992 |
) ifTrue:[ |
|
3993 |
newItem := anItemOrNil |
|
3994 |
] |
|
3995 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3996 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3997 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3998 |
newItem ~~ enteredItem ifTrue:[ |
3938 | 3999 |
oldItem := enteredItem. |
4000 |
enteredItem := newItem. |
|
4001 |
||
4002 |
oldItem notNil ifTrue:[ |
|
4003 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
|
4004 |
]. |
|
4005 |
||
4006 |
enteredItem notNil ifTrue:[ |
|
4007 |
self invalidateItem:enteredItem repairNow:true. |
|
4008 |
]. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4009 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4010 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4011 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4012 |
processHideMenuEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4013 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4014 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4015 |
"Modified: / 29-06-2011 / 16:39:36 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4016 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4017 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4018 |
processMenuEnterItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4019 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4020 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4021 |
"Created: / 29-06-2011 / 13:18:05 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4022 |
"Modified: / 29-06-2011 / 16:39:29 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4023 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4024 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4025 |
processMenuSelectItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4026 |
|winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4027 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4028 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4029 |
winGrp notNil ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4030 |
masterGroup := winGrp previousGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4031 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4032 |
winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4033 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4034 |
item := ev item. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4035 |
itemIndex := ev itemIndex. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4036 |
itemValue := ev itemValue. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4037 |
menuReceiver := ev menuReceiver. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4038 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4039 |
acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4040 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4041 |
(item showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4042 |
and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4043 |
ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4044 |
winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4045 |
] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4046 |
acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4047 |
]. |
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 |
"Modified: / 29-06-2011 / 16:32:36 / cg" |
388 | 4050 |
! ! |
4051 |
||
2251 | 4052 |
!MenuPanel methodsFor:'focus handling'! |
4053 |
||
3187 | 4054 |
canTab |
4055 |
"depends whether I'am a toolbar and selectable items exists |
|
4056 |
" |
|
4057 |
|selectableItem| |
|
4058 |
||
4059 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3938 | 4060 |
selectableItem := self firstItemSelectable. |
4061 |
^ selectableItem notNil |
|
3187 | 4062 |
]. |
4063 |
^ false |
|
4064 |
! |
|
4065 |
||
4066 |
focusComesByTab |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4067 |
"returns true if focus comes by tab and should be drawn" |
3187 | 4068 |
|
4069 |
focusComesByTab == true ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4070 |
(shown and:[self hasFocus]) ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4071 |
^ true |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4072 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4073 |
focusComesByTab := false. |
3187 | 4074 |
]. |
4075 |
^ false |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4076 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4077 |
"Modified: / 29-06-2011 / 16:23:09 / cg" |
3187 | 4078 |
! |
4079 |
||
4080 |
focusComesByTab:aBoolean |
|
4081 |
"only handled for toolBars" |
|
4082 |
||
4083 |
|selectableItem| |
|
4084 |
||
4085 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4086 |
focusComesByTab := aBoolean. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4087 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4088 |
self hasSelection ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4089 |
^ self |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4090 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4091 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4092 |
aBoolean ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4093 |
selectableItem := self firstItemSelectable. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4094 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4095 |
self selection:selectableItem openMenu:false. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4096 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4097 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4098 |
"Modified: / 29-06-2011 / 16:23:19 / cg" |
3187 | 4099 |
! |
4100 |
||
2251 | 4101 |
hasKeyboardFocus:aBoolean |
2715 | 4102 |
"notification from the windowGroup that I got/lost the keyboard focus." |
4103 |
||
2251 | 4104 |
|focusView| |
4105 |
||
4106 |
self isPopUpView ifTrue:[ |
|
3938 | 4107 |
"/ not visible for popup menus |
4108 |
^ super hasKeyboardFocus:aBoolean |
|
2251 | 4109 |
]. |
4110 |
||
4111 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3938 | 4112 |
hasImplicitGrap ~~ true ifTrue:[ |
4113 |
focusView := windowGroup focusView. |
|
4114 |
||
4115 |
focusView == self ifFalse:[ |
|
4116 |
self selection:nil. |
|
4117 |
] |
|
4118 |
] |
|
4119 |
]. |
|
2251 | 4120 |
super hasKeyboardFocus:aBoolean. |
3142 | 4121 |
! |
4122 |
||
3187 | 4123 |
showFocus:focusComesByTab |
4124 |
self focusComesByTab:focusComesByTab. |
|
4125 |
super showFocus:focusComesByTab. |
|
4126 |
! |
|
4127 |
||
4128 |
showNoFocus:focusByTab |
|
4129 |
self focusComesByTab:false. |
|
4130 |
super showNoFocus:focusByTab. |
|
4131 |
! |
|
4132 |
||
4133 |
supportsFocusOnTab |
|
4134 |
"returns true if focus is supported |
|
4135 |
" |
|
4136 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 4137 |
! |
4138 |
||
4139 |
wantsFocusWithButtonPress |
|
3187 | 4140 |
"needs only the focus if I'am a toolbar; all events are delegated |
4141 |
to my subMenus" |
|
4142 |
||
4153 | 4143 |
"/ old: |
4144 |
"/ ^ self isPopUpView not |
|
4145 |
||
4342 | 4146 |
"/ I am not sure how this really should be - |
4147 |
"/ I guess, it needs a more intelligent and dynamic decision. |
|
4148 |
"/ for now, the menuPanelTakesFocusOnClick returns true, otherwise, |
|
4149 |
"/ we cannot control menus with the keyboard. |
|
4150 |
self isPopUpView ifTrue:[ |
|
4151 |
^ false |
|
4152 |
] ifFalse:[ |
|
4153 |
^ UserPreferences current menuPanelTakesFocusOnClick. |
|
4154 |
] |
|
2251 | 4155 |
! ! |
4156 |
||
388 | 4157 |
!MenuPanel methodsFor:'grabbing'! |
4158 |
||
1699 | 4159 |
doGrab |
4160 |
relativeGrabOrigin := nil. |
|
4161 |
||
4162 |
superMenu notNil ifTrue:[ |
|
3938 | 4163 |
superMenu doGrab |
1699 | 4164 |
] ifFalse:[ |
3938 | 4165 |
hasImplicitGrap ~~ true ifTrue:[ |
4166 |
self grabMouseAndKeyboard. |
|
4167 |
hasImplicitGrap := true |
|
4168 |
] |
|
1699 | 4169 |
] |
4170 |
! |
|
4171 |
||
4172 |
doUngrab:forceDo |
|
4173 |
||
4174 |
relativeGrabOrigin := nil. |
|
1767 | 4175 |
self clearImplicitGrab. |
1699 | 4176 |
|
4177 |
superMenu notNil ifTrue:[ |
|
3938 | 4178 |
forceDo ifTrue:[ |
4179 |
superMenu doUngrab:true |
|
4180 |
]. |
|
4181 |
^ self |
|
1699 | 4182 |
]. |
4183 |
||
4184 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3938 | 4185 |
^ self |
1699 | 4186 |
]. |
4187 |
||
4188 |
forceDo ifFalse:[ |
|
3938 | 4189 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
4190 |
^ self |
|
4191 |
]. |
|
1699 | 4192 |
]. |
4193 |
self ungrabMouseAndKeyboard. |
|
4194 |
self selection:nil. |
|
4195 |
hasImplicitGrap := nil. |
|
1703 | 4196 |
prevFocusView := nil. |
1699 | 4197 |
! |
4198 |
||
1630 | 4199 |
grabKeyboard |
2715 | 4200 |
"grap the keyboard; keep previous grab" |
4201 |
||
1630 | 4202 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 4203 |
^ super grabKeyboard |
1630 | 4204 |
! |
4205 |
||
388 | 4206 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4207 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4208 |
|
3754 | 4209 |
|winGroup sensor activeGrab| |
3142 | 4210 |
|
4211 |
winGroup := self windowGroup. |
|
4212 |
||
4213 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
3938 | 4214 |
prevFocusView isNil ifTrue:[ |
4215 |
prevFocusView := winGroup focusView. |
|
4216 |
]. |
|
4217 |
sensor := self sensor. |
|
4218 |
||
4219 |
device activePointerGrab ~~ self ifTrue:[ |
|
4220 |
sensor flushMotionEventsFor:nil. |
|
4221 |
||
4222 |
(self grabPointer) ifFalse:[ |
|
4223 |
Delay waitForSeconds:0.1. |
|
4224 |
(self grabPointer) ifFalse:[ |
|
4225 |
"give up" |
|
4226 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
|
4227 |
self unmap |
|
4228 |
] |
|
4229 |
] |
|
4230 |
]. |
|
4231 |
||
4232 |
(activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[ |
|
4233 |
device sync. |
|
4234 |
"/ cg: mhmh - should we flush for all or for the activeGrab only ? |
|
3754 | 4235 |
"/ activeGrab notNil ifTrue:[ |
4236 |
"/ sensor flushKeyboardFor:activeGrab. |
|
4237 |
"/ ]. |
|
3938 | 4238 |
sensor flushKeyboardFor:nil. |
4239 |
self grabKeyboard. |
|
4240 |
] |
|
388 | 4241 |
] |
4242 |
||
3158 | 4243 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4244 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 4245 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 4246 |
! |
4247 |
||
1630 | 4248 |
grabPointerWithCursor:aCursorOrNil |
2715 | 4249 |
"grap the pointer; keep previous grab" |
4250 |
||
1630 | 4251 |
previousPointerGrab := device activePointerGrab. |
1699 | 4252 |
hasImplicitGrap := true. |
2715 | 4253 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 4254 |
! |
4255 |
||
4256 |
ungrabKeyboard |
|
2715 | 4257 |
"ungrap the keyboard; restore previous grab" |
4258 |
||
1630 | 4259 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4260 |
|
2579 | 4261 |
(previousKeyboardGrab notNil |
4262 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3938 | 4263 |
device grabKeyboardInView:previousKeyboardGrab. |
2579 | 4264 |
]. |
1630 | 4265 |
! |
4266 |
||
388 | 4267 |
ungrabMouseAndKeyboard |
2715 | 4268 |
"ungrab resources (mouse and keyboard)" |
4269 |
||
1630 | 4270 |
self ungrabPointer. |
4271 |
self ungrabKeyboard. |
|
4272 |
! |
|
4273 |
||
4274 |
ungrabPointer |
|
2715 | 4275 |
"ungrap the pointer; restore previous grab" |
4276 |
||
1630 | 4277 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4278 |
|
2579 | 4279 |
(previousPointerGrab notNil |
4280 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3938 | 4281 |
device grabPointerInView:previousPointerGrab. |
1630 | 4282 |
]. |
388 | 4283 |
! ! |
4284 |
||
1251 | 4285 |
!MenuPanel methodsFor:'help'! |
4286 |
||
3441 | 4287 |
flyByHelpSpec |
4288 |
"allows subclasses to provide texts" |
|
4289 |
||
4290 |
^ IdentityDictionary new |
|
4291 |
! |
|
4292 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4293 |
flyByHelpTextAt:aPoint |
2058 | 4294 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4295 |
If there is a selection, that items helpText is used (ignoring the given point)." |
4296 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4297 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4298 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4299 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4300 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4301 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4302 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4303 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4304 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4305 |
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
|
4306 |
^ nil |
2058 | 4307 |
! |
4308 |
||
4309 |
flyByHelpTextForItem:anItem |
|
2715 | 4310 |
"returns the helpText for an item (empty if none)" |
4311 |
||
2063 | 4312 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4313 |
^ anItem flyByHelpText. |
2058 | 4314 |
! |
4315 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4316 |
flyByHelpTextForKey:aKey |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4317 |
|app text| |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4318 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4319 |
app := self application. |
3441 | 4320 |
app notNil ifTrue:[ |
3938 | 4321 |
text := self application flyByHelpTextForKey:aKey. |
4322 |
text notNil ifTrue:[^ text]. |
|
3441 | 4323 |
]. |
4324 |
^ 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
|
4325 |
! |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4326 |
|
1251 | 4327 |
helpText |
2715 | 4328 |
"return the helpText for the currently selected item (empty if none)" |
4329 |
||
1613 | 4330 |
^ self helpTextForItem:selection |
1251 | 4331 |
! |
4332 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4333 |
helpTextAt:aPoint |
1252 | 4334 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4335 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
4336 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4337 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4338 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4339 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4340 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4341 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4342 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4343 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4344 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4345 |
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
|
4346 |
^ nil |
1613 | 4347 |
! |
4348 |
||
4349 |
helpTextForItem:anItem |
|
2715 | 4350 |
"returns the helpText for an item (empty if none)" |
4351 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4352 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4353 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4354 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4355 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4356 |
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
|
4357 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4358 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4359 |
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
|
4360 |
dstMenu notNil ifTrue:[ |
3938 | 4361 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
4362 |
item := dstMenu itemAtPoint:dstPoint. |
|
4363 |
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
|
4364 |
] |
1251 | 4365 |
! ! |
4366 |
||
794 | 4367 |
!MenuPanel methodsFor:'image registration'! |
4368 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
4369 |
imageOnMyDevice:anImage |
2715 | 4370 |
"returns image registered on device" |
4371 |
||
2770 | 4372 |
^ self class image:anImage value onDevice:device |
794 | 4373 |
! |
4374 |
||
4375 |
lightenedImageOnDevice:anImage |
|
2715 | 4376 |
"returns lightened image registered on device" |
4377 |
||
794 | 4378 |
^ self class lightenedImage:anImage onDevice:device |
4379 |
! ! |
|
4380 |
||
1688 | 4381 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 4382 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4383 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4384 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4385 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4386 |
|
388 | 4387 |
create |
2715 | 4388 |
"create the shadow view for a none contained submenu" |
4389 |
||
388 | 4390 |
super create. |
4391 |
||
4392 |
self isPopUpView ifTrue:[ |
|
3938 | 4393 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
4394 |
shadowView isNil ifTrue:[ |
|
4395 |
shadowView := (ShadowView onDevice:device) for:self |
|
4396 |
] ifFalse:[ |
|
4397 |
self saveUnder:true. |
|
4398 |
]. |
|
4399 |
] |
|
388 | 4400 |
] ifFalse:[ |
3938 | 4401 |
self hasExplicitExtent ifTrue:[ |
4402 |
(self width) == (superView width) ifTrue:[ |
|
4403 |
self verticalLayout:false |
|
4404 |
] |
|
4405 |
] |
|
388 | 4406 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4407 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4408 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 4409 |
! |
4410 |
||
4411 |
destroy |
|
2715 | 4412 |
"destroy items and shadowView; remove dependencies" |
4413 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4414 |
self clearLastActiveMenu. |
2051 | 4415 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 4416 |
items := nil. |
4417 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4418 |
|
388 | 4419 |
super destroy. |
3142 | 4420 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4421 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4422 |
|
2051 | 4423 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4424 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4425 |
|
616 | 4426 |
fetchDeviceResources |
2715 | 4427 |
"fetch device colors, to avoid reallocation at redraw time" |
4428 |
||
2219 | 4429 |
|style| |
4430 |
||
2374 | 4431 |
superMenu notNil ifTrue:[ |
3938 | 4432 |
styleSheet := superMenu styleSheet |
2219 | 4433 |
]. |
616 | 4434 |
|
4435 |
super fetchDeviceResources. |
|
4436 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4437 |
"/ 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
|
4438 |
"/ (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
|
4439 |
|
616 | 4440 |
superMenu isNil ifTrue:[ |
3938 | 4441 |
rightArrow isNil ifTrue:[ |
4442 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
|
4443 |
]. |
|
4444 |
fgColor := fgColor onDevice:device. |
|
4445 |
style := styleSheet name. |
|
4446 |
||
4447 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
|
4448 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
4449 |
] ifFalse:[ |
|
4450 |
rightArrowShadow := nil |
|
4451 |
]. |
|
616 | 4452 |
] ifFalse:[ |
3938 | 4453 |
rightArrow := superMenu rightArrow. |
4454 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4455 |
||
4456 |
self foregroundColor:(superMenu foregroundColor). |
|
4457 |
self font:(superMenu font). |
|
2761 | 4458 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4459 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4460 |
|
1829 | 4461 |
items notNil ifTrue:[ |
3938 | 4462 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 4463 |
]. |
4464 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4465 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 4466 |
! |
4467 |
||
580 | 4468 |
initStyle |
4469 |
"initialize style specific stuff" |
|
4470 |
||
2919 | 4471 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
4061 | 4472 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
4473 |
#'menu.itemHorizontalSpace' |
|
4474 |
#'popup.hideOnRelease' |
|
4475 |
)> |
|
2609 | 4476 |
|fn| |
4477 |
||
580 | 4478 |
super initStyle. |
616 | 4479 |
|
2883 | 4480 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
4481 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4482 |
buttonInsetX := buttonInsetX abs. |
|
4483 |
||
4484 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
4485 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4486 |
buttonInsetY := buttonInsetY abs. |
|
4487 |
||
4488 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
4489 |
itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ]. |
|
4490 |
||
4491 |
||
4061 | 4492 |
fgColor := DefaultForegroundColor. |
4493 |
fgColor isNil ifTrue:[ fgColor := Color black ]. |
|
2609 | 4494 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
4495 |
fn := self class defaultFont. |
|
2610 | 4496 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 4497 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4498 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4499 |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4500 |
buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4501 |
buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4502 |
buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4503 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4504 |
self updateLevelAndBorder. |
4061 | 4505 |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4506 |
"Modified (format): / 19-01-2012 / 13:19:19 / cg" |
580 | 4507 |
! |
4508 |
||
388 | 4509 |
initialize |
2715 | 4510 |
"set default configuration" |
4511 |
||
388 | 4512 |
super initialize. |
616 | 4513 |
|
2877 | 4514 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4515 |
enabled := true. |
3881 | 4516 |
self originChangedFlag:false extentChangedFlag:false. |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4517 |
"/ explicitExtent := nil. |
2253 | 4518 |
shortKeyInset := 0. |
4519 |
mustRearrange := false. |
|
4520 |
showSeparatingLines := false. |
|
4521 |
showGroupDivider := true. |
|
3780 | 4522 |
hideOnRelease := defaultHideOnRelease. |
388 | 4523 |
! |
4524 |
||
1573 | 4525 |
map |
3938 | 4526 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4527 |
If the grab fails, try again and unmap myself if that fails too." |
4528 |
||
1791 | 4529 |
|loIndices loItems| |
388 | 4530 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4531 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4532 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4533 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4534 |
self becomesActiveMenu. |
1573 | 4535 |
super map. |
2681 | 4536 |
self addDependencies. |
388 | 4537 |
|
1785 | 4538 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4539 |
loItems := items ? #[]. |
4540 |
||
4541 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4542 |
|
388 | 4543 |
self isPopUpView ifTrue:[ |
3938 | 4544 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4545 |
] ifFalse:[ |
3938 | 4546 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4547 |
]. |
1791 | 4548 |
loItems do:[:el| el updateIndicators ]. |
388 | 4549 |
|
1785 | 4550 |
loIndices size > 0 ifTrue:[ |
3938 | 4551 |
self redrawX:0 y:0 width:width height:height. |
4552 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4553 |
]. |
4554 |
||
1177 | 4555 |
"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
|
4556 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4557 |
! |
4558 |
||
4559 |
realize |
|
2715 | 4560 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4561 |
|
2761 | 4562 |
|bgColor| |
4563 |
||
388 | 4564 |
self isPopUpView ifTrue:[ |
3938 | 4565 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4566 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4567 |
||
4568 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
|
4569 |
shadowView must be realized before self" |
|
4570 |
self hiddenOnRealize:true. |
|
4571 |
super realize. |
|
4572 |
self resize. |
|
4573 |
self makeFullyVisible. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4574 |
"/ self mustRearrange. |
3938 | 4575 |
shadowView notNil ifTrue:[ |
4576 |
shadowView realize. |
|
4577 |
]. |
|
4578 |
self raise. |
|
4579 |
self map. |
|
736 | 4580 |
] ifFalse:[ |
3938 | 4581 |
super realize. |
1767 | 4582 |
]. |
4583 |
self allSubViewsDo:[:aView| aView realize ]. |
|
3780 | 4584 |
"/ hideOnRelease := defaultHideOnRelease. |
388 | 4585 |
! |
4586 |
||
4587 |
recreate |
|
1832 | 4588 |
"this is called after a snapin or a migration. |
2715 | 4589 |
If the image was saved with an active menu, hide the menu" |
4590 |
||
1455 | 4591 |
selection := nil. |
388 | 4592 |
super recreate. |
4593 |
! |
|
4594 |
||
1130 | 4595 |
reinitStyle |
4596 |
"handle style change while being open (win32 only - for now)" |
|
4597 |
||
4598 |
super reinitStyle. |
|
4599 |
||
4600 |
self fetchDeviceResources. |
|
1811 | 4601 |
self mustRearrange. "/ care for changed font sizes etc. |
4602 |
||
4603 |
self do:[:anItem | |
|
3938 | 4604 |
anItem reinitStyle |
1811 | 4605 |
]. |
1130 | 4606 |
|
4607 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4608 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4609 |
! |
4610 |
||
388 | 4611 |
unmap |
1330 | 4612 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4613 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4614 |
|
3203 | 4615 |
mapTime := nil. |
4616 |
||
3975 | 4617 |
"hide all submenus opened within the menu" |
4618 |
self itemsDo:[:eachItem| |
|
4619 |
eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ]. |
|
4620 |
]. |
|
4621 |
||
2681 | 4622 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4623 |
self clearLastActiveMenu. |
1699 | 4624 |
self doUngrab:(superMenu isNil). |
4625 |
"/ self isPopUpView ifTrue:[ |
|
4626 |
"/ self doUngrab:(superMenu isNil) |
|
4627 |
"/ ]. |
|
3142 | 4628 |
prevFocusView := nil. |
388 | 4629 |
super unmap. |
4630 |
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
|
4631 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4632 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4633 |
updateLevelAndBorder |
3820 | 4634 |
"update level & border" |
4635 |
||
4636 |
<resource: #style (#'popup.borderWidth' |
|
3938 | 4637 |
#'popup.borderColor' |
4638 |
#'popup.level' |
|
4639 |
#'pullDownMenu.level' |
|
4640 |
)> |
|
3820 | 4641 |
|
4642 |
|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
|
4643 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4644 |
self isPopUpView ifTrue:[ |
3938 | 4645 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
4646 |
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
|
4647 |
] ifFalse:[ |
3938 | 4648 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
4649 |
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
|
4650 |
]. |
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4651 |
bw ~~ 0 ifTrue:[ |
3938 | 4652 |
bc := styleSheet at:#'popup.borderColor' default:Color black. |
4653 |
self borderColor:bc |
|
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4654 |
]. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4655 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4656 |
self level:lvl. |
388 | 4657 |
! ! |
4658 |
||
1878 | 4659 |
!MenuPanel methodsFor:'keyboard control'! |
4660 |
||
4661 |
mnemonicViewNext:aKeyEvent |
|
4662 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4663 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4664 |
return the topMenu otherwise nil." |
4665 |
||
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4666 |
|menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel| |
2112 | 4667 |
|
4668 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4669 |
shown ifFalse:[^ nil]. |
4670 |
||
4671 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4672 |
lKey := uKey asLowercase. |
|
2112 | 4673 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4674 |
accessCharacterMatchQuery := |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4675 |
[:el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4676 |
|k| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4677 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4678 |
k := el accessCharacter. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4679 |
k == uKey or:[k == lKey] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4680 |
]. |
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4681 |
maxShortCutSearchLevel := self class maxShortCutSearchLevel. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4682 |
|
2112 | 4683 |
selection notNil ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4684 |
"first lookup the current grapMenu before starting in the topMenu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4685 |
" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4686 |
menu := self detectGrabMenu. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4687 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4688 |
[ menu ~~ self ] whileTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4689 |
index := menu selectionIndex. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4690 |
list := menu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4691 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4692 |
maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4693 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4694 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4695 |
list size ~~ 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4696 |
"/ has item which responds to the mnemonic |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4697 |
menu processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4698 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4699 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4700 |
menu := menu superMenu. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4701 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4702 |
index := self selectionIndex. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4703 |
list := self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4704 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4705 |
maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4706 |
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
|
4707 |
|
2112 | 4708 |
] ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4709 |
index := 99999. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4710 |
list := nil. |
3938 | 4711 |
]. |
2112 | 4712 |
|
2374 | 4713 |
list isNil ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4714 |
list := self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4715 |
selectItemIndicesFor:accessCharacterMatchQuery |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4716 |
maxDepth:maxShortCutSearchLevel from:1 to:index |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4717 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4718 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4719 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4720 |
list isNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4721 |
"/ must clear existing selection |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4722 |
self selection:nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4723 |
^ nil |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4724 |
] |
2112 | 4725 |
]. |
4726 |
||
4727 |
"/ has item which responds to the mnemonic |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4728 |
self processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4729 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4730 |
"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
|
4731 |
! |
1878 | 4732 |
|
4733 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4734 |
"open all menus derived from sequence of item indices" |
4735 |
||
1878 | 4736 |
|item| |
4737 |
||
4738 |
anItemIndiceList size == 0 ifTrue:[ |
|
3938 | 4739 |
^ self |
1878 | 4740 |
]. |
4741 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4742 |
||
4743 |
(item notNil and:[item enabled]) ifTrue:[ |
|
3938 | 4744 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4745 |
self selection:item openMenu:true. |
|
4746 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4747 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4748 |
! |
1878 | 4749 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4750 |
processCollectedShortcutIndices:indices |
1878 | 4751 |
|menu item| |
4752 |
||
4753 |
indices size == 0 ifTrue:[ |
|
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4754 |
^ self |
1878 | 4755 |
]. |
4756 |
menu := self. |
|
4757 |
||
3192 | 4758 |
"/ first lookup in current open submenus |
1878 | 4759 |
[menu selectionIndex == indices first] whileTrue:[ |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4760 |
( (item := menu selection) isNil |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4761 |
or:[(menu := item currentSubmenu) isNil] |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4762 |
) ifTrue:[ "/ selected but no submenu open - not handled |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4763 |
^ self |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4764 |
]. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4765 |
indices removeFirst. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4766 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4767 |
indices isEmpty ifTrue:[ |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4768 |
menu selection:nil. |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4769 |
^ self |
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4770 |
] |
1878 | 4771 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4772 |
menu openMenusFromItemIndices:indices. |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4773 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
4774 |
"Modified: / 24-03-2011 / 11:19:38 / cg" |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4775 |
"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
|
4776 |
! |
1878 | 4777 |
|
4778 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4779 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4780 |
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
|
4781 |
Otherwise return false." |
2715 | 4782 |
|
3431 | 4783 |
|menu rawKey logicalKey list item selectableItem| |
1878 | 4784 |
|
4785 |
superMenu notNil ifTrue:[ |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4786 |
^ superMenu processShortcut:aKeyEvent |
1878 | 4787 |
]. |
4788 |
shown ifFalse:[^ false]. |
|
4789 |
||
3431 | 4790 |
logicalKey := aKeyEvent key. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4791 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4792 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4793 |
|
3192 | 4794 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
3431 | 4795 |
) includes:logicalKey |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4796 |
) ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4797 |
^ false. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4798 |
]. |
3431 | 4799 |
rawKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4800 |
item := nil. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4801 |
menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu |
1878 | 4802 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4803 |
"/ 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
|
4804 |
aKeyEvent isKeyReleaseEvent ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4805 |
selection isNil ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4806 |
prevFocusView := self windowGroup focusView. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4807 |
self requestFocus. "/ self windowGroup focusView:self. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4808 |
selectableItem := self firstItemSelectable. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4809 |
self selection:selectableItem openMenu:false. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4810 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4811 |
prevFocusView requestFocus. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4812 |
self selection:nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4813 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4814 |
^ true |
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4815 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
4816 |
|
1878 | 4817 |
[true] whileTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4818 |
list := menu |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4819 |
selectItemIndicesFor:[:el| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4820 |
|skey| |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4821 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4822 |
item := el. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4823 |
el ignoreShortcutKeys ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4824 |
false |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4825 |
] ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4826 |
skey := el shortcutKey. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4827 |
skey == rawKey or:[skey == logicalKey] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4828 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4829 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4830 |
maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999 |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4831 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4832 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4833 |
list size ~~ 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4834 |
"/ has item which responds to the shortcut |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4835 |
item hasSubmenu ifFalse:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4836 |
menu accept:item |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4837 |
] ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4838 |
menu processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4839 |
self requestFocus. "/ self windowGroup focusView:self. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4840 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4841 |
^ true |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4842 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4843 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4844 |
menu == self ifTrue:[ ^ false ]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4845 |
menu := self. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4846 |
]. |
2219 | 4847 |
^ false "/ never reached |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4848 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4849 |
"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
|
4850 |
! |
1878 | 4851 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4852 |
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
|
4853 |
"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
|
4854 |
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
|
4855 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4856 |
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
|
4857 |
is created and passed through if the block returns false. |
2715 | 4858 |
Otherwise the item is not asked for its submenu." |
4859 |
||
2112 | 4860 |
|start stop| |
4861 |
||
4862 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4863 |
||
4864 |
start := aStart max:1. |
|
4865 |
stop := aStop min:(items size). |
|
4866 |
||
3938 | 4867 |
start to:stop do:[:i| |
4868 |
|item menu result| |
|
4869 |
||
4870 |
item := items at:i. |
|
4871 |
(item enabled and:[item isVisible]) ifTrue:[ |
|
4872 |
(aOneArgBlock value:item) ifTrue:[ |
|
4873 |
^ OrderedCollection with:i |
|
4874 |
]. |
|
4875 |
||
4876 |
maxDepth > 1 ifTrue:[ |
|
4877 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
|
4878 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
|
4879 |
menu := item setupSubmenu. |
|
4880 |
||
4881 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
|
4882 |
result := menu |
|
4883 |
selectItemIndicesFor:aOneArgBlock |
|
4884 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
|
4885 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
|
4886 |
||
4887 |
result notNil ifTrue:[ |
|
4888 |
result addFirst:i. |
|
4889 |
^ result |
|
4890 |
]. |
|
4891 |
]. |
|
4892 |
]. |
|
4893 |
]. |
|
4894 |
]. |
|
4895 |
]. |
|
1878 | 4896 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4897 |
^ nil |
3128 | 4898 |
|
4899 |
"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
|
4900 |
! ! |
1878 | 4901 |
|
388 | 4902 |
!MenuPanel methodsFor:'misc'! |
4903 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4904 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4905 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4906 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4907 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4908 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4909 |
|
388 | 4910 |
superMenu |
2715 | 4911 |
"returns supermenu or nil" |
4912 |
||
388 | 4913 |
^ superMenu |
4914 |
! |
|
4915 |
||
4916 |
topMenu |
|
2715 | 4917 |
"returns the topMenu; the one having no superMenu" |
4918 |
||
1791 | 4919 |
|menu smenu| |
4920 |
||
4921 |
menu := self. |
|
4922 |
||
4923 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
3938 | 4924 |
menu := smenu |
1791 | 4925 |
]. |
4926 |
^ menu |
|
388 | 4927 |
! ! |
4928 |
||
1825 | 4929 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4930 |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4931 |
printOn:aStream |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4932 |
|label| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4933 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4934 |
aStream nextPutAll:'Menu:'. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4935 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4936 |
self do:[:eachItem| |
3938 | 4937 |
label := eachItem label. |
4938 |
label notEmptyOrNil ifTrue:[ |
|
4939 |
aStream nextPutAll:' '. |
|
4940 |
label printOn:aStream. |
|
4941 |
]. |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
4942 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4943 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4944 |
|
388 | 4945 |
!MenuPanel methodsFor:'private'! |
4946 |
||
434 | 4947 |
application |
2715 | 4948 |
"optimize access to retrive the application" |
4949 |
||
2374 | 4950 |
application notNil ifTrue:[^ application ]. |
434 | 4951 |
|
4952 |
superMenu notNil ifTrue:[ |
|
3938 | 4953 |
application := superMenu application. |
4954 |
^ application |
|
2253 | 4955 |
]. |
4956 |
application := super application. |
|
2374 | 4957 |
^ application |
1872 | 4958 |
! |
434 | 4959 |
|
3725 | 4960 |
detectItem:aBlock |
4961 |
"returns the item for which aBlock returns true." |
|
4962 |
||
4963 |
items notNil ifTrue:[ |
|
3938 | 4964 |
items keysAndValuesDo:[:anIndex :anItem| |
4965 |
(aBlock value:anItem) ifTrue:[^ anItem]. |
|
4966 |
]. |
|
3725 | 4967 |
]. |
4968 |
^ nil |
|
4969 |
! |
|
4970 |
||
1572 | 4971 |
detectItemForKey:aKey |
4972 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4973 |
if no item is detected nil is returned." |
4974 |
||
1572 | 4975 |
|cIdx uKey lKey item| |
4976 |
||
1699 | 4977 |
items isNil ifTrue:[^ nil]. |
4978 |
||
1572 | 4979 |
cIdx := self selectionIndex. |
4980 |
uKey := aKey asUppercase. |
|
4981 |
lKey := aKey asLowercase. |
|
4982 |
||
3938 | 4983 |
items keysAndValuesDo:[:anIndex :anItem| |
4984 |
|char label| |
|
4985 |
||
4986 |
( anIndex ~~ cIdx |
|
4987 |
and:[anItem canSelect |
|
4988 |
and:[(label := anItem textLabel) notNil |
|
4989 |
and:[label size ~~ 0]]] |
|
4990 |
) ifTrue:[ |
|
4991 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4992 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4993 |
^ anItem |
|
4994 |
] |
|
4995 |
] ifFalse:[ |
|
4996 |
char := label at:1. |
|
4997 |
||
4998 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4999 |
anIndex > cIdx ifTrue:[ |
|
5000 |
^ anItem |
|
5001 |
]. |
|
5002 |
item isNil ifTrue:[item := anItem] |
|
5003 |
] |
|
5004 |
] |
|
5005 |
] |
|
1572 | 5006 |
]. |
5007 |
^ item |
|
5008 |
! |
|
5009 |
||
3725 | 5010 |
detectItemForLabel:aLabel |
5011 |
^ self detectItem:[:anItem | anItem label = aLabel]. |
|
5012 |
! |
|
5013 |
||
5014 |
detectItemForNameKey:aKey |
|
5015 |
^ self detectItem:[:anItem | anItem nameKey == aKey]. |
|
5016 |
! |
|
5017 |
||
388 | 5018 |
onEachPerform:aSelector withArgList:aList |
2715 | 5019 |
"on each item perform selector with an argument derived from aList" |
5020 |
||
388 | 5021 |
aList isCollection ifTrue:[ |
3938 | 5022 |
items size >= aList size ifTrue:[ |
5023 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
5024 |
(items at:anIndex) perform:aSelector with:anArg |
|
5025 |
] |
|
5026 |
] |
|
388 | 5027 |
] ifFalse:[ |
3938 | 5028 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 5029 |
] |
5030 |
! |
|
5031 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5032 |
registerImageOnDevice:anImage |
2269 | 5033 |
|
5034 |
anImage isNil ifTrue:[ ^ nil ]. |
|
5035 |
^ self class image:anImage onDevice:device |
|
5036 |
||
5037 |
"/ |image| |
|
5038 |
"/ |
|
5039 |
"/ (image := anImage) notNil ifTrue:[ |
|
5040 |
"/ image device ~~ device ifTrue:[ |
|
5041 |
"/ image := image copy. |
|
5042 |
"/ ]. |
|
5043 |
"/ image := image onDevice:device. |
|
5044 |
"/ image := image clearMaskedPixels. |
|
5045 |
"/ ]. |
|
5046 |
"/ ^ image |
|
2355 | 5047 |
! |
5048 |
||
5049 |
superMenu:aSuperMenu |
|
2715 | 5050 |
"set my supermenu from which i'am activated" |
5051 |
||
2355 | 5052 |
superMenu := aSuperMenu. |
5053 |
||
2374 | 5054 |
superMenu notNil ifTrue:[ |
3938 | 5055 |
styleSheet := superMenu styleSheet. |
5056 |
rightArrow := superMenu rightArrow. |
|
5057 |
rightArrowShadow := superMenu rightArrowShadow. |
|
2355 | 5058 |
]. |
388 | 5059 |
! ! |
5060 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5061 |
!MenuPanel methodsFor:'private-activation'! |
687 | 5062 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5063 |
activeMenu |
2715 | 5064 |
"returns the current active menu or self (the top menu)" |
5065 |
||
687 | 5066 |
^ lastActiveMenu ? self |
5067 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5068 |
"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
|
5069 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5070 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5071 |
activeMenu:aMenu |
2715 | 5072 |
"set the current active menu" |
5073 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5074 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5075 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5076 |
"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
|
5077 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5078 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5079 |
becomesActiveMenu |
2715 | 5080 |
"submenu becomes the active menu" |
5081 |
||
3224 | 5082 |
mapTime isNil ifTrue:[ |
4122
50b3429eb6b4
Use Timestamo instead of AbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
4119
diff
changeset
|
5083 |
"/ set the mapTime if not yet done |
50b3429eb6b4
Use Timestamo instead of AbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
4119
diff
changeset
|
5084 |
mapTime := Timestamp now. |
3224 | 5085 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5086 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5087 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5088 |
"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
|
5089 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5090 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5091 |
clearLastActiveMenu |
2715 | 5092 |
"reset the current active menu" |
5093 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5094 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5095 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5096 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5097 |
|
2251 | 5098 |
"/ prevFocusView notNil ifTrue:[ |
5099 |
"/ self windowGroup focusView:prevFocusView. |
|
5100 |
"/ prevFocusView := nil. |
|
5101 |
"/ ]. |
|
5102 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5103 |
top activeMenu == self ifTrue:[ |
3938 | 5104 |
top activeMenu:nil |
687 | 5105 |
] |
5106 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5107 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 5108 |
! |
5109 |
||
5110 |
mapTime |
|
3203 | 5111 |
"get the time the menu was activated or nil" |
2715 | 5112 |
|
687 | 5113 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5114 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5115 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
3203 | 5116 |
! |
5117 |
||
5118 |
mapTime:aTimestamp |
|
5119 |
"set the time the menu was activated" |
|
5120 |
||
5121 |
mapTime := aTimestamp. |
|
5122 |
||
5123 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
|
687 | 5124 |
! ! |
5125 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5126 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 5127 |
|
5128 |
hasScrollerAt:aDirection |
|
2715 | 5129 |
"returns true if a visible scroller at a direction exists" |
5130 |
||
2016 | 5131 |
|layout| |
5132 |
||
5133 |
self hasScrollers ifFalse:[ |
|
3938 | 5134 |
^ false |
2016 | 5135 |
]. |
5136 |
||
5137 |
aDirection == #PREV ifTrue:[ |
|
3938 | 5138 |
layout := items first layout. |
2016 | 5139 |
|
5140 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
3938 | 5141 |
ifFalse:[ layout left < margin] |
2016 | 5142 |
]. |
5143 |
layout := items last layout. |
|
5144 |
||
5145 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
3938 | 5146 |
ifFalse:[ layout right > (width - margin)] |
2016 | 5147 |
! |
5148 |
||
5149 |
hasScrollers |
|
2715 | 5150 |
"returns true if scrollers are needed" |
5151 |
||
2018 | 5152 |
|maxExtent first last isVert| |
5153 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5154 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 5155 |
|
5156 |
isVert := self verticalLayout. |
|
5157 |
||
5158 |
superView notNil ifTrue:[ |
|
3938 | 5159 |
((first := items first layout) isNil |
5160 |
or:[(last := items last layout) isNil] |
|
5161 |
) ifTrue:[ |
|
5162 |
^ false |
|
5163 |
]. |
|
5164 |
isVert ifTrue:[ |
|
5165 |
^ first top < 0 or:[last bottom > height] |
|
5166 |
]. |
|
5167 |
^ first left < 0 or:[last right > width] |
|
2018 | 5168 |
]. |
5169 |
maxExtent := self maxExtent. |
|
5170 |
isVert ifTrue:[ |
|
3938 | 5171 |
^ (height >= maxExtent y) |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5172 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5173 |
^ (width >= maxExtent x) |
2016 | 5174 |
! |
5175 |
||
5176 |
indexOfItemAtScroller:aDirection |
|
2715 | 5177 |
"returns the index of the item under the scroller or 0" |
5178 |
||
2016 | 5179 |
|bounds min max layout| |
5180 |
||
2860 | 5181 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 5182 |
bounds := self scrollerBoundsAt:aDirection. |
5183 |
||
5184 |
self verticalLayout ifTrue:[ |
|
3938 | 5185 |
min := bounds top. |
5186 |
max := bounds bottom. |
|
5187 |
||
5188 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5189 |
anItem isVisible ifTrue:[ |
|
5190 |
layout := anItem layout. |
|
5191 |
||
5192 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
5193 |
^ anIndex |
|
5194 |
]. |
|
5195 |
]. |
|
5196 |
]. |
|
2016 | 5197 |
] ifFalse:[ |
3938 | 5198 |
min := bounds left. |
5199 |
max := bounds right. |
|
5200 |
||
5201 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5202 |
anItem isVisible ifTrue:[ |
|
5203 |
layout := anItem layout. |
|
5204 |
||
5205 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
5206 |
^ anIndex |
|
5207 |
]. |
|
5208 |
]. |
|
5209 |
] |
|
2016 | 5210 |
]. |
5211 |
^ 0 |
|
5212 |
! |
|
5213 |
||
5214 |
makeItemVisible:anItem |
|
2715 | 5215 |
"make an item visible" |
5216 |
||
2018 | 5217 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
5218 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 5219 |
inv1 inv2| |
2018 | 5220 |
|
5221 |
( anItem notNil |
|
5222 |
and:[self hasScrollers |
|
5223 |
and:[(layout := anItem layout) notNil]] |
|
5224 |
) ifFalse:[ |
|
3938 | 5225 |
^ self |
2016 | 5226 |
]. |
2018 | 5227 |
index := self indexOfItem:anItem. |
2016 | 5228 |
boundsPREV := self scrollerBoundsAt:#PREV. |
5229 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
5230 |
||
2018 | 5231 |
isVertical := self verticalLayout. |
5232 |
||
5233 |
isVertical ifTrue:[ |
|
3938 | 5234 |
boundsMin := boundsPREV bottom. |
5235 |
boundsMax := boundsNEXT top. |
|
5236 |
layoutMin := layout top. |
|
5237 |
layoutMax := layout bottom. |
|
5238 |
windowSz := height. |
|
2018 | 5239 |
] ifFalse:[ |
3938 | 5240 |
boundsMin := boundsPREV right. |
5241 |
boundsMax := boundsNEXT left. |
|
5242 |
layoutMin := layout left. |
|
5243 |
layoutMax := layout right. |
|
5244 |
windowSz := width. |
|
2018 | 5245 |
]. |
5246 |
||
5247 |
||
5248 |
layoutMin < boundsMin ifTrue:[ |
|
3938 | 5249 |
layoutMin >= 0 ifTrue:[ |
5250 |
^ self |
|
5251 |
]. |
|
5252 |
"/ test whether is first visible item |
|
5253 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
5254 |
||
5255 |
index == 0 ifTrue:[ scr0 := margin ] |
|
5256 |
ifFalse:[ scr0 := boundsMin ]. |
|
5257 |
||
5258 |
delta := layoutMin negated + scr0. |
|
2016 | 5259 |
] ifFalse:[ |
3938 | 5260 |
layoutMax > boundsMax ifFalse:[ |
5261 |
^ self |
|
5262 |
]. |
|
5263 |
"/ test whether is last visible item |
|
5264 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
5265 |
||
5266 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
|
5267 |
ifFalse:[ scr0 := boundsMax ]. |
|
5268 |
||
5269 |
delta := scr0 - layoutMax. |
|
2018 | 5270 |
]. |
5271 |
delta == 0 ifTrue:[ ^ self ]. |
|
5272 |
||
2016 | 5273 |
doScroll := false. |
5274 |
||
5275 |
shown ifTrue:[ |
|
3938 | 5276 |
delta abs < (windowSz / 2) ifTrue:[ |
5277 |
doScroll := true. |
|
5278 |
self repairDamage |
|
5279 |
] |
|
2016 | 5280 |
]. |
2018 | 5281 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
5282 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 5283 |
|
5284 |
doScroll ifFalse:[ |
|
3938 | 5285 |
self invalidate. |
5286 |
^ self |
|
2016 | 5287 |
]. |
5288 |
||
2018 | 5289 |
windowSz := windowSz - margin - margin. |
5290 |
||
5291 |
scr0 := boundsMin. |
|
5292 |
scr1 := scr0 + delta abs. |
|
5293 |
scrSz := boundsMax - scr1. |
|
5294 |
||
5295 |
delta < 0 ifTrue:[ |
|
3938 | 5296 |
isVertical ifTrue:[ |
5297 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
5298 |
width:windowSz height:scrSz async:false. |
|
5299 |
||
5300 |
scr1 := scr0 + scrSz. |
|
5301 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
|
5302 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
5303 |
] ifFalse:[ |
|
5304 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
5305 |
width:scrSz height:windowSz async:false. |
|
5306 |
||
5307 |
scr1 := scr0 + scrSz. |
|
5308 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
|
5309 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
5310 |
]. |
|
5311 |
inv1 := boundsPREV. |
|
2016 | 5312 |
] ifFalse:[ |
3938 | 5313 |
isVertical ifTrue:[ |
5314 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
5315 |
width:windowSz height:scrSz async:false. |
|
5316 |
||
5317 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
|
5318 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
5319 |
] ifFalse:[ |
|
5320 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
5321 |
width:scrSz height:windowSz async:false. |
|
5322 |
||
5323 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
|
5324 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
5325 |
]. |
|
5326 |
inv1 := boundsNEXT. |
|
2042 | 5327 |
]. |
5328 |
self invalidate:inv1. |
|
5329 |
self invalidate:inv2. |
|
2048 | 5330 |
|
5331 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 5332 |
! |
5333 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5334 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5335 |
"returns the one and only scrollActivity - data holder |
2715 | 5336 |
for a menu and all contained submenus" |
5337 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5338 |
superMenu notNil ifTrue:[ |
3938 | 5339 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5340 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5341 |
scrollActivity isNil ifTrue:[ |
3938 | 5342 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5343 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5344 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5345 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5346 |
|
2016 | 5347 |
scrollerBoundsAt:aDirection |
2860 | 5348 |
"returns the bounds of the scroller at a direction" |
2715 | 5349 |
|
2016 | 5350 |
|y x w h inset| |
5351 |
||
5352 |
inset := 0. |
|
5353 |
x := y := inset. |
|
5354 |
w := h := 15. |
|
5355 |
||
5356 |
self verticalLayout ifTrue:[ |
|
3938 | 5357 |
aDirection == #NEXT ifTrue:[ |
5358 |
y := height - h - inset. |
|
5359 |
]. |
|
5360 |
w := width - inset - inset. |
|
2016 | 5361 |
] ifFalse:[ |
3938 | 5362 |
aDirection == #NEXT ifTrue:[ |
5363 |
x := width - w - inset. |
|
5364 |
]. |
|
5365 |
h := height - inset - inset. |
|
2016 | 5366 |
]. |
5367 |
^ Rectangle left:x top:y width:w height:h |
|
5368 |
! |
|
5369 |
||
2046 | 5370 |
scrollerDirectionAtPoint:aPoint |
2715 | 5371 |
"returns the scroller-direction at aPoint, or nil" |
5372 |
||
2046 | 5373 |
self hasScrollers ifTrue:[ |
3938 | 5374 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
5375 |
bounds := self scrollerBoundsAt:aDirection. |
|
5376 |
||
5377 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
5378 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
5379 |
] |
|
5380 |
] |
|
2046 | 5381 |
]. |
5382 |
^ nil |
|
5383 |
||
5384 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 5385 |
! ! |
5386 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5387 |
!MenuPanel methodsFor:'private-searching'! |
388 | 5388 |
|
1699 | 5389 |
detectGrabMenu |
2715 | 5390 |
"returns the menu which is responsible for the grap; the last opened menu" |
5391 |
||
1699 | 5392 |
|subMenu| |
5393 |
||
5394 |
selection notNil ifTrue:[ |
|
3938 | 5395 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
5396 |
^ subMenu detectGrabMenu |
|
5397 |
] |
|
1699 | 5398 |
]. |
5399 |
^ self |
|
5400 |
! |
|
5401 |
||
5402 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 5403 |
"returns the menu which contains the grab-point" |
5404 |
||
1699 | 5405 |
|dstMenu dstPoint firstMenu| |
5406 |
||
5407 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
5408 |
||
5409 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
3938 | 5410 |
firstMenu := self. |
1699 | 5411 |
]. |
5412 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5413 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
3938 | 5414 |
^ firstMenu |
1699 | 5415 |
]. |
5416 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 5417 |
^ dstMenu ? firstMenu |
1699 | 5418 |
! |
5419 |
||
1767 | 5420 |
detectViewAtX:x y:y in:aTopView |
2715 | 5421 |
"detect view at x@y" |
5422 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5423 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5424 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5425 |
"/ 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
|
5426 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5427 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5428 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5429 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5430 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5431 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5432 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5433 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5434 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5435 |
"/ 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
|
5436 |
"/ ^ 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
|
5437 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5438 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5439 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5440 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5441 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5442 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5443 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 5444 |
! |
5445 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5446 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5447 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 5448 |
If no item match nil is returned." |
5449 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5450 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5451 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5452 |
stringOrNumberOrPoint isPoint ifTrue:[ |
3938 | 5453 |
^ self itemAtPoint:stringOrNumberOrPoint |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5454 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5455 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5456 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 5457 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5458 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5459 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5460 |
itemAtPoint:aPoint |
2715 | 5461 |
"returns the item at aPoint or nil if none detected" |
5462 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5463 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5464 |
|
1699 | 5465 |
items notNil ifTrue:[ |
3938 | 5466 |
x := aPoint x. |
5467 |
y := aPoint y. |
|
5468 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
|
1699 | 5469 |
]. |
5470 |
^ nil |
|
388 | 5471 |
! |
5472 |
||
2048 | 5473 |
superMenuAtPoint:aPoint |
2715 | 5474 |
"returns the superMenu which contains aPoint, or nil if none detected" |
5475 |
||
1699 | 5476 |
|grabPoint superMenu| |
5477 |
||
2048 | 5478 |
(self containsPoint:aPoint) ifTrue:[ |
3938 | 5479 |
^ self |
1699 | 5480 |
]. |
5481 |
||
2048 | 5482 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 5483 |
superMenu := self. |
5484 |
||
5485 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
3938 | 5486 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
5487 |
^ superMenu |
|
5488 |
] |
|
2715 | 5489 |
]. |
5490 |
^ nil |
|
1699 | 5491 |
|
2048 | 5492 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 5493 |
! ! |
5494 |
||
5495 |
!MenuPanel methodsFor:'queries'! |
|
5496 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5497 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5498 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5499 |
aView notNil ifTrue:[ |
3147 | 5500 |
"/ I am no longer a popUpView |
5501 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5502 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5503 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5504 |
|
388 | 5505 |
containsPoint:aPoint |
2715 | 5506 |
"returns true if the argument, aPoint is contained by the view" |
5507 |
||
388 | 5508 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
5509 |
! |
|
5510 |
||
5511 |
containsPointX:x y:y |
|
2715 | 5512 |
"returns true if point is contained by the view" |
5513 |
||
708 | 5514 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 5515 |
! |
5516 |
||
390 | 5517 |
hasGroupDividerAt:anIndex |
2715 | 5518 |
"returns true if a divider is defined at an index" |
5519 |
||
388 | 5520 |
|i| |
5521 |
||
5522 |
groupSizes size ~~ 0 ifTrue:[ |
|
3938 | 5523 |
i := 0. |
5524 |
||
5525 |
groupSizes do:[:t| |
|
5526 |
(i := i + t) == anIndex ifTrue:[ |
|
5527 |
^ true |
|
5528 |
] |
|
5529 |
] |
|
2715 | 5530 |
]. |
5531 |
^ false |
|
388 | 5532 |
! |
5533 |
||
390 | 5534 |
hasGroupDividers |
2715 | 5535 |
"returns true if any group divider exists" |
5536 |
||
5537 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 5538 |
! |
5539 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5540 |
hasPerformed |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5541 |
^ hasPerformed ? false |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5542 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5543 |
"Created: / 29-06-2011 / 16:24:14 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5544 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5545 |
|
390 | 5546 |
isFitPanel |
4384 | 5547 |
"returns true if the panel is the first in the menu hierarchy |
5548 |
and must be fit to the extent of its superView; |
|
5549 |
Obsolete: NO LONGER SUPPORTED" |
|
2715 | 5550 |
|
1699 | 5551 |
^ false |
390 | 5552 |
! |
5553 |
||
388 | 5554 |
isPopUpView |
5555 |
"return true if view is a popup view; without decoration |
|
2715 | 5556 |
and popUp to top immediately" |
5557 |
||
388 | 5558 |
^ superView isNil |
5559 |
! |
|
5560 |
||
5561 |
isVerticalLayout |
|
2715 | 5562 |
"returns true if vertical layout otherwise false( horizontal layout )" |
5563 |
||
1699 | 5564 |
^ self verticalLayout |
416 | 5565 |
! |
5566 |
||
1793 | 5567 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
5568 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 5569 |
! |
5570 |
||
416 | 5571 |
type |
428 | 5572 |
^ nil. |
416 | 5573 |
|
388 | 5574 |
! ! |
5575 |
||
5576 |
!MenuPanel methodsFor:'selection'! |
|
5577 |
||
5578 |
hasSelection |
|
2715 | 5579 |
"returns true if a selection exists" |
5580 |
||
388 | 5581 |
^ self selection notNil |
5582 |
! |
|
5583 |
||
2199 | 5584 |
openDelayed:anItem |
3187 | 5585 |
self openDelayed:anItem afterSeconds:0.5. |
5586 |
! |
|
5587 |
||
4185 | 5588 |
openDelayed:anItemOrNil afterSeconds:seconds |
4347 | 5589 |
|b| |
2199 | 5590 |
|
2374 | 5591 |
superMenu notNil ifTrue:[ |
4185 | 5592 |
superMenu openDelayed:anItemOrNil afterSeconds:seconds. |
5593 |
^ self |
|
2374 | 5594 |
]. |
4347 | 5595 |
(b := openDelayedMenuBlock notNil) ifTrue:[ |
5596 |
openDelayedMenuBlock := nil. |
|
5597 |
Processor removeTimedBlock:b. |
|
4185 | 5598 |
]. |
5599 |
(anItemOrNil notNil and:[anItemOrNil hasSubmenu]) ifFalse:[ |
|
5600 |
openDelayedMenuBlock := nil. |
|
5601 |
^ self |
|
2253 | 5602 |
]. |
4193 | 5603 |
|
5604 |
openDelayedMenuBlock := |
|
5605 |
[ |
|
5606 |
openDelayedMenuBlock := nil. |
|
5607 |
anItemOrNil openDelayedSubmenu |
|
5608 |
]. |
|
2253 | 5609 |
|
3187 | 5610 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
4347 | 5611 |
|
5612 |
"Modified: / 29-08-2013 / 09:40:28 / cg" |
|
2199 | 5613 |
! |
5614 |
||
3975 | 5615 |
selectAndOpenDelayed:anItemOrNil |
5616 |
"change selection to an item or nil" |
|
5617 |
||
4347 | 5618 |
|helpListener oldSelect delayedOpenSeconds b| |
3975 | 5619 |
|
5620 |
anItemOrNil == selection ifTrue:[ ^ self ]. |
|
4193 | 5621 |
"/ self openDelayed:nil. |
3975 | 5622 |
|
4347 | 5623 |
(b := openDelayedMenuBlock notNil) ifTrue:[ |
5624 |
openDelayedMenuBlock := nil. |
|
5625 |
Processor removeTimedBlock:b. |
|
5626 |
]. |
|
5627 |
||
5628 |
delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu. |
|
5629 |
||
3975 | 5630 |
oldSelect := selection. |
5631 |
selection := nil. |
|
5632 |
||
5633 |
oldSelect notNil ifTrue:[ |
|
5634 |
"/ clear current selection |
|
5635 |
|oldSubmenu| |
|
4343 | 5636 |
|
3975 | 5637 |
oldSubmenu := oldSelect visibleSubmenu. |
5638 |
oldSubmenu notNil ifTrue:[ |
|
5639 |
Processor addTimedBlock:[ |
|
5640 |
selection ~~ oldSelect ifTrue:[ |
|
4183 | 5641 |
"cancels the current delayed operation" |
3975 | 5642 |
oldSelect hideSubmenu. |
5643 |
||
5644 |
( selection notNil |
|
5645 |
and:[selection hasSubmenu |
|
5646 |
and:[selection visibleSubmenu isNil]] |
|
5647 |
) ifTrue:[ |
|
4185 | 5648 |
"setup new delayed operation.." |
4191 | 5649 |
self openDelayed:selection afterSeconds:delayedOpenSeconds "0.1" |
3975 | 5650 |
]. |
5651 |
]. |
|
5652 |
] afterSeconds:delayedOpenSeconds. |
|
5653 |
]. |
|
5654 |
oldSelect invalidate. |
|
5655 |
]. |
|
5656 |
||
5657 |
anItemOrNil notNil ifTrue:[ |
|
5658 |
self makeItemVisible:anItemOrNil. |
|
5659 |
anItemOrNil canSelect ifTrue:[ |
|
5660 |
selection := anItemOrNil |
|
5661 |
]. |
|
5662 |
]. |
|
5663 |
selection isNil ifTrue:[^ self]. |
|
5664 |
||
5665 |
ActiveHelp isActive ifTrue:[ |
|
5666 |
helpListener := ActiveHelp currentHelpListener. |
|
5667 |
helpListener initiateHelpFor:self at:nil now:true. |
|
5668 |
]. |
|
4193 | 5669 |
|
3975 | 5670 |
shown ifTrue:[ |
5671 |
"/ self rearrangeItems. |
|
5672 |
selection invalidate. |
|
5673 |
selection hasSubmenu ifTrue:[ |
|
4343 | 5674 |
(oldSelect isNil or:[oldSelect visibleSubmenu isNil]) ifTrue:[ |
5675 |
self openDelayed:selection afterSeconds:0. |
|
5676 |
] ifFalse:[ |
|
5677 |
self openDelayed:selection afterSeconds:delayedOpenSeconds. |
|
5678 |
] |
|
3975 | 5679 |
]. |
5680 |
]. |
|
4347 | 5681 |
|
5682 |
"Modified: / 29-08-2013 / 09:44:06 / cg" |
|
3975 | 5683 |
! |
5684 |
||
388 | 5685 |
selection |
2715 | 5686 |
"returns current selected item or nil" |
5687 |
||
388 | 5688 |
^ selection |
5689 |
! |
|
5690 |
||
5691 |
selection:anItemOrNil |
|
2016 | 5692 |
"change selection to an item or nil |
2715 | 5693 |
if the item has a submenu the first item might be selected (style-sheet)" |
5694 |
||
2249 | 5695 |
|openMenu openOnSelect submenu item| |
5696 |
||
5697 |
selection == anItemOrNil ifTrue:[^ self]. |
|
5698 |
||
5699 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
3938 | 5700 |
self selection:anItemOrNil openMenu:false. |
5701 |
^ self |
|
2249 | 5702 |
]. |
5703 |
||
5704 |
openMenu := self isPopUpView not. |
|
5705 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
5706 |
||
5707 |
openMenu ifFalse:[ |
|
3938 | 5708 |
openMenu := openOnSelect. |
2249 | 5709 |
]. |
5710 |
self selection:anItemOrNil openMenu:openMenu. |
|
5711 |
||
5712 |
openOnSelect ifFalse:[ |
|
3938 | 5713 |
"/ select first item in submenu |
5714 |
||
5715 |
submenu := anItemOrNil currentSubmenu. |
|
5716 |
||
5717 |
submenu notNil ifTrue:[ |
|
5718 |
item := submenu itemAt:1. |
|
5719 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
|
5720 |
submenu selection:item openMenu:false |
|
5721 |
] |
|
5722 |
]. |
|
2249 | 5723 |
]. |
5724 |
! |
|
5725 |
||
5726 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 5727 |
"change selection to an item or nil" |
5728 |
||
2251 | 5729 |
|helpListener oldSelect| |
2249 | 5730 |
|
5731 |
anItemOrNil == selection ifTrue:[ |
|
3938 | 5732 |
^ self |
2016 | 5733 |
]. |
2199 | 5734 |
self openDelayed:nil. |
388 | 5735 |
|
2251 | 5736 |
oldSelect := selection. |
5737 |
selection := nil. |
|
2249 | 5738 |
|
2374 | 5739 |
anItemOrNil notNil ifTrue:[ |
3938 | 5740 |
self makeItemVisible:anItemOrNil. |
5741 |
anItemOrNil canSelect ifTrue:[ |
|
5742 |
selection := anItemOrNil |
|
5743 |
] ifFalse:[ |
|
5744 |
oldSelect isNil ifTrue:[^ self]. |
|
5745 |
]. |
|
2249 | 5746 |
]. |
2374 | 5747 |
oldSelect notNil ifTrue:[ |
3938 | 5748 |
"/ clear current selection |
5749 |
oldSelect isSelected:false. |
|
2251 | 5750 |
]. |
2374 | 5751 |
selection isNil ifTrue:[^ self]. |
2251 | 5752 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5753 |
"/ selection == enteredItem ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5754 |
"/ enteredItem := nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5755 |
"/ ] ifFalse:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5756 |
"/ self pointerEntersItem:nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
5757 |
"/ ]. |
2016 | 5758 |
ActiveHelp isActive ifTrue:[ |
3938 | 5759 |
helpListener := ActiveHelp currentHelpListener. |
5760 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 5761 |
]. |
5762 |
shown ifTrue:[ |
|
3938 | 5763 |
"/ self rearrangeItems. |
5764 |
||
5765 |
openMenu ifFalse:[ |
|
5766 |
selection invalidate. |
|
5767 |
] |
|
2249 | 5768 |
]. |
5769 |
openMenu ifTrue:[ |
|
3938 | 5770 |
selection isSelected:true. |
2249 | 5771 |
]. |
388 | 5772 |
! |
5773 |
||
5774 |
selectionIndex |
|
2715 | 5775 |
"returns index of current selection or 0" |
5776 |
||
388 | 5777 |
|item| |
5778 |
||
5779 |
(item := self selection) notNil ifTrue:[ |
|
3938 | 5780 |
^ self findFirst:[:el| el == item ] |
388 | 5781 |
]. |
5782 |
^ 0 |
|
5783 |
! |
|
5784 |
||
5785 |
selectionIndex:anIndex |
|
2715 | 5786 |
"set selection at an index" |
5787 |
||
388 | 5788 |
self selection:(self itemAt:anIndex) |
5789 |
! ! |
|
5790 |
||
1791 | 5791 |
!MenuPanel methodsFor:'translation'! |
5792 |
||
5793 |
translateGrabPoint:aGrabPoint |
|
2715 | 5794 |
"translate the grab point into self" |
5795 |
||
1791 | 5796 |
superMenu isNil ifTrue:[ |
3938 | 5797 |
"I am the grabView" |
5798 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5799 |
^ aGrabPoint |
|
1791 | 5800 |
]. |
5801 |
||
5802 |
relativeGrabOrigin isNil ifTrue:[ |
|
3938 | 5803 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
5804 |
relativeGrabOrigin isNil ifTrue:[ |
|
5805 |
"I am the grabView" |
|
5806 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5807 |
^ aGrabPoint |
|
5808 |
]. |
|
1791 | 5809 |
]. |
5810 |
^ relativeGrabOrigin + aGrabPoint |
|
5811 |
! |
|
5812 |
||
5813 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 5814 |
"translate a point into another menu its point" |
5815 |
||
1791 | 5816 |
|grapPoint| |
5817 |
||
5818 |
aMenu == self ifTrue:[ |
|
3938 | 5819 |
^ aPoint |
1791 | 5820 |
]. |
5821 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
5822 |
||
2715 | 5823 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 5824 |
! |
5825 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5826 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 5827 |
"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
|
5828 |
|
3938 | 5829 |
^ device |
5830 |
translatePoint:aPoint asPoint |
|
5831 |
fromView:self |
|
5832 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5833 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5834 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 5835 |
! ! |
5836 |
||
388 | 5837 |
!MenuPanel::Item class methodsFor:'accessing'! |
5838 |
||
689 | 5839 |
horizontalInset |
5840 |
^ HorizontalInset |
|
5841 |
! |
|
5842 |
||
388 | 5843 |
labelRightOffset |
5844 |
^ LabelRightOffset |
|
5845 |
! |
|
5846 |
||
689 | 5847 |
verticalInset |
5848 |
^ VerticalInset |
|
1765 | 5849 |
! |
5850 |
||
5851 |
verticalPopUpInset |
|
5852 |
^ VerticalPopUpInset |
|
388 | 5853 |
! ! |
5854 |
||
616 | 5855 |
!MenuPanel::Item class methodsFor:'defaults'! |
5856 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5857 |
halfSeparatorSize |
2870 | 5858 |
"returns the size of a space-separator" |
5859 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5860 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5861 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5862 |
|
1699 | 5863 |
separatorSize |
2870 | 5864 |
"returns the size of a separator" |
5865 |
||
1699 | 5866 |
^ 10 |
616 | 5867 |
! |
5868 |
||
5869 |
updateStyleCache |
|
2777 | 5870 |
"extract values from the styleSheet and cache them in class variables" |
5871 |
||
1765 | 5872 |
<resource: #style (#'menuPanel.verticalInset')> |
5873 |
||
1699 | 5874 |
HorizontalInset := 2. |
1765 | 5875 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5876 |
VerticalPopUpInset := 2. |
|
727 | 5877 |
|
5878 |
HorizontalButtonInset := 3. |
|
5879 |
VerticalButtonInset := 3. |
|
5880 |
||
681 | 5881 |
LabelRightOffset := 15. |
1765 | 5882 |
|
2777 | 5883 |
" |
5884 |
self updateStyleCache |
|
5885 |
" |
|
1124 | 5886 |
! ! |
1078 | 5887 |
|
388 | 5888 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5889 |
||
5890 |
in:aSuperMenu |
|
5891 |
^ self in:aSuperMenu label:nil |
|
5892 |
! |
|
5893 |
||
5894 |
in:aSuperMenu label:aLabel |
|
5895 |
|item| |
|
5896 |
||
5897 |
item := self new in:aSuperMenu. |
|
5898 |
item label:aLabel. |
|
2870 | 5899 |
^ item |
388 | 5900 |
! |
5901 |
||
5902 |
in:aSuperMenu menuItem:aMenuItem |
|
5903 |
|item| |
|
5904 |
||
5905 |
item := self in:aSuperMenu. |
|
5906 |
item menuItem:aMenuItem. |
|
2870 | 5907 |
^ item. |
2359 | 5908 |
! |
5909 |
||
5910 |
new |
|
5911 |
^ self basicNew initialize |
|
388 | 5912 |
! ! |
5913 |
||
1808 | 5914 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5915 |
|
420 | 5916 |
canAccept |
2870 | 5917 |
"returns true if item is acceptable" |
5918 |
||
2199 | 5919 |
self enabled ifFalse:[ ^ false]. |
5920 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5921 |
||
5922 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
3558 | 5923 |
^ subMenu isNil or:[subMenu shown not] |
524 | 5924 |
! |
5925 |
||
5926 |
toggleIndication |
|
2870 | 5927 |
"toggle indication or choice" |
5928 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5929 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5930 |
|
3938 | 5931 |
indication notNil ifTrue:[ |
4118
a2a352a255a9
Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents:
4113
diff
changeset
|
5932 |
arg := self indicationValue not. |
a2a352a255a9
Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents:
4113
diff
changeset
|
5933 |
self indicationValue:arg. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5934 |
] ifFalse:[ |
4118
a2a352a255a9
Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents:
4113
diff
changeset
|
5935 |
(choice notNil and:[choice isValueModel])ifTrue:[ |
a2a352a255a9
Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents:
4113
diff
changeset
|
5936 |
choice value:(menuItem choiceValue). |
a2a352a255a9
Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents:
4113
diff
changeset
|
5937 |
^ true |
a2a352a255a9
Fix behavior, if a menu item's choice is a block
Stefan Vogel <sv@exept.de>
parents:
4113
diff
changeset
|
5938 |
]. |
524 | 5939 |
]. |
5940 |
^ arg |
|
389 | 5941 |
! ! |
5942 |
||
388 | 5943 |
!MenuPanel::Item methodsFor:'accessing'! |
5944 |
||
5945 |
accessCharacter |
|
2870 | 5946 |
"returns my accessCharacter or nil" |
5947 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5948 |
^ accessCharacter |
388 | 5949 |
! |
5950 |
||
5951 |
accessCharacterPosition |
|
2870 | 5952 |
"get the access character position or nil" |
5953 |
||
2359 | 5954 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5955 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5956 |
|
3938 | 5957 |
accessCharacterPosition:anIndex |
2870 | 5958 |
"set the access character position or nil" |
5959 |
||
2359 | 5960 |
menuItem accessCharacterPosition:anIndex. |
388 | 5961 |
! |
5962 |
||
5963 |
argument |
|
2870 | 5964 |
"gets the argument" |
5965 |
||
2359 | 5966 |
^ menuItem argument |
388 | 5967 |
! |
5968 |
||
5969 |
argument:anArgument |
|
2870 | 5970 |
"sets the argument" |
5971 |
||
2359 | 5972 |
menuItem argument:anArgument. |
389 | 5973 |
! |
5974 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5975 |
displayLabel |
2870 | 5976 |
"returns my printable Label" |
5977 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5978 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5979 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5980 |
|
2614 | 5981 |
displayLabelExtent |
2870 | 5982 |
"returns the labels extent" |
5983 |
||
3837 | 5984 |
|myFont prevFont w h| |
2614 | 5985 |
|
5986 |
displayLabelExtent notNil ifTrue:[ |
|
3938 | 5987 |
^ displayLabelExtent |
2614 | 5988 |
]. |
5989 |
||
5990 |
displayLabel isNil ifTrue:[ |
|
3938 | 5991 |
displayLabelExtent := 0@0. |
5992 |
^ displayLabelExtent |
|
2614 | 5993 |
]. |
3837 | 5994 |
|
5995 |
myFont := self font. |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
5996 |
myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ]. |
3837 | 5997 |
myFont := myFont onDevice:menuPanel device. |
5998 |
||
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
5999 |
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
|
6000 |
|
3837 | 6001 |
displayLabel isString ifTrue:[ |
3938 | 6002 |
w := displayLabel widthOn:menuPanel. |
6003 |
h := displayLabel heightOn:menuPanel. |
|
6004 |
"/ 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
|
6005 |
"/ h := myFont heightOf:displayLabel. |
3938 | 6006 |
] ifFalse:[ |
6007 |
displayLabel isArray ifTrue:[ |
|
6008 |
w := h := 0. |
|
6009 |
||
6010 |
displayLabel do:[:aSubLabel| |
|
6011 |
aSubLabel notNil ifTrue:[ |
|
6012 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
6013 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
6014 |
] ifFalse:[ |
|
6015 |
h := h + (self spaceBetweenEmptyLines) |
|
6016 |
] |
|
6017 |
] |
|
6018 |
] ifFalse:[ |
|
6019 |
w := displayLabel widthOn:menuPanel. |
|
6020 |
h := displayLabel heightOn:menuPanel. |
|
6021 |
]. |
|
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6022 |
]. |
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6023 |
|
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6024 |
menuPanel setFont:prevFont. "/ restore previous font |
3837 | 6025 |
|
2614 | 6026 |
"/ care for italic fonts - give a few more pixels at the end |
3837 | 6027 |
myFont italic ifTrue:[ |
3938 | 6028 |
w := w + 2. |
2614 | 6029 |
]. |
6030 |
displayLabelExtent := w@h. |
|
6031 |
^ displayLabelExtent |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
6032 |
|
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
6033 |
"Modified: / 17-08-2010 / 10:46:06 / cg" |
2614 | 6034 |
! |
6035 |
||
1727 | 6036 |
font |
2870 | 6037 |
"returns the user configured font or nil (default menu font)" |
6038 |
||
2373 | 6039 |
|font| |
6040 |
||
6041 |
menuPanel isNil ifTrue:[^ nil]. |
|
6042 |
||
6043 |
font := menuItem font. |
|
6044 |
||
6045 |
font notNil ifTrue:[ |
|
3938 | 6046 |
font := font onDevice:(menuPanel device). |
6047 |
menuItem font:font. |
|
2373 | 6048 |
]. |
1727 | 6049 |
^ font |
6050 |
! |
|
6051 |
||
6052 |
font:aFont |
|
2870 | 6053 |
"returns the user configured font or nil (default menu font)" |
6054 |
||
2373 | 6055 |
menuItem font:aFont. |
1727 | 6056 |
! |
6057 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6058 |
ignoreMnemonicKeys |
4076 | 6059 |
"if true, mnemonic (access character) in the submenus under the item are ignored. |
6060 |
Set this to speedup accelerator key processing for slow dynamci menus" |
|
2870 | 6061 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6062 |
^ menuItem ignoreMnemonicKeys |
4076 | 6063 |
|
6064 |
"Modified (comment): / 08-09-2011 / 04:29:47 / cg" |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6065 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6066 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6067 |
ignoreMnemonicKeys:aBoolean |
2870 | 6068 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
6069 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6070 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6071 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6072 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6073 |
ignoreShortcutKeys |
2870 | 6074 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
6075 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6076 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6077 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6078 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6079 |
ignoreShortcutKeys:aBoolean |
2870 | 6080 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
6081 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6082 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6083 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6084 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6085 |
itemValue |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6086 |
"gets the item's value" |
2870 | 6087 |
|
2360 | 6088 |
^ menuItem itemValue |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6089 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6090 |
"Modified (comment): / 06-03-2012 / 14:41:27 / cg" |
2360 | 6091 |
! |
6092 |
||
6093 |
itemValue:aValue |
|
2870 | 6094 |
"argument could be a value holder, an action or selector" |
6095 |
||
2360 | 6096 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6097 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6098 |
|
388 | 6099 |
label |
2870 | 6100 |
"returns the label" |
6101 |
||
388 | 6102 |
^ label |
6103 |
! |
|
6104 |
||
6105 |
label:aLabel |
|
399 | 6106 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 6107 |
handle characters $& (ST-80 compatibility)" |
6108 |
||
2614 | 6109 |
|size char oldExtent| |
6110 |
||
6111 |
oldExtent := displayLabelExtent. |
|
6112 |
displayLabelExtent := nil. "/ force a recomputation |
|
6113 |
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
|
6114 |
|
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
6115 |
"Stefan: Why do we use #value two times??" |
2614 | 6116 |
label := aLabel value. |
6117 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6118 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6119 |
displayLabel isString ifTrue:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6120 |
"CHECK FOR SEPARATOR" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6121 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6122 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6123 |
size := displayLabel size. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6124 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6125 |
size == 0 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6126 |
displayLabel := nil. "blank separator" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6127 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6128 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6129 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6130 |
size == 1 ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6131 |
char := displayLabel first. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6132 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6133 |
(char == $- or:[char == $=]) ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6134 |
label := displayLabel. "line separator" |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6135 |
displayLabel := nil. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6136 |
^ self |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6137 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6138 |
] |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6139 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6140 |
] ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6141 |
displayLabel isCollection ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6142 |
displayLabel := displayLabel asArray. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6143 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6144 |
]. |
4218 | 6145 |
menuPanel notNil ifTrue:[ |
6146 |
menuPanel doAccessCharacterTranslation ifTrue:[ |
|
6147 |
displayLabel notNil ifTrue:[ |
|
6148 |
displayLabel isArray ifTrue:[ |
|
6149 |
displayLabel keysAndValuesDo:[:i :el| |
|
6150 |
el notNil ifTrue:[ |
|
6151 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
6152 |
]. |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6153 |
]. |
4218 | 6154 |
] ifFalse:[ |
6155 |
displayLabel isImageOrForm ifFalse:[ |
|
6156 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
6157 |
]. |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6158 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6159 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6160 |
]. |
4218 | 6161 |
|
6162 |
menuPanel shown ifTrue:[ |
|
6163 |
self fetchImages. |
|
6164 |
||
6165 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
6166 |
self invalidate |
|
6167 |
] ifFalse:[ |
|
6168 |
menuPanel mustRearrange |
|
6169 |
] |
|
6170 |
]. |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6171 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6172 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6173 |
"Modified: / 06-10-2011 / 16:36:53 / cg" |
388 | 6174 |
! |
6175 |
||
6176 |
menuPanel |
|
2870 | 6177 |
"returns my menuPanel" |
6178 |
||
399 | 6179 |
^ menuPanel |
388 | 6180 |
! |
6181 |
||
6182 |
nameKey |
|
2870 | 6183 |
"gets the nameKey" |
6184 |
||
2359 | 6185 |
^ menuItem nameKey |
388 | 6186 |
! |
6187 |
||
6188 |
nameKey:aNameKey |
|
2870 | 6189 |
"sets the nameKey" |
6190 |
||
2359 | 6191 |
menuItem nameKey:aNameKey. |
388 | 6192 |
! |
6193 |
||
6194 |
rawLabel |
|
2870 | 6195 |
"returns my raw, unprocessed label" |
6196 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6197 |
^ menuItem rawLabel |
388 | 6198 |
! |
6199 |
||
6200 |
shortcutKey |
|
6201 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 6202 |
no submenu exists evaluate the action assigned to the item (accept)." |
6203 |
||
2359 | 6204 |
^ menuItem shortcutKey |
388 | 6205 |
! |
6206 |
||
6207 |
shortcutKey:aKey |
|
6208 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 6209 |
no submenu exists evaluate the action assigned to the item (accept)." |
6210 |
||
2359 | 6211 |
menuItem shortcutKey ~= aKey ifTrue:[ |
3938 | 6212 |
menuItem shortcutKey:aKey. |
6213 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6214 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6215 |
! |
388 | 6216 |
|
710 | 6217 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6218 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6219 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6220 |
|
2359 | 6221 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6222 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6223 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 6224 |
! |
6225 |
||
6226 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6227 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6228 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6229 |
|
2359 | 6230 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6231 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6232 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 6233 |
! |
6234 |
||
388 | 6235 |
submenu |
3133 | 6236 |
"returns my submenu or creates it if its defined via a selector or channel. |
6237 |
May return nil, if there is really no menu" |
|
6238 |
||
6239 |
subMenu isNil ifTrue:[ |
|
3938 | 6240 |
self setupSubmenu |
3133 | 6241 |
]. |
6242 |
^ subMenu |
|
6243 |
||
6244 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 6245 |
! |
6246 |
||
6247 |
submenu:aSubMenu |
|
3938 | 6248 |
"set a new submenu; an existing submenu will be destroyed. |
2870 | 6249 |
This might lead to a redraw if 'hasSubmenu' changed" |
6250 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6251 |
|widget| |
1767 | 6252 |
|
4196
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6253 |
subMenu notNil ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6254 |
subMenu ~~ aSubMenu ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6255 |
subMenu destroy. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6256 |
subMenu := nil. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6257 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6258 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6259 |
|
1767 | 6260 |
aSubMenu isNil ifTrue:[ |
4196
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6261 |
subMenu notNil ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6262 |
subMenu destroy. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6263 |
subMenu := nil. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6264 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6265 |
^ self |
1767 | 6266 |
]. |
6267 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6268 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
4196
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6269 |
subMenu := MenuPanel new. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6270 |
|
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6271 |
menuPanel notNil ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6272 |
subMenu receiver:menuPanel receiver. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6273 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6274 |
subMenu superMenu:menuPanel. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6275 |
|
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6276 |
menuItem horizontalLayout == true ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6277 |
subMenu verticalLayout:false |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6278 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6279 |
subMenu menu:aSubMenu. |
1767 | 6280 |
] ifFalse:[ |
4196
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6281 |
aSubMenu isView ifFalse:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6282 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6283 |
"/ ... mhhhh .... |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6284 |
^ menuItem submenuChannel:aSubMenu |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6285 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6286 |
widget := SimpleView new. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6287 |
widget client:aSubMenu. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6288 |
] ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6289 |
widget := aSubMenu. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6290 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6291 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6292 |
|
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6293 |
(widget isKindOf:MenuPanel) ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6294 |
subMenu := widget. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6295 |
|
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6296 |
menuItem horizontalLayout == true ifTrue:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6297 |
subMenu verticalLayout:false |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6298 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6299 |
] ifFalse:[ |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6300 |
subMenu := MenuPanel new. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6301 |
subMenu receiver:menuPanel receiver. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6302 |
subMenu addSubView:widget. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6303 |
subMenu extent:(widget preferredExtent). |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6304 |
widget origin:0.0@0.0 corner:1.0@1.0. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6305 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6306 |
subMenu superMenu:menuPanel. |
2360 | 6307 |
]. |
389 | 6308 |
! |
6309 |
||
3133 | 6310 |
submenuOrNil |
6311 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
6312 |
||
6313 |
^ subMenu |
|
6314 |
||
6315 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
6316 |
! |
|
6317 |
||
390 | 6318 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6319 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6320 |
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
|
6321 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6322 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6323 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6324 |
displayLabel notNil ifTrue:[ |
3938 | 6325 |
displayLabel isArray ifFalse:[ |
6326 |
^ displayLabel perform:#string ifNotUnderstood:nil |
|
6327 |
]. |
|
6328 |
||
6329 |
displayLabel do:[:el| |
|
6330 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
|
6331 |
^ txt |
|
6332 |
] |
|
6333 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6334 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6335 |
^ nil |
390 | 6336 |
! |
6337 |
||
1841 | 6338 |
triggerOnDown |
2870 | 6339 |
"return true if triggering the action if pressed" |
6340 |
||
2359 | 6341 |
menuItem triggerOnDown ifTrue:[ |
3938 | 6342 |
self hasSubmenu ifFalse:[^ true]. |
1841 | 6343 |
]. |
6344 |
^ false |
|
6345 |
! |
|
6346 |
||
6347 |
triggerOnDown:aBool |
|
2870 | 6348 |
"setup to trigger the action if pressed" |
6349 |
||
2359 | 6350 |
menuItem triggerOnDown:aBool. |
1841 | 6351 |
! |
6352 |
||
389 | 6353 |
value |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6354 |
"gets the item's value |
2870 | 6355 |
Left here for ST80 compatibility - value is a bad name" |
6356 |
||
2360 | 6357 |
^ menuItem itemValue |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6358 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6359 |
"Modified (comment): / 06-03-2012 / 14:41:23 / cg" |
2360 | 6360 |
! |
6361 |
||
6362 |
value:aValue |
|
389 | 6363 |
"could be a value holder, an action or selector |
2870 | 6364 |
Left here for ST80 compatibility - value: is a bad name" |
6365 |
||
2360 | 6366 |
menuItem itemValue:aValue. |
502 | 6367 |
! |
6368 |
||
6369 |
value:aValue argument:anArgument |
|
2870 | 6370 |
"set the value and an argument" |
6371 |
||
2360 | 6372 |
menuItem itemValue:aValue. |
6373 |
menuItem argument:anArgument. |
|
388 | 6374 |
! ! |
6375 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6376 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 6377 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6378 |
choice |
2870 | 6379 |
"implements a radio group; the field" |
6380 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6381 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6382 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6383 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6384 |
choice:something |
2870 | 6385 |
"set choice indication" |
6386 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6387 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6388 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6389 |
choice isValueModel ifTrue:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6390 |
choice removeDependent:self |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6391 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6392 |
|
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6393 |
choice := something. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6394 |
choice notNil ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6395 |
choice isSymbol ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6396 |
choice := (self aspectAt:choice) ? choice. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6397 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6398 |
choice isValueModel ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6399 |
choice addDependent:self |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6400 |
] |
1699 | 6401 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6402 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6403 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6404 |
choiceValue |
2870 | 6405 |
"implements a radio group; the value writen to the choice if selected" |
6406 |
||
2359 | 6407 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6408 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6409 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6410 |
choiceValue:something |
2870 | 6411 |
"implements a radio group; the value writen to the choice if selected" |
6412 |
||
2359 | 6413 |
menuItem choiceValue ~= something ifTrue:[ |
3938 | 6414 |
menuItem choiceValue:something. |
6415 |
choice notNil ifTrue:[ self invalidate ]. |
|
2359 | 6416 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6417 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6418 |
|
388 | 6419 |
enabled |
2870 | 6420 |
"returns the enabled state" |
6421 |
||
524 | 6422 |
|state| |
6423 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6424 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6425 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6426 |
enableChannel isSymbol ifTrue:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6427 |
state := self aspectAt:enableChannel. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6428 |
state isValueModel ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6429 |
enableChannel := state. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6430 |
enableChannel addDependent:self. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6431 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6432 |
] ifFalse:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6433 |
state := enableChannel. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6434 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6435 |
^ state value ~~ false |
388 | 6436 |
! |
6437 |
||
389 | 6438 |
enabled:something |
2870 | 6439 |
"change the enabled state; if the state changed, a redraw is performed" |
6440 |
||
390 | 6441 |
|oldState newState| |
6442 |
||
6443 |
enableChannel isNil ifTrue:[ |
|
3938 | 6444 |
oldState := true |
390 | 6445 |
] ifFalse:[ |
3938 | 6446 |
oldState := enableChannel value. |
6447 |
enableChannel isValueModel ifTrue:[ |
|
6448 |
enableChannel removeDependent:self |
|
6449 |
] |
|
388 | 6450 |
]. |
390 | 6451 |
enableChannel := something. |
6452 |
||
6453 |
enableChannel isNil ifTrue:[ |
|
3938 | 6454 |
menuPanel shown ifFalse:[^ self]. |
6455 |
newState := true |
|
390 | 6456 |
] ifFalse:[ |
3938 | 6457 |
enableChannel isValueModel ifTrue:[ |
6458 |
enableChannel addDependent:self |
|
6459 |
] ifFalse:[ |
|
6460 |
enableChannel isSymbol ifTrue:[^ self] |
|
6461 |
]. |
|
6462 |
menuPanel shown ifFalse:[^ self]. |
|
6463 |
newState := enableChannel value. |
|
390 | 6464 |
]. |
6465 |
||
6466 |
newState ~~ oldState ifTrue:[ |
|
3938 | 6467 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6468 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6469 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6470 |
|
1670 | 6471 |
hideMenuOnActivated |
2870 | 6472 |
"hide the menu when the item was activated; the default is true" |
6473 |
||
2359 | 6474 |
^ menuItem hideMenuOnActivated |
1670 | 6475 |
! |
6476 |
||
6477 |
hideMenuOnActivated:aBool |
|
2870 | 6478 |
"hide the menu when the item was activated; the default is true" |
6479 |
||
2359 | 6480 |
menuItem hideMenuOnActivated:aBool. |
1670 | 6481 |
! |
6482 |
||
2216 | 6483 |
ifNotInUIBuilderInfoPrintCR:aMessage |
6484 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
6485 |
||
3732 | 6486 |
|app| |
6487 |
||
6488 |
app := menuPanel application. |
|
6489 |
||
2216 | 6490 |
(menuPanel receiver isNil |
3732 | 6491 |
and:[ app notNil |
6492 |
and:[ app askFor:#isUIPainter]]) |
|
2216 | 6493 |
ifTrue:[ |
3938 | 6494 |
^ self "/ suppressed |
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6495 |
]. |
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6496 |
aMessage infoPrint. |
3833 | 6497 |
"/ app notNil ifTrue:[ |
6498 |
"/ ' Application: ' infoPrint. app infoPrint |
|
6499 |
"/ ]. |
|
3444
b7d2f3fe5055
avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents:
3441
diff
changeset
|
6500 |
'' infoPrintCR. |
2216 | 6501 |
! |
6502 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6503 |
indication |
2870 | 6504 |
"get on/off indication" |
6505 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6506 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6507 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6508 |
|
4226 | 6509 |
indication:aValueHolder |
2870 | 6510 |
"set on/off indication" |
6511 |
||
4226 | 6512 |
indication == aValueHolder ifTrue:[^ self]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6513 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6514 |
indication isValueModel ifTrue:[ |
4226 | 6515 |
indication removeDependent:self |
6516 |
]. |
|
6517 |
||
6518 |
(indication := aValueHolder) notNil ifTrue:[ |
|
6519 |
indication isValueModel ifTrue:[ |
|
6520 |
indication addDependent:self |
|
6521 |
] ifFalse:[ |
|
6522 |
"/ to force an update of the value |
|
6523 |
self indicationValue |
|
6524 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6525 |
]. |
464 | 6526 |
! |
6527 |
||
1767 | 6528 |
keepLinkedMenu |
2870 | 6529 |
"get the keepLinkedMenu flag" |
6530 |
||
2359 | 6531 |
^ menuItem keepLinkedMenu |
6532 |
! |
|
6533 |
||
6534 |
keepLinkedMenu:aBool |
|
2870 | 6535 |
"get the keepLinkedMenu flag" |
6536 |
||
2359 | 6537 |
menuItem keepLinkedMenu:aBool. |
1767 | 6538 |
! |
6539 |
||
2331 | 6540 |
sendToOriginator |
6541 |
"if true, the message is sent to the originating widget; |
|
6542 |
otherwise (the default), it it sent to the receiver/application." |
|
6543 |
||
2359 | 6544 |
^ menuItem sendToOriginator |
2331 | 6545 |
! |
6546 |
||
6547 |
sendToOriginator:aBoolean |
|
6548 |
"if true, the message is sent to the originating widget; |
|
6549 |
otherwise (the default), it it sent to the receiver/application." |
|
6550 |
||
2359 | 6551 |
menuItem sendToOriginator:aBoolean. |
2331 | 6552 |
! |
6553 |
||
464 | 6554 |
submenuChannel |
2870 | 6555 |
"get the submenu channel" |
6556 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6557 |
^ menuItem submenuChannel |
464 | 6558 |
! |
6559 |
||
6560 |
submenuChannel:aSelectorOrNil |
|
2870 | 6561 |
"returns the submenu channel" |
6562 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6563 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 6564 |
! ! |
6565 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6566 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 6567 |
|
2016 | 6568 |
moveBy:aPoint |
2870 | 6569 |
"move the layouts origin" |
6570 |
||
2016 | 6571 |
layout moveBy:aPoint. |
6572 |
! |
|
6573 |
||
1699 | 6574 |
preferredExtent |
2870 | 6575 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
6576 |
||
2614 | 6577 |
|isVertical icon wIcon isButton labelExtent |
1699 | 6578 |
x "{ Class:SmallInteger }" |
6579 |
y "{ Class:SmallInteger }" |
|
6580 |
s "{ Class:SmallInteger }" |
|
6581 |
| |
|
6582 |
self isVisible ifFalse:[^ 0@0 ]. |
|
6583 |
||
2359 | 6584 |
isButton := menuItem isButton. |
6585 |
||
1699 | 6586 |
isButton ifTrue:[ |
3987 | 6587 |
s := menuPanel maxAbsoluteButtonLevel ? 0. |
6588 |
x := s + HorizontalButtonInset. |
|
6589 |
y := s + VerticalButtonInset. |
|
1699 | 6590 |
] ifFalse:[ |
3987 | 6591 |
x := HorizontalInset. |
6592 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
|
1699 | 6593 |
]. |
6594 |
x := x * 2. |
|
6595 |
y := y * 2. |
|
6596 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6597 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6598 |
|
2362 | 6599 |
self isSeparator ifTrue:[ |
3987 | 6600 |
s := self class separatorSize. |
6601 |
label = '' ifTrue:[ |
|
6602 |
s := self class halfSeparatorSize. |
|
6603 |
]. |
|
6604 |
||
6605 |
"width of doubleSeparator is 5 !!!!" |
|
6606 |
isVertical ifFalse:[ |
|
6607 |
x := x max:s. |
|
6608 |
y := y + 5. |
|
6609 |
] ifTrue:[ |
|
6610 |
y := y max:s. |
|
6611 |
x := x + 5. |
|
6612 |
]. |
|
1699 | 6613 |
] ifFalse:[ |
3987 | 6614 |
labelExtent := self displayLabelExtent. |
6615 |
||
6616 |
x := x + labelExtent x. |
|
6617 |
y := y + labelExtent y. |
|
6618 |
x := x + (menuPanel stringOffsetXfor:self). |
|
6619 |
||
6620 |
isButton ifFalse:[ |
|
6621 |
menuPanel showSeparatingLines ifTrue:[ |
|
6622 |
"width of separator is 2 plus right offset 1 := 3" |
|
6623 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
|
6624 |
]. |
|
6625 |
]. |
|
6626 |
wIcon := 0. |
|
6627 |
self hasMenuIndicator ifTrue:[ |
|
6628 |
icon := MenuPanel menuIndicator. |
|
6629 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
|
6630 |
] ifFalse:[ |
|
6631 |
self hasDelayedMenuIndicator ifTrue:[ |
|
6632 |
icon := MenuPanel delayedMenuIndicator. |
|
6633 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
|
6634 |
] |
|
6635 |
]. |
|
6636 |
x := x + wIcon. |
|
1699 | 6637 |
]. |
6638 |
^ x@y |
|
3987 | 6639 |
|
6640 |
"Modified: / 19-01-2011 / 21:20:35 / cg" |
|
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6641 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6642 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6643 |
preferredHeight |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6644 |
^ self preferredExtent y |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6645 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6646 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6647 |
preferredWidth |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
6648 |
^ self preferredExtent x |
388 | 6649 |
! ! |
6650 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6651 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 6652 |
|
6653 |
activeHelpKey |
|
2870 | 6654 |
"get the active helpKey; the key to retrieve the helpText from the application" |
6655 |
||
2359 | 6656 |
^ menuItem activeHelpKey |
1613 | 6657 |
! |
6658 |
||
6659 |
activeHelpKey:aHelpKey |
|
2870 | 6660 |
"set the active helpKey; the key to retrieve the helpText from the application" |
6661 |
||
2359 | 6662 |
menuItem activeHelpKey:aHelpKey. |
6663 |
activeHelpText := nil. |
|
1613 | 6664 |
! |
6665 |
||
6666 |
activeHelpText |
|
2870 | 6667 |
"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
|
6668 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6669 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6670 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6671 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6672 |
|
3938 | 6673 |
((key := self activeHelpKey) notNil |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6674 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
3938 | 6675 |
^ app helpTextForKey:key. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6676 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6677 |
^ nil |
1613 | 6678 |
! |
6679 |
||
6680 |
activeHelpText:aText |
|
2870 | 6681 |
"set the active helpText" |
6682 |
||
1613 | 6683 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6684 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6685 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6686 |
flyByHelpText |
2870 | 6687 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6688 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6689 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6690 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6691 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6692 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6693 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6694 |
|
2471 | 6695 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
6696 |
"/ (if you have an argument for that let us know..) |
|
6697 |
"/ self isButton ifFalse:[^ nil]. |
|
6698 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6699 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6700 |
"/ if an activeHelpKey was explicitely given, use that one |
3938 | 6701 |
key := self activeHelpKey. |
2895 | 6702 |
app := menuPanel application. |
6703 |
||
6704 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
6705 |
(key isAssociation) ifTrue:[ |
|
3938 | 6706 |
app := key key. |
6707 |
key := key value. |
|
2895 | 6708 |
]. |
6709 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6710 |
key notNil ifTrue:[ |
3938 | 6711 |
app notNil ifTrue:[ |
6712 |
text := app flyByHelpTextForKey:key. |
|
6713 |
]. |
|
6714 |
text isNil ifTrue:[ |
|
6715 |
text := menuPanel flyByHelpTextForKey:key. |
|
6716 |
]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6717 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6718 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6719 |
"/ 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
|
6720 |
text isNil ifTrue:[ |
3938 | 6721 |
self hasSubmenu ifTrue:[ |
6722 |
^ key |
|
6723 |
]. |
|
6724 |
||
6725 |
text := key. |
|
6726 |
text isNil ifTrue:[ |
|
6727 |
displayLabel isString ifTrue:[ |
|
6728 |
text := displayLabel string. |
|
6729 |
]. |
|
6730 |
]. |
|
6731 |
text isNil ifTrue:[ |
|
6732 |
text := self rawLabel. |
|
6733 |
text isString ifFalse:[ |
|
6734 |
text := menuItem rawLabel. |
|
6735 |
text isString ifFalse:[ |
|
6736 |
text := nil. |
|
6737 |
] |
|
6738 |
]. |
|
6739 |
text notNil ifTrue:[ |
|
6740 |
(text includes:$&) ifTrue:[ |
|
6741 |
text := (self updateAccessCharacterFor:text) string. |
|
6742 |
]. |
|
6743 |
]. |
|
6744 |
]. |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6745 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6746 |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
6747 |
(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
|
6748 |
text = displayLabel ifTrue:[ |
3938 | 6749 |
"for text menus: it does not make sense to show the labels string again |
6750 |
(i.e. in a pull down menu)" |
|
6751 |
^ nil |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6752 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6753 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6754 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6755 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6756 |
flyByHelpText:aText |
2870 | 6757 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
6758 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6759 |
flyByHelpText := aText. |
1613 | 6760 |
! ! |
6761 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6762 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6763 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6764 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6765 |
"on default submenus has a vertical layout; |
2870 | 6766 |
true, the submenu has a horizontal layout." |
6767 |
||
2360 | 6768 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6769 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6770 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6771 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6772 |
"on default submenus has a vertical layout; |
2870 | 6773 |
true, the submenu has a horizontal layout." |
6774 |
||
2360 | 6775 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6776 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6777 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6778 |
isButton |
2870 | 6779 |
"returns whether the item looks like a Button" |
6780 |
||
2359 | 6781 |
^ menuItem isButton |
6782 |
! |
|
6783 |
||
6784 |
isButton:aBool |
|
2870 | 6785 |
"set/clear the item to look like a Button" |
6786 |
||
2359 | 6787 |
menuItem isButton ~~ aBool ifTrue:[ |
3938 | 6788 |
menuItem isButton:aBool. |
6789 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6790 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6791 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6792 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6793 |
layout |
2870 | 6794 |
"returns my layout ( Rectangle )" |
6795 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6796 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6797 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6798 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6799 |
layout:aLayout |
2870 | 6800 |
"set a new layout ( Rectangle )" |
6801 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6802 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6803 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6804 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6805 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6806 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6807 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 6808 |
while performing the menu action. Defaults to false." |
6809 |
||
2359 | 6810 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6811 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6812 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6813 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6814 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 6815 |
while performing the menu action. Defaults to false." |
6816 |
||
2359 | 6817 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6818 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6819 |
|
2504 | 6820 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 6821 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6822 |
currentSubmenu |
2870 | 6823 |
"returns the current submenu or nil" |
6824 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6825 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6826 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6827 |
|
1705 | 6828 |
hideSubmenu |
2870 | 6829 |
"hide submenu" |
6830 |
||
2199 | 6831 |
self hideSubmenu:subMenu. |
6832 |
! |
|
6833 |
||
6834 |
hideSubmenu:aSubmenu |
|
2870 | 6835 |
"hide submenu" |
6836 |
||
2871 | 6837 |
|id wg| |
1705 | 6838 |
|
2374 | 6839 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 6840 |
aSubmenu removeDependencies. |
2199 | 6841 |
|
6842 |
aSubmenu realized ifFalse:[ |
|
3938 | 6843 |
id := aSubmenu id. |
6844 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
|
2199 | 6845 |
] ifTrue:[ |
3938 | 6846 |
aSubmenu hide |
2199 | 6847 |
]. |
6848 |
||
2870 | 6849 |
aSubmenu windowGroup:nil. |
2871 | 6850 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
3938 | 6851 |
wg removeView:aSubmenu. |
2871 | 6852 |
]. |
2199 | 6853 |
|
6854 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6855 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
3938 | 6856 |
menuItem keepLinkedMenu ifFalse:[ |
6857 |
subMenu := nil |
|
6858 |
] |
|
2199 | 6859 |
]. |
6860 |
! |
|
6861 |
||
6862 |
openDelayedSubmenu |
|
2870 | 6863 |
"called to open now my delayed submenu" |
6864 |
||
3133 | 6865 |
|subMenuBeforeOpening| |
2199 | 6866 |
|
6867 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
6868 |
||
2374 | 6869 |
subMenu notNil ifTrue:[ |
4239 | 6870 |
subMenu realized ifTrue:[ |
6871 |
"/ already open |
|
6872 |
^ self |
|
6873 |
]. |
|
2199 | 6874 |
]. |
3133 | 6875 |
self setupSubmenu. |
6876 |
subMenu isNil ifTrue:[^ self]. |
|
4241 | 6877 |
subMenu hasItems ifFalse:[^ self]. |
3133 | 6878 |
subMenuBeforeOpening := subMenu. |
2199 | 6879 |
self openSubmenu. |
6880 |
||
3133 | 6881 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
4239 | 6882 |
"/ closed during building or opening the submenu |
6883 |
self hideSubmenu:subMenuBeforeOpening. |
|
3133 | 6884 |
]. |
6885 |
||
6886 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 6887 |
! |
1701 | 6888 |
|
6889 |
openSubmenu |
|
6890 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
6891 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 6892 |
nescessary." |
6893 |
||
3203 | 6894 |
|p o device isVertical topMenu windGrp prefExtent lastEvent |
1701 | 6895 |
devBot "{ Class:SmallInteger }" |
6896 |
devRight "{ Class:SmallInteger }" |
|
6897 |
width "{ Class:SmallInteger }" |
|
6898 |
height "{ Class:SmallInteger }" |
|
6899 |
top "{ Class:SmallInteger }" |
|
6900 |
left "{ Class:SmallInteger }" |
|
6901 |
| |
|
6902 |
||
4150 | 6903 |
(subMenu isNil or:[subMenu shown or:[self isSelected not or:[menuPanel realized not]]]) ifTrue:[ |
3975 | 6904 |
^ self |
6905 |
]. |
|
6906 |
"close all other open submenus assigned to the menuPanel I'am located in" |
|
6907 |
||
6908 |
menuPanel itemsDo:[:eachItem| |
|
6909 |
(eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[ |
|
6910 |
eachItem hideSubmenu. |
|
6911 |
]. |
|
6912 |
]. |
|
1701 | 6913 |
topMenu := menuPanel topMenu. |
1829 | 6914 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
3975 | 6915 |
subMenu releaseDeviceResources. |
6916 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
6917 |
subMenu recreate. |
|
1829 | 6918 |
]. |
6919 |
||
1701 | 6920 |
windGrp := topMenu windowGroup. |
3203 | 6921 |
windGrp notNil ifTrue:[ |
3975 | 6922 |
lastEvent := windGrp lastEvent. |
6923 |
||
6924 |
(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[ |
|
6925 |
subMenu mapTime:(lastEvent timeStamp). |
|
6926 |
]. |
|
3203 | 6927 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6928 |
subMenu superMenu:menuPanel. |
1701 | 6929 |
subMenu becomesActiveMenu. |
6930 |
subMenu cursor:Cursor hand. |
|
6931 |
||
6932 |
windGrp notNil ifTrue:[ |
|
3975 | 6933 |
subMenu windowGroup:windGrp. |
6934 |
windGrp addTopView:subMenu. |
|
1701 | 6935 |
]. |
6936 |
||
2111 | 6937 |
"Q&D kludge - test whether the layout is nil; |
3975 | 6938 |
if true recompute the layouts |
2111 | 6939 |
" |
2374 | 6940 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6941 |
|
4150 | 6942 |
isVertical := menuPanel verticalLayout. |
6943 |
||
6944 |
p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft]. |
|
6945 |
menuPanel isPopUpView ifTrue:[ |
|
6946 |
o := menuPanel origin + p |
|
6947 |
] ifFalse:[ |
|
6948 |
o := menuPanel translatePoint:p to:nil. "/ translate to root window |
|
6949 |
]. |
|
6950 |
subMenu origin:o. "set temporary origin to compute preferredExtent" |
|
6951 |
||
1701 | 6952 |
" Q&D kludge - if any visibility attributes are blocks; |
6953 |
TODO: only invoke mustRearrange if any are blocks |
|
3975 | 6954 |
(since I react correctly on valueHolder changes) |
1701 | 6955 |
" |
6956 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6957 |
subMenu fixSize. |
|
6958 |
||
4150 | 6959 |
"compute origin of subMenu" |
1701 | 6960 |
device := menuPanel device. |
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6961 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6962 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6963 |
width := prefExtent x. |
4150 | 6964 |
devBot := device usableHeightAt:o. |
1701 | 6965 |
devRight := device usableWidth. |
6966 |
||
6967 |
left := o x. |
|
6968 |
top := o y. |
|
6969 |
||
2016 | 6970 |
top + height > devBot ifTrue:[ |
3975 | 6971 |
top := isVertical ifTrue:[devBot - height] |
6972 |
ifFalse:[top - layout height - height + 2] |
|
3938 | 6973 |
]. |
2016 | 6974 |
|
6975 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6976 |
"/ top < menuPanel bottom ifTrue:[ |
|
6977 |
"/ left := left + layout width. |
|
6978 |
"/ ]. |
|
6979 |
"/ left + width > devRight ifTrue:[ |
|
6980 |
"/ left := o x - width - 2 |
|
6981 |
"/ ]. |
|
6982 |
"/ ]. |
|
3938 | 6983 |
|
1701 | 6984 |
left + width > devRight ifTrue:[ |
3975 | 6985 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6986 |
ifFalse:[devRight - width] |
|
3938 | 6987 |
]. |
6988 |
||
6989 |
"/ ***** MULTI SCREEN |
|
6990 |
"/ top := top max:0. |
|
6991 |
"/ left := left max:0. |
|
1701 | 6992 |
|
6993 |
subMenu origin:(left@top). |
|
6994 |
||
6995 |
subMenu realized ifFalse:[ |
|
3975 | 6996 |
subMenu realize. |
1701 | 6997 |
] ifTrue:[ |
3975 | 6998 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6999 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7000 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7001 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7002 |
toggleSubmenuVisibility |
2870 | 7003 |
"toggle the visibility of the submenu" |
7004 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7005 |
subMenu notNil ifTrue:[ |
3938 | 7006 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7007 |
] ifFalse:[ |
3938 | 7008 |
self setupSubmenu. |
7009 |
subMenu isNil ifTrue:[ |
|
7010 |
"/ cannot open a submenu |
|
7011 |
^ self |
|
7012 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7013 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7014 |
self openSubmenu. |
3133 | 7015 |
|
7016 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7017 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7018 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7019 |
visibleSubmenu |
2870 | 7020 |
"returns the current visible submenu or nil" |
7021 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7022 |
subMenu notNil ifTrue:[ |
3938 | 7023 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7024 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7025 |
^ nil |
1701 | 7026 |
! ! |
7027 |
||
524 | 7028 |
!MenuPanel::Item methodsFor:'building'! |
7029 |
||
7030 |
aspectAt:aKey |
|
3092 | 7031 |
"returns the value assigned to key or nil" |
2870 | 7032 |
|
524 | 7033 |
|appl value| |
7034 |
||
7035 |
appl := menuPanel receiver. |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
7036 |
(appl isValueModel) ifTrue:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7037 |
^ appl value:aKey |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7038 |
]. |
2123 | 7039 |
appl isNil ifTrue:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7040 |
appl := menuPanel application. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7041 |
appl isNil ifTrue:[ ^ nil]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7042 |
]. |
2123 | 7043 |
|
7044 |
MessageNotUnderstood handle:[:ex| |
|
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7045 |
ex selector ~~ aKey ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7046 |
ex reject |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7047 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7048 |
self ifNotInUIBuilderInfoPrintCR: |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7049 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2 (in %3)' |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7050 |
bindWith:appl classNameWithArticle |
4316 | 7051 |
with:aKey |
7052 |
with:(label isString ifTrue:[label] ifFalse:[self nameKey ? self itemValue ? '???'])). |
|
2123 | 7053 |
] do:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7054 |
aKey numArgs == 1 ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7055 |
value := appl perform:aKey with:(menuItem argument ? self). |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7056 |
] ifFalse:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7057 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7058 |
value := appl aspectFor:aKey |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7059 |
] ifFalse:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7060 |
value := appl perform:aKey |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7061 |
] |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7062 |
] |
524 | 7063 |
]. |
7064 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
7065 |
|
4316 | 7066 |
"Modified: / 02-08-2013 / 16:44:28 / cg" |
524 | 7067 |
! ! |
7068 |
||
390 | 7069 |
!MenuPanel::Item methodsFor:'change & update'! |
7070 |
||
2614 | 7071 |
fontChanged |
2870 | 7072 |
"called whenever the font changed" |
7073 |
||
2614 | 7074 |
displayLabel notNil ifTrue:[ |
3938 | 7075 |
displayLabelExtent := nil. |
7076 |
||
7077 |
subMenu notNil ifTrue:[ |
|
7078 |
subMenu font:(menuPanel font). |
|
7079 |
]. |
|
2614 | 7080 |
]. |
7081 |
! |
|
7082 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7083 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7084 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7085 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7086 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7087 |
(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
|
7088 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7089 |
self isSeparator ifFalse:[ |
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7090 |
"/ NOT A SEPARATOR |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7091 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7092 |
menuPanel shown ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7093 |
changedObject == enableChannel ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7094 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7095 |
^ menuPanel selection:nil. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7096 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7097 |
^ self invalidate |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7098 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7099 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7100 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7101 |
menuItem isButton ifTrue:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7102 |
self invalidate |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7103 |
] ifFalse:[ |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7104 |
"/ invalidate the interactor only |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7105 |
"/ take any interactor; interactors has the same extent |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7106 |
form := menuPanel iconIndicationOff. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7107 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7108 |
rect := Rectangle left:(layout left + HorizontalInset) |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7109 |
top:(layout top) |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7110 |
width:(form width) |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7111 |
height:(layout height). |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7112 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7113 |
menuPanel invalidate:rect repairNow:false |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7114 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7115 |
^ self |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7116 |
]. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7117 |
self invalidate. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7118 |
]. |
498 | 7119 |
]. |
712 | 7120 |
|
7121 |
changedObject == isVisible ifTrue:[ |
|
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7122 |
menuPanel mustRearrange. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7123 |
"/ 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
|
7124 |
"/ 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
|
7125 |
"/ too early if more items change their visibility. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7126 |
"/ redraw will call rearrangeItems, if the mustRearrange is set. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7127 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7128 |
"/ menuPanel rearrangeItems. |
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7129 |
^ self. |
712 | 7130 |
]. |
7131 |
||
498 | 7132 |
super update:something with:aParameter from:changedObject |
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7133 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7134 |
"Modified (comment): / 24-11-2011 / 19:01:42 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7135 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7136 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7137 |
updateIndicators |
2870 | 7138 |
"update indicators " |
7139 |
||
2934 | 7140 |
indication notNil ifTrue:[ |
3938 | 7141 |
(indication isSymbol |
7142 |
or:[menuItem hideMenuOnActivated not]) |
|
7143 |
ifTrue:[ |
|
7144 |
"indication is a selector; |
|
7145 |
otherwise no need to redraw, because |
|
7146 |
a change notification is raised from the model !!!!" |
|
7147 |
self update:nil with:nil from:indication |
|
7148 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
7149 |
] |
390 | 7150 |
! ! |
7151 |
||
388 | 7152 |
!MenuPanel::Item methodsFor:'converting'! |
7153 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7154 |
asMenuItem |
2870 | 7155 |
"convert to a MenuItem" |
7156 |
||
2359 | 7157 |
^ menuItem |
388 | 7158 |
! |
7159 |
||
2827 | 7160 |
menuItem |
7161 |
^ menuItem |
|
7162 |
! |
|
7163 |
||
388 | 7164 |
menuItem:aMenuItem |
2870 | 7165 |
"setup attributes from a MenuItem" |
7166 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7167 |
|lbl| |
389 | 7168 |
|
388 | 7169 |
menuPanel disabledRedrawDo:[ |
3938 | 7170 |
menuItem := aMenuItem. |
7171 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
7172 |
||
7173 |
label := displayLabel := activeHelpText := nil. |
|
7174 |
||
7175 |
self enabled:(menuItem enabled). |
|
7176 |
self indication:(menuItem indication). |
|
7177 |
self choice:(menuItem choice). |
|
7178 |
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
|
7179 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7180 |
"/ 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
|
7181 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7182 |
|
3938 | 7183 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
7184 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
7185 |
]. |
|
7186 |
||
7187 |
self submenu:(menuItem submenu). |
|
7188 |
self label:lbl. |
|
388 | 7189 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
7190 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
7191 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 7192 |
! ! |
7193 |
||
2681 | 7194 |
!MenuPanel::Item methodsFor:'dependents access'! |
7195 |
||
7196 |
addDependencies |
|
2870 | 7197 |
"add all dependencies" |
7198 |
||
2681 | 7199 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
7200 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
7201 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
7202 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
7203 |
! |
|
7204 |
||
7205 |
removeDependencies |
|
2870 | 7206 |
"remove all dependencies" |
7207 |
||
2681 | 7208 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
7209 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
7210 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
7211 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
7212 |
! ! |
|
7213 |
||
388 | 7214 |
!MenuPanel::Item methodsFor:'drawing'! |
7215 |
||
2768 | 7216 |
choiceForm |
2870 | 7217 |
"returns choice form or nil" |
7218 |
||
2768 | 7219 |
|isOn| |
7220 |
||
7221 |
choice isNil ifTrue:[^ nil]. |
|
7222 |
||
7223 |
isOn := (choice value = menuItem choiceValue). |
|
7224 |
self enabled ifFalse:[ |
|
3938 | 7225 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
7226 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
2768 | 7227 |
]. |
3565 | 7228 |
self isSelected ifTrue:[ |
3938 | 7229 |
^ isOn == true |
7230 |
ifTrue:[menuPanel iconRadioGroupEnteredOn] |
|
7231 |
ifFalse:[menuPanel iconRadioGroupEnteredOff] |
|
3565 | 7232 |
]. |
2768 | 7233 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
3938 | 7234 |
ifFalse:[menuPanel iconRadioGroupOff] |
2768 | 7235 |
! |
7236 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7237 |
draw |
2870 | 7238 |
"redraw this item" |
7239 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7240 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7241 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7242 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7243 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7244 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7245 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7246 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7247 |
self isVisible ifFalse:[^ self]. |
4152 | 7248 |
layout isNil ifTrue:[ |
7249 |
"/ cg: why does this happen - it does!! |
|
7250 |
^ self |
|
7251 |
]. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7252 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7253 |
self isSeparator ifTrue:[ |
4152 | 7254 |
self drawSeparator. |
7255 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7256 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7257 |
menuItem isButton ifTrue:[ |
4152 | 7258 |
self drawButton. |
7259 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7260 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7261 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7262 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7263 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7264 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7265 |
bgColor := menuPanel backgroundColor. |
3938 | 7266 |
paint := isSelected |
4152 | 7267 |
ifTrue:[self activeBackgroundColor] |
7268 |
ifFalse:[ |
|
7269 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
|
7270 |
menuPanel enteredBackgroundColor |
|
7271 |
] ifFalse:[ |
|
7272 |
bgColor |
|
7273 |
]]. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7274 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7275 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
4152 | 7276 |
paint := ownBgCol |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7277 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7278 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7279 |
paint ~= bgColor ifTrue:[ |
4152 | 7280 |
menuPanel paint:paint. |
7281 |
menuPanel fillRectangle:layout. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7282 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7283 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7284 |
menuPanel showSeparatingLines ifTrue:[ |
4152 | 7285 |
self drawSeparatingLines |
3938 | 7286 |
]. |
7287 |
||
7288 |
self drawLabel. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7289 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7290 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
4152 | 7291 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
7292 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
|
7293 |
||
7294 |
x := layout left. |
|
7295 |
y := layout top. |
|
7296 |
w := layout width. |
|
7297 |
h := layout height. |
|
7298 |
||
7299 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
|
7300 |
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
|
7301 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7302 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7303 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7304 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7305 |
drawButton |
2870 | 7306 |
"draw as button" |
7307 |
||
2362 | 7308 |
|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
|
7309 |
x "{ Class:SmallInteger }" |
2143 | 7310 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7311 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7312 |
drawObject := displayLabel. |
2362 | 7313 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7314 |
isSelected := self isSelected. |
2362 | 7315 |
|
7316 |
isSelected ifFalse:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7317 |
"/ 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
|
7318 |
showSelected := (self isToggle and:[self indicationValue]). |
2362 | 7319 |
] ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7320 |
showSelected := isSelected |
2362 | 7321 |
]. |
7322 |
||
7323 |
showSelected ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7324 |
bg := self activeBackgroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7325 |
fg := self activeForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7326 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7327 |
self isEntered ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7328 |
bg := self buttonEnteredBackgroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7329 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7330 |
bg := self backgroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7331 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7332 |
isEnabled ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7333 |
fg := menuPanel foregroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7334 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7335 |
fg := menuPanel disabledForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7336 |
etchFg := menuPanel disabledEtchedForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7337 |
drawObject := self disabledRawLabel |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7338 |
] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7339 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7340 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7341 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7342 |
bg := ownBgCol |
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7343 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7344 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7345 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7346 |
bg ~= menuPanel backgroundColor ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7347 |
menuPanel paint:bg. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7348 |
menuPanel fillRectangle:layout. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7349 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7350 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7351 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 7352 |
|
7353 |
(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
|
7354 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
2337 | 7355 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7356 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7357 |
isSelected ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7358 |
"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
|
7359 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7360 |
indication notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7361 |
"button is indicator and set" |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7362 |
isSelected := self indicationValue |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7363 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7364 |
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
|
7365 |
] |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7366 |
]. |
2143 | 7367 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7368 |
|
3938 | 7369 |
isSelected ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7370 |
level := menuPanel buttonActiveLevel. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7371 |
x := x + 1 "level abs". |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7372 |
y := y + 1 "level abs". |
3938 | 7373 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7374 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7375 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 7376 |
]. |
7377 |
||
2817 | 7378 |
drawObject notEmptyOrNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7379 |
etchFg notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7380 |
"/ 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
|
7381 |
drawObject isImageOrForm ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7382 |
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
|
7383 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7384 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7385 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
2362 | 7386 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7387 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7388 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7389 |
level ~~ 0 ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7390 |
menuPanel drawButtonEdgesFor:self level:level |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7391 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7392 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7393 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7394 |
drawLabel |
2870 | 7395 |
"draw a labeled entry; no button, no separator." |
7396 |
||
3938 | 7397 |
|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
|
7398 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7399 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7400 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7401 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7402 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7403 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7404 |
drawObject := displayLabel. |
2362 | 7405 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7406 |
isSelected := self isSelected. |
2362 | 7407 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7408 |
isSelected ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7409 |
fg := self activeForegroundColor |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7410 |
] ifFalse:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7411 |
isEnabled ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7412 |
self isEntered ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7413 |
fg := menuPanel enteredForegroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7414 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7415 |
fg := menuPanel foregroundColor |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7416 |
] |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7417 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7418 |
fg := menuPanel disabledForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7419 |
etchFg := menuPanel disabledEtchedForegroundColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7420 |
drawObject := self disabledRawLabel |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7421 |
] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7422 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7423 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7424 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7425 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7426 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7427 |
|
3131 | 7428 |
( (form := self indicatorForm) notNil |
7429 |
or:[(form := self choiceForm) notNil] |
|
7430 |
) ifTrue:[ |
|
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7431 |
y := t + ((h - form height) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7432 |
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
|
7433 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7434 |
|
2817 | 7435 |
drawObject notEmptyOrNil ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7436 |
x := x + (menuPanel stringOffsetXfor:self). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7437 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7438 |
etchFg notNil ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7439 |
"/ 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
|
7440 |
drawObject isImageOrForm ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7441 |
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
|
7442 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7443 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7444 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
2362 | 7445 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7446 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7447 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7448 |
"/ DRAW SHORTCUT KEY |
2359 | 7449 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7450 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7451 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7452 |
) ifTrue:[ |
3976
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7453 |
x := layout left + x. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7454 |
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
|
7455 |
y := y + menuPanel font ascent. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7456 |
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
|
7457 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7458 |
|
3403 | 7459 |
"/ DRAW SUBMENU INDICATION (if a vertical menu with submenu) |
7460 |
(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
|
7461 |
arrow := menuPanel rightArrow. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7462 |
x := layout right - arrow width - HorizontalInset. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7463 |
y := t + ((h - arrow height) // 2). |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7464 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7465 |
(menuPanel styleSheet is3D not |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7466 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7467 |
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
|
7468 |
] ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7469 |
cLa := menuPanel shadowColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7470 |
cLb := menuPanel lightColor. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7471 |
|
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7472 |
isSelected ifFalse:[ |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7473 |
fg := cLa. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7474 |
cLa := cLb. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7475 |
cLb := fg |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7476 |
]. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7477 |
menuPanel paint:cLa. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7478 |
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
|
7479 |
menuPanel paint:cLb. |
b4631e698205
bugfix: donot draw icons twice if disabled and etch color is specified
ca
parents:
3975
diff
changeset
|
7480 |
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
|
7481 |
]. |
3403 | 7482 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7483 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7484 |
"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
|
7485 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7486 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7487 |
drawMenuIndicator |
2870 | 7488 |
"draw a menu indicator if the item has a menu or delayed menu." |
7489 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7490 |
|x y icon bAbsLevel verticalPosition| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7491 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7492 |
icon := self menuIndicatorIcon. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7493 |
icon isNil ifTrue:[ |
3938 | 7494 |
^ self |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7495 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7496 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7497 |
x := layout right - icon width. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7498 |
verticalPosition := menuPanel menuIndicatorVerticalPosition. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7499 |
verticalPosition == #center ifTrue:[ |
3938 | 7500 |
y := (layout height - icon height) // 2 + layout top. |
2220 | 7501 |
] ifFalse:[ |
3938 | 7502 |
verticalPosition == #top ifTrue:[ |
7503 |
y := layout top + 2. |
|
7504 |
] ifFalse:[ |
|
7505 |
y := layout bottom - icon height - 2. |
|
7506 |
] |
|
2220 | 7507 |
]. |
7508 |
||
7509 |
bAbsLevel := 0. |
|
2359 | 7510 |
menuItem isButton ifTrue:[ |
3938 | 7511 |
self isSelected ifTrue:[ |
7512 |
x := x + 1. |
|
7513 |
y := y + 1. |
|
7514 |
]. |
|
7515 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
7516 |
x := x - bAbsLevel. |
|
7517 |
y := y - bAbsLevel. |
|
2220 | 7518 |
]. |
7519 |
x := x - 1 "- HorizontalInset". |
|
7520 |
||
7521 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
3938 | 7522 |
icon := menuPanel lightenedImageOnDevice:icon |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7523 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7524 |
icon displayOn:menuPanel x:x y:y. |
2220 | 7525 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7526 |
(menuPanel drawMenuIndicatorSeparatorLine |
3938 | 7527 |
and:[ self isEntered |
7528 |
and:[ menuPanel buttonEnteredLevel ~~ 0] ]) |
|
7529 |
ifTrue:[ |
|
7530 |
menuPanel paint:menuPanel buttonShadowColor. |
|
7531 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
7532 |
menuPanel paint:menuPanel buttonLightColor. |
|
7533 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
2220 | 7534 |
]. |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7535 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7536 |
|
2059 | 7537 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 7538 |
"draw a labeled entry; no button, no separator." |
7539 |
||
3486 | 7540 |
|oldFont labelExtent |
1727 | 7541 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7542 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7543 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7544 |
| |
2059 | 7545 |
|
3486 | 7546 |
oldFont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7547 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7548 |
menuPanel paint:fg. |
2614 | 7549 |
labelExtent := self displayLabelExtent. |
7550 |
||
4232 | 7551 |
y := layout top + ((layout height - labelExtent y) // 2) + yOffset. |
2337 | 7552 |
"/ menuPanel centerItems ifTrue:[self halt]. |
3938 | 7553 |
aLabel isArray ifFalse:[ |
4232 | 7554 |
|printLabel| |
7555 |
||
7556 |
aLabel isText ifTrue:[ |
|
7557 |
"/ background of label has already been drawn |
|
7558 |
printLabel := aLabel withoutBackgroundColorEmphasis. |
|
7559 |
] ifFalse:[ |
|
7560 |
printLabel := aLabel. |
|
7561 |
]. |
|
7562 |
y := y + (printLabel ascentOn:menuPanel). |
|
7563 |
printLabel displayOn:menuPanel x:x y:y. |
|
1727 | 7564 |
] ifTrue:[ |
4232 | 7565 |
aLabel do:[:el| |
7566 |
el notNil ifTrue:[ |
|
7567 |
y0 := y + (el ascentOn:menuPanel). |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7568 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7569 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7570 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7571 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7572 |
"/ ]. |
4232 | 7573 |
x0 := x + ((labelExtent x - (el widthOn:menuPanel)) // 2). |
7574 |
el displayOn:menuPanel x:x0 y:y0. |
|
7575 |
y := y + 1 + (el heightOn:menuPanel) |
|
7576 |
] ifFalse:[ |
|
7577 |
y := y + (self spaceBetweenEmptyLines) |
|
7578 |
] |
|
7579 |
]. |
|
1727 | 7580 |
]. |
3486 | 7581 |
menuPanel setFont:oldFont |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7582 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7583 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7584 |
drawSeparatingLines |
2870 | 7585 |
"draw separating lines" |
7586 |
||
2059 | 7587 |
|myIndex lfSep rtSep items prevItem nextItem |
7588 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7589 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7590 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7591 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7592 |
b "{ Class:SmallInteger }" |
706 | 7593 |
| |
2059 | 7594 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7595 |
items := menuPanel items. |
2059 | 7596 |
myIndex := items identityIndexOf:self. |
7597 |
||
7598 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
7599 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
7600 |
||
7601 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
7602 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
7603 |
||
7604 |
(lfSep or:[rtSep]) ifFalse:[ |
|
3938 | 7605 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7606 |
]. |
2059 | 7607 |
|
7608 |
lightColor := menuPanel lightColor. |
|
7609 |
shadowColor := menuPanel shadowColor. |
|
7610 |
||
7611 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7612 |
|
608 | 7613 |
l := layout left. |
7614 |
t := layout top. |
|
7615 |
r := layout right. |
|
7616 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7617 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7618 |
menuPanel verticalLayout ifTrue:[ |
3938 | 7619 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
7620 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
7621 |
||
7622 |
menuPanel paint:shadowColor. |
|
7623 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
7624 |
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
|
7625 |
] ifFalse:[ |
3938 | 7626 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
7627 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
7628 |
||
7629 |
menuPanel paint:shadowColor. |
|
7630 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
7631 |
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
|
7632 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7633 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7634 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7635 |
drawSeparator |
2870 | 7636 |
"draw as separator" |
7637 |
||
2059 | 7638 |
|type lightColor shadowColor isDouble |
7639 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7640 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7641 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7642 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7643 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7644 |
| |
2059 | 7645 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7646 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7647 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
4152 | 7648 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7649 |
]. |
2059 | 7650 |
|
7651 |
isDouble := type == #doubleLine. |
|
7652 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7653 |
lightColor := menuPanel lightColor. |
2059 | 7654 |
shadowColor := menuPanel shadowColor. |
7655 |
menuPanel paint:shadowColor. |
|
7656 |
||
7657 |
left := layout left. |
|
7658 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7659 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7660 |
menuPanel verticalLayout ifTrue:[ |
4152 | 7661 |
x0 := left + HorizontalInset. |
7662 |
x1 := layout right - HorizontalInset. |
|
7663 |
y0 := top - 1 + (layout height // 2). |
|
7664 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
7665 |
||
7666 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
7667 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
7668 |
||
7669 |
menuPanel paint:lightColor. |
|
7670 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
7671 |
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
|
7672 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7673 |
] ifFalse:[ |
4152 | 7674 |
y1 := layout bottom. |
7675 |
x0 := left - 1 + (layout width // 2). |
|
7676 |
y0 := top. |
|
7677 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
7678 |
||
7679 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
7680 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
7681 |
||
7682 |
menuPanel paint:lightColor. |
|
7683 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
7684 |
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
|
7685 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7686 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7687 |
|
2768 | 7688 |
indicatorForm |
2870 | 7689 |
"returns indication form or nil" |
7690 |
||
3565 | 7691 |
|isOn| |
2768 | 7692 |
|
7693 |
indication isNil ifTrue:[^ nil]. |
|
7694 |
||
3565 | 7695 |
isOn := self indicationValue. |
2768 | 7696 |
self enabled ifFalse:[ |
3938 | 7697 |
^ isOn == true |
7698 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
7699 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 7700 |
]. |
3565 | 7701 |
"/ self isSelected ifTrue:[ |
3938 | 7702 |
"/ ^ isOn == true |
3565 | 7703 |
"/ ifTrue:[menuPanel iconIndicationEnteredOn] |
7704 |
"/ ifFalse:[menuPanel iconIndicationEnteredOff] |
|
7705 |
"/ ]. |
|
7706 |
||
3938 | 7707 |
^ isOn == true |
7708 |
ifTrue:[menuPanel iconIndicationOn] |
|
7709 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 7710 |
! |
7711 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7712 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7713 |
|
2362 | 7714 |
layout isNil ifTrue:[^ self]. |
7715 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7716 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
3938 | 7717 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7718 |
] |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7719 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7720 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7721 |
menuIndicatorIcon |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7722 |
"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
|
7723 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7724 |
self hasDelayedMenuIndicator ifTrue:[ |
3938 | 7725 |
^ MenuPanel delayedMenuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7726 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7727 |
self hasMenuIndicator ifTrue:[ |
3938 | 7728 |
^ MenuPanel menuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7729 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7730 |
^ nil |
388 | 7731 |
! ! |
7732 |
||
7733 |
!MenuPanel::Item methodsFor:'initialization'! |
|
7734 |
||
7735 |
destroy |
|
2870 | 7736 |
"destroy submenus, remove dependencies" |
7737 |
||
616 | 7738 |
self submenu:nil. |
2681 | 7739 |
self removeDependencies. |
616 | 7740 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7741 |
menuPanel := nil. |
616 | 7742 |
! |
7743 |
||
794 | 7744 |
in:aPanel |
2870 | 7745 |
"create item in a menuPanel" |
7746 |
||
794 | 7747 |
menuPanel := aPanel. |
2359 | 7748 |
|
7749 |
menuItem isNil ifTrue:[ |
|
3938 | 7750 |
self breakPoint:#ca. |
7751 |
menuItem := MenuItem new |
|
2359 | 7752 |
]. |
7753 |
! |
|
7754 |
||
7755 |
initialize |
|
7756 |
menuItem := MenuItem new. |
|
1811 | 7757 |
! |
7758 |
||
7759 |
reinitStyle |
|
7760 |
||
7761 |
subMenu notNil ifTrue:[ |
|
3147 | 7762 |
subMenu reinitStyle |
1811 | 7763 |
]. |
7764 |
||
7765 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
7766 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 7767 |
! ! |
7768 |
||
7769 |
!MenuPanel::Item methodsFor:'label basics'! |
|
7770 |
||
7771 |
disabledRawLabel |
|
2870 | 7772 |
"returns the label used if the item is disabled" |
7773 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7774 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7775 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7776 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7777 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7778 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7779 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7780 |
disabledDisplayLabel isString ifTrue:[ |
3938 | 7781 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7782 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7783 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7784 |
block := [:el| |rslt| |
3938 | 7785 |
(rslt := el) notNil ifTrue:[ |
7786 |
el isImageOrForm ifTrue:[ |
|
7787 |
el colorMap notNil ifTrue:[ |
|
7788 |
rslt := menuPanel lightenedImageOnDevice:el |
|
7789 |
] |
|
7790 |
] ifFalse:[ |
|
7791 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
|
7792 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
|
7793 |
form := menuPanel lightenedImageOnDevice:form |
|
7794 |
]. |
|
7795 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
|
7796 |
image := menuPanel lightenedImageOnDevice:image |
|
7797 |
]. |
|
7798 |
rslt := LabelAndIcon form:form image:image string:(el string). |
|
7799 |
] |
|
7800 |
] |
|
7801 |
]. |
|
7802 |
rslt |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7803 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7804 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7805 |
displayLabel isArray ifTrue:[ |
3938 | 7806 |
disabledDisplayLabel := Array new:(displayLabel size). |
7807 |
||
7808 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
|
7809 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
|
7810 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7811 |
] ifFalse:[ |
3938 | 7812 |
disabledDisplayLabel := block value:displayLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7813 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7814 |
^ disabledDisplayLabel |
794 | 7815 |
! |
7816 |
||
1829 | 7817 |
fetchDeviceResources |
2373 | 7818 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7819 |
disabledDisplayLabel := nil. |
1829 | 7820 |
self fetchImages. |
7821 |
! |
|
7822 |
||
616 | 7823 |
fetchImages |
2870 | 7824 |
"fetch my icon images" |
7825 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7826 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7827 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7828 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
3938 | 7829 |
^ self |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7830 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7831 |
displayLabel isImageOrForm ifTrue:[ |
3938 | 7832 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
7833 |
^ self. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7834 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7835 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7836 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
3938 | 7837 |
(icon := displayLabel image) notNil ifTrue:[ |
7838 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
|
7839 |
]. |
|
7840 |
(icon := displayLabel icon) notNil ifTrue:[ |
|
7841 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
|
7842 |
]. |
|
7843 |
^ self |
|
7844 |
]. |
|
7845 |
||
7846 |
displayLabel isArray ifFalse:[^ self]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7847 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7848 |
displayLabel keysAndValuesDo:[:i :el| |
3938 | 7849 |
(el notNil and:[el isString not]) ifTrue:[ |
7850 |
el isImageOrForm ifTrue:[ |
|
7851 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
|
7852 |
] ifFalse:[ |
|
7853 |
el class == LabelAndIcon ifTrue:[ |
|
7854 |
(icon := el image) notNil ifTrue:[ |
|
7855 |
el image:(menuPanel imageOnMyDevice:icon) |
|
7856 |
]. |
|
7857 |
(icon := el icon) notNil ifTrue:[ |
|
7858 |
el icon:(menuPanel imageOnMyDevice:icon) |
|
7859 |
] |
|
7860 |
] |
|
7861 |
] |
|
7862 |
] |
|
1078 | 7863 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7864 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7865 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7866 |
updateAccessCharacterFor:aLabel |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7867 |
"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
|
7868 |
|
3192 | 7869 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7870 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7871 |
aLabel isString ifFalse:[ |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7872 |
aLabel class == LabelAndIcon ifTrue:[ |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7873 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7874 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7875 |
^ aLabel |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7876 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
7877 |
|
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7878 |
^ MenuPanel |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7879 |
processAmpersandCharactersFor:aLabel |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7880 |
withAccessCharacterPosition:(menuItem accessCharacterPosition). |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7881 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
7882 |
"Modified: / 15-02-2012 / 18:53:11 / cg" |
388 | 7883 |
! ! |
7884 |
||
1573 | 7885 |
!MenuPanel::Item methodsFor:'printing & storing'! |
7886 |
||
4139
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7887 |
displayOn:aGCOrStream |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7888 |
"Compatibility |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7889 |
append a printed desription on some stream (Dolphin, Squeak) |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7890 |
OR: |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7891 |
display the receiver in a graphicsContext at 0@0 (ST80). |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7892 |
This method allows for any object to be displayed in some view |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7893 |
(although the fallBack is to display its printString ...)" |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7894 |
|
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7895 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7896 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7897 |
aGCOrStream isStream ifFalse:[ |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7898 |
^ super displayOn:aGCOrStream. |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7899 |
]. |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7900 |
|
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7901 |
aGCOrStream |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7902 |
nextPutAll:self class name; |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7903 |
nextPut:$(. |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7904 |
label displayOn:aGCOrStream. |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
7905 |
aGCOrStream nextPut:$). |
1573 | 7906 |
! ! |
7907 |
||
388 | 7908 |
!MenuPanel::Item methodsFor:'private'! |
7909 |
||
650 | 7910 |
activeBackgroundColor |
2870 | 7911 |
"returns the active background color derived from menuPanel" |
7912 |
||
2359 | 7913 |
menuItem isButton ifTrue:[ |
3938 | 7914 |
^ menuPanel buttonActiveBackgroundColor |
2359 | 7915 |
]. |
7916 |
^ menuPanel activeBackgroundColor |
|
650 | 7917 |
! |
7918 |
||
7919 |
activeForegroundColor |
|
2870 | 7920 |
"returns the active foreground color derived from menuPanel" |
650 | 7921 |
|
3441 | 7922 |
menuItem isButton ifTrue:[ |
3938 | 7923 |
^ menuPanel buttonActiveForegroundColor |
3441 | 7924 |
]. |
650 | 7925 |
^menuPanel activeForegroundColor |
7926 |
! |
|
7927 |
||
727 | 7928 |
backgroundColor |
2870 | 7929 |
"returns the background color derived from menuPanel" |
7930 |
||
2359 | 7931 |
menuItem isButton ifTrue:[ |
3938 | 7932 |
^ menuPanel buttonPassiveBackgroundColor |
2359 | 7933 |
]. |
7934 |
^ menuPanel backgroundColor |
|
727 | 7935 |
! |
7936 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7937 |
backgroundColorFromLabel |
2870 | 7938 |
"returns the background color derived from label or nil" |
7939 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7940 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7941 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7942 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7943 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7944 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7945 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7946 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7947 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7948 |
run size == 0 ifTrue:[ |
3938 | 7949 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
7950 |
^ run value |
|
7951 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7952 |
] ifFalse:[ |
3938 | 7953 |
run do:[:r| |
7954 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
7955 |
^ r value |
|
7956 |
] |
|
7957 |
] |
|
388 | 7958 |
]. |
7959 |
^ nil |
|
7960 |
! |
|
7961 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7962 |
buttonEnteredBackgroundColor |
3938 | 7963 |
"returns the background color to use when thhe mouse has entered |
2870 | 7964 |
derived from menuPanel" |
7965 |
||
2359 | 7966 |
menuItem isButton ifTrue:[ |
3938 | 7967 |
^ menuPanel buttonEnteredBackgroundColor |
2359 | 7968 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7969 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7970 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7971 |
|
663 | 7972 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7973 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7974 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7975 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7976 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7977 |
|
3866
fbdbf71489d8
show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
7978 |
|subm sel numArgs gotMenu| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7979 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7980 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7981 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7982 |
sel := menuItem submenuChannel. |
3934 | 7983 |
(sel isString or:[sel isSymbol]) ifFalse:[^ nil]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7984 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7985 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7986 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7987 |
numArgs == 0 ifTrue:[ |
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7988 |
gotMenu := false. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7989 |
MessageNotUnderstood handle:[:ex | |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7990 |
|selector| |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7991 |
|
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7992 |
((selector := ex selector) == sel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7993 |
or:[selector == #aspectFor:]) ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7994 |
ex reject |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7995 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7996 |
] do:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7997 |
subm := aRecv aspectFor:sel. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7998 |
gotMenu := true. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
7999 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8000 |
"/ 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
|
8001 |
"/ 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
|
8002 |
gotMenu ifTrue:[^ subm]. |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8003 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8004 |
|
2043 | 8005 |
(Array with:(aRecv) with:(aRecv class)) |
8006 |
do:[:aPossibleReceiver | |
|
4025
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8007 |
MessageNotUnderstood handle:[:ex| |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8008 |
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
|
8009 |
] do:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8010 |
numArgs == 0 ifTrue:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8011 |
subm := aPossibleReceiver perform:sel |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8012 |
] ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8013 |
numArgs == 1 ifTrue:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8014 |
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
|
8015 |
] ifFalse:[ |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8016 |
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
|
8017 |
] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8018 |
] |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8019 |
]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8020 |
subm notNil ifTrue:[^ subm]. |
065f1854215f
give a warning about missing menu spec on the transcript
Claus Gittinger <cg@exept.de>
parents:
3987
diff
changeset
|
8021 |
Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
4027 | 8022 |
"/ ('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
|
8023 |
] |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8024 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8025 |
|
663 | 8026 |
^ subm |
2043 | 8027 |
|
4027 | 8028 |
"Modified: / 24-03-2011 / 11:20:24 / cg" |
663 | 8029 |
! |
8030 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8031 |
indicationValue |
2870 | 8032 |
"returns indication value or nil in case of no indication" |
8033 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8034 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8035 |
|
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8036 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8037 |
|
3938 | 8038 |
indication isSymbol ifFalse:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8039 |
^ indication value == true "block or model" |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8040 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8041 |
|
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8042 |
numArgs := indication numArgs. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8043 |
numArgs == 2 ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8044 |
recv := menuPanel receiver ? menuPanel application. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8045 |
(recv notNil and:[recv isValueModel not]) ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8046 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8047 |
sel := sel asSymbol. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8048 |
|
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8049 |
MessageNotUnderstood handle:[:ex| |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8050 |
ex selector ~~ sel ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8051 |
ex reject. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8052 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8053 |
] do:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8054 |
sel := recv perform:sel with:(menuItem argument). |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8055 |
] |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8056 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8057 |
] ifFalse:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8058 |
numArgs == 0 ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8059 |
sel := indication |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8060 |
] ifFalse:[ |
4209
690b2ad1414b
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4196
diff
changeset
|
8061 |
sel := (indication copyButLast:1) asSymbol. |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8062 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8063 |
sel := self aspectAt:sel. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8064 |
sel isValueModel ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8065 |
indication := sel. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8066 |
indication addDependent:self. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8067 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8068 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8069 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8070 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8071 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8072 |
indicationValue:aValue |
2870 | 8073 |
"set the indication value" |
8074 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8075 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8076 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8077 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8078 |
|
3938 | 8079 |
indication isSymbol ifFalse:[ |
4316 | 8080 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
8081 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8082 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8083 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8084 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
4316 | 8085 |
^ self |
1218 | 8086 |
]. |
8087 |
||
524 | 8088 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8089 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8090 |
|
1218 | 8091 |
recv isNil ifTrue:[ |
4316 | 8092 |
recv := menuPanel application. |
8093 |
recv isNil ifTrue:[^ self]. |
|
3938 | 8094 |
]. |
8095 |
||
8096 |
MessageNotUnderstood handle:[:ex| |
|
4316 | 8097 |
(ex selector ~~ indication) ifTrue:[ |
8098 |
ex reject |
|
8099 |
]. |
|
8100 |
self ifNotInUIBuilderInfoPrintCR: |
|
8101 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
|
8102 |
bindWith:recv classNameWithArticle |
|
8103 |
with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8104 |
] do:[ |
4316 | 8105 |
numArgs == 1 ifTrue:[ |
8106 |
recv perform:indication with:aValue |
|
8107 |
] ifFalse:[ |
|
8108 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
8109 |
] |
|
8110 |
]. |
|
8111 |
||
8112 |
"Modified (format): / 02-08-2013 / 16:42:20 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8113 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8114 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8115 |
isEntered |
2870 | 8116 |
"returns true if the mouse pointer is over the item" |
8117 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8118 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8119 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8120 |
"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
|
8121 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8122 |
|
464 | 8123 |
separatorType |
2870 | 8124 |
"returns type of separator line or nil" |
8125 |
||
390 | 8126 |
|c lbl| |
388 | 8127 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8128 |
self isSeparator ifFalse:[ |
3938 | 8129 |
^ nil |
388 | 8130 |
]. |
8131 |
||
390 | 8132 |
(lbl := label value) isNil ifTrue:[ |
3938 | 8133 |
^ #singleLine |
388 | 8134 |
]. |
8135 |
||
390 | 8136 |
lbl size == 1 ifTrue:[ |
3938 | 8137 |
c := lbl first. |
8138 |
c == $- ifTrue:[^ #singleLine]. |
|
8139 |
c == $= ifTrue:[^ #doubleLine]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8140 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8141 |
^ #blankLine |
1130 | 8142 |
! |
8143 |
||
8144 |
setupSubmenu |
|
3938 | 8145 |
|appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding |
3934 | 8146 |
channel whoProvidedMenu t| |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8147 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8148 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8149 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8150 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8151 |
subMenu notNil ifTrue:[ |
3938 | 8152 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8153 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8154 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8155 |
channel isSymbol ifFalse:[ |
3938 | 8156 |
submenuHolder := channel |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8157 |
] ifTrue:[ |
3938 | 8158 |
"/ submenu is specified by a selector in submenuChannel. |
8159 |
"/ who gets me the menu: |
|
8160 |
"/ 1) submenuProvider (if not nil) |
|
8161 |
"/ 2) menuPanel application |
|
8162 |
"/ 3) menuPanel receiver |
|
8163 |
"/ 4) menuPanel application master-chain |
|
8164 |
"/ 5) menuPanel receiver master-chain |
|
8165 |
||
8166 |
(submenuProvider := menuItem submenuProvider) notNil ifTrue:[ |
|
8167 |
submenuHolder := self findSubMenuIn:submenuProvider. |
|
8168 |
whoProvidedMenu := submenuProvider. |
|
8169 |
]. |
|
8170 |
submenuHolder isNil ifTrue:[ |
|
8171 |
appl := menuPanel application. |
|
8172 |
(appl notNil and:[appl ~~ submenuProvider]) ifTrue:[ |
|
8173 |
submenuHolder := self findSubMenuIn:appl. |
|
8174 |
whoProvidedMenu := appl. |
|
8175 |
]. |
|
8176 |
submenuHolder isNil ifTrue:[ |
|
8177 |
recv := menuPanel receiver. |
|
8178 |
(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[ |
|
8179 |
submenuHolder := self findSubMenuIn:recv. |
|
8180 |
whoProvidedMenu := recv. |
|
8181 |
]. |
|
8182 |
(submenuHolder isNil and:[appl notNil]) ifTrue:[ |
|
8183 |
t := appl. |
|
8184 |
[ submenuHolder isNil |
|
8185 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8186 |
] whileTrue:[ |
|
8187 |
( master ~~ appl |
|
8188 |
and:[ master ~~ recv |
|
8189 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8190 |
submenuHolder := self findSubMenuIn:master. |
|
8191 |
]. |
|
8192 |
t := master. |
|
8193 |
whoProvidedMenu := master. |
|
8194 |
] |
|
8195 |
]. |
|
8196 |
(submenuHolder isNil and:[recv notNil]) ifTrue:[ |
|
8197 |
t := recv. |
|
8198 |
[ submenuHolder isNil |
|
8199 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8200 |
] whileTrue:[ |
|
8201 |
( master ~~ appl |
|
8202 |
and:[ master ~~ recv |
|
8203 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8204 |
submenuHolder := self findSubMenuIn:master. |
|
8205 |
]. |
|
8206 |
t := master. |
|
8207 |
whoProvidedMenu := master. |
|
8208 |
] |
|
8209 |
]. |
|
8210 |
]. |
|
8211 |
]. |
|
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8212 |
"/ submenuHolder isNil ifTrue:[ |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8213 |
"/ self halt:'did not find any menu' |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8214 |
"/ ]. |
3934 | 8215 |
|
8216 |
"/ appl := menuPanel application. |
|
8217 |
"/ appl isNil ifTrue:[ |
|
8218 |
"/ appl := menuPanel receiver. |
|
8219 |
"/ appl notNil ifTrue:[ |
|
8220 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
|
3938 | 8221 |
"/ [submenuHolder isNil |
3934 | 8222 |
"/ and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
8223 |
"/ and:[master ~~ appl]]] whileTrue:[ |
|
8224 |
"/ appl := master. |
|
8225 |
"/ submenuHolder := self findSubMenuIn:appl. |
|
8226 |
"/ ]. |
|
8227 |
"/ ] |
|
8228 |
"/ ]. |
|
8229 |
"/ ]. |
|
3938 | 8230 |
"/ submenuHolder isNil ifTrue:[ |
3934 | 8231 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
8232 |
"/ (recv := menuPanel receiver) ~~ appl ifTrue:[ |
|
8233 |
"/ appl := recv. |
|
8234 |
"/ submenuHolder := self findSubMenuIn:appl |
|
8235 |
"/ ] |
|
8236 |
"/ ] |
|
8237 |
"/ ] |
|
8238 |
]. |
|
8239 |
||
8240 |
(newSubmenu := submenuHolder value) isArray ifTrue:[ |
|
3938 | 8241 |
submenuEncoding := newSubmenu. |
8242 |
newSubmenu := Menu decodeFromLiteralArray:submenuEncoding. |
|
8243 |
"/ cg: linked menus also may contain translations ... |
|
8244 |
newSubmenu notNil ifTrue:[ |
|
8245 |
whoProvidedMenu "appl" notNil ifTrue:[ |
|
8246 |
newSubmenu findGuiResourcesIn:whoProvidedMenu "appl". |
|
8247 |
] |
|
8248 |
]. |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8249 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8250 |
"/ appl notNil ifTrue:[submenu application:appl]. |
3934 | 8251 |
self submenu:newSubmenu. |
1130 | 8252 |
^ subMenu |
8253 |
||
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8254 |
"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
|
8255 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8256 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8257 |
spaceBetweenEmptyLines |
3938 | 8258 |
^ 3 |
388 | 8259 |
! ! |
8260 |
||
8261 |
!MenuPanel::Item methodsFor:'queries'! |
|
8262 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8263 |
canChangeVisibility |
1699 | 8264 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 8265 |
otherwise there is a change notification raised if the model changed" |
8266 |
||
3122 | 8267 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 8268 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 8269 |
|
8270 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 8271 |
"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
|
8272 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8273 |
|
388 | 8274 |
canSelect |
1699 | 8275 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 8276 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
8277 |
||
2362 | 8278 |
self isSeparator ifTrue:[^ false]. |
8279 |
||
8280 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
3938 | 8281 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
8282 |
^ true |
|
8283 |
]. |
|
1078 | 8284 |
]. |
8285 |
^ false |
|
388 | 8286 |
! |
8287 |
||
2046 | 8288 |
containsPoint:aPoint |
2870 | 8289 |
"returns true if aPoint is contained in my layout" |
8290 |
||
2046 | 8291 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8292 |
^ layout containsPoint:aPoint |
2046 | 8293 |
]. |
8294 |
^ false |
|
8295 |
||
8296 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
8297 |
! |
|
8298 |
||
388 | 8299 |
containsPointX:x y:y |
2870 | 8300 |
"returns true if point is contained in my layout" |
8301 |
||
712 | 8302 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8303 |
^ layout containsPointX:x y:y |
505 | 8304 |
]. |
8305 |
^ false |
|
388 | 8306 |
! |
8307 |
||
2199 | 8308 |
hasDelayedMenu |
2870 | 8309 |
"returns true if a delayed menu exists" |
8310 |
||
2360 | 8311 |
self hasSubmenu ifFalse:[ |
3938 | 8312 |
^ false |
2199 | 8313 |
]. |
2360 | 8314 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
8315 |
||
8316 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
3938 | 8317 |
^ false |
2199 | 8318 |
]. |
8319 |
^ true |
|
8320 |
! |
|
8321 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8322 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8323 |
"returns true if the item has a delayed menu |
2870 | 8324 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8325 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8326 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8327 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8328 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8329 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8330 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8331 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8332 |
hasIndication |
2870 | 8333 |
"returns true if on/off indication exists" |
8334 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8335 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8336 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8337 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8338 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8339 |
"returns true if the item has a delayed menu |
2870 | 8340 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8341 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8342 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8343 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8344 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8345 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8346 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8347 |
|
388 | 8348 |
hasSubmenu |
2870 | 8349 |
"returns true if the item is configured as an subMenu entry" |
3938 | 8350 |
|
2870 | 8351 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
388 | 8352 |
! |
8353 |
||
8354 |
isEnabled |
|
2870 | 8355 |
"returns the enabled state" |
8356 |
||
388 | 8357 |
^ self enabled |
8358 |
! |
|
8359 |
||
608 | 8360 |
isSeparator |
2870 | 8361 |
"returns true if item is a separator" |
8362 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8363 |
^ displayLabel isNil |
608 | 8364 |
! |
8365 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8366 |
isToggle |
2870 | 8367 |
"returns true if on/off indication exists" |
8368 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8369 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8370 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8371 |
|
712 | 8372 |
isVisible |
2870 | 8373 |
"returns the visibility state" |
8374 |
||
712 | 8375 |
|state| |
8376 |
||
8377 |
isVisible isSymbol ifTrue:[ |
|
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8378 |
state := self aspectAt:isVisible. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8379 |
state isValueModel ifTrue:[ |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8380 |
isVisible := state. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8381 |
isVisible addDependent:self. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8382 |
]. |
712 | 8383 |
] ifFalse:[ |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8384 |
state := isVisible |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8385 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8386 |
^ state value ~~ false |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8387 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8388 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 8389 |
! |
8390 |
||
8391 |
isVisible:something |
|
2870 | 8392 |
"change the visibility state; if the state changed, a redraw is performed" |
8393 |
||
712 | 8394 |
|oldState newState| |
8395 |
||
8396 |
isVisible isNil ifTrue:[ |
|
3938 | 8397 |
oldState := true |
712 | 8398 |
] ifFalse:[ |
3938 | 8399 |
oldState := isVisible value. |
8400 |
isVisible isValueModel ifTrue:[ |
|
8401 |
isVisible removeDependent:self |
|
8402 |
] |
|
712 | 8403 |
]. |
8404 |
isVisible := something. |
|
8405 |
||
8406 |
isVisible isNil ifTrue:[ |
|
3938 | 8407 |
newState := true |
712 | 8408 |
] ifFalse:[ |
3938 | 8409 |
isVisible isValueModel ifTrue:[ |
8410 |
isVisible addDependent:self |
|
8411 |
] ifFalse:[ |
|
8412 |
isVisible isSymbol ifTrue:[^ self] |
|
8413 |
]. |
|
8414 |
menuPanel shown ifFalse:[^ self]. |
|
8415 |
newState := isVisible value. |
|
712 | 8416 |
]. |
8417 |
||
8418 |
newState ~~ oldState ifTrue:[ |
|
3938 | 8419 |
menuPanel mustRearrange |
712 | 8420 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8421 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8422 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 8423 |
! |
8424 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8425 |
menuIndicatorContains:aPoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8426 |
"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
|
8427 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8428 |
|icon xSep| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8429 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8430 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8431 |
(layout containsPoint:aPoint) ifTrue:[ |
8432 |
icon := self menuIndicatorIcon. |
|
8433 |
icon notNil ifTrue:[ |
|
8434 |
xSep := layout right - icon width. |
|
8435 |
^ aPoint x >= xSep |
|
8436 |
] |
|
8437 |
] |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8438 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8439 |
^ false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8440 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8441 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8442 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8443 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8444 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8445 |
|
388 | 8446 |
shortcutKeyAsString |
3601 | 8447 |
"converts shortcutKey to a text object for the menu-label-hint. |
8448 |
returns nil, if the key has no assignment." |
|
2870 | 8449 |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8450 |
|shortcutKey| |
2359 | 8451 |
|
8452 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 8453 |
|
8454 |
shortcutKey isNil ifTrue:[ |
|
3938 | 8455 |
^ nil |
1609 | 8456 |
]. |
8457 |
shortcutKey isCharacter ifTrue:[ |
|
3938 | 8458 |
shortcutKey == Character space ifFalse:[ |
8459 |
^ 'Space' |
|
8460 |
]. |
|
8461 |
^ shortcutKey asString |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8462 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8463 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8464 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8465 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 8466 |
! ! |
8467 |
||
8468 |
!MenuPanel::Item methodsFor:'selection'! |
|
8469 |
||
8470 |
isSelected |
|
2870 | 8471 |
"returns true if item is selected" |
1998 | 8472 |
|
8473 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 8474 |
! |
8475 |
||
2249 | 8476 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
8477 |
"change selection to a state. Dependant on the state open or hide an existing |
2870 | 8478 |
submenu and perform a redraw" |
8479 |
||
2249 | 8480 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
3938 | 8481 |
self invalidate. |
8482 |
self hideSubmenu. |
|
8483 |
^ self |
|
2249 | 8484 |
]. |
8485 |
||
2199 | 8486 |
menuPanel realized ifFalse:[ ^ self ]. |
8487 |
||
2359 | 8488 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
3938 | 8489 |
self invalidate |
2199 | 8490 |
]. |
8491 |
self hasSubmenu ifFalse:[ ^ self]. |
|
8492 |
||
8493 |
self hasDelayedMenu ifTrue:[ |
|
3938 | 8494 |
menuPanel openDelayed:self |
2199 | 8495 |
] ifFalse:[ |
3938 | 8496 |
self setupSubmenu. |
8497 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
|
1701 | 8498 |
]. |
3133 | 8499 |
|
8500 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 8501 |
! ! |
8502 |
||
2692 | 8503 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
8504 |
||
8505 |
argument2 |
|
8506 |
||
8507 |
^ argument2 |
|
8508 |
! |
|
8509 |
||
8510 |
argument2:anArgumentOrNil |
|
8511 |
||
8512 |
argument2 := anArgumentOrNil |
|
8513 |
! ! |
|
8514 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8515 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 8516 |
|
2018 | 8517 |
icon |
2016 | 8518 |
"This resource specification was automatically generated |
8519 |
by the ImageEditor of ST/X." |
|
8520 |
||
8521 |
"Do not manually edit this!! If it is corrupted, |
|
8522 |
the ImageEditor may not be able to read the specification." |
|
8523 |
||
8524 |
" |
|
2018 | 8525 |
self icon inspect |
8526 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 8527 |
" |
8528 |
||
8529 |
<resource: #image> |
|
8530 |
||
8531 |
^Icon |
|
3938 | 8532 |
constantNamed:#'MenuPanel::ScrollActivity class icon' |
8533 |
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 | 8534 |
! ! |
8535 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8536 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 8537 |
|
8538 |
new |
|
8539 |
^ self basicNew initialize |
|
8540 |
! ! |
|
8541 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8542 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 8543 |
|
8544 |
activeMenu |
|
8545 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 8546 |
is returned if scrolling is deactivated" |
8547 |
||
2016 | 8548 |
^ activeMenu |
8549 |
! |
|
8550 |
||
8551 |
direction |
|
2870 | 8552 |
"returns the scroll-direction" |
8553 |
||
2016 | 8554 |
^ direction |
8555 |
! |
|
8556 |
||
8557 |
iconAt:aDirection on:aMenu |
|
2018 | 8558 |
|icon device index| |
2016 | 8559 |
|
8560 |
device := aMenu device. |
|
8561 |
||
8562 |
aDirection == #PREV ifTrue:[ |
|
3147 | 8563 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
3938 | 8564 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
2018 | 8565 |
] ifFalse:[ |
3147 | 8566 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
8567 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 8568 |
]. |
8569 |
||
8570 |
icon := icons at:index. |
|
8571 |
||
8572 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
3147 | 8573 |
icon := self class icon. |
8574 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
8575 |
ifFalse:[ icon := icon copy ]. |
|
8576 |
||
8577 |
icon := icon onDevice:device. |
|
8578 |
icon clearMaskedPixels. |
|
8579 |
icons at:index put:icon |
|
2018 | 8580 |
]. |
8581 |
^ icon |
|
2016 | 8582 |
! ! |
8583 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8584 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 8585 |
|
8586 |
initialize |
|
8587 |
||
4173 | 8588 |
semaLock := RecursionLock new name:'MenuPanel ScrollActivity'. |
2018 | 8589 |
icons := Array new:4. |
2016 | 8590 |
! ! |
8591 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8592 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 8593 |
|
8594 |
isActive |
|
2870 | 8595 |
"returns true if scrolling is activated" |
8596 |
||
2016 | 8597 |
^ activeMenu notNil |
8598 |
! ! |
|
8599 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8600 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 8601 |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8602 |
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress |
2870 | 8603 |
"start scrolling; returns true if scrolling is activated" |
8604 |
||
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8605 |
|bounds index isScrolledMenu boundsOnRoot| |
2860 | 8606 |
|
8607 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 8608 |
|
8609 |
semaLock critical:[ |
|
3938 | 8610 |
self stop. |
8611 |
||
8612 |
isScrolledMenu ifTrue:[ |
|
8613 |
bounds := aMenu scrollerBoundsAt:aDirection. |
|
8614 |
||
8615 |
comesViaButtonPress ifFalse:[ |
|
8616 |
boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu) |
|
8617 |
extent:(bounds extent). |
|
8618 |
]. |
|
8619 |
||
8620 |
activeMenu := aMenu. |
|
8621 |
direction := aDirection. |
|
8622 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
8623 |
||
8624 |
index ~~ 0 ifTrue:[ |
|
8625 |
scrollTask := |
|
8626 |
[ |
|
8627 |
|item step continue| |
|
8628 |
||
8629 |
[ |
|
8630 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
8631 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
8632 |
aMenu makeItemVisible:item. |
|
8633 |
index := index + step. |
|
8634 |
]. |
|
8635 |
||
8636 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
8637 |
||
8638 |
[ |
|
8639 |
continue := (aMenu shown and:[(item := aMenu itemAt:index) notNil]). |
|
8640 |
||
8641 |
boundsOnRoot notNil ifTrue:[ |
|
8642 |
continue ifTrue:[ |
|
8643 |
continue := boundsOnRoot containsPoint:aMenu sensor mousePoint. |
|
8644 |
] ifFalse:[ |
|
8645 |
boundsOnRoot := nil. |
|
8646 |
] |
|
8647 |
]. |
|
8648 |
continue |
|
8649 |
] whileTrue:[ |
|
8650 |
aMenu makeItemVisible:item. |
|
8651 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
8652 |
index := index + step. |
|
8653 |
]. |
|
8654 |
item := nil. |
|
8655 |
] ensure:[ |
|
8656 |
activeMenu := direction := scrollTask := nil. |
|
8657 |
||
8658 |
item notNil ifTrue:[ |
|
8659 |
"/ process was killed |
|
8660 |
aMenu invalidate:bounds |
|
8661 |
] |
|
8662 |
]. |
|
8663 |
boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ]. |
|
8664 |
] forkAt:8. |
|
8665 |
] |
|
8666 |
] |
|
2016 | 8667 |
]. |
8668 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
8669 |
|
2048 | 8670 |
"Created: ca" |
8671 |
||
8672 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 8673 |
! |
8674 |
||
8675 |
stop |
|
2870 | 8676 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
8677 |
||
2016 | 8678 |
|task resp| |
8679 |
||
8680 |
activeMenu isNil ifTrue:[ |
|
3938 | 8681 |
^ false |
2016 | 8682 |
]. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
8683 |
|
2016 | 8684 |
semaLock critical:[ |
3938 | 8685 |
resp := activeMenu notNil. |
8686 |
||
8687 |
(task := scrollTask) notNil ifTrue:[ |
|
8688 |
scrollTask := nil. |
|
8689 |
||
8690 |
Error handle:[:ex| |
|
8691 |
] do:[ |
|
8692 |
task terminateWithAllSubprocessesInGroup. |
|
8693 |
task waitUntilTerminated. |
|
8694 |
]. |
|
8695 |
]. |
|
8696 |
activeMenu := direction := nil. |
|
2016 | 8697 |
]. |
8698 |
^ resp |
|
8699 |
! ! |
|
8700 |
||
388 | 8701 |
!MenuPanel class methodsFor:'documentation'! |
8702 |
||
4109 | 8703 |
version |
4453 | 8704 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.572 2013-11-28 15:30:02 cg Exp $' |
4109 | 8705 |
! |
8706 |
||
3780 | 8707 |
version_CVS |
4453 | 8708 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.572 2013-11-28 15:30:02 cg Exp $' |
388 | 8709 |
! ! |
2199 | 8710 |
|
4167 | 8711 |
|
388 | 8712 |
MenuPanel initialize! |