author | Merge Script |
Tue, 20 Sep 2016 07:03:06 +0200 | |
branch | jv |
changeset 5250 | a4da316f8065 |
parent 5247 | 90655676e59b |
parent 5248 | b869436ed677 |
child 5260 | c36548c31c27 |
permissions | -rw-r--r-- |
5239 | 1 |
"{ Encoding: utf8 }" |
2 |
||
2005 | 3 |
" |
4 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 5 |
All Rights Reserved |
2005 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1750 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
4712 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
2182
59a770bbb95a
changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
18 |
View subclass:#MenuPanel |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
19 |
instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
20 |
selection items groupSizes receiver enabled lastActiveMenu |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
21 |
enteredItem prevFocusView previousPointerGrab |
3147 | 22 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
23 |
scrollActivity rightArrowShadow rightArrow fgColor verticalLayout |
|
24 |
showSeparatingLines showGroupDivider implicitGrabView |
|
4454 | 25 |
lastPointerView openDelayedMenuBlock closeDelayedMenuBlock |
26 |
preferredWidth application originator centerItems hideOnRelease |
|
27 |
defaultHideOnRelease buttonInsetX buttonInsetY itemSpace |
|
28 |
activeBackgroundColor stringOffsetX doAccessCharacterTranslation |
|
29 |
lastItem hasPerformed focusComesByTab lastDrawnScrollerNextBounds |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
30 |
buttonActiveBackgroundColor buttonEnteredBackgroundColor |
4893 | 31 |
buttonPassiveBackgroundColor maxExtent sizeFixed extraMargin |
4910 | 32 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel |
33 |
pluggableHelpSpecProvider' |
|
5193 | 34 |
classVariableNames:'DefaultBackgroundColor DefaultForegroundColor |
35 |
IconDisabledIndicationOff IconDisabledIndicationOn |
|
36 |
IconDisabledRadioOff IconDisabledRadioOn IconIndicationOff |
|
37 |
IconIndicationOn IconRadioOff IconRadioOn Images |
|
38 |
InitialSelectionQuerySignal LigthenedImages |
|
39 |
MaxShortCutSearchLevel' |
|
3147 | 40 |
poolDictionaries:'' |
41 |
category:'Views-Menus' |
|
388 | 42 |
! |
43 |
||
44 |
Object subclass:#Item |
|
3147 | 45 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
46 |
disabledDisplayLabel enableChannel label activeHelpText |
|
47 |
flyByHelpText isVisible indication choice accessCharacter' |
|
48 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
|
49 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
50 |
poolDictionaries:'' |
|
51 |
privateIn:MenuPanel |
|
388 | 52 |
! |
53 |
||
2692 | 54 |
Object subclass:#Adornment |
3147 | 55 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
56 |
choice choiceValue' |
|
57 |
classVariableNames:'' |
|
58 |
poolDictionaries:'' |
|
59 |
privateIn:MenuPanel::Item |
|
2692 | 60 |
! |
61 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
62 |
Object subclass:#ScrollActivity |
3147 | 63 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
64 |
classVariableNames:'' |
|
65 |
poolDictionaries:'' |
|
66 |
privateIn:MenuPanel |
|
2016 | 67 |
! |
68 |
||
388 | 69 |
!MenuPanel class methodsFor:'documentation'! |
70 |
||
2005 | 71 |
copyright |
72 |
" |
|
73 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 74 |
All Rights Reserved |
2005 | 75 |
|
76 |
This software is furnished under a license and may be used |
|
77 |
only in accordance with the terms of that license and with the |
|
78 |
inclusion of the above copyright notice. This software may not |
|
79 |
be provided or otherwise made available to, or used by, any |
|
80 |
other person. No title to or ownership of the software is |
|
81 |
hereby transferred. |
|
82 |
" |
|
83 |
||
388 | 84 |
! |
85 |
||
86 |
documentation |
|
87 |
" |
|
88 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
89 |
||
4244 | 90 |
Due to some historic leftover, there are two mechanisms for menus: |
4657 | 91 |
1) the (very) old MenuView (which inherits from SelectionInListView) |
92 |
2) this new MenuPanel. |
|
4244 | 93 |
|
2170 | 94 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
4244 | 95 |
(and hopefully be ST-80 compatible...) |
96 |
||
97 |
To create a menu, there exists a MenuEditor which can generate |
|
98 |
menu specifications, from which a MenuPanel can be dynamically created. |
|
502 | 99 |
|
100 |
||
2061 | 101 |
Notice: |
4657 | 102 |
This is going to replace the obsolete MenuView. |
2061 | 103 |
|
388 | 104 |
[author:] |
4657 | 105 |
Claus Atzkern |
388 | 106 |
|
107 |
[see also:] |
|
4657 | 108 |
Menu |
109 |
MenuItem |
|
110 |
MenuEditor |
|
2170 | 111 |
|
112 |
cg: this code is so ugly - needs a complete rewrite... |
|
113 |
||
388 | 114 |
" |
115 |
! |
|
116 |
||
117 |
examples |
|
118 |
||
119 |
" |
|
4081 | 120 |
a PullDownMenu |
4657 | 121 |
[exBegin] |
388 | 122 |
|top subView mview desc s1 s2 s3 img lbs labels| |
123 |
||
124 |
top := StandardSystemView new. |
|
125 |
||
436 | 126 |
mview := MenuPanel in:top. |
388 | 127 |
|
502 | 128 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 129 |
mview level:2. |
130 |
mview verticalLayout:false. |
|
131 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 132 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 133 |
mview labels:lbs. |
134 |
mview shortcutKeyAt:2 put:#Cut. |
|
135 |
mview accessCharacterPositionAt:1 put:1. |
|
136 |
mview accessCharacterPositionAt:2 put:2. |
|
137 |
||
138 |
mview enabledAt:5 put:false. |
|
139 |
mview groupSizes:#( 2 2 ). |
|
436 | 140 |
s1 := MenuPanel labels:labels. |
388 | 141 |
s1 accessCharacterPositionAt:1 put:1. |
142 |
s1 accessCharacterPositionAt:2 put:2. |
|
143 |
s1 groupSizes:#( 2 2 ). |
|
436 | 144 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
145 |
s3 := MenuPanel labels:lbs. |
|
388 | 146 |
|
147 |
s1 subMenuAt:2 put:s2. |
|
436 | 148 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 149 |
s2 subMenuAt:3 put:s3. |
436 | 150 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 151 |
s3 shortcutKeyAt:3 put:$q. |
152 |
||
153 |
mview subMenuAt:1 put:s1. |
|
436 | 154 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 155 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
156 |
s1 shortcutKeyAt:1 put:#Copy. |
|
157 |
s1 shortcutKeyAt:3 put:#Paste. |
|
158 |
||
436 | 159 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 160 |
top extent:(mview preferredExtent). |
388 | 161 |
top open. |
4657 | 162 |
[exEnd] |
4081 | 163 |
|
164 |
a PullDownMenu with applications |
|
4657 | 165 |
[exBegin] |
1767 | 166 |
|top menu view item| |
167 |
||
168 |
top := StandardSystemView extent:240@100. |
|
169 |
menu := MenuPanel in:top. |
|
170 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
171 |
menu verticalLayout:false. |
|
172 |
||
173 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
174 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
175 |
||
176 |
view := ClockView new. |
|
177 |
view preferredExtent:100@100. |
|
178 |
item := menu itemAt:3. |
|
179 |
item submenu:view. |
|
180 |
||
4081 | 181 |
view := ImageView new. |
182 |
view image:(Image fromScreen:(0@0 corner:200@200)). |
|
183 |
view preferredExtent:(200@200). |
|
1767 | 184 |
item := menu itemAt:2. |
185 |
item submenu:view. |
|
186 |
||
187 |
menu origin:0@0 corner:1.0@30. |
|
188 |
top open. |
|
4657 | 189 |
[exEnd] |
4081 | 190 |
|
191 |
||
192 |
a PopUpMenu |
|
4657 | 193 |
[exBegin] |
388 | 194 |
|subView mview desc s1 s2 s3 img lbs labels| |
195 |
||
436 | 196 |
mview := MenuPanel new. |
502 | 197 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 198 |
mview level:2. |
199 |
||
200 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 201 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 202 |
mview labels:lbs. |
203 |
||
436 | 204 |
s1 := MenuPanel labels:labels. |
205 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
206 |
s3 := MenuPanel labels:lbs. |
|
388 | 207 |
s1 subMenuAt:2 put:s2. |
436 | 208 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 209 |
s2 subMenuAt:3 put:s3. |
436 | 210 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 211 |
s3 shortcutKeyAt:3 put:$q. |
212 |
||
213 |
mview subMenuAt:1 put:s1. |
|
436 | 214 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 215 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
216 |
s1 shortcutKeyAt:1 put:#Copy. |
|
217 |
s1 shortcutKeyAt:3 put:#Paste. |
|
218 |
||
436 | 219 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 220 |
mview startUp |
4657 | 221 |
[exEnd] |
4081 | 222 |
|
223 |
||
224 |
a menu spec |
|
4657 | 225 |
[exBegin] |
388 | 226 |
|menu| |
227 |
||
436 | 228 |
menu := MenuPanel menu: |
4657 | 229 |
#(#Menu #( #(#MenuItem |
230 |
#label: 'File' |
|
231 |
#submenu: |
|
232 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
233 |
(#MenuItem |
|
234 |
#label: 'edit' |
|
235 |
#submenu: |
|
236 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
237 |
#(#MenuItem #label: 'close' #value:#close) |
|
238 |
) |
|
239 |
nil |
|
240 |
nil |
|
241 |
) |
|
242 |
) |
|
243 |
#(#MenuItem #label: 'help' #value:#help ) |
|
244 |
) |
|
245 |
nil |
|
246 |
nil |
|
247 |
) |
|
248 |
) |
|
249 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
250 |
#(#MenuItem #label: 'Bar' |
|
251 |
#submenu: |
|
252 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
253 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
254 |
) |
|
255 |
nil |
|
256 |
nil |
|
257 |
) |
|
258 |
) |
|
259 |
) |
|
260 |
#( 2 ) |
|
261 |
nil |
|
262 |
) decodeAsLiteralArray. |
|
388 | 263 |
|
264 |
menu verticalLayout:false. |
|
265 |
Transcript showCR:(menu startUp). |
|
4657 | 266 |
[exEnd] |
388 | 267 |
|
268 |
" |
|
269 |
! ! |
|
270 |
||
271 |
!MenuPanel class methodsFor:'instance creation'! |
|
272 |
||
273 |
fromSpec:aSpec |
|
274 |
^ self fromSpec:aSpec receiver:nil |
|
275 |
! |
|
276 |
||
277 |
fromSpec:aSpec receiver:aReceiver |
|
278 |
|menu| |
|
279 |
||
280 |
aSpec notNil ifTrue:[ |
|
3147 | 281 |
menu := Menu new. |
282 |
menu receiver:aReceiver. |
|
283 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 284 |
]. |
285 |
^ self menu:menu receiver:aReceiver |
|
286 |
! |
|
287 |
||
288 |
labels:labels |
|
289 |
^ self labels:labels nameKeys:nil receiver:nil |
|
290 |
! |
|
291 |
||
292 |
labels:labels nameKeys:nameKeys |
|
293 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
294 |
! |
|
295 |
||
296 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
297 |
|mview| |
|
298 |
||
299 |
mview := self menu:nil receiver:aReceiver. |
|
300 |
mview labels:labels. |
|
301 |
mview nameKeys:nameKeys. |
|
302 |
^ mview |
|
303 |
||
304 |
! |
|
305 |
||
502 | 306 |
labels:labels receiver:aReceiver |
307 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
308 |
! |
|
309 |
||
388 | 310 |
menu:aMenu |
311 |
^ self menu:aMenu receiver:nil |
|
312 |
! |
|
313 |
||
314 |
menu:aMenu receiver:aReceiver |
|
315 |
|mview| |
|
316 |
||
317 |
mview := self new. |
|
1955 | 318 |
|
319 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
3147 | 320 |
"/ no receiver specified in the menu; thus set the receiver immediately |
321 |
mview receiver:aReceiver |
|
1955 | 322 |
]. |
323 |
||
388 | 324 |
mview menu:aMenu. |
325 |
||
1955 | 326 |
|
388 | 327 |
"/ a menu itself may contain a receiver |
328 |
"/ thus we do not overwrite the receiver |
|
329 |
||
330 |
aReceiver notNil ifTrue:[ |
|
3147 | 331 |
mview receiver:aReceiver |
388 | 332 |
]. |
333 |
^ mview |
|
334 |
! ! |
|
335 |
||
336 |
!MenuPanel class methodsFor:'class initialization'! |
|
337 |
||
338 |
initialize |
|
339 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
3938 | 340 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 341 |
]. |
342 |
||
2715 | 343 |
" |
344 |
self initialize |
|
345 |
" |
|
346 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
347 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
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 |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
353 |
<resource: #image> |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
355 |
by the ImageEditor of ST/X." |
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 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
360 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
361 |
Icon flushCachedIcons" |
4657 | 362 |
|
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
363 |
^ Icon constantNamed:#'MenuPanel class delayedMenuIndicator' |
4657 | 364 |
ifAbsentPut:[ |
365 |
(Depth1Image new) |
|
366 |
width:7; |
|
367 |
height:6; |
|
368 |
photometric:(#palette); |
|
369 |
bitsPerSample:(#( 1 )); |
|
370 |
samplesPerPixel:(1); |
|
371 |
bits:(ByteArray fromPackedString:'@@@@@HCB'); |
|
372 |
colorMapFromArray:#[ 0 0 0 255 255 255 ]; |
|
373 |
mask:((ImageMask new) |
|
374 |
width:7; |
|
375 |
height:6; |
|
376 |
bits:(ByteArray fromPackedString:'@J+V[C P'); |
|
377 |
yourself); |
|
378 |
yourself |
|
379 |
] |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
380 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
381 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
382 |
iconIndicationDisabledOff |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
383 |
<resource: #image> |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
384 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
385 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
386 |
"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
|
387 |
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
|
388 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
self iconIndicationDisabledOff inspect |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
390 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff" |
4657 | 391 |
|
2755 | 392 |
IconDisabledIndicationOff isNil ifTrue:[ |
4657 | 393 |
IconDisabledIndicationOff := Icon |
394 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
|
395 |
ifAbsentPut:[ |
|
396 |
(Depth2Image new) |
|
397 |
width:14; |
|
398 |
height:14; |
|
399 |
photometric:(#palette); |
|
400 |
bitsPerSample:(#( 2 )); |
|
401 |
samplesPerPixel:(1); |
|
402 |
bits:(ByteArray |
|
403 |
fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b'); |
|
404 |
colorMapFromArray:#[ 255 255 255 127 127 127 170 170 170 0 0 0 ]; |
|
405 |
mask:((ImageMask new) |
|
406 |
width:14; |
|
407 |
height:14; |
|
408 |
bits:(ByteArray |
|
409 |
fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a'); |
|
410 |
yourself); |
|
411 |
yourself |
|
412 |
] |
|
2755 | 413 |
]. |
414 |
^ IconDisabledIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
415 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
416 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
417 |
iconIndicationDisabledOn |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
418 |
<resource: #image> |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
419 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
420 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
421 |
"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
|
422 |
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
|
423 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
424 |
self iconIndicationDisabledOn inspect |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
425 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn" |
4657 | 426 |
|
2755 | 427 |
IconDisabledIndicationOn isNil ifTrue:[ |
4657 | 428 |
IconDisabledIndicationOn := Icon |
429 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
|
430 |
ifAbsentPut:[ |
|
431 |
(Depth2Image new) |
|
432 |
width:14; |
|
433 |
height:14; |
|
434 |
photometric:(#palette); |
|
435 |
bitsPerSample:(#( 2 )); |
|
436 |
samplesPerPixel:(1); |
|
437 |
bits:(ByteArray |
|
438 |
fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b'); |
|
439 |
colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ]; |
|
440 |
mask:((ImageMask new) |
|
441 |
width:14; |
|
442 |
height:14; |
|
443 |
bits:(ByteArray |
|
444 |
fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a'); |
|
445 |
yourself); |
|
446 |
yourself |
|
447 |
] |
|
2755 | 448 |
]. |
449 |
^ IconDisabledIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
450 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
451 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
452 |
iconIndicationOff |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
453 |
<resource: #image> |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
454 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
455 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
456 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
457 |
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
|
458 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
459 |
self iconIndicationOff inspect |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
460 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff" |
4657 | 461 |
|
2752 | 462 |
IconIndicationOff isNil ifTrue:[ |
4657 | 463 |
IconIndicationOff := Icon constantNamed:#'MenuPanel iconIndicationOff' |
464 |
ifAbsentPut:[ |
|
465 |
(Depth2Image new) |
|
466 |
width:14; |
|
467 |
height:14; |
|
468 |
photometric:(#palette); |
|
469 |
bitsPerSample:(#( 2 )); |
|
470 |
samplesPerPixel:(1); |
|
471 |
bits:(ByteArray |
|
472 |
fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b'); |
|
473 |
colorMapFromArray:#[ 255 255 255 127 127 127 170 170 170 0 0 0 ]; |
|
474 |
mask:((ImageMask new) |
|
475 |
width:14; |
|
476 |
height:14; |
|
477 |
bits:(ByteArray |
|
478 |
fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a'); |
|
479 |
yourself); |
|
480 |
yourself |
|
481 |
] |
|
2752 | 482 |
]. |
483 |
^ IconIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
484 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
485 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
486 |
iconIndicationOn |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
487 |
<resource: #image> |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
488 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
489 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
490 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
491 |
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
|
492 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
493 |
self iconIndicationOn inspect |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
494 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn" |
4657 | 495 |
|
2752 | 496 |
IconIndicationOn isNil ifTrue:[ |
4657 | 497 |
IconIndicationOn := Icon constantNamed:#'MenuPanel iconIndicationOn' |
498 |
ifAbsentPut:[ |
|
499 |
(Depth2Image new) |
|
500 |
width:14; |
|
501 |
height:14; |
|
502 |
photometric:(#palette); |
|
503 |
bitsPerSample:(#( 2 )); |
|
504 |
samplesPerPixel:(1); |
|
505 |
bits:(ByteArray |
|
506 |
fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b'); |
|
507 |
colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ]; |
|
508 |
mask:((ImageMask new) |
|
509 |
width:14; |
|
510 |
height:14; |
|
511 |
bits:(ByteArray |
|
512 |
fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a'); |
|
513 |
yourself); |
|
514 |
yourself |
|
515 |
] |
|
2752 | 516 |
]. |
517 |
^ IconIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
518 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
519 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
520 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
521 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
522 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
523 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
524 |
"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
|
525 |
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
|
526 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
527 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
528 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
529 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
530 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
531 |
|
3565 | 532 |
"/ <resource: #image> |
533 |
"/ |
|
534 |
"/ IconDisabledRadioOff isNil ifTrue:[ |
|
535 |
"/ IconDisabledRadioOff := Icon |
|
536 |
"/ constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
|
537 |
"/ 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] |
|
538 |
"/ ]. |
|
539 |
"/ ^ IconDisabledRadioOff |
|
540 |
||
541 |
<resource: #programImage> |
|
542 |
^ RadioButton disabledPassiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
543 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
544 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
545 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
546 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
547 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
548 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
549 |
"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
|
550 |
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
|
551 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
552 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
553 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
554 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 555 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
556 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
557 |
|
3565 | 558 |
"/ <resource: #image> |
559 |
"/ |
|
560 |
"/ IconDisabledRadioOn isNil ifTrue:[ |
|
561 |
"/ IconDisabledRadioOn := Icon |
|
562 |
"/ constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
563 |
"/ 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] |
|
564 |
"/ ]. |
|
565 |
"/ ^ IconDisabledRadioOn |
|
566 |
||
567 |
<resource: #programImage> |
|
568 |
^ RadioButton disabledActiveForm |
|
569 |
! |
|
570 |
||
571 |
iconRadioGroupEnteredOff |
|
572 |
<resource: #programImage> |
|
573 |
^ RadioButton enteredPassiveForm |
|
574 |
! |
|
575 |
||
576 |
iconRadioGroupEnteredOn |
|
577 |
<resource: #programImage> |
|
578 |
^ RadioButton enteredActiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
579 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
580 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
581 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
582 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
583 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
584 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
585 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
586 |
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
|
587 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
588 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
589 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
590 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
591 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
592 |
|
3565 | 593 |
"/ <resource: #image> |
594 |
"/ |
|
595 |
"/ IconRadioOff isNil ifTrue:[ |
|
596 |
"/ IconRadioOff := Icon |
|
597 |
"/ constantNamed:#'MenuPanel iconRadioGroupOff' |
|
598 |
"/ 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] |
|
599 |
"/ ]. |
|
600 |
"/ ^ IconRadioOff |
|
601 |
||
602 |
<resource: #programImage> |
|
603 |
^ RadioButton passiveForm |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
604 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
605 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
606 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
607 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
608 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
609 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
610 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
611 |
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
|
612 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
613 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
614 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
615 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
616 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
617 |
|
3565 | 618 |
"/ <resource: #image> |
619 |
"/ |
|
620 |
"/ IconRadioOn isNil ifTrue:[ |
|
621 |
"/ IconRadioOn := Icon |
|
622 |
"/ constantNamed:#'MenuPanel iconRadioGroupOn' |
|
623 |
"/ 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] |
|
624 |
"/ ]. |
|
625 |
"/ ^ IconRadioOn |
|
626 |
||
627 |
<resource: #programImage> |
|
628 |
^ RadioButton activeForm |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
629 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
630 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
631 |
menuIndicator |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
632 |
<resource: #image> |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
633 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
634 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
635 |
"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
|
636 |
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
|
637 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
638 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
639 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
640 |
Icon flushCachedIcons" |
4657 | 641 |
|
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
642 |
^ Icon constantNamed:#'MenuPanel class menuIndicator' |
4657 | 643 |
ifAbsentPut:[ |
644 |
(Depth1Image new) |
|
645 |
width:7; |
|
646 |
height:4; |
|
647 |
photometric:(#palette); |
|
648 |
bitsPerSample:(#( 1 )); |
|
649 |
samplesPerPixel:(1); |
|
650 |
bits:(ByteArray fromPackedString:'@@B@0 @a'); |
|
651 |
colorMapFromArray:#[ 0 0 0 255 255 255 ]; |
|
652 |
mask:((ImageMask new) |
|
653 |
width:7; |
|
654 |
height:4; |
|
655 |
bits:(ByteArray fromPackedString:'?''08D@@a'); |
|
656 |
yourself); |
|
657 |
yourself |
|
658 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
659 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
660 |
|
616 | 661 |
!MenuPanel class methodsFor:'defaults'! |
450 | 662 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
663 |
defaultBackgroundColor |
2609 | 664 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 665 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
666 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
667 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
668 |
defaultLevel |
2372 | 669 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
670 |
" |
|
671 |
self defaultLevel |
|
672 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
673 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
674 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
675 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
676 |
"returns an additional offset between the label and the |
2715 | 677 |
delayedMenu indication (i.e. the down-arrow icon)" |
678 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
679 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
680 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
681 |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
682 |
maxShortCutSearchLevel |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
683 |
"1 means: only search in top items. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
684 |
2 means: search one level of menus. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
685 |
used to be 10" |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
686 |
|
3384 | 687 |
MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.]. |
688 |
^ MaxShortCutSearchLevel |
|
689 |
! |
|
690 |
||
691 |
maxShortCutSearchLevel: anInteger |
|
692 |
"1 means: only search in top items. |
|
693 |
2 means: search one level of menus." |
|
694 |
||
695 |
MaxShortCutSearchLevel := anInteger |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
696 |
! |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
697 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
698 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
699 |
"returns an additional offset between the label and the |
2715 | 700 |
delayedMenu indication (i.e. the down-arrow icon)" |
701 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
702 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
703 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
704 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
705 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
706 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
707 |
ex: |
3938 | 708 |
&File mnemonic := Cmdf |
709 |
F&ile mnemonic := Cmdi |
|
710 |
....." |
|
2715 | 711 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
712 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
713 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
714 |
|
450 | 715 |
updateStyleCache |
2777 | 716 |
"extract values from the styleSheet and cache them in class variables" |
657 | 717 |
|
2219 | 718 |
<resource: #style ( |
4893 | 719 |
#'selection.disabledForegroundColor' |
720 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
721 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
722 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
|
723 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
|
724 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
725 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
726 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
727 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
728 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
729 |
#'menu.selectionFollowsMouse' |
|
730 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
731 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
732 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
733 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
734 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
|
735 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
|
736 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
|
737 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
|
738 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
|
739 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
|
740 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
|
741 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
|
2219 | 742 |
)> |
743 |
||
744 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 745 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 746 |
|
2611 | 747 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
748 |
which returns the default cashed DefaultBackgroundColor |
|
749 |
" |
|
750 |
DefaultBackgroundColor := nil. |
|
751 |
||
2219 | 752 |
MenuView updateStyleCache. |
753 |
SelectionInListView updateStyleCache. |
|
1699 | 754 |
|
2372 | 755 |
styleSheet := StyleSheet. |
756 |
style := styleSheet name. |
|
757 |
||
2607 | 758 |
DefaultFont := MenuView defaultFont. |
3938 | 759 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
4893 | 760 |
default:[styleSheet |
761 |
colorAt:#'menu.foregroundColor' |
|
762 |
default:Color black]. |
|
2609 | 763 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 764 |
|
765 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 766 |
var isNil ifTrue:[ |
4893 | 767 |
style == #motif ifTrue:[ var := backgroundColor ] |
768 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
2219 | 769 |
]. |
770 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
771 |
||
772 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 773 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 774 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
775 |
||
776 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 777 |
var isNil ifTrue:[ |
4893 | 778 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
779 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
|
2219 | 780 |
]. |
781 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
782 |
||
783 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 784 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 785 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
786 |
||
787 |
||
788 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 789 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
4893 | 790 |
"/ styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
2219 | 791 |
|
792 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 793 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
4893 | 794 |
"/ styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
2219 | 795 |
|
796 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
4893 | 797 |
"/ styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
2219 | 798 |
|
799 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
800 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
801 |
||
802 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 803 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
4893 | 804 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
2219 | 805 |
]. |
806 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
807 |
||
808 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 809 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 810 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
811 |
||
812 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 813 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 814 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
815 |
||
816 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 817 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 818 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
819 |
||
820 |
Item updateStyleCache. |
|
2607 | 821 |
|
2754 | 822 |
getBitmapOrFile := [:key :fileKey | |
4893 | 823 |
|var| |
824 |
||
825 |
var := styleSheet at:key ifAbsent:nil. |
|
826 |
var isNil ifTrue:[ |
|
827 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
828 |
var notNil ifTrue:[ |
|
829 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
|
830 |
]. |
|
831 |
]. |
|
832 |
var |
|
2754 | 833 |
]. |
834 |
||
2883 | 835 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
836 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
837 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
838 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
839 |
||
840 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
841 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
842 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
843 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 844 |
|
2607 | 845 |
" |
846 |
self updateStyleCache |
|
847 |
" |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
848 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
849 |
"Modified: / 19-01-2012 / 13:17:59 / cg" |
388 | 850 |
! ! |
851 |
||
794 | 852 |
!MenuPanel class methodsFor:'image registration'! |
853 |
||
854 |
image:anImage onDevice:aDevice |
|
855 |
" |
|
856 |
Images := nil |
|
857 |
" |
|
2269 | 858 |
|deviceImages| |
794 | 859 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
860 |
anImage device == aDevice ifTrue:[ |
5009 | 861 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
862 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
863 |
|
5246 | 864 |
Images isNil ifTrue:[ |
5248 | 865 |
Images := IdentityDictionary new. |
5246 | 866 |
]. |
867 |
deviceImages := Images at:aDevice ifAbsentPut:[Dictionary new]. |
|
5009 | 868 |
^ deviceImages at:anImage ifAbsentPut:[anImage copy onDevice:aDevice]. |
794 | 869 |
! |
870 |
||
871 |
lightenedImage:anImage onDevice:aDevice |
|
872 |
" |
|
873 |
LigthenedImages := nil |
|
874 |
" |
|
2374 | 875 |
|deviceImages image colorMap| |
794 | 876 |
|
5248 | 877 |
LigthenedImages isNil ifTrue:[LigthenedImages := IdentityDictionary new]. |
5239 | 878 |
|
879 |
deviceImages := LigthenedImages at:aDevice ifAbsentPut:[WeakIdentityDictionary new]. |
|
1097 | 880 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
5239 | 881 |
^ image |
2374 | 882 |
]. |
883 |
||
884 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
885 |
colorMap notNil ifTrue:[ |
|
5239 | 886 |
image := anImage lightened onDevice:aDevice. |
794 | 887 |
] ifFalse:[ |
5239 | 888 |
image := self image:anImage onDevice:aDevice |
794 | 889 |
]. |
1097 | 890 |
deviceImages at:anImage put:image. |
794 | 891 |
^ image |
5248 | 892 |
! |
893 |
||
894 |
releaseCachedImagesFromDevice:aGraphicsDevice |
|
895 |
"flush cached resources before saving a snapshot |
|
896 |
(do not save them in the image)" |
|
897 |
||
898 |
aGraphicsDevice isNil ifTrue:[ |
|
899 |
Images := LigthenedImages := nil. |
|
900 |
^ self. |
|
901 |
]. |
|
902 |
||
903 |
Images notNil ifTrue:[ |
|
904 |
Images removeKey:aGraphicsDevice ifAbsent:[]. |
|
905 |
]. |
|
906 |
LigthenedImages notNil ifTrue:[ |
|
907 |
LigthenedImages removeKey:aGraphicsDevice ifAbsent:[]. |
|
908 |
]. |
|
794 | 909 |
! ! |
910 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
911 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
912 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
913 |
subMenu:aSubMenu |
2715 | 914 |
"create a submenu; can be redifined in derived classes" |
915 |
||
916 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
917 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
918 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
919 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
920 |
|
5094 | 921 |
!MenuPanel class methodsFor:'startup & release'! |
922 |
||
923 |
preSnapshot |
|
924 |
"flush cached resources before saving a snapshot |
|
925 |
(do not save them in the image)" |
|
926 |
||
5248 | 927 |
self releaseCachedImagesFromDevice:nil |
5094 | 928 |
! ! |
929 |
||
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
930 |
!MenuPanel class methodsFor:'utilities'! |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
931 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
932 |
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
933 |
"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
|
934 |
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
|
935 |
or fix), or by an ampersand escape. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
936 |
Double ampersands are replaced by a single one." |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
937 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
938 |
|i label nextChar rest pos size accessCharacter| |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
939 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
940 |
pos := accessCharacterPositionOrNil. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
941 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
942 |
label := aLabel. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
943 |
size := aLabel size. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
944 |
i := 1. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
945 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < size])] whileTrue:[ |
4657 | 946 |
nextChar := label at:(i+1). |
947 |
nextChar isSeparator ifTrue:[ |
|
948 |
i := i + 1 |
|
949 |
] ifFalse:[ |
|
950 |
rest := label copyFrom:(i+1). |
|
951 |
||
952 |
i == 1 ifTrue:[label := rest] |
|
953 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
954 |
||
955 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
956 |
size := size - 1. |
|
957 |
]. |
|
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
958 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
959 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
960 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
4657 | 961 |
^ label |
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
962 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
963 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
964 |
label isText ifFalse:[ |
4657 | 965 |
label := Text string:label |
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
966 |
]. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
967 |
label emphasisAt:pos add:#underline. |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
968 |
^ label |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
969 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
970 |
"Created: / 15-02-2012 / 18:50:58 / cg" |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
971 |
! ! |
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
972 |
|
1808 | 973 |
!MenuPanel methodsFor:'accepting'! |
389 | 974 |
|
975 |
accept |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
976 |
"accept the current selected item" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
977 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
978 |
|item| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
979 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
980 |
(item := self selection) isNil ifTrue:[ |
4657 | 981 |
self topMenu |
982 |
openDelayed:nil; |
|
983 |
accept:nil. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
984 |
] ifFalse:[ |
4657 | 985 |
self acceptItem:item inMenu:self |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
986 |
] |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
987 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
988 |
"Modified: / 29-06-2011 / 16:14:26 / cg" |
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 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
991 |
accept:anItemOrNil |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
992 |
"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
|
993 |
|
4089 | 994 |
|itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor| |
1630 | 995 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
996 |
self superMenu notNil ifTrue:[ |
5001 | 997 |
^ self topMenu accept:anItemOrNil |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
998 |
]. |
3142 | 999 |
prevFocusView ~~ self ifTrue:[ |
5001 | 1000 |
focusView := prevFocusView. |
3142 | 1001 |
]. |
1002 |
prevFocusView := nil. |
|
1003 |
||
2199 | 1004 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1005 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1006 |
self selection:nil. |
420 | 1007 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1008 |
(anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[ |
5001 | 1009 |
tgState := anItemOrNil toggleIndication. |
1010 |
panel := anItemOrNil menuPanel. |
|
1011 |
itemIdx := panel findFirst:[:el| el == anItemOrNil ]. |
|
1012 |
itemAcceptedOrNil := anItemOrNil. |
|
1013 |
recv := panel receiver. |
|
389 | 1014 |
]. |
1699 | 1015 |
self doUngrab:true. |
389 | 1016 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1017 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1018 |
|
510 | 1019 |
self isPopUpView ifFalse:[ |
5001 | 1020 |
self do:[:el| el updateIndicators]. |
1021 |
winGrp notNil ifTrue:[ |
|
1022 |
winGrp processExposeEvents. |
|
1023 |
]. |
|
524 | 1024 |
] ifTrue:[ |
5001 | 1025 |
self unmap. |
1026 |
device sync. "/ round trip - all expose events are now received |
|
1027 |
||
1028 |
winGrp notNil ifTrue:[ |
|
1029 |
"/ give expose event a chance to arrive |
|
1030 |
[shown and:[realized]] whileTrue:[ |
|
1031 |
winGrp processExposeEventsFor:self |
|
1032 |
]. |
|
1033 |
masterGroup := winGrp previousGroup. |
|
1034 |
]. |
|
1035 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
1036 |
"/ self destroy. |
|
1037 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1038 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1039 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1040 |
(focusView notNil and:[winGrp notNil]) ifTrue:[ |
5001 | 1041 |
winGrp focusView:focusView. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1042 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1043 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1044 |
itemAcceptedOrNil isNil ifTrue:[ |
5001 | 1045 |
hasPerformed := true. |
1046 |
self isPopUpView ifTrue:[ |
|
1047 |
lastItem := itemAcceptedOrNil. |
|
1048 |
]. |
|
1049 |
^ itemAcceptedOrNil. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1050 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1051 |
|
4089 | 1052 |
"/ using master maingroup, sensor in my current windowgroup |
1053 |
"/ flushes its events if the window goes |
|
1054 |
winGrp notNil ifTrue:[ |
|
1055 |
winGrp mainGroup notNil ifTrue:[ |
|
5001 | 1056 |
sensor := winGrp mainGroup sensor. |
4089 | 1057 |
]. |
1058 |
]. |
|
1059 |
sensor isNil ifTrue:[sensor := self sensor ]. |
|
1060 |
||
1061 |
sensor pushEvent:( |
|
5001 | 1062 |
MenuEvent |
1063 |
selectMenuItem:itemAcceptedOrNil |
|
1064 |
index:itemIdx |
|
1065 |
text:nil |
|
1066 |
value:tgState |
|
1067 |
inMenu:self |
|
1068 |
menuReceiver:recv). |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1069 |
|
4053 | 1070 |
^ anItemOrNil. "/ stupid convention |
1071 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1072 |
"/ acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1073 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1074 |
"/ winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1075 |
"/ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1076 |
"/ (itemAcceptedOrNil showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1077 |
"/ and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1078 |
"/ ifTrue:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1079 |
"/ winGrpForBusyCursor withWaitCursorDo:acceptAction |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1080 |
"/ ] ifFalse:[ |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1081 |
"/ acceptAction value |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1082 |
"/ ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1083 |
|
4053 | 1084 |
"Modified: / 07-07-2011 / 18:08:41 / cg" |
524 | 1085 |
! |
1086 |
||
1087 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1088 |
"really accept an item" |
2715 | 1089 |
|
3938 | 1090 |
|selectorOrBlock argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
1091 |
app master fallBack| |
524 | 1092 |
|
2253 | 1093 |
isValueModel := aReceiver isValueModel. |
1094 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1095 |
hasPerformed := isValueModel. |
524 | 1096 |
|
3558 | 1097 |
(selectorOrBlock := anItem value) isNil ifTrue:[ |
4657 | 1098 |
^ self "/ ^ anIndex |
524 | 1099 |
]. |
1100 |
||
1101 |
(argument := anItem argument) isNil ifTrue:[ |
|
4657 | 1102 |
argument := aState ? anItem |
389 | 1103 |
]. |
524 | 1104 |
|
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1105 |
(selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[ |
4657 | 1106 |
"/ a valueHolder or block |
1107 |
(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[ |
|
1108 |
'MenuPanel [warning]: menuItem''s value does not respond to #value protocol' infoPrintCR. |
|
1109 |
^ self "/ ^ selectorOrBlock |
|
1110 |
]. |
|
1111 |
||
1112 |
numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0. |
|
1113 |
||
1114 |
numArgs == 0 ifTrue:[ |
|
1115 |
args := nil |
|
1116 |
] ifFalse:[ |
|
1117 |
numArgs == 1 ifTrue:[ |
|
1118 |
args := Array with:argument |
|
1119 |
] ifFalse:[ |
|
1120 |
args := Array with:argument with:self |
|
1121 |
] |
|
1122 |
]. |
|
1123 |
||
1124 |
selectorOrBlock valueWithArguments:args. |
|
1125 |
||
1126 |
hasPerformed := true. |
|
1127 |
^ self "/ ^ anIndex |
|
524 | 1128 |
]. |
1129 |
||
2331 | 1130 |
anItem sendToOriginator ifTrue:[ |
4657 | 1131 |
rec := self originator. |
1132 |
rec isNil ifTrue:[ |
|
1133 |
self error:'no originating widget (no target for message)' mayProceed:true. |
|
1134 |
]. |
|
2331 | 1135 |
] ifFalse:[ |
4657 | 1136 |
rec := aReceiver |
2331 | 1137 |
]. |
1138 |
||
1139 |
rec isNil ifTrue:[ |
|
4657 | 1140 |
'MenuPanel [warning]: menu has no receiver defined' infoPrintCR. |
1141 |
^ self "/ ^ selectorOrBlock |
|
2253 | 1142 |
]. |
1143 |
||
1144 |
isValueModel ifTrue:[ |
|
4657 | 1145 |
rec value:selectorOrBlock |
465 | 1146 |
] ifFalse:[ |
4657 | 1147 |
selectorOrBlock isArray ifTrue:[ |
1148 |
"/ a hack !!!!!! Must be compatible to old MenuView |
|
1149 |
args := selectorOrBlock copyFrom:2. |
|
1150 |
selectorOrBlock := selectorOrBlock first. |
|
1151 |
] ifFalse:[ |
|
1152 |
||
1153 |
arg2 := self. |
|
1154 |
||
1155 |
"/ support for ST80 style applications |
|
1156 |
"/ (expecting the message to go to the application |
|
1157 |
"/ if not understood by the view) |
|
1158 |
"/ These expect the controller to be passed as argument. |
|
1159 |
"/ sigh. |
|
1160 |
||
1161 |
(rec isView |
|
1162 |
and:[(rec respondsTo:selectorOrBlock) not |
|
1163 |
and:[(app := rec application) ~~ rec |
|
1164 |
and:[app notNil]]]) ifTrue:[ |
|
1165 |
arg2 := rec controller. "/ the Views controller |
|
1166 |
rec := app. |
|
1167 |
]. |
|
1168 |
||
1169 |
(numArgs := selectorOrBlock numArgs) == 0 ifTrue:[ |
|
1170 |
args := nil |
|
1171 |
] ifFalse:[ |
|
1172 |
numArgs == 1 ifTrue:[ |
|
1173 |
args := Array with:argument |
|
1174 |
] ifFalse:[ |
|
1175 |
args := Array with:argument with:arg2 |
|
1176 |
] |
|
1177 |
]. |
|
1178 |
]. |
|
1179 |
||
1180 |
fallBack := |
|
1181 |
[ |
|
1182 |
|val| |
|
1183 |
||
1184 |
"/ mhmh - the receiver did not respond to that message; |
|
1185 |
"/ if there is a master-application, try that one |
|
1186 |
"/ (recursive) |
|
1187 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
1188 |
master notNil ifTrue:[ |
|
1189 |
rec := master. |
|
1190 |
val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack |
|
1191 |
] ifFalse:[ |
|
1192 |
self |
|
1193 |
error:('Unimplemented (or error in) menu message: %1 for %2' |
|
1194 |
bindWith:selectorOrBlock |
|
1195 |
with:aReceiver printString) |
|
1196 |
mayProceed:true. |
|
1197 |
val := nil. |
|
1198 |
]. |
|
1199 |
val |
|
1200 |
]. |
|
1201 |
||
1202 |
rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack. |
|
420 | 1203 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1204 |
hasPerformed := true. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1205 |
^ self "/ ^ selectorOrBlock |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1206 |
|
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
1207 |
"Modified: / 06-03-2012 / 14:49:00 / cg" |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1208 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1209 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1210 |
acceptItem:anItemOrNil inMenu:aMenu |
2199 | 1211 |
|tgState topMenu| |
1212 |
||
1213 |
topMenu := self topMenu. |
|
1214 |
topMenu openDelayed:nil. |
|
1670 | 1215 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1216 |
(anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[ |
4657 | 1217 |
topMenu accept:anItemOrNil |
1670 | 1218 |
] ifFalse:[ |
4657 | 1219 |
anItemOrNil canAccept ifTrue:[ |
1220 |
tgState := anItemOrNil toggleIndication. |
|
1221 |
||
1222 |
self |
|
1223 |
accept:anItemOrNil |
|
1224 |
index:(aMenu selectionIndex) |
|
1225 |
toggle:tgState |
|
1226 |
receiver:(aMenu receiver). |
|
1227 |
||
1228 |
aMenu do:[:el| el updateIndicators]. |
|
1229 |
anItemOrNil hideMenuOnActivated ifFalse:[ |
|
1230 |
aMenu invalidate |
|
1231 |
]. |
|
1232 |
] |
|
1670 | 1233 |
] |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1234 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1235 |
"Modified: / 29-06-2011 / 14:34:45 / cg" |
1670 | 1236 |
! |
1237 |
||
389 | 1238 |
lastItemAccepted |
2715 | 1239 |
"returns last item selected or nil" |
1240 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1241 |
^ lastItem |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1242 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
1243 |
"Modified: / 29-06-2011 / 16:24:48 / cg" |
389 | 1244 |
! |
1245 |
||
1246 |
lastValueAccepted |
|
2715 | 1247 |
"returns last value accepted or nil" |
1248 |
||
2253 | 1249 |
^ self lastItemAccepted value |
389 | 1250 |
! ! |
1251 |
||
388 | 1252 |
!MenuPanel methodsFor:'accessing'! |
1253 |
||
1254 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1255 |
"get the access character position for a textLabel" |
1256 |
||
2059 | 1257 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1258 |
! |
1259 |
||
1260 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1261 |
"get the access character position for a textLabel" |
1262 |
||
388 | 1263 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1264 |
! |
|
1265 |
||
1266 |
accessCharacterPositions |
|
2715 | 1267 |
"returns a collection of accessCharacterPositions or nil" |
1268 |
||
388 | 1269 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1270 |
! |
|
1271 |
||
1272 |
accessCharacterPositions:something |
|
2715 | 1273 |
"define accessCharacterPositions for each item" |
1274 |
||
388 | 1275 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1276 |
! |
|
1277 |
||
1278 |
args |
|
2715 | 1279 |
"returns a collection of arguments or nil" |
1280 |
||
388 | 1281 |
^ self collect:[:anItem| anItem argument ] |
1282 |
! |
|
1283 |
||
1284 |
args:something |
|
2715 | 1285 |
"define arguments for each item" |
1286 |
||
388 | 1287 |
self onEachPerform:#argument: withArgList:something |
1288 |
! |
|
1289 |
||
1290 |
argsAt:stringOrNumber |
|
2715 | 1291 |
"gets the argument of an item or nil" |
1292 |
||
2059 | 1293 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1294 |
! |
1295 |
||
1296 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1297 |
"sets the argument of an item" |
1298 |
||
388 | 1299 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1300 |
! |
|
1301 |
||
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1302 |
doAccessCharacterTranslation |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1303 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1304 |
Can be set to false to leave accessCharacter unchanged" |
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1305 |
|
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1306 |
^ doAccessCharacterTranslation ? true |
3958 | 1307 |
|
1308 |
"Modified: / 02-11-2010 / 10:19:09 / cg" |
|
3332
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1309 |
! |
321b83142fc3
changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents:
3328
diff
changeset
|
1310 |
|
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1311 |
doAccessCharacterTranslation:aBoolean |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1312 |
"true if &-chars in a label are to be treated as accessCharacter indicators. |
3958 | 1313 |
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
|
1314 |
|
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1315 |
doAccessCharacterTranslation := aBoolean |
3958 | 1316 |
|
1317 |
"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
|
1318 |
! |
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
1319 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1320 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1321 |
"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
|
1322 |
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
|
1323 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1324 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1325 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1326 |
"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
|
1327 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1328 |
|
388 | 1329 |
groupSizes |
2715 | 1330 |
"gets collection of group sizes" |
1331 |
||
388 | 1332 |
^ groupSizes |
1333 |
! |
|
1334 |
||
1335 |
groupSizes:aGroupSizes |
|
2715 | 1336 |
"sets collection of group sizes" |
1337 |
||
388 | 1338 |
aGroupSizes = groupSizes ifFalse:[ |
3938 | 1339 |
groupSizes := aGroupSizes copy. |
1340 |
self mustRearrange. |
|
388 | 1341 |
]. |
1342 |
! |
|
1343 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1344 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1345 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1346 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1347 |
|
3725 | 1348 |
hideOnRelease:aBoolean |
1349 |
hideOnRelease := aBoolean |
|
1350 |
! |
|
1351 |
||
388 | 1352 |
labelAt:stringOrNumber |
2715 | 1353 |
"gets the label of an item or nil" |
1354 |
||
388 | 1355 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1356 |
! |
|
1357 |
||
1358 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1359 |
"sets the label of an item" |
1360 |
||
388 | 1361 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1362 |
! |
|
1363 |
||
1364 |
labels |
|
2715 | 1365 |
"returns a collection of labels's or nil" |
1366 |
||
388 | 1367 |
^ self collect:[:anItem| anItem label ] |
1368 |
! |
|
1369 |
||
1370 |
labels:labels |
|
2715 | 1371 |
"define labels for each item" |
1372 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1373 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1374 |
|
388 | 1375 |
self disabledRedrawDo:[ |
4657 | 1376 |
self removeAll. |
1377 |
size := labels size. |
|
1378 |
||
1379 |
size > 0 ifTrue:[ |
|
1380 |
items := OrderedCollection new:size. |
|
1381 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ]. |
|
1382 |
preferredExtent := nil. "/ flush cached preferredExtent |
|
1383 |
] |
|
3938 | 1384 |
]. |
1385 |
! |
|
1386 |
||
1387 |
menuPerformer:anObject |
|
1999 | 1388 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1389 |
from all submenus no specific receiver is defined )." |
1390 |
||
1999 | 1391 |
^ self receiver:anObject |
1392 |
! |
|
1393 |
||
388 | 1394 |
nameKeyAt:stringOrNumber |
2715 | 1395 |
"gets the nameKey of an item or nil" |
1396 |
||
1397 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1398 |
! |
1399 |
||
1400 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1401 |
"sets the nameKey of an item" |
1402 |
||
388 | 1403 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1404 |
! |
|
1405 |
||
1406 |
nameKeys |
|
2715 | 1407 |
"returns a collection of nameKeyss or nil" |
1408 |
||
388 | 1409 |
^ self collect:[:anItem| anItem nameKey ] |
1410 |
! |
|
1411 |
||
1412 |
nameKeys:something |
|
2715 | 1413 |
"define nameKeys for each item" |
1414 |
||
388 | 1415 |
self onEachPerform:#nameKey: withArgList:something |
1416 |
! |
|
1417 |
||
1418 |
numberOfItems |
|
2715 | 1419 |
"gets number of items" |
1420 |
||
388 | 1421 |
^ items size |
1422 |
! |
|
1423 |
||
2331 | 1424 |
originator |
1425 |
originator notNil ifTrue:[^ originator]. |
|
1426 |
superMenu notNil ifTrue:[ |
|
3938 | 1427 |
^ superMenu originator |
2331 | 1428 |
]. |
1429 |
^ nil |
|
1430 |
! |
|
1431 |
||
388 | 1432 |
receiver |
1433 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1434 |
from all submenus no specific receiver is defined )." |
1435 |
||
389 | 1436 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
3938 | 1437 |
^ superMenu receiver |
388 | 1438 |
]. |
389 | 1439 |
^ receiver |
388 | 1440 |
! |
1441 |
||
3938 | 1442 |
receiver:anObject |
388 | 1443 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
2715 | 1444 |
from all submenus no specific receiver is defined )." |
1445 |
||
389 | 1446 |
receiver := anObject |
388 | 1447 |
! |
1448 |
||
1449 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1450 |
"gets the shortCutKey of an item or nil" |
1451 |
||
1452 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1453 |
! |
1454 |
||
1455 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1456 |
"sets the shortCutKey of an item" |
1457 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1458 |
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
|
1459 |
! |
388 | 1460 |
|
1461 |
shortcutKeys |
|
2715 | 1462 |
"returns a collection of shortcutKeys or nil" |
1463 |
||
388 | 1464 |
^ self collect:[:anItem| anItem shortcutKey ] |
1465 |
! |
|
1466 |
||
1467 |
shortcutKeys:something |
|
2715 | 1468 |
"define shortcutKeys for each item" |
1469 |
||
388 | 1470 |
self onEachPerform:#shortcutKey: withArgList:something |
1471 |
! |
|
1472 |
||
1473 |
valueAt:stringOrNumber |
|
2715 | 1474 |
"gets value of an item; a block, valueHolder, ..." |
1475 |
||
1476 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1477 |
! |
1478 |
||
4226 | 1479 |
valueAt:stringOrNumber put:aBlockOrValueHolderOrSelector |
2715 | 1480 |
"sets value of an item; a block, valueHolder, ..." |
1481 |
||
4226 | 1482 |
self itemAt:stringOrNumber do:[:el| el value:aBlockOrValueHolderOrSelector ] |
388 | 1483 |
! |
1484 |
||
1485 |
values:something |
|
2715 | 1486 |
"define values for each item" |
1487 |
||
388 | 1488 |
self onEachPerform:#value: withArgList:something |
1489 |
! ! |
|
1490 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1491 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1492 |
|
1493 |
disableAll |
|
2715 | 1494 |
"disable all items; not the menu in case of enabled" |
1495 |
||
498 | 1496 |
self do:[:anItem| anItem enabled:false] |
388 | 1497 |
! |
1498 |
||
1499 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1500 |
"disable an collection of items" |
1501 |
||
388 | 1502 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1503 |
! |
|
1504 |
||
1505 |
enableAll |
|
2715 | 1506 |
"enable all items; not the menu in case of disabled" |
1507 |
||
498 | 1508 |
self do:[:anItem| anItem enabled:true] |
388 | 1509 |
! |
1510 |
||
1511 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1512 |
"enable an collection of items" |
1513 |
||
388 | 1514 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1515 |
! |
|
1516 |
||
1517 |
enabled |
|
2715 | 1518 |
"returns enabled state" |
1519 |
||
498 | 1520 |
^ enabled |
388 | 1521 |
! |
1522 |
||
1523 |
enabled:aState |
|
2715 | 1524 |
"change enabled state of menu" |
1525 |
||
545 | 1526 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1527 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1528 |
state := aState ? true. |
388 | 1529 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1530 |
enabled ~~ state ifTrue:[ |
3938 | 1531 |
enabled := state. |
1532 |
self invalidate. |
|
498 | 1533 |
]. |
388 | 1534 |
! |
1535 |
||
1536 |
enabledAt:stringOrNumber |
|
2715 | 1537 |
"gets the enabled state of an item or false" |
1538 |
||
388 | 1539 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1540 |
! |
|
1541 |
||
1542 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1543 |
"sets the enabled state of an item" |
1544 |
||
388 | 1545 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1546 |
! |
|
1547 |
||
3725 | 1548 |
exclusivePointer:aBoolean |
1549 |
"Do nothing here. Compatibility with PopUpListController" |
|
1550 |
||
1551 |
^ self |
|
1552 |
! |
|
1553 |
||
388 | 1554 |
isEnabled:stringOrNumber |
2715 | 1555 |
"gets the enabled state of an item or false" |
1556 |
||
388 | 1557 |
^ self enabledAt:stringOrNumber |
1558 |
! ! |
|
1559 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1560 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1561 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1562 |
enableChannel:aValueHolder |
2715 | 1563 |
"set my enableChannel" |
1564 |
||
498 | 1565 |
enableChannel notNil ifTrue:[ |
3938 | 1566 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1567 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1568 |
|
498 | 1569 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
3938 | 1570 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1571 |
]. |
498 | 1572 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1573 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1574 |
|
3222 | 1575 |
menuChannel |
1576 |
^ self menuHolder |
|
1577 |
||
1578 |
"Created: / 27-03-2007 / 08:38:31 / cg" |
|
1579 |
! |
|
1580 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1581 |
menuHolder:aValueHolder |
2715 | 1582 |
"set my menuHolder" |
1583 |
||
498 | 1584 |
menuHolder notNil ifTrue:[ |
3938 | 1585 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1586 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1587 |
|
498 | 1588 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
3938 | 1589 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1590 |
]. |
498 | 1591 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1592 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1593 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1594 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1595 |
|
616 | 1596 |
activeBackgroundColor |
2715 | 1597 |
"get the background drawing color used to highlight selection" |
1598 |
||
2219 | 1599 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1600 |
! |
1601 |
||
1602 |
activeForegroundColor |
|
2715 | 1603 |
"get the foreground color used to highlight selections" |
1604 |
||
2219 | 1605 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1606 |
! |
1607 |
||
390 | 1608 |
backgroundColor |
2715 | 1609 |
"return the background color" |
1610 |
||
502 | 1611 |
^ super viewBackground |
390 | 1612 |
! |
1613 |
||
1614 |
backgroundColor:aColor |
|
1615 |
"set the background drawing color. You should not use this method; |
|
2715 | 1616 |
instead, leave the value as defined in the styleSheet." |
1617 |
||
1618 |
self backgroundColor ~~ aColor ifTrue:[ |
|
3938 | 1619 |
super viewBackground:aColor. |
1620 |
self invalidate "/ RepairNow:true |
|
616 | 1621 |
] |
1622 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1623 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1624 |
! |
1625 |
||
727 | 1626 |
buttonActiveBackgroundColor |
2715 | 1627 |
"get the background drawing color used to highlight button selection" |
1628 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1629 |
^ buttonActiveBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1630 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1631 |
"Modified: / 19-01-2012 / 11:51:46 / cg" |
727 | 1632 |
! |
1633 |
||
3441 | 1634 |
buttonActiveForegroundColor |
1635 |
"get the foreground drawing color used to highlight button selection" |
|
1636 |
||
1637 |
^ styleSheet colorAt:#'button.activeForegroundColor' |
|
3938 | 1638 |
default:(self foregroundColor) |
3441 | 1639 |
! |
1640 |
||
730 | 1641 |
buttonEdgeStyle |
2715 | 1642 |
"get the button edge style" |
1643 |
||
2219 | 1644 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1645 |
! |
1646 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1647 |
buttonEnteredBackgroundColor |
2715 | 1648 |
"get the background drawing color used to highlight entered button items" |
1649 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1650 |
^ buttonEnteredBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1651 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1652 |
"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
|
1653 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1654 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1655 |
buttonEnteredLevel |
2715 | 1656 |
"get the 3D-level used to highlight entered button items" |
1657 |
||
4893 | 1658 |
^ buttonEnteredLevel "/ ? (styleSheet at:#'menuPanel.buttonEnteredLevel') ? 0 |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1659 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1660 |
|
730 | 1661 |
buttonHalfLightColor |
2715 | 1662 |
"get the background drawing color used to half light button frame" |
1663 |
||
2219 | 1664 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1665 |
! |
1666 |
||
1667 |
buttonHalfShadowColor |
|
2715 | 1668 |
"get the background drawing color used to half shadow button frame" |
1669 |
||
2219 | 1670 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1671 |
! |
1672 |
||
1673 |
buttonLightColor |
|
2715 | 1674 |
"get the background drawing color used to light button frame" |
1675 |
||
2219 | 1676 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1677 |
! |
1678 |
||
1679 |
buttonPassiveBackgroundColor |
|
2715 | 1680 |
"get the background drawing color used for button" |
1681 |
||
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1682 |
^ buttonPassiveBackgroundColor ? viewBackground |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1683 |
|
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
1684 |
"Modified: / 19-01-2012 / 13:13:59 / cg" |
727 | 1685 |
! |
1686 |
||
1687 |
buttonShadowColor |
|
2715 | 1688 |
"get the background drawing color used to shadow button frame" |
1689 |
||
2219 | 1690 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1691 |
! |
1692 |
||
1693 |
disabledEtchedForegroundColor |
|
1694 |
"return the color used for etching disabled items. |
|
2715 | 1695 |
If nil, no 3D effect is drawn." |
1696 |
||
4453 | 1697 |
|bg| |
1698 |
||
1699 |
(bg := self backgroundColor) = DefaultBackgroundColor ifFalse:[ |
|
4657 | 1700 |
^ bg mixed:0.5 with:Color white |
4453 | 1701 |
]. |
2219 | 1702 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
4453 | 1703 |
|
1704 |
"Modified: / 28-11-2013 / 16:28:25 / cg" |
|
727 | 1705 |
! |
1706 |
||
390 | 1707 |
disabledForegroundColor |
2715 | 1708 |
"return the foreground color used by disabled items" |
1709 |
||
2219 | 1710 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1711 |
! |
1712 |
||
2170 | 1713 |
enteredBackgroundColor |
2715 | 1714 |
"return the background color for entered items" |
1715 |
||
2219 | 1716 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
3938 | 1717 |
default:(self backgroundColor) |
2170 | 1718 |
! |
1719 |
||
1720 |
enteredForegroundColor |
|
2715 | 1721 |
"return the foreground color for entered items" |
1722 |
||
2219 | 1723 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1724 |
! |
1725 |
||
390 | 1726 |
font:aFont |
2715 | 1727 |
"set the font" |
1728 |
||
4523 | 1729 |
(aFont isNil or:[aFont = gc font]) ifTrue:[ ^ self ]. |
2614 | 1730 |
|
1731 |
super font:aFont. |
|
1732 |
self do:[:anItem| anItem fontChanged ]. |
|
1733 |
||
1734 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
4657 | 1735 |
self extent:(self preferredExtent) |
2614 | 1736 |
]. |
1737 |
self mustRearrange. |
|
390 | 1738 |
! |
1739 |
||
1740 |
foregroundColor |
|
2715 | 1741 |
"return the passive foreground color" |
1742 |
||
2059 | 1743 |
^ fgColor |
390 | 1744 |
! |
1745 |
||
1746 |
foregroundColor:aColor |
|
1747 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1748 |
instead leave the value as defined in the styleSheet." |
1749 |
||
2219 | 1750 |
aColor ~= fgColor ifTrue:[ |
5001 | 1751 |
fgColor := aColor onDevice:device. |
1752 |
self invalidate |
|
2219 | 1753 |
]. |
580 | 1754 |
! |
1755 |
||
1699 | 1756 |
maxAbsoluteButtonLevel |
1757 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1758 |
extent of a button" |
1759 |
||
3987 | 1760 |
^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0 |
1761 |
||
1762 |
"Modified: / 19-01-2011 / 21:21:53 / cg" |
|
390 | 1763 |
! |
1764 |
||
730 | 1765 |
selectionFrameBrightColor |
2715 | 1766 |
"get the selection frame bright color" |
1767 |
||
5168 | 1768 |
^ self whiteColor |
730 | 1769 |
! |
1770 |
||
1771 |
selectionFrameDarkColor |
|
2715 | 1772 |
"get the selection frame dark color" |
1773 |
||
5168 | 1774 |
^ self blackColor |
730 | 1775 |
! |
1776 |
||
1727 | 1777 |
setFont:aFont |
3938 | 1778 |
"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
|
1779 |
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
|
1780 |
|
1727 | 1781 |
|currentFont| |
1782 |
||
4523 | 1783 |
currentFont := gc font. |
1784 |
(aFont notNil and:[aFont ~= currentFont]) ifTrue:[ |
|
4657 | 1785 |
super font:aFont. |
1727 | 1786 |
]. |
1787 |
^ currentFont |
|
4893 | 1788 |
! |
1789 |
||
1790 |
suppressSeparatingLines |
|
1791 |
^ self verticalLayout not |
|
1792 |
and:[ (styleSheet at:#'menu.suppressSeparatingLinesInToolbar' default:false) ] |
|
390 | 1793 |
! ! |
1794 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1795 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1796 |
|
1797 |
height |
|
2715 | 1798 |
"default height" |
1799 |
||
3886 | 1800 |
self hasExplicitExtent ifFalse:[ |
3938 | 1801 |
^ self preferredHeight |
388 | 1802 |
]. |
1803 |
^ super height |
|
1804 |
! |
|
1805 |
||
2016 | 1806 |
maxExtent |
4113 | 1807 |
|minH pos| |
4110 | 1808 |
|
1809 |
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
|
1810 |
|
5001 | 1811 |
device notNil ifTrue:[ |
1812 |
"/ notice, the position-dependent query: if there is a higher secondary screen, |
|
1813 |
"/ this makes a difference in where a popUpMenu is allowed... |
|
1814 |
pos := self origin. |
|
1815 |
pos = (0@0) ifTrue:[ |
|
1816 |
"called too early" |
|
1817 |
minH := device smallestMonitorHeight. |
|
1818 |
] ifFalse:[ |
|
1819 |
minH := device usableHeightAt:pos. |
|
1820 |
]. |
|
1821 |
^ device usableWidth @ (minH - 2) |
|
1822 |
"/ ^ self graphicsDevice usableExtent - 5. |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1823 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1824 |
superMenu notNil ifTrue:[ |
5001 | 1825 |
^ superMenu maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1826 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1827 |
"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
|
1828 |
self error:'don''t know maxExtent'. |
4109 | 1829 |
|
4110 | 1830 |
"Modified: / 15-02-2012 / 19:22:24 / cg" |
2016 | 1831 |
! |
1832 |
||
4656 | 1833 |
origin:origin |
1834 |
"changed due to menu in horizontal panel, if the origin |
|
1835 |
changed we have to rearrange the menu items if size not fixed" |
|
1836 |
||
1837 |
|oldLeft| |
|
1838 |
||
1839 |
(shown and:[mustRearrange not and:[sizeFixed not]]) ifFalse:[ |
|
4657 | 1840 |
^ super origin:origin |
4656 | 1841 |
]. |
1842 |
"left partner in horizontal panel toggles visibility" |
|
1843 |
oldLeft := self left. |
|
1844 |
super origin:origin. |
|
1845 |
oldLeft = self left ifFalse:[ |
|
4657 | 1846 |
"/ no change notification... so cannot call #mustRearrange |
1847 |
mustRearrange := true. |
|
1848 |
self invalidate. |
|
4656 | 1849 |
]. |
1850 |
! |
|
1851 |
||
388 | 1852 |
preferredExtent |
2715 | 1853 |
"compute and returns my preferred extent" |
1854 |
||
2253 | 1855 |
|maxExtent usedExtent| |
2024 | 1856 |
|
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1857 |
"/ If I have an explicit preferredExtent.. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1858 |
explicitExtent notNil ifTrue:[ |
4893 | 1859 |
^ explicitExtent |
3580
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1860 |
]. |
e9fe446dc779
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3565
diff
changeset
|
1861 |
"/ If I have a cached preferredExtent value.. |
2016 | 1862 |
preferredExtent notNil ifTrue:[ |
4893 | 1863 |
^ preferredExtent |
2016 | 1864 |
]. |
3837 | 1865 |
|
2024 | 1866 |
usedExtent := self preferredExtentOfItems. |
1867 |
superView isNil ifTrue:[ |
|
4893 | 1868 |
"/ is standalone |
1869 |
preferredWidth notNil ifTrue:[ |
|
1870 |
usedExtent x < preferredWidth ifTrue:[ |
|
1871 |
usedExtent := preferredWidth @ usedExtent y. |
|
1872 |
] |
|
1873 |
] |
|
3938 | 1874 |
]. |
1875 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1876 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1877 |
maxExtent notNil ifTrue:[ |
4893 | 1878 |
usedExtent := usedExtent min:maxExtent. |
4627 | 1879 |
]. |
4656 | 1880 |
"/ changed due to menu in horizontal panel |
1881 |
(superView notNil and:[items size == 0] ) ifTrue:[ |
|
4893 | 1882 |
self isViewWrapper ifFalse:[ ^ usedExtent ]. |
4656 | 1883 |
]. |
1884 |
||
3837 | 1885 |
preferredExtent := usedExtent. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1886 |
^ usedExtent |
2024 | 1887 |
|
1888 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1889 |
! |
1890 |
||
1891 |
preferredExtentOfItems |
|
1892 |
"compute and returns my preferred extent including all items |
|
4893 | 1893 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
2715 | 1894 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1895 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1896 |
x "{ Class:SmallInteger }" |
1897 |
y "{ Class:SmallInteger }" |
|
1898 |
size "{ Class:SmallInteger }" |
|
2883 | 1899 |
buttonInsetX2 "{ Class:SmallInteger }" |
1900 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1901 |
labelInsetX "{ Class:SmallInteger }" |
1902 |
labelInsetY "{ Class:SmallInteger }" |
|
1903 |
itemMargin "{ Class:SmallInteger }" |
|
1904 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1905 |
| |
388 | 1906 |
|
1699 | 1907 |
(size := items size) == 0 ifTrue:[ |
4893 | 1908 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
1909 |
^ 32 @ 32 |
|
2219 | 1910 |
]. |
3131 | 1911 |
stringOffsetX := nil. |
2883 | 1912 |
buttonInsetX2 := 2 * buttonInsetX. |
1913 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1914 |
|
1915 |
self isPopUpView ifFalse:[ |
|
4893 | 1916 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1917 |
] ifTrue:[ |
4893 | 1918 |
labelInsetX := labelInsetY := 0. |
1699 | 1919 |
]. |
1920 |
||
1921 |
x := 0. |
|
1922 |
y := 0. |
|
2219 | 1923 |
groupDividerSize := self groupDividerSize. |
388 | 1924 |
|
1925 |
self verticalLayout ifFalse:[ |
|
4893 | 1926 |
items keysAndValuesDo:[:key :el| |eX eY| |
1927 |
extent := el preferredExtent. |
|
1928 |
||
1929 |
"/ check for visibility (extent x ~~ 0) |
|
1930 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1931 |
eY := extent y. |
|
1932 |
||
1933 |
el isButton ifTrue:[ |
|
1934 |
eX := eX + buttonInsetX2. |
|
1935 |
eY := eY + buttonInsetY2. |
|
1936 |
] ifFalse:[ |
|
1937 |
eX := eX + labelInsetX. |
|
1938 |
eY := eY + labelInsetY. |
|
1939 |
]. |
|
1940 |
key ~~ size ifTrue:[ |
|
1941 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1942 |
x := x + groupDividerSize |
|
1943 |
] ifFalse:[ |
|
1944 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
1945 |
x := x + itemSpace |
|
1946 |
] |
|
1947 |
] |
|
1948 |
]. |
|
1949 |
x := x + eX. |
|
1950 |
y := y max:eY. |
|
1951 |
] |
|
1952 |
] |
|
388 | 1953 |
] ifTrue:[ |
4893 | 1954 |
hasMenu := false. |
1955 |
shCtKey := 0. |
|
1956 |
showAcc := MenuView showAcceleratorKeys == true. |
|
1957 |
y := x. |
|
1958 |
x := 0. |
|
1959 |
itemMargin := 2 * self itemMargin. |
|
1960 |
||
1961 |
items keysAndValuesDo:[:key :el| |eX eY| |
|
1962 |
extent := el preferredExtent. |
|
1963 |
||
1964 |
"/ check for visibility (extent x ~~ 0) |
|
1965 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1966 |
eY := extent y. |
|
1967 |
||
1968 |
el isButton ifTrue:[ |
|
1969 |
eX := eX + buttonInsetX2. |
|
1970 |
eY := eY + buttonInsetY2. |
|
1971 |
] ifFalse:[ |
|
1972 |
eX := eX + labelInsetX. |
|
1973 |
eY := eY + labelInsetY. |
|
1974 |
]. |
|
1975 |
hasMenu ifFalse:[ |
|
1976 |
hasMenu := el hasSubmenu |
|
1977 |
]. |
|
1978 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1979 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1980 |
]. |
|
1981 |
key ~~ size ifTrue:[ |
|
1982 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1983 |
y := y + groupDividerSize |
|
1984 |
] |
|
1985 |
]. |
|
1986 |
y := y + eY. |
|
1987 |
x := x max:eX. |
|
1988 |
]. |
|
1989 |
]. |
|
1990 |
x := x + itemMargin. |
|
1991 |
||
1992 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
|
1993 |
shortKeyInset := x + Item labelRightOffset. |
|
1994 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
|
1995 |
||
1996 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
|
1997 |
x := x + self shortcutKeyOffset. |
|
1998 |
] |
|
1999 |
]. |
|
1699 | 2000 |
"/ to have a small inset |
4893 | 2001 |
y := y + 1. |
1699 | 2002 |
"/ x := x + 1. |
2003 |
]. |
|
4893 | 2004 |
x := x + ((margin + extraMargin)*2). |
2005 |
y := y + ((margin + extraMargin)*2). |
|
1699 | 2006 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2007 |
^ x @ y |
388 | 2008 |
! |
2009 |
||
2253 | 2010 |
preferredWidth:aWidthOrNil |
2011 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
2012 |
If nil (default), the width is computed from the contained items. |
|
2715 | 2013 |
If not nil, the width is the maximum from the contained items and the required width." |
2014 |
||
2253 | 2015 |
preferredWidth := aWidthOrNil. |
2024 | 2016 |
! |
2017 |
||
388 | 2018 |
shortKeyInset |
2715 | 2019 |
"left inset of shortcutKey" |
2020 |
||
2021 |
^ shortKeyInset |
|
616 | 2022 |
! |
2023 |
||
4628 | 2024 |
sizeFixed:aBoolean |
4657 | 2025 |
"set/clear the fix-size attribute. |
4628 | 2026 |
If true (the default), the menuPanel will not change its size when items become visible/invisible. |
2027 |
If false, it will resize itself to adapt to the number of visible items" |
|
2028 |
||
4656 | 2029 |
sizeFixed := aBoolean. |
2030 |
||
2031 |
sizeFixed ifFalse:[ |
|
4657 | 2032 |
"/ changed due to menu in horizontal panel |
2033 |
superView notNil ifTrue:[ superView addDependent:self ]. |
|
4656 | 2034 |
]. |
4628 | 2035 |
! |
2036 |
||
3131 | 2037 |
stringOffsetXfor:anItem |
2038 |
"return the x offset for a MenuItem where to draw the text |
|
2039 |
" |
|
2040 |
|label w| |
|
2041 |
||
2042 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
2043 |
||
2044 |
stringOffsetX isNil ifTrue:[ |
|
3938 | 2045 |
stringOffsetX := 0. |
2046 |
||
2047 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
2048 |
self do:[:el| |
|
2049 |
el isVisible ifTrue:[ |
|
2050 |
( (label := el indicatorForm) notNil |
|
2051 |
or:[(label := el choiceForm) notNil] |
|
2052 |
) ifTrue:[ |
|
2053 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
2054 |
] ifFalse:[ |
|
2055 |
label := el displayLabel. |
|
2056 |
label class == LabelAndIcon ifTrue:[ |
|
2057 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
2058 |
]. |
|
2059 |
]. |
|
2060 |
]. |
|
2061 |
]. |
|
2062 |
]. |
|
3131 | 2063 |
]. |
2064 |
w := 0. |
|
2065 |
||
2066 |
( (label := anItem indicatorForm) notNil |
|
2067 |
or:[(label := anItem choiceForm) notNil] |
|
2068 |
) ifTrue:[ |
|
3938 | 2069 |
w := label width + 2. |
3131 | 2070 |
]. |
2071 |
stringOffsetX == 0 ifTrue:[ |
|
3938 | 2072 |
^ w |
3131 | 2073 |
]. |
2074 |
w == 0 ifTrue:[ |
|
3938 | 2075 |
label := anItem displayLabel. |
2076 |
||
2077 |
label class == LabelAndIcon ifTrue:[ |
|
2078 |
^ stringOffsetX - label xOfString |
|
2079 |
]. |
|
3131 | 2080 |
]. |
2081 |
^ stringOffsetX. |
|
2082 |
! |
|
2083 |
||
616 | 2084 |
subMenuIndicationWidth |
2219 | 2085 |
^ self rightArrow width |
388 | 2086 |
! ! |
2087 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2088 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2089 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2090 |
iconIndicationDisabledOff |
2219 | 2091 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2092 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2093 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2094 |
iconIndicationDisabledOn |
2219 | 2095 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2096 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2097 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2098 |
iconIndicationOff |
2219 | 2099 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2100 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2101 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2102 |
iconIndicationOn |
2219 | 2103 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2104 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2105 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2106 |
iconRadioGroupDisabledOff |
2219 | 2107 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2108 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2109 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2110 |
iconRadioGroupDisabledOn |
2219 | 2111 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2112 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
2113 |
|
3565 | 2114 |
iconRadioGroupEnteredOff |
2115 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff) |
|
2116 |
! |
|
2117 |
||
2118 |
iconRadioGroupEnteredOn |
|
2119 |
^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn) |
|
2120 |
! |
|
2121 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2122 |
iconRadioGroupOff |
2219 | 2123 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2124 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2125 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2126 |
iconRadioGroupOn |
2219 | 2127 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2128 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
2129 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2130 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 2131 |
|
4240 | 2132 |
hasItems |
2133 |
"return true, if I have items" |
|
2134 |
||
2135 |
^ items notEmptyOrNil |
|
2136 |
! |
|
2137 |
||
388 | 2138 |
itemAt:stringOrNumber do:aOneArgBlock |
3938 | 2139 |
"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
|
2140 |
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
|
2141 |
|
388 | 2142 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
2143 |
! |
|
2144 |
||
2145 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
3938 | 2146 |
"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
|
2147 |
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
|
2148 |
|
388 | 2149 |
|item| |
2150 |
||
2151 |
item := self itemAt:stringOrNumber. |
|
2152 |
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
|
2153 |
^ exceptionBlock value |
706 | 2154 |
! |
2155 |
||
2156 |
itemAtIndex:anIndex |
|
2715 | 2157 |
"returns item at an index or nil" |
2158 |
||
706 | 2159 |
^ 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
|
2160 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2161 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2162 |
items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2163 |
"returns the list of items or nil. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2164 |
Warning: do not change this list - it is mine !!" |
2715 | 2165 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
2166 |
^ items |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2167 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2168 |
"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
|
2169 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2170 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2171 |
itemsDo:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2172 |
items notNil ifTrue:[ |
4657 | 2173 |
items do:aBlock |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2174 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2175 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2176 |
"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
|
2177 |
! |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2178 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2179 |
itemsDoWithIndex:aBlock |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2180 |
items notNil ifTrue:[ |
4657 | 2181 |
items doWithIndex:aBlock |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2182 |
] |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2183 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2184 |
"Created: / 09-11-2010 / 10:06:02 / cg" |
388 | 2185 |
! ! |
2186 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2187 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 2188 |
|
727 | 2189 |
buttonActiveLevel |
2715 | 2190 |
"get the buttons active level" |
2191 |
||
4893 | 2192 |
^ buttonActiveLevel "/ ? (styleSheet at:#'menuPanel.buttonActiveLevel') ? 0 |
727 | 2193 |
! |
2194 |
||
2195 |
buttonPassiveLevel |
|
2715 | 2196 |
"get the buttons passive level" |
2197 |
||
4893 | 2198 |
^ buttonPassiveLevel "/ ? (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0 |
727 | 2199 |
! |
2200 |
||
2337 | 2201 |
centerItems |
2202 |
^ centerItems ? false |
|
2203 |
! |
|
2204 |
||
2205 |
centerItems:aBoolean |
|
2206 |
centerItems := aBoolean |
|
2207 |
! |
|
2208 |
||
390 | 2209 |
fitFirstPanel |
3938 | 2210 |
"gets true if the first panel in the menu hierarchy must be fit |
390 | 2211 |
to the extent of its superView |
1699 | 2212 |
|
2715 | 2213 |
NOT SUPPORTED" |
2214 |
||
2219 | 2215 |
^ false |
388 | 2216 |
! |
2217 |
||
390 | 2218 |
fitFirstPanel:aState |
3938 | 2219 |
"sets true if the first panel in the menu hierarchy must be fit |
390 | 2220 |
to the extent of its superView |
1699 | 2221 |
|
2715 | 2222 |
NOT SUPPORTED" |
616 | 2223 |
! |
2224 |
||
1093 | 2225 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2226 |
anInt ~~ level ifTrue:[ |
3147 | 2227 |
super level:anInt. |
2228 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
2229 |
] |
2052 | 2230 |
|
2231 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 2232 |
! |
2233 |
||
616 | 2234 |
rightArrow |
2374 | 2235 |
rightArrow isNil ifTrue:[ |
5001 | 2236 |
device isNil ifTrue:[ |
2237 |
^ SelectionInListView rightArrowFormOn:Screen current |
|
2238 |
]. |
|
2239 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
2219 | 2240 |
]. |
616 | 2241 |
^ rightArrow |
2242 |
! |
|
2243 |
||
2244 |
rightArrowShadow |
|
2245 |
^ rightArrowShadow |
|
388 | 2246 |
! |
2247 |
||
390 | 2248 |
showGroupDivider |
2715 | 2249 |
"get the enabled flag for showing groupDiveders" |
2250 |
||
2253 | 2251 |
^ showGroupDivider |
388 | 2252 |
! |
2253 |
||
390 | 2254 |
showGroupDivider:aState |
2715 | 2255 |
"set the enabled flag for showing groupDiveders" |
2256 |
||
2253 | 2257 |
showGroupDivider ~~ aState ifTrue:[ |
3938 | 2258 |
showGroupDivider := aState. |
2259 |
self mustRearrange. |
|
653 | 2260 |
] |
388 | 2261 |
! |
2262 |
||
2263 |
showSeparatingLines |
|
2715 | 2264 |
"gets true if drawing of separating lines is enabled." |
2265 |
||
2253 | 2266 |
^ showSeparatingLines |
388 | 2267 |
! |
2268 |
||
390 | 2269 |
showSeparatingLines:aState |
2715 | 2270 |
"turn on/off drawing of separating lines." |
2271 |
||
2253 | 2272 |
aState ~~ showSeparatingLines ifTrue:[ |
3938 | 2273 |
showSeparatingLines := aState. |
2274 |
self mustRearrange |
|
2253 | 2275 |
]. |
388 | 2276 |
! |
2277 |
||
2278 |
verticalLayout |
|
2715 | 2279 |
"get the layout: vertical( true ) or horizontal( false )" |
2280 |
||
2374 | 2281 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 2282 |
|
2283 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
3938 | 2284 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
2374 | 2285 |
^ verticalLayout |
388 | 2286 |
! |
2287 |
||
2288 |
verticalLayout:aState |
|
2715 | 2289 |
"set the layout: vertical( true ) or horizontal( false )" |
2290 |
||
2253 | 2291 |
aState ~~ verticalLayout ifTrue:[ |
3938 | 2292 |
verticalLayout isNil ifTrue:[ |
2293 |
verticalLayout := aState |
|
2294 |
] ifFalse:[ |
|
2295 |
verticalLayout := aState. |
|
2296 |
self mustRearrange. |
|
2297 |
]. |
|
2253 | 2298 |
]. |
388 | 2299 |
! ! |
2300 |
||
2219 | 2301 |
!MenuPanel methodsFor:'accessing-style'! |
2302 |
||
2303 |
buttonInsetX |
|
2715 | 2304 |
"returns the verical button space" |
2305 |
||
2883 | 2306 |
^ buttonInsetX |
2219 | 2307 |
! |
2308 |
||
2309 |
buttonInsetY |
|
2715 | 2310 |
"returns the verical button space" |
2311 |
||
2883 | 2312 |
^ buttonInsetY |
2219 | 2313 |
! |
2314 |
||
3975 | 2315 |
delayInSecondsBeforeOpeningSubmenu |
2316 |
"answer the seconds a submenu will be delayed before |
|
2317 |
open; an already open submenu than will be closed" |
|
2318 |
||
4527 | 2319 |
^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu' default:0.15 |
3975 | 2320 |
! |
2321 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2322 |
drawMenuIndicatorSeparatorLine |
4235 | 2323 |
^ true. |
2324 |
"/ ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine' default:false |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2325 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2326 |
|
2219 | 2327 |
enteredLevel |
2715 | 2328 |
"returns the enter-level for an unselected item moved through" |
2329 |
||
2219 | 2330 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
2331 |
! |
|
2332 |
||
2333 |
groupDividerSize |
|
2715 | 2334 |
"returns the width of a group divider" |
2335 |
||
2219 | 2336 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
2337 |
! |
|
2338 |
||
2339 |
itemMargin |
|
2715 | 2340 |
"returns the margin of an item" |
2341 |
||
2219 | 2342 |
^ styleSheet at:#'menu.itemMargin' default:0 |
2343 |
! |
|
2344 |
||
2345 |
itemSpace |
|
2715 | 2346 |
"returns the additional space for an item in a (vertical) panel" |
2347 |
||
2883 | 2348 |
^ itemSpace |
2219 | 2349 |
! |
2350 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2351 |
menuIndicatorVerticalPosition |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2352 |
"#center, #top or #bottom" |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2353 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2354 |
^ #center |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2355 |
"/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2356 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2357 |
|
2219 | 2358 |
selectionFollowsMouse |
2715 | 2359 |
"returns true if the selection follows the mouse" |
2360 |
||
2219 | 2361 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
2362 |
! |
|
2363 |
||
2364 |
shortcutKeyOffset |
|
2715 | 2365 |
"returns the offset for a shortcutKey" |
2366 |
||
2219 | 2367 |
^ 5 |
2368 |
! ! |
|
2369 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
2370 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 2371 |
|
2372 |
subMenuAt:stringOrNumber |
|
3192 | 2373 |
"gets the current submenu of an item; if the submenu is nil, the |
2374 |
submenu is generated if specified otherwise nil is returned." |
|
2375 |
||
2376 |
|submenu| |
|
2377 |
||
2378 |
self itemAt:stringOrNumber do:[:anItem| |
|
3938 | 2379 |
submenu := anItem currentSubmenu. |
2380 |
submenu isNil ifTrue:[ |
|
2381 |
submenu := anItem setupSubmenu |
|
2382 |
]. |
|
3192 | 2383 |
]. |
2384 |
^ submenu |
|
3934 | 2385 |
|
2386 |
"Modified: / 22-09-2010 / 13:53:21 / cg" |
|
388 | 2387 |
! |
2388 |
||
2389 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2390 |
"sets the submenu of an item" |
2391 |
||
388 | 2392 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2393 |
! |
|
2394 |
||
2395 |
subMenuShown |
|
2715 | 2396 |
"return the currently visible submenu - or nil if there is none" |
2397 |
||
3192 | 2398 |
|item submenu| |
2399 |
||
2400 |
item := self selection. |
|
2401 |
||
2402 |
item notNil ifTrue:[ |
|
3938 | 2403 |
submenu := item currentSubmenu. |
2404 |
||
2405 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2406 |
^ submenu |
|
2407 |
]. |
|
2715 | 2408 |
]. |
2409 |
^ nil |
|
388 | 2410 |
! ! |
2411 |
||
2504 | 2412 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2413 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2414 |
closeMenus |
2715 | 2415 |
"close all menus without accepting" |
2416 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2417 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2418 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2419 |
|
388 | 2420 |
hide |
2715 | 2421 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2422 |
|
2407 | 2423 |
"/ TODO: replace with LeaveSignal raise. |
2424 |
||
388 | 2425 |
self selection:nil. |
2426 |
self unmap. |
|
2427 |
! |
|
2428 |
||
2429 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2430 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2431 |
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
|
2432 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2433 |
to some performer)" |
2434 |
||
2435 |
^ self showAt:(self origin) resizing:true |
|
388 | 2436 |
! |
2437 |
||
2438 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2439 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2440 |
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
|
2441 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2442 |
to some performer)" |
2443 |
||
3754 | 2444 |
^ self showAt:aPoint resizing:true |
388 | 2445 |
! |
2446 |
||
2447 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2448 |
"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
|
2449 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2450 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2451 |
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
|
2452 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2453 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2454 |
|
4150 | 2455 |
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
|
2456 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2457 |
|
2458 |
aBoolean ifTrue:[ |
|
4657 | 2459 |
self fixSize. |
388 | 2460 |
]. |
1459 | 2461 |
"/ self makeFullyVisible. -- done in realize |
388 | 2462 |
self openModal:[true]. "realize " |
2463 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2464 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2465 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2466 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2467 |
self topMenu hasPerformed ifTrue:[ |
4657 | 2468 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2469 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2470 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2471 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2472 |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
2473 |
"Modified: / 29-06-2011 / 16:24:22 / cg" |
388 | 2474 |
! |
2475 |
||
2476 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2477 |
"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
|
2478 |
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
|
2479 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2480 |
to some performer)" |
2481 |
||
5001 | 2482 |
^ self showAt:(device pointerPosition) resizing:true |
4064
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2483 |
|
b8060862ebe1
comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
2484 |
"Modified (format): / 22-07-2011 / 15:24:48 / cg" |
388 | 2485 |
! |
2486 |
||
2487 |
showCenteredIn:aView |
|
2488 |
"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
|
2489 |
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
|
2490 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2491 |
to some performer)" |
2492 |
||
388 | 2493 |
|top| |
2494 |
||
2495 |
top := aView topView. |
|
2496 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2497 |
^ 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
|
2498 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2499 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2500 |
! |
2501 |
||
2502 |
startUp |
|
2503 |
"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
|
2504 |
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
|
2505 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2506 |
to some performer)" |
2507 |
||
388 | 2508 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2509 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2510 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2511 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2512 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2513 |
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
|
2514 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2515 |
to some performer)" |
2516 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2517 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2518 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2519 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2520 |
! |
2521 |
||
2332 | 2522 |
startUpFor:originatingWidget |
2523 |
"realize the menu at the current pointer position |
|
2524 |
return the value of the selectedItem or nil, of none was selected |
|
2525 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2526 |
to some performer)" |
2527 |
||
2332 | 2528 |
originator := originatingWidget. |
2529 |
^ self startUp |
|
2530 |
! |
|
2531 |
||
1750 | 2532 |
startUpOrNil |
2533 |
"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
|
2534 |
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
|
2535 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2536 |
to some performer)" |
2537 |
||
1750 | 2538 |
^ self showAtPointer |
388 | 2539 |
! ! |
2540 |
||
2541 |
!MenuPanel methodsFor:'adding & removing'! |
|
2542 |
||
2543 |
createAtIndex:anIndexOrNil |
|
1800 | 2544 |
"create an item and add this item to the index. In case of nil, the item |
2545 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2546 |
otherwise the new created item is returned." |
2547 |
||
4046 | 2548 |
|max item index| |
388 | 2549 |
|
2550 |
max := (items size) + 1. |
|
2551 |
||
4046 | 2552 |
(index := anIndexOrNil) notNil ifTrue:[ |
4657 | 2553 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2554 |
index := max. |
|
2555 |
"/ ^ nil |
|
2556 |
] |
|
388 | 2557 |
]. |
2558 |
items isNil ifTrue:[ |
|
4657 | 2559 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2560 |
] ifFalse:[ |
4657 | 2561 |
items := items asOrderedCollection |
388 | 2562 |
]. |
2563 |
item := Item in:self. |
|
2564 |
||
4046 | 2565 |
(index isNil or:[index == max]) ifTrue:[ |
4657 | 2566 |
items add:item |
388 | 2567 |
] ifFalse:[ |
4657 | 2568 |
items add:item beforeIndex:index |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2569 |
]. |
4627 | 2570 |
preferredExtent := nil. "/ flush cached preferredExtent |
3966 | 2571 |
self mustRearrange. |
388 | 2572 |
^ item |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2573 |
|
4046 | 2574 |
"Modified: / 03-07-2011 / 22:49:47 / cg" |
388 | 2575 |
! |
2576 |
||
2577 |
remove:stringOrNumber |
|
2578 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2579 |
if found, remove and return it" |
2580 |
||
388 | 2581 |
|item| |
2582 |
||
2583 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
4657 | 2584 |
items remove:item. |
2585 |
items := items asNilIfEmpty. |
|
2586 |
item destroy. |
|
2587 |
preferredExtent := nil. "/ flush cached preferredExtent |
|
2588 |
self mustRearrange. |
|
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2589 |
]. |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2590 |
^ item |
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2591 |
|
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2592 |
"Modified: / 09-11-2010 / 10:04:08 / cg" |
388 | 2593 |
! |
2594 |
||
2595 |
removeAll |
|
2715 | 2596 |
"remove all items and submenus" |
2597 |
||
388 | 2598 |
self disabledRedrawDo:[ |
4657 | 2599 |
self selection:nil. |
2600 |
groupSizes := nil. |
|
2601 |
items notNil ifTrue:[ |
|
2602 |
items copy do:[:el| el destroy ]. |
|
2603 |
]. |
|
2604 |
items := nil. |
|
2605 |
preferredExtent := nil. "/ flush cached preferredExtent |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2606 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2607 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2608 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2609 |
! ! |
2610 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2611 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2612 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2613 |
update:something with:aParameter from:changedObject |
498 | 2614 |
|
2615 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2616 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2617 |
|
4656 | 2618 |
changedObject == superView ifTrue:[ |
4657 | 2619 |
"/ changed due to menu in horizontal panel |
2620 |
something == #sizeOfView ifTrue:[ |
|
2621 |
(shown and:[sizeFixed not]) ifTrue:[ |
|
2622 |
"/ no change notification... so cannot call #mustRearrange |
|
2623 |
mustRearrange := true. |
|
2624 |
self invalidate. |
|
2625 |
]. |
|
2626 |
]. |
|
2627 |
^ self |
|
4656 | 2628 |
]. |
2629 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2630 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2631 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2632 |
|
388 | 2633 |
!MenuPanel methodsFor:'converting'! |
2634 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2635 |
asMenu |
3222 | 2636 |
"convert contents to a menu" |
2715 | 2637 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2638 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2639 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2640 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2641 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2642 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2643 |
^ menu |
3222 | 2644 |
|
2645 |
"Modified: / 27-03-2007 / 08:39:48 / cg" |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2646 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2647 |
|
388 | 2648 |
fromSpec:aMenuSpec |
2715 | 2649 |
"build from spec" |
2650 |
||
3222 | 2651 |
self menu:(Menu decodeFromLiteralArray:aMenuSpec) |
2652 |
||
2653 |
"Modified: / 27-03-2007 / 08:42:43 / cg" |
|
388 | 2654 |
! |
2655 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2656 |
menu:aMenu |
3965
bf89086ea0b5
layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
2657 |
"setup from a menu" |
2715 | 2658 |
|
388 | 2659 |
self disabledRedrawDo:[ |
4657 | 2660 |
|menu newItems menuReceiver| |
2661 |
||
2662 |
self removeAll. |
|
2663 |
||
2664 |
(menu := aMenu) notNil ifTrue:[ |
|
2665 |
(aMenu isCollection) ifTrue:[ |
|
2666 |
menu := Menu decodeFromLiteralArray:aMenu. |
|
2667 |
] ifFalse:[ |
|
2668 |
menuReceiver := menu receiver. |
|
2669 |
menuReceiver notNil ifTrue:[ |
|
2670 |
self receiver:menuReceiver. |
|
2671 |
] |
|
2672 |
]. |
|
2673 |
(newItems := menu menuItems) notEmptyOrNil ifTrue:[ |
|
2674 |
items := newItems collect:[:ni | |
|
2675 |
|i| |
|
2676 |
||
2677 |
i:= Item in:self. |
|
2678 |
i menuItem:ni. |
|
2679 |
i. |
|
2680 |
]. |
|
2681 |
]. |
|
2682 |
self groupSizes:(menu groupSizes). |
|
2683 |
preferredExtent := nil. "/ flush cached preferredExtent |
|
2684 |
] |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2685 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2686 |
|
3966 | 2687 |
"Modified: / 09-11-2010 / 11:52:28 / cg" |
388 | 2688 |
! ! |
2689 |
||
2681 | 2690 |
!MenuPanel methodsFor:'dependents access'! |
2691 |
||
2692 |
addDependencies |
|
2715 | 2693 |
"add all dependencies" |
2694 |
||
2681 | 2695 |
self do:[:anItem| anItem addDependencies ]. |
2696 |
||
2697 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2698 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2699 |
! |
|
2700 |
||
2701 |
removeDependencies |
|
2715 | 2702 |
"remove all dependencies" |
2703 |
||
2681 | 2704 |
self do:[:anItem| anItem removeDependencies ]. |
2705 |
||
2706 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2707 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2708 |
! ! |
|
2709 |
||
388 | 2710 |
!MenuPanel methodsFor:'drawing'! |
2711 |
||
2712 |
disabledRedrawDo:aBlock |
|
2713 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2714 |
of the block a redraw might be performed" |
2715 |
||
388 | 2716 |
|state| |
2717 |
||
2718 |
state := mustRearrange. |
|
2719 |
mustRearrange := true. |
|
2720 |
aBlock value. |
|
2721 |
mustRearrange := state. |
|
2722 |
self mustRearrange |
|
2723 |
! |
|
2724 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2725 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2726 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2727 |
|
4482 | 2728 |
aLevel isNil ifTrue:[^ self]. |
2729 |
aLevel == 0 ifTrue:[^ self]. |
|
2730 |
||
2731 |
layout := anItem layout. |
|
2732 |
||
4843 | 2733 |
(styleSheet at:'menuPanel.button3D' default:styleSheet is3D) ifFalse:[ |
2734 |
self displayRectangle:layout. |
|
4482 | 2735 |
] ifTrue:[ |
4843 | 2736 |
self drawEdgesForX:(layout left) |
2737 |
y:(layout top) |
|
2738 |
width:(layout width) |
|
2739 |
height:(layout height) |
|
2740 |
level:aLevel |
|
2741 |
shadow:(self buttonShadowColor) |
|
2742 |
light:(self buttonLightColor) |
|
2743 |
halfShadow:(self buttonHalfShadowColor) |
|
2744 |
halfLight:(self buttonHalfLightColor) |
|
2745 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2746 |
] |
4482 | 2747 |
|
2748 |
"Modified: / 06-02-2014 / 14:55:05 / cg" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2749 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2750 |
|
3187 | 2751 |
drawFocusForItem:anItem |
2752 |
|lytItem| |
|
2753 |
||
2754 |
lytItem := anItem layout. |
|
5168 | 2755 |
self paint:(self blackColor). |
3187 | 2756 |
|
2757 |
self displayDottedRectangleX:(lytItem left) |
|
5168 | 2758 |
y:(lytItem top) |
2759 |
width:(lytItem width) |
|
2760 |
height:(lytItem height). |
|
3187 | 2761 |
! |
2762 |
||
2016 | 2763 |
drawItemsX:x y:y width:w height:h |
2715 | 2764 |
"redraw items and groups in a damage" |
2765 |
||
2016 | 2766 |
|isVertical item layout prevClip |
2767 |
x1 "{ Class:SmallInteger }" |
|
2768 |
x2 "{ Class:SmallInteger }" |
|
2769 |
y1 "{ Class:SmallInteger }" |
|
2770 |
y2 "{ Class:SmallInteger }" |
|
2771 |
start "{ Class:SmallInteger }" |
|
2772 |
stop "{ Class:SmallInteger }" |
|
2773 |
size "{ Class:SmallInteger }" |
|
2774 |
groupDivInset "{ Class:SmallInteger }" |
|
2775 |
| |
|
2776 |
||
2777 |
size := items size. |
|
2778 |
isVertical := self verticalLayout. |
|
2779 |
||
2780 |
isVertical ifTrue:[ |
|
4657 | 2781 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2782 |
start == 0 ifTrue:[ ^ self ]. |
|
2783 |
y1 := y + h. |
|
2784 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
|
2785 |
startingAt:(start + 1). |
|
2016 | 2786 |
] ifFalse:[ |
4657 | 2787 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2788 |
start == 0 ifTrue:[ ^ self ]. |
|
2789 |
x1 := x + w. |
|
2790 |
stop := items findFirst:[:el| |l| l := el layout .l notNil and:[l left > x1]] |
|
2791 |
startingAt:(start + 1). |
|
2016 | 2792 |
]. |
2793 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2794 |
||
2253 | 2795 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
4657 | 2796 |
groupDivInset := self groupDividerSize // 2. |
2797 |
||
2798 |
groupDivInset ~~ 0 ifTrue:[ |
|
2799 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2800 |
start := start - 1 |
|
2801 |
] |
|
2802 |
]. |
|
2016 | 2803 |
] ifFalse:[ |
4657 | 2804 |
groupDivInset := 0 |
4523 | 2805 |
]. |
2806 |
||
2807 |
prevClip := self clippingBoundsOrNil. |
|
2016 | 2808 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
2809 |
||
2810 |
start to:stop do:[:i| |
|
4657 | 2811 |
item := items at:i. |
2812 |
item draw. |
|
2813 |
||
2814 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2815 |
layout := item layout. |
|
2816 |
||
2817 |
isVertical ifTrue:[ |
|
2818 |
x1 := layout left. |
|
2819 |
x2 := layout right. |
|
2820 |
y1 := layout bottom + groupDivInset. |
|
2821 |
y2 := y1. |
|
2822 |
] ifFalse:[ |
|
2823 |
y1 := layout top. |
|
2824 |
y2 := layout bottom. |
|
2825 |
x1 := layout right + groupDivInset. |
|
2826 |
x2 := x1. |
|
2827 |
]. |
|
2828 |
self paint:shadowColor. |
|
2829 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2830 |
self paint:lightColor. |
|
2831 |
||
2832 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2833 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2834 |
||
2835 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2836 |
]. |
|
2837 |
selection == item ifTrue:[ |
|
2838 |
self focusComesByTab ifTrue:[ |
|
2839 |
self drawFocusForItem:item. |
|
2840 |
]. |
|
2841 |
]. |
|
2016 | 2842 |
]. |
2843 |
self clippingRectangle:prevClip. |
|
2844 |
! |
|
2845 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2846 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2847 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2848 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2849 |
isSelected ifTrue:[ |
3938 | 2850 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2851 |
] ifFalse:[ |
3938 | 2852 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2853 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2854 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2855 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2856 |
level ~~ 0 ifTrue:[ |
3938 | 2857 |
layout := anItem layout. |
2858 |
||
2859 |
self drawEdgesForX:(layout left) |
|
2860 |
y:(layout top) |
|
2861 |
width:(layout width) |
|
2862 |
height:(layout height) |
|
2863 |
level:level |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2864 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2865 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2866 |
|
2016 | 2867 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2868 |
"draw a scroller" |
2869 |
||
2016 | 2870 |
|scrolling icon level x y w h| |
2871 |
||
2872 |
x := bounds left. |
|
2873 |
y := bounds top. |
|
2874 |
w := bounds width. |
|
2875 |
h := bounds height. |
|
2876 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2877 |
scrolling := self scrollActivity. |
2016 | 2878 |
|
2879 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
4843 | 2880 |
level := styleSheet at:'menuPanel.scrollButtonActiveLevel' default:-2 |
2016 | 2881 |
] ifFalse:[ |
4843 | 2882 |
level := styleSheet at:'menuPanel.scrollButtonPassiveLevel' default:1 |
2883 |
]. |
|
2884 |
||
2885 |
self isPopUpView ifFalse:[ |
|
2886 |
self verticalLayout ifFalse:[ |
|
2887 |
aDirection == #NEXT ifTrue:[ |
|
2888 |
icon := scrolling class iconScrollRightM |
|
2889 |
] ifFalse:[ |
|
2890 |
aDirection == #PREV ifTrue:[ |
|
2891 |
icon := scrolling class iconScrollLeftM |
|
2892 |
] |
|
2893 |
] |
|
2894 |
] |
|
2895 |
]. |
|
2896 |
icon isNil ifTrue:[ |
|
2897 |
icon := scrolling iconAt:aDirection on:self. |
|
2898 |
]. |
|
2899 |
||
2900 |
icon displayOn:self x:(x + ((w - icon width) // 2)) |
|
2901 |
y:(y + 2 + ((h - 2 - icon height) // 2)). |
|
2016 | 2902 |
|
2903 |
level ~~ 0 ifTrue:[ |
|
4843 | 2904 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2905 |
] ifFalse:[ |
|
2906 |
"/ self paint:lightColor. |
|
2907 |
"/ self displayLineFromX:x y:2 toX:x+w-1 y:2. |
|
2908 |
"/ aDirection == #NEXT ifTrue:[ |
|
2909 |
"/ self displayLineFromX:x y:2 toX:x y:h-1. |
|
2910 |
"/ ] ifFalse:[ |
|
2911 |
"/ aDirection == #PREV ifTrue:[ |
|
2912 |
"/ self paint:shadowColor. |
|
2913 |
"/ self displayLineFromX:x+w-1 y:2 toX:x+w-1 y:h-1. |
|
2914 |
"/ ]. |
|
2915 |
"/ ]. |
|
2916 |
]. |
|
2016 | 2917 |
! |
2918 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2919 |
invalidateItem:anItem repairNow:aBool |
2715 | 2920 |
"an item changed; invalidate the items layout" |
2921 |
||
2016 | 2922 |
|layout| |
2923 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2924 |
(mustRearrange not and:[shown]) ifTrue:[ |
3938 | 2925 |
layout := anItem layout. |
2926 |
||
2927 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2928 |
self invalidate:(layout "insetBy:-1") repairNow:aBool |
|
2929 |
] |
|
1728 | 2930 |
]. |
2931 |
||
2932 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2933 |
! |
2934 |
||
388 | 2935 |
mustRearrange |
2715 | 2936 |
"force rearrange (i.e. set the rearrange flag)" |
2937 |
||
4628 | 2938 |
|oldPref| |
2939 |
||
2080 | 2940 |
mustRearrange ifFalse:[ |
5147 | 2941 |
oldPref := preferredExtent. |
2942 |
preferredExtent := nil. |
|
2943 |
mustRearrange := true. |
|
2944 |
self invalidate. "/ RepairNow:true |
|
2945 |
(oldPref notNil and:[oldPref ~= self preferredExtent]) ifTrue:[ |
|
2946 |
dependents notNil ifTrue:[ self changed:#preferredExtent ] |
|
2947 |
]. |
|
388 | 2948 |
] |
590 | 2949 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2950 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2951 |
! |
2952 |
||
710 | 2953 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2954 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2955 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2956 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2957 |
|
1699 | 2958 |
|layout point |
710 | 2959 |
dltX "{ Class:SmallInteger }" |
2960 |
start "{ Class:SmallInteger }" |
|
2961 |
| |
|
2962 |
||
2963 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
4893 | 2964 |
^ self |
710 | 2965 |
]. |
2966 |
||
2967 |
layout := items last layout. |
|
3246 | 2968 |
layout notNil ifTrue:[ |
4893 | 2969 |
(dltX := width - margin - extraMargin - layout right) <= 0 ifTrue:[ |
2970 |
^ self "/ no free space |
|
2971 |
]. |
|
710 | 2972 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2973 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2974 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2975 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2976 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2977 |
"/ 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
|
2978 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2979 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
4893 | 2980 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
3148 | 2981 |
] ifFalse:[ |
4893 | 2982 |
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
|
2983 |
]. |
710 | 2984 |
start == 0 ifTrue:[ |
4893 | 2985 |
^ self "/ no right-group item detected |
2986 |
]. |
|
2987 |
||
1699 | 2988 |
point := dltX @ 0. |
2989 |
||
2990 |
"/ move items layout to right |
|
710 | 2991 |
items from:start do:[:anItem| |
4893 | 2992 |
anItem isVisible ifTrue:[ |
2993 |
anItem layout moveBy:point. |
|
2994 |
] |
|
710 | 2995 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
2996 |
self updateEnteredItem. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2997 |
|
3246 | 2998 |
"Modified: / 10-10-2007 / 00:29:34 / cg" |
710 | 2999 |
! |
3000 |
||
388 | 3001 |
rearrangeItems |
1699 | 3002 |
"recompute the layout of each item |
4893 | 3003 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2715 | 3004 |
|
1791 | 3005 |
|isVertical extent isPopUpMenu |
2219 | 3006 |
x "{ Class:SmallInteger }" |
3007 |
y "{ Class:SmallInteger }" |
|
3008 |
x0 "{ Class:SmallInteger }" |
|
3009 |
y0 "{ Class:SmallInteger }" |
|
3010 |
x1 "{ Class:SmallInteger }" |
|
3011 |
y1 "{ Class:SmallInteger }" |
|
3012 |
size "{ Class:SmallInteger }" |
|
3013 |
insetX "{ Class:SmallInteger }" |
|
3014 |
insetY "{ Class:SmallInteger }" |
|
3015 |
labelInsetX "{ Class:SmallInteger }" |
|
3016 |
labelInsetY "{ Class:SmallInteger }" |
|
3017 |
itemMargin "{ Class:SmallInteger }" |
|
3018 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 3019 |
| |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3020 |
|
1699 | 3021 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
4893 | 3022 |
mustRearrange := false. |
3023 |
^ self |
|
390 | 3024 |
]. |
2219 | 3025 |
|
2080 | 3026 |
"/ DON'T SET THIS!! |
3938 | 3027 |
"/ item layout: below of first item -> item invalidate |
3028 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2080 | 3029 |
"/ -> invalidate:rapairDamage: |
3030 |
"/ -> redrawX:y:width:height: |
|
3031 |
"/ tries to get uninitialized layout from second item. |
|
3032 |
"/ This happens in a modal debugger!! |
|
3033 |
"/ mustRearrange := false. |
|
2219 | 3034 |
isVertical := self verticalLayout. |
3035 |
groupDividerSize := self groupDividerSize. |
|
3036 |
isPopUpMenu := self isPopUpView. |
|
1791 | 3037 |
|
3038 |
isPopUpMenu ifFalse:[ |
|
4893 | 3039 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 3040 |
] ifTrue:[ |
4893 | 3041 |
labelInsetX := labelInsetY := 0 |
3938 | 3042 |
]. |
3043 |
||
3044 |
(isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[ |
|
4893 | 3045 |
|saveExtent maxExtent extentToSet| |
3046 |
||
3047 |
extent := self preferredExtent. |
|
3048 |
||
3049 |
isPopUpMenu ifTrue:[ |
|
3050 |
maxExtent := self maxExtent. |
|
3051 |
maxExtent notNil ifTrue:[ |
|
3052 |
extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] |
|
3053 |
ifFalse:[(extent x min:(maxExtent x)) @ extent y]. |
|
3054 |
]. |
|
3055 |
] ifFalse:[ |
|
3056 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
|
3057 |
]. |
|
3058 |
self extent:extentToSet. |
|
390 | 3059 |
] ifFalse:[ |
4893 | 3060 |
extent := self computeExtent |
3061 |
]. |
|
3062 |
||
3063 |
x := y := margin + extraMargin. |
|
3064 |
||
1699 | 3065 |
isVertical ifFalse:[ |
4893 | 3066 |
y0 := y. |
3067 |
y1 := extent y - margin - extraMargin. |
|
3068 |
||
3069 |
items keysAndValuesDo:[:anIndex :el| |
|
3070 |
el isVisible ifFalse:[ |
|
3071 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
3072 |
] ifTrue:[ |
|
3073 |
el isButton ifTrue:[ |
|
3074 |
insetX := buttonInsetX. |
|
3075 |
insetY := buttonInsetY. |
|
3076 |
] ifFalse:[ |
|
3077 |
insetX := labelInsetX. |
|
3078 |
insetY := labelInsetY. |
|
3079 |
]. |
|
3080 |
x0 := x + insetX. |
|
3081 |
x1 := x0 + (el preferredWidth). |
|
3082 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
|
3083 |
x := x1 + insetX. |
|
3084 |
||
3085 |
size ~~ anIndex ifTrue:[ |
|
3086 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
3087 |
x := x + groupDividerSize |
|
3088 |
] ifFalse:[ |
|
3089 |
el needsItemSpaceWhenDrawing ifTrue:[ |
|
3090 |
x := x + itemSpace |
|
3091 |
] |
|
3092 |
] |
|
3093 |
] |
|
3094 |
]. |
|
3095 |
]. |
|
1699 | 3096 |
] ifTrue:[ |
4893 | 3097 |
itemMargin := self itemMargin. |
3098 |
x0 := margin. |
|
3099 |
x1 := extent x - margin - itemMargin. "/ -1 |
|
3100 |
||
3101 |
items keysAndValuesDo:[:anIndex :el| |
|
3102 |
el isVisible ifFalse:[ |
|
3103 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
3104 |
] ifTrue:[ |
|
3105 |
el isButton ifTrue:[ |
|
3106 |
insetX := buttonInsetX. |
|
3107 |
insetY := buttonInsetY. |
|
3108 |
] ifFalse:[ |
|
3109 |
insetX := labelInsetX. |
|
3110 |
insetY := labelInsetY. |
|
3111 |
]. |
|
3112 |
y0 := y + insetY. |
|
3113 |
y1 := y0 + el preferredHeight. |
|
3114 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
|
3115 |
y := y1 + insetY. |
|
3116 |
||
3117 |
size ~~ anIndex ifTrue:[ |
|
3118 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
3119 |
y := y + groupDividerSize |
|
3120 |
] |
|
3121 |
] |
|
3122 |
] |
|
3123 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3124 |
]. |
710 | 3125 |
self rearrangeGroups. |
2048 | 3126 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 3127 |
mustRearrange := false. |
2048 | 3128 |
|
3129 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 3130 |
! |
3131 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
3132 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 3133 |
"check for items which can change its visibility; |
2715 | 3134 |
if at least one item exists, rearrange all items" |
3135 |
||
1464 | 3136 |
items isNil ifTrue:[^ self]. |
1699 | 3137 |
|
4456 | 3138 |
(items contains:[:item | item canChangeVisibility]) ifTrue:[ |
4657 | 3139 |
mustRearrange := true. |
3140 |
self rearrangeItems. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
3141 |
] |
4456 | 3142 |
|
3143 |
"Modified: / 03-12-2013 / 17:04:05 / cg" |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
3144 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
3145 |
|
388 | 3146 |
redrawX:x y:y width:w height:h |
2715 | 3147 |
"redraw a damage" |
3148 |
||
4843 | 3149 |
|y0 y1 x0 x1 prvBound mustDrawLeft mustDrawRight nxtBound isScroller| |
388 | 3150 |
|
710 | 3151 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 3152 |
|
1699 | 3153 |
mustRearrange ifTrue:[ |
4843 | 3154 |
self isPopUpView ifFalse:[ |
3155 |
self explicitExtent:true. |
|
3156 |
||
3157 |
"/ changed due to menu in horizontal panel |
|
3158 |
sizeFixed ifFalse:[ |
|
3159 |
self preferredExtent. |
|
3160 |
||
3161 |
preferredExtent notNil ifTrue:[ |lw| |
|
3162 |
lw := (superView width - self left) max: 1. |
|
3163 |
self width:(preferredExtent x min:lw). |
|
3164 |
]. |
|
3165 |
]. |
|
3166 |
]. |
|
3167 |
self rearrangeItems. |
|
3168 |
self invalidate. |
|
3169 |
^ self |
|
3170 |
]. |
|
3171 |
||
2888 | 3172 |
"/ self paint:(self viewBackground). |
1699 | 3173 |
self clearRectangleX:x y:y width:w height:h. |
3174 |
||
2016 | 3175 |
items size == 0 ifTrue:[ |
4843 | 3176 |
^ self |
3177 |
]. |
|
3178 |
||
2016 | 3179 |
y0 := y. |
3180 |
y1 := y + h. |
|
2018 | 3181 |
x0 := x. |
3182 |
x1 := x + w. |
|
2016 | 3183 |
|
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3184 |
"Draw the scroll handles - especially for Popup-Lists" |
4843 | 3185 |
mustDrawLeft := mustDrawRight := false. |
3186 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3187 |
self hasScrollers ifTrue:[ |
4843 | 3188 |
(self hasScrollerAt:#PREV) ifTrue:[ |
3189 |
prvBound := self scrollerBoundsAt:#PREV. |
|
3190 |
||
3191 |
self verticalLayout ifTrue:[ |
|
3192 |
(mustDrawLeft := (prvBound bottom > y)) ifTrue:[ |
|
3193 |
y0 := prvBound bottom. |
|
3194 |
]. |
|
3195 |
] ifFalse:[ |
|
3196 |
(mustDrawLeft := (prvBound right > x)) ifTrue:[ |
|
3197 |
x0 := prvBound right. |
|
3198 |
]. |
|
3199 |
]. |
|
3200 |
]. |
|
3201 |
||
3202 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
3203 |
nxtBound := self scrollerBoundsAt:#NEXT. |
|
3204 |
||
3205 |
self verticalLayout ifTrue:[ |
|
3206 |
(mustDrawRight := (nxtBound top < y1)) ifTrue:[ |
|
3207 |
y1 := nxtBound top. |
|
3208 |
] |
|
3209 |
] ifFalse:[ |
|
3210 |
(mustDrawRight := (nxtBound left < x1)) ifTrue:[ |
|
3211 |
x1 := nxtBound left. |
|
3212 |
] |
|
3213 |
]. |
|
3214 |
]. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3215 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3216 |
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
|
3217 |
|
2018 | 3218 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
4843 | 3219 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
3220 |
]. |
|
3221 |
||
3222 |
mustDrawLeft ifTrue:[ |
|
3223 |
self drawScrollerAt:#PREV bounds:prvBound. |
|
3224 |
]. |
|
3225 |
mustDrawRight ifTrue:[ |
|
3226 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
|
3227 |
]. |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3228 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3229 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3230 |
updateEnteredItem |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3231 |
|mousePoint| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3232 |
|
5001 | 3233 |
mousePoint := device translatePoint:(device pointerPosition) |
4893 | 3234 |
fromView:nil toView:self. |
3938 | 3235 |
|
3236 |
(self containsPoint:mousePoint) ifTrue:[ |
|
4893 | 3237 |
enteredItem := self itemAtPoint:mousePoint |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3238 |
]. |
388 | 3239 |
! ! |
3240 |
||
4628 | 3241 |
!MenuPanel methodsFor:'enumerating & searching'! |
388 | 3242 |
|
3243 |
collect:aOneArgBlock |
|
3244 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 3245 |
and return a collection of the results" |
3246 |
||
388 | 3247 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 3248 |
^ nil |
388 | 3249 |
! |
3250 |
||
3251 |
do:aOneArgBlock |
|
2715 | 3252 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
3253 |
||
388 | 3254 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
3255 |
! |
|
3256 |
||
3257 |
findFirst:aOneArgBlock |
|
3206 | 3258 |
"find the index of the first item, for which evaluation of the argument, aOneArgBlock |
2715 | 3259 |
returns true; return its index or 0 if none detected." |
3260 |
||
388 | 3261 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 3262 |
^ 0 |
388 | 3263 |
! |
3264 |
||
3265 |
findLast:aOneArgBlock |
|
3266 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 3267 |
returns true; return its index or 0 if none detected." |
3268 |
||
388 | 3269 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 3270 |
^ 0 |
388 | 3271 |
! |
3272 |
||
3187 | 3273 |
firstItemSelectable |
3274 |
"returns the first item which is selectable or nil |
|
3275 |
" |
|
3276 |
items size > 0 ifTrue:[ |
|
3938 | 3277 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
3187 | 3278 |
]. |
3279 |
^ nil |
|
3280 |
! |
|
3281 |
||
390 | 3282 |
indexOf:something |
3283 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 3284 |
If no item match 0 is returned. No range checks are performed on a number argument" |
3285 |
||
390 | 3286 |
|i v| |
3287 |
||
3288 |
something isNumber ifTrue:[ ^ something ]. |
|
3289 |
something isNil ifTrue:[ ^ 0 ]. |
|
3290 |
||
1218 | 3291 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 3292 |
|
3293 |
i ~~ 0 ifTrue:[ |
|
3938 | 3294 |
^ i |
388 | 3295 |
]. |
390 | 3296 |
|
3297 |
something isSymbol ifTrue:[ |
|
3938 | 3298 |
i := self findFirst:[:el| |
3299 |
v := el value. |
|
3300 |
v isSymbol and:[v == something] |
|
3301 |
]. |
|
3302 |
i ~~ 0 ifTrue:[ |
|
3303 |
^ i |
|
3304 |
] |
|
390 | 3305 |
]. |
3306 |
||
3307 |
(something respondsTo:#string) ifTrue:[ |
|
3938 | 3308 |
v := something string. |
1218 | 3309 |
^ self findFirst:[:el | el textLabel = v]. |
3310 |
]. |
|
3311 |
^ 0 |
|
388 | 3312 |
! |
3313 |
||
706 | 3314 |
indexOfItem:anItem |
2715 | 3315 |
"returns the index of the item or 0" |
3316 |
||
706 | 3317 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
3318 |
! |
|
3319 |
||
388 | 3320 |
keysAndValuesDo:aTwoArgBlock |
2715 | 3321 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
3322 |
||
388 | 3323 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
3324 |
! ! |
|
3325 |
||
3326 |
!MenuPanel methodsFor:'event handling'! |
|
3327 |
||
3328 |
buttonMotion:state x:x y:y |
|
2715 | 3329 |
"open or close the corresponding submenu" |
3330 |
||
2046 | 3331 |
|menue motionPoint translatedPoint sensor| |
1699 | 3332 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3333 |
self scrollActivity isActive ifTrue:[ |
4657 | 3334 |
^ self |
2016 | 3335 |
]. |
3336 |
||
1699 | 3337 |
sensor := self sensor. |
4526 | 3338 |
"/ cg: the following seems to lead to leftover submenus to remain unclosed... |
3339 |
"/ (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
3340 |
"/ ^ self |
|
3341 |
"/ ]. |
|
1699 | 3342 |
menue := self detectGrabMenu. |
1841 | 3343 |
|
2046 | 3344 |
motionPoint := x@y. |
3345 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 3346 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 3347 |
|
3780 | 3348 |
"/ hideOnRelease := true. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3349 |
|
1699 | 3350 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
4657 | 3351 |
^ self |
1699 | 3352 |
]. |
3353 |
||
3826 | 3354 |
hideOnRelease ifTrue:[ |
4657 | 3355 |
sensor anyButtonPressed ifFalse:[^ self] |
3826 | 3356 |
] ifFalse:[ |
4657 | 3357 |
sensor anyButtonPressed ifTrue:[^ self] |
3826 | 3358 |
]. |
3359 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3360 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
4657 | 3361 |
"/ selection on grabView without a submenu (Button ...); check whether moving out |
3362 |
(self containsPoint:motionPoint) ifFalse:[ |
|
3363 |
^ self accept:nil |
|
3364 |
] |
|
1699 | 3365 |
]. |
3366 |
||
2048 | 3367 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 3368 |
! |
3369 |
||
3370 |
buttonPress:button x:x y:y |
|
2715 | 3371 |
"any button pressed; open or close the corresponding submenus" |
3372 |
||
4629 | 3373 |
|menu point screen screenPoint targetView targetPoint wg| |
2016 | 3374 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3375 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3376 |
|
4629 | 3377 |
"/ simulate momentary loss of focus to force accept into models in other components |
3378 |
wg := self windowGroup. |
|
3379 |
wg notNil ifTrue:[ |
|
5001 | 3380 |
wg focusMomentaryRelease. |
4629 | 3381 |
]. |
3382 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3383 |
self scrollActivity stop. |
2016 | 3384 |
point := x@y. |
3385 |
menu := self detectMenuAtGrabPoint:point. |
|
3386 |
||
3387 |
menu isNil ifTrue:[ |
|
5001 | 3388 |
self accept:nil. |
3389 |
||
3390 |
"/ tell underlying view about the click... |
|
3391 |
((button ~~ 2) |
|
3392 |
or:[(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease])]) ifTrue:[ |
|
3393 |
screen := device. |
|
3394 |
screenPoint := screen translatePointToRoot:point fromView:self. |
|
3395 |
targetView := screen viewFromPoint:screenPoint. |
|
3396 |
(targetView notNil and:[targetView ~~ self]) ifTrue:[ |
|
3397 |
targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView. |
|
3398 |
targetView buttonPress:button x:targetPoint x y:targetPoint y. |
|
3399 |
] |
|
3400 |
]. |
|
2016 | 3401 |
] ifFalse:[ |
5001 | 3402 |
point := menu translateGrabPoint:point. |
3403 |
menu handleButtonPress:button atPoint:point. |
|
2016 | 3404 |
] |
2046 | 3405 |
|
4082 | 3406 |
"Modified: / 02-10-2011 / 09:20:08 / cg" |
1699 | 3407 |
! |
3408 |
||
3409 |
buttonRelease:button x:x y:y |
|
2715 | 3410 |
"button release action; accept selection and close all views" |
3411 |
||
3938 | 3412 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
3203 | 3413 |
releaseTime menuMapTime| |
2199 | 3414 |
|
3780 | 3415 |
hideOnRelease ifFalse:[ |
4657 | 3416 |
^ self |
4463 | 3417 |
]. |
2199 | 3418 |
topMenu := self topMenu. |
3419 |
topMenu openDelayed:nil. |
|
1699 | 3420 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3421 |
self scrollActivity stop ifTrue:[ |
4657 | 3422 |
^ self |
4463 | 3423 |
]. |
1699 | 3424 |
dstMenu := topMenu activeMenu. |
2679 | 3425 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
3426 |
||
4463 | 3427 |
hideMenuAndPerformAction ifTrue:[ |
4657 | 3428 |
"open topMenu, a popup by click and release button in a short time period" |
3429 |
(topMenu == self |
|
3430 |
and:[mapTime notNil |
|
3431 |
and:[dstMenu == self |
|
3432 |
and:[dstMenu isPopUpView]]]) ifTrue:[ |
|
3433 |
hideMenuAndPerformAction := false. |
|
3434 |
]. |
|
4463 | 3435 |
]. |
2679 | 3436 |
hideMenuAndPerformAction ifFalse:[ |
4657 | 3437 |
hideOnRelease ifTrue:[ |
3438 |
releaseTime := windowGroup lastEvent timeStamp. |
|
3439 |
menuMapTime := dstMenu mapTime ? releaseTime. |
|
3440 |
||
3441 |
hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime) |
|
3442 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
3443 |
]. |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3444 |
]. |
2679 | 3445 |
hideMenuAndPerformAction ifTrue:[ |
4657 | 3446 |
srcPoint := x@y. |
3447 |
||
3448 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
|
3449 |
and:[(item := dstMenu selection) notNil] |
|
3450 |
) ifTrue:[ |
|
3451 |
item visibleSubmenu notNil ifTrue:[ |
|
3452 |
dstMenu selection:nil. |
|
3453 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
|
3454 |
self accept:nil. |
|
3455 |
]. |
|
3456 |
^ self |
|
3457 |
]. |
|
3458 |
subm := item currentSubmenu. |
|
3459 |
||
3460 |
subm notNil ifTrue:[ |
|
3461 |
subm shown ifTrue:[^ self]. |
|
3462 |
"/ test whether any action is assigned to the menu |
|
3463 |
"/ if not ignorre accept |
|
3464 |
item hasDelayedMenu ifFalse:[^ self]. |
|
3465 |
"/ handle action defined for the delayed menu |
|
3466 |
]. |
|
3467 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
|
3468 |
||
3469 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
|
3470 |
item := nil |
|
3471 |
]. |
|
3472 |
topMenu acceptItem:item inMenu:dstMenu. |
|
3473 |
^ self |
|
3474 |
]. |
|
3475 |
||
3476 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
|
3477 |
selection visibleSubmenu notNil ifTrue:[ |
|
3478 |
^ self |
|
3479 |
] |
|
3480 |
]. |
|
3481 |
self accept:nil. |
|
1699 | 3482 |
]. |
3483 |
! |
|
3484 |
||
2860 | 3485 |
handleSizeChanged:how |
3486 |
"used to handle the scrollers and groups in a none popUpView |
|
3487 |
" |
|
3488 |
|layouts damage isVertical scrollBound| |
|
3489 |
||
3490 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
4657 | 3491 |
^ self |
2860 | 3492 |
]. |
3493 |
mustRearrange := true. |
|
3494 |
||
3495 |
shown ifFalse:[ |
|
4657 | 3496 |
^ self |
2860 | 3497 |
]. |
3498 |
layouts := OrderedCollection new. |
|
3499 |
||
3500 |
items do:[:el| |layout| |
|
4657 | 3501 |
(layout := el layout) isNil ifTrue:[ |
3502 |
self invalidate. |
|
3503 |
^ self. |
|
3504 |
]. |
|
3505 |
layouts add:layout. |
|
2860 | 3506 |
]. |
3507 |
isVertical := self verticalLayout. |
|
3508 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3509 |
||
3510 |
self rearrangeItems. |
|
3511 |
||
3512 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
4657 | 3513 |
damage isNil ifTrue:[ |
3514 |
newLyt := el layout. |
|
3515 |
oldLyt := layouts at:i ifAbsent:newLyt. |
|
3516 |
||
3517 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
|
3518 |
start := 0. |
|
3519 |
||
3520 |
i > 1 ifTrue:[ |
|
3521 |
isVertical ifTrue:[ |
|
3522 |
x := 0. |
|
3523 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
|
3524 |
] ifFalse:[ |
|
3525 |
y := 0. |
|
3526 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
|
3527 |
]. |
|
3528 |
]. |
|
3529 |
start <= 20 ifTrue:[ |
|
3530 |
self invalidate. |
|
3531 |
^ self |
|
3532 |
]. |
|
3533 |
damage := Rectangle left:x top:y extent:(self extent). |
|
3534 |
]. |
|
3535 |
]. |
|
2860 | 3536 |
]. |
3537 |
damage isNil ifTrue:[ |
|
4657 | 3538 |
damage := scrollBound. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3539 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3540 |
scrollBound := lastDrawnScrollerNextBounds. |
2860 | 3541 |
scrollBound notNil ifTrue:[ |
4657 | 3542 |
damage := damage merge:scrollBound |
2860 | 3543 |
]. |
3544 |
self invalidate:damage. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3545 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
3546 |
"Modified: / 29-06-2011 / 16:24:59 / cg" |
2860 | 3547 |
! |
3548 |
||
1699 | 3549 |
keyPress:key x:x y:y |
2715 | 3550 |
"any key is pressed" |
3551 |
||
2869 | 3552 |
<resource: #keyboard (#Escape |
4657 | 3553 |
#Tab #FocusNext #FocusPrevious |
3554 |
#CursorLeft #CursorRight )> |
|
2869 | 3555 |
|
3556 |
|menu menusSuperMenu sensor| |
|
2251 | 3557 |
|
3558 |
sensor := self sensor. |
|
3158 | 3559 |
|
3560 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3561 |
"/ ^ self "/ ignored while any button is pressed |
|
3562 |
"/ ]. |
|
1699 | 3563 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3564 |
self scrollActivity isActive ifTrue:[ |
4657 | 3565 |
key ~~ #Escape ifTrue:[ |
3566 |
^ self |
|
3567 |
]. |
|
3568 |
self scrollActivity stop |
|
3938 | 3569 |
]. |
3570 |
||
3571 |
(key == #Tab |
|
1699 | 3572 |
or:[key == #FocusNext |
3573 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
4657 | 3574 |
self accept:nil. |
3575 |
^ super keyPress:key x:x y:y |
|
1699 | 3576 |
]. |
3577 |
||
3578 |
menu := self detectGrabMenu. |
|
2869 | 3579 |
menusSuperMenu := menu superMenu. |
1699 | 3580 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
3581 |
(key == #Escape) ifTrue:[ |
4657 | 3582 |
"/ must hide the active menu |
3583 |
menusSuperMenu notNil ifTrue:[ |
|
3584 |
"/ hide active menu but keep the grab |
|
3585 |
menusSuperMenu selection hideSubmenu |
|
3586 |
] ifFalse:[ |
|
3587 |
"/ hide active menu and ungrab |
|
3588 |
self accept:nil |
|
3589 |
]. |
|
3590 |
^ self |
|
2251 | 3591 |
]. |
3592 |
||
3593 |
menu isViewWrapper ifFalse:[ |
|
4657 | 3594 |
sensor compressKeyPressEventsWithKey:key. |
3595 |
menu handleKeyPress:key. |
|
3596 |
^ self |
|
2251 | 3597 |
]. |
2869 | 3598 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3599 |
|
3600 |
"/ allow cursor movement |
|
3601 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
4657 | 3602 |
(self containsPoint:x@y) ifTrue:[ |
3603 |
self handleKeyPress:key. |
|
3604 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3605 |
]. |
1699 | 3606 |
! |
3607 |
||
3834
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3608 |
mapped |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3609 |
super mapped. |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3610 |
|
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3611 |
"/ if I come up with a pressed button, react on release instead. |
5191 | 3612 |
gc device anyButtonPressed ifTrue:[ hideOnRelease := true ]. |
3834
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3613 |
! |
9ab4091d6829
if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents:
3833
diff
changeset
|
3614 |
|
3415 | 3615 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime |
3616 |
"mousewheel action" |
|
3617 |
||
3618 |
|menu| |
|
3619 |
||
3620 |
menu := self detectGrabMenu. |
|
3621 |
menu isViewWrapper ifTrue:[ |
|
4826 | 3622 |
menu superMenu ~~ self ifTrue:[^ self]. |
3623 |
menu := self. |
|
3624 |
]. |
|
3625 |
"/ support line and page scrolling |
|
3626 |
menu shown ifTrue:[ |
|
3627 |
self window sensor shiftDown ifTrue:[ |
|
3628 |
amount > 0 ifTrue:[menu pageUp] |
|
3629 |
ifFalse:[menu pageDown]. |
|
3630 |
] ifFalse:[ |
|
3631 |
amount > 0 ifTrue:[menu scrollUp] |
|
3632 |
ifFalse:[menu scrollDown]. |
|
3633 |
]. |
|
3415 | 3634 |
]. |
3635 |
! |
|
3636 |
||
1699 | 3637 |
pointerLeave:state |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3638 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3639 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3640 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3641 |
|
1699 | 3642 |
self detectGrabMenu handlePointerLeave:state. |
3643 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3644 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
3938 | 3645 |
^ self |
2251 | 3646 |
]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3647 |
|
2374 | 3648 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3649 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3650 |
windowGroup focusView ~~ self ifTrue:[ |
3938 | 3651 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3652 |
] ifFalse:[ |
3938 | 3653 |
selection isButton ifTrue:[ |
3654 |
sensor := self sensor. |
|
3655 |
||
3656 |
sensor isNil ifTrue:[ |
|
3657 |
self accept:nil |
|
3658 |
] ifFalse:[ |
|
3659 |
"/ I'have the focus; if no button pressed, than keep the selection |
|
3660 |
sensor anyButtonPressed ifTrue:[ |
|
3661 |
self selection:nil |
|
3662 |
] |
|
3663 |
]. |
|
3664 |
] |
|
1699 | 3665 |
]. |
3666 |
! |
|
3667 |
||
3668 |
sizeChanged:how |
|
2715 | 3669 |
"redraw #right groups" |
3670 |
||
2860 | 3671 |
"/ self isPopUpView ifFalse:[ |
3672 |
"/ mustRearrange := true. |
|
3673 |
"/ self invalidate |
|
3674 |
"/ ]. |
|
3675 |
"/ ^ super sizeChanged:how. |
|
3676 |
||
3677 |
self handleSizeChanged:how. |
|
3678 |
super sizeChanged:how. |
|
1699 | 3679 |
! ! |
3680 |
||
2503 | 3681 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3682 |
|
1767 | 3683 |
clearImplicitGrab |
2253 | 3684 |
implicitGrabView := lastPointerView := nil. |
1767 | 3685 |
! |
3686 |
||
3687 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3688 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3689 |
|
2253 | 3690 |
|view x y p syntheticEvent menu| |
1767 | 3691 |
|
2658 | 3692 |
ev isDamage ifTrue:[ |
5001 | 3693 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
2658 | 3694 |
]. |
3695 |
||
3142 | 3696 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
5001 | 3697 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
3142 | 3698 |
]. |
3699 |
||
1767 | 3700 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3701 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3702 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3703 |
implicitGrabView notNil ifTrue:[ |
|
5001 | 3704 |
self sensor leftButtonPressed ifFalse:[ |
3705 |
self clearImplicitGrab. |
|
3706 |
]. |
|
1767 | 3707 |
]. |
3708 |
||
3709 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
5001 | 3710 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3711 |
]. |
3712 |
||
3713 |
implicitGrabView notNil ifTrue:[ |
|
5001 | 3714 |
ev isButtonEvent ifTrue:[ |
3715 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3716 |
ev view:implicitGrabView. |
|
3717 |
ev arguments at:2 put:p x. |
|
3718 |
ev arguments at:3 put:p y. |
|
3719 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3720 |
||
3721 |
ev isButtonReleaseEvent ifTrue:[ |
|
3722 |
self clearImplicitGrab. |
|
3723 |
]. |
|
3724 |
^ self |
|
3725 |
] |
|
1767 | 3726 |
]. |
3727 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3728 |
||
2016 | 3729 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
5001 | 3730 |
self clearImplicitGrab. |
3731 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
|
3732 |
]. |
|
3733 |
||
3734 |
p := menu translateGrabPoint:(x@y). |
|
1767 | 3735 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
3630 | 3736 |
view == self ifTrue:[^self]. "MB:changed - recursion" |
3737 |
||
5001 | 3738 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3739 |
|
3740 |
ev isButtonPressEvent ifTrue:[ |
|
5001 | 3741 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3742 |
view requestFocus. |
|
3743 |
]. |
|
3744 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3745 |
implicitGrabView := view. |
|
3746 |
] |
|
2253 | 3747 |
]. |
1767 | 3748 |
|
3749 |
ev isButtonMotionEvent ifTrue:[ |
|
5001 | 3750 |
lastPointerView ~~ view ifTrue:[ |
3751 |
"/ must generate enter/leave ... (sigh) |
|
3752 |
lastPointerView notNil ifTrue:[ |
|
3753 |
"/ XXX: should be fixed |
|
3754 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3755 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3756 |
]. |
|
3757 |
view notNil ifTrue:[ |
|
3758 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3759 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3760 |
]. |
|
3761 |
lastPointerView := view. |
|
3762 |
]. |
|
1767 | 3763 |
]. |
3764 |
||
3765 |
ev view:view. |
|
3766 |
ev x:p x. |
|
3767 |
ev y:p y. |
|
3768 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3769 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3770 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3771 |
! |
3772 |
||
2048 | 3773 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3774 |
"open or close the corresponding submenus" |
3775 |
||
3242
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3776 |
|menu item translatedPoint containsPoint direction| |
2251 | 3777 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3778 |
containsPoint := self containsPoint:motionPoint. |
3975 | 3779 |
(containsPoint not and:[items size > 0]) ifTrue:[ |
4657 | 3780 |
"/ check if there is still open a menu which is not assigned to the |
3781 |
"/ current selection |
|
3782 |
item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil. |
|
3783 |
item notNil ifTrue:[ |
|
3784 |
|visibleSubmenu point| |
|
3785 |
||
3786 |
visibleSubmenu := item visibleSubmenu. |
|
3787 |
visibleSubmenu notNil ifTrue:[ |
|
3788 |
point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu. |
|
3789 |
||
3790 |
(visibleSubmenu containsPoint:point) ifTrue:[ |
|
3791 |
selection notNil ifTrue:[ selection invalidate ]. |
|
3792 |
selection := item. |
|
3793 |
selection invalidate. |
|
3794 |
visibleSubmenu becomesActiveMenu. |
|
3795 |
^ self. |
|
3796 |
]. |
|
3797 |
]. |
|
3798 |
item := nil. |
|
3799 |
]. |
|
3975 | 3800 |
]. |
3938 | 3801 |
containsPoint ifTrue:[ |
4657 | 3802 |
item := self itemAtPoint:motionPoint |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3803 |
]. |
2251 | 3804 |
|
4183 | 3805 |
"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
|
3806 |
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
|
3807 |
direction notNil ifTrue:[ |
4657 | 3808 |
self pointerEntersItem:nil. |
3809 |
||
3810 |
self sensor anyButtonPressed ifTrue:[ |
|
3811 |
self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false. |
|
3812 |
]. |
|
3813 |
^ 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
|
3814 |
]. |
4d8c5bde0f98
Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents:
3233
diff
changeset
|
3815 |
|
4193 | 3816 |
"/ self pointerEntersItem:item. |
1699 | 3817 |
|
1910 | 3818 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
4657 | 3819 |
(self selectionFollowsMouse |
3820 |
and:[self topMenu focusComesByTab not] |
|
3821 |
) ifTrue:[ |
|
3822 |
self isPopUpView ifTrue:[ |
|
3823 |
item isNil ifTrue:[ |
|
3824 |
superMenu notNil ifTrue:[ |
|
3825 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3826 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3827 |
] |
|
3828 |
] ifFalse:[ |
|
3829 |
self selectAndOpenDelayed:item. |
|
3830 |
]. |
|
3831 |
] ifFalse:[ |
|
3832 |
"/ processing in the toolbar |
|
3833 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
|
3834 |
self selectAndOpenDelayed:item. |
|
4193 | 3835 |
"/ self selection:item openMenu:true. |
4657 | 3836 |
]. |
3837 |
]. |
|
3838 |
]. |
|
3839 |
^ self |
|
3975 | 3840 |
]. |
4193 | 3841 |
|
2251 | 3842 |
containsPoint ifTrue:[ |
4657 | 3843 |
self isPopUpView ifTrue:[ |
3844 |
self selectAndOpenDelayed:item. |
|
3845 |
] ifFalse:[ |
|
3846 |
"/ also open delayed if I am the top-menu |
|
3847 |
self selectAndOpenDelayed:item. |
|
4191 | 3848 |
"/ self selection:item openMenu:true. |
4657 | 3849 |
]. |
3850 |
^ self |
|
2251 | 3851 |
]. |
3852 |
||
3853 |
menu := self superMenuAtPoint:motionPoint. |
|
2374 | 3854 |
menu notNil ifTrue:[ |
4657 | 3855 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
3856 |
menu handleButtonMotion:state atPoint:translatedPoint. |
|
3857 |
^ self |
|
2251 | 3858 |
]. |
3859 |
self isPopUpView ifTrue:[ |
|
4657 | 3860 |
self selection:nil |
2251 | 3861 |
]. |
2046 | 3862 |
! |
3863 |
||
3383 | 3864 |
handleButtonPress:button atPoint:aPoint |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3865 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3866 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3867 |
|item scrollerDirectionOrNil wasSelected| |
2016 | 3868 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3869 |
"/ is a scroller-button present and hit ? |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3870 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3871 |
scrollerDirectionOrNil notNil ifTrue:[ |
4843 | 3872 |
(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[ |
3873 |
self pointerEntersItem:nil. |
|
3874 |
^ self |
|
3875 |
] |
|
3876 |
]. |
|
3877 |
||
3878 |
item := self itemAtPoint:aPoint. |
|
3879 |
item isNil ifTrue:[ |
|
3880 |
self selection:nil openMenu:false. |
|
3881 |
^ self |
|
2016 | 3882 |
]. |
2251 | 3883 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3884 |
"/ right button always immediately pulls the delayedMenu |
3383 | 3885 |
button == 2 ifTrue:[ |
4843 | 3886 |
item hasDelayedMenu ifTrue:[ |
3887 |
self selection:item openMenu:false. |
|
3888 |
self openDelayed:item afterSeconds:0. |
|
3889 |
^ self. |
|
3890 |
]. |
|
3383 | 3891 |
]. |
3892 |
||
2251 | 3893 |
wasSelected := (selection == item). |
3894 |
wasSelected ifFalse:[ |
|
5001 | 3895 |
self selection:item openMenu:true. |
3896 |
"/ make sure that a momentary press is visible |
|
3897 |
self repairDamage. |
|
3898 |
Delay waitForSeconds:0.1. |
|
2251 | 3899 |
]. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3900 |
item hasDelayedMenu ifTrue:[ |
4843 | 3901 |
"/ clicked on the arrow icon ? |
3902 |
(item menuIndicatorContains:aPoint) ifTrue:[ |
|
3903 |
self selection:item openMenu:false. |
|
3904 |
self openDelayed:item afterSeconds:0. |
|
3905 |
^ self. |
|
3906 |
]. |
|
3907 |
^ self |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
3908 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3909 |
|
2238 | 3910 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
4843 | 3911 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3912 |
item toggleSubmenuVisibility |
|
3913 |
]. |
|
3914 |
^ self |
|
2238 | 3915 |
]. |
3916 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
4843 | 3917 |
^ self |
2238 | 3918 |
]. |
3919 |
self invalidateItem:item repairNow:true. |
|
3920 |
self acceptItem:item inMenu:self. |
|
3921 |
||
5001 | 3922 |
[ (device notNil and:[device anyButtonPressed]) ] whileTrue:[ |
4843 | 3923 |
"/ using device - sensor is not updated sometimes |
3924 |
Delay waitForSeconds:0.1. |
|
3233 | 3925 |
]. |
3926 |
self sensor flushUserEvents. |
|
2238 | 3927 |
self selection:nil. |
2046 | 3928 |
|
3929 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3930 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3931 |
! |
3932 |
||
1699 | 3933 |
handleCursorKey:aKey |
2715 | 3934 |
"handle a cursor key" |
3935 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3936 |
|next menu item isVrt backKey p1 p2 |
2354 | 3937 |
idx0 "{ Class:SmallInteger }" |
687 | 3938 |
idx "{ Class:SmallInteger }" |
1705 | 3939 |
size "{ Class:SmallInteger }" |
687 | 3940 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3941 |
(size := items size) == 0 ifTrue:[ |
4657 | 3942 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
3943 |
^ self |
|
388 | 3944 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3945 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3946 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3947 |
|
4172 | 3948 |
selection isNil ifTrue:[ |
4657 | 3949 |
(isVrt and:[aKey == #CursorDown]) ifTrue:[ |
3950 |
idx := items findFirst:[:el | el notNil and:[ el canSelect ]]. |
|
3951 |
idx ~~ 0 ifTrue:[ |
|
3952 |
self selection:(items at:idx). |
|
3953 |
^ self |
|
3954 |
] |
|
3955 |
]. |
|
3956 |
(isVrt and:[aKey == #CursorUp]) ifTrue:[ |
|
3957 |
idx := items findLast:[:el | el notNil and:[ el canSelect ]]. |
|
3958 |
idx ~~ 0 ifTrue:[ |
|
3959 |
self selection:(items at:idx). |
|
3960 |
^ self |
|
3961 |
] |
|
3962 |
] |
|
4172 | 3963 |
]. |
3964 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3965 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3966 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3967 |
) ifTrue:[ |
4657 | 3968 |
selection isNil ifTrue:[ |
3969 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
|
3970 |
^ superMenu handleCursorKey:aKey |
|
3971 |
]. |
|
3972 |
idx := 0. |
|
3973 |
||
3974 |
isVrt ifTrue:[ |
|
3975 |
"/ used because of vertical scrolling |
|
3976 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
3977 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
|
3978 |
]. |
|
3979 |
] ifFalse:[ |
|
3980 |
idx := self indexOf:selection. |
|
3981 |
]. |
|
3982 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
|
3983 |
||
3984 |
idx0 := idx. |
|
3985 |
size timesRepeat:[ |
|
3986 |
|el| |
|
3987 |
||
3988 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3989 |
||
3990 |
idx > size ifTrue:[ |
|
3991 |
idx := 0 "1" |
|
3992 |
] ifFalse:[ |
|
3993 |
idx < 0 ifTrue:[ |
|
3994 |
idx := size |
|
3995 |
] |
|
3996 |
]. |
|
3997 |
||
3998 |
idx == 0 ifTrue:[ |
|
3999 |
self selection:nil. |
|
4000 |
^ self |
|
4001 |
] ifFalse:[ |
|
4002 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
4003 |
el canSelect ifTrue:[ |
|
4004 |
el hasDelayedMenu ifTrue:[ |
|
4005 |
"/ do not open menu |
|
4006 |
self selection:el openMenu:false |
|
4007 |
] ifFalse:[ |
|
4008 |
"/ open comes from style-sheet |
|
4009 |
self selection:el. |
|
4010 |
]. |
|
4011 |
^ self |
|
4012 |
]. |
|
4013 |
] |
|
4014 |
]. |
|
4015 |
idx == idx0 ifTrue:[ |
|
4016 |
^ self |
|
4017 |
]. |
|
4018 |
]. |
|
4019 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4020 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4021 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4022 |
superMenu notNil ifTrue:[ |
4657 | 4023 |
p1 := self translateGrabPoint:0. |
4024 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4025 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4026 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4027 |
isVrt ifTrue:[ |
4657 | 4028 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
4029 |
backKey := #CursorRight |
|
4030 |
] ifFalse:[ |
|
4031 |
backKey := #CursorLeft. |
|
4032 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4033 |
] ifFalse:[ |
4657 | 4034 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
4035 |
backKey := #CursorDown |
|
4036 |
] ifFalse:[ |
|
4037 |
backKey := #CursorUp. |
|
4038 |
] |
|
3938 | 4039 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4040 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4041 |
aKey == backKey ifTrue:[ |
4657 | 4042 |
superMenu isNil ifTrue:[ |
4043 |
self accept:nil |
|
4044 |
] ifFalse:[ |
|
4045 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
4046 |
superMenu handleCursorKey:aKey |
|
4047 |
] ifFalse:[ |
|
4048 |
superMenu selection hideSubmenu |
|
4049 |
] |
|
4050 |
]. |
|
4051 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4052 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4053 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4054 |
selection isNil ifTrue:[ |
4657 | 4055 |
superMenu isNil ifTrue:[^ self accept:nil]. |
4056 |
||
4057 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
4058 |
superMenu handleCursorKey:aKey |
|
4059 |
] ifFalse:[ |
|
4060 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
|
4061 |
self selectionIndex:item |
|
4062 |
] |
|
4063 |
]. |
|
4064 |
^ self |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4065 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4066 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4067 |
selection hasSubmenu ifTrue:[ |
4657 | 4068 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
4069 |
selection toggleSubmenuVisibility |
|
4070 |
] ifFalse:[ |
|
4071 |
menu selectionIndex:1 |
|
4072 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4073 |
] ifFalse:[ |
4657 | 4074 |
superMenu notNil ifTrue:[ |
4075 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
|
4076 |
superMenu handleCursorKey:aKey |
|
4077 |
] |
|
4078 |
] ifFalse:[ |
|
4079 |
self accept:nil |
|
4080 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4081 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4082 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4083 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4084 |
handleKeyPress:key |
4167 | 4085 |
<resource: #keyboard (#CursorDown #CursorUp #CursorLeft #CursorRight #Return)> |
4086 |
||
2715 | 4087 |
"any key is pressed" |
4088 |
||
2219 | 4089 |
|item inMenu| |
1699 | 4090 |
|
4091 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
4826 | 4092 |
self handleReturnPressed. |
4093 |
^ true. |
|
3754 | 4094 |
]. |
4095 |
key isCharacter ifTrue:[ |
|
1862 | 4096 |
"/ selection notNil ifTrue:[ |
4097 |
"/ inMenu := self |
|
4098 |
"/ ] ifFalse:[ |
|
4099 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
4100 |
"/ ]. |
|
4826 | 4101 |
inMenu := self. |
4102 |
||
4103 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
|
4104 |
inMenu selection:item |
|
4105 |
]. |
|
4106 |
^ true |
|
3938 | 4107 |
]. |
4108 |
(key == #CursorDown |
|
4826 | 4109 |
or:[key == #CursorUp |
4110 |
or:[key == #CursorLeft |
|
4111 |
or:[key == #CursorRight]]]) |
|
3754 | 4112 |
ifTrue:[ |
4826 | 4113 |
self handleCursorKey:key. |
4114 |
^ true |
|
4115 |
]. |
|
4116 |
"/ handle scrolling keys" |
|
4117 |
key == #EndOfLine ifTrue:[self scrollToBottom. ^ true ]. |
|
4118 |
key == #BeginOfLine ifTrue:[self scrollToTop. ^ true.]. |
|
4119 |
key == #NextPage ifTrue:[self pageDown. ^ true.]. |
|
4120 |
key == #PreviousPage ifTrue:[self pageUp. ^ true.]. |
|
4121 |
||
3754 | 4122 |
^ false. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4123 |
! |
1699 | 4124 |
|
4125 |
handlePointerLeave:state |
|
4126 |
self pointerEntersItem:nil. |
|
4127 |
super pointerLeave:state |
|
4128 |
! |
|
4129 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4130 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4131 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4132 |
|
2238 | 4133 |
|sensor subm item| |
4134 |
||
4135 |
(item := selection) isNil ifTrue:[ |
|
4657 | 4136 |
superMenu notNil ifTrue:[ |
4137 |
item := superMenu selection. |
|
4138 |
||
4139 |
item value notNil ifTrue:[ |
|
4140 |
"/ is a delayed menu |
|
4141 |
self accept:item |
|
4142 |
] ifFalse:[ |
|
4143 |
item toggleSubmenuVisibility |
|
4144 |
] |
|
4145 |
] ifFalse:[ |
|
4146 |
self accept |
|
4147 |
]. |
|
4148 |
^ self |
|
1841 | 4149 |
]. |
4150 |
selection hasSubmenu ifTrue:[ |
|
4657 | 4151 |
selection hasDelayedMenu ifFalse:[ |
4152 |
selection toggleSubmenuVisibility. |
|
4153 |
^ self |
|
4154 |
]. |
|
4155 |
subm := selection currentSubmenu. |
|
4156 |
||
4157 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
4158 |
selection toggleSubmenuVisibility. |
|
4159 |
^ self |
|
4160 |
]. |
|
4161 |
self openDelayed:nil |
|
1841 | 4162 |
]. |
4163 |
self accept. |
|
4164 |
||
2238 | 4165 |
" test for toggle " |
4166 |
item isToggle ifTrue:[ |
|
4657 | 4167 |
self selection:item. |
2238 | 4168 |
] ifFalse:[ |
4657 | 4169 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
4170 |
^ self |
|
4171 |
] |
|
3938 | 4172 |
]. |
1841 | 4173 |
|
4174 |
(sensor := self sensor) isNil ifTrue:[ |
|
4657 | 4175 |
^ self |
3938 | 4176 |
]. |
4177 |
||
4178 |
[ |
|
4657 | 4179 |
sensor flushKeyboardFor:nil. |
4180 |
Delay waitForSeconds:0.1. |
|
4181 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 4182 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4183 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4184 |
|
1699 | 4185 |
pointerEntersItem:anItemOrNil |
4186 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 4187 |
redraw the new item highlighted." |
4188 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4189 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4190 |
|
1699 | 4191 |
( anItemOrNil notNil |
4192 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4193 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4194 |
and:[self isPopUpView not]]]) ifTrue:[ |
3938 | 4195 |
anItemOrNil isButton ifTrue:[ |
4196 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
|
4197 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
4198 |
) ifTrue:[ |
|
4199 |
newItem := anItemOrNil |
|
4200 |
] |
|
4201 |
] ifFalse:[ |
|
4202 |
(self enteredLevel ~~ 0 |
|
4203 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
4204 |
) ifTrue:[ |
|
4205 |
newItem := anItemOrNil |
|
4206 |
] |
|
4207 |
] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4208 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4209 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4210 |
newItem ~~ enteredItem ifTrue:[ |
3938 | 4211 |
oldItem := enteredItem. |
4212 |
enteredItem := newItem. |
|
4213 |
||
4214 |
oldItem notNil ifTrue:[ |
|
4215 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
|
4216 |
]. |
|
4217 |
||
4218 |
enteredItem notNil ifTrue:[ |
|
4219 |
self invalidateItem:enteredItem repairNow:true. |
|
4220 |
]. |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4221 |
]. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4222 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4223 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4224 |
processHideMenuEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4225 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4226 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4227 |
"Modified: / 29-06-2011 / 16:39:36 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4228 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4229 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4230 |
processMenuEnterItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4231 |
"to be filled..." |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4232 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4233 |
"Created: / 29-06-2011 / 13:18:05 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4234 |
"Modified: / 29-06-2011 / 16:39:29 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4235 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4236 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4237 |
processMenuSelectItemEvent:ev |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4238 |
|winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction| |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4239 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4240 |
winGrp := self windowGroup. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4241 |
winGrp notNil ifTrue:[ |
4657 | 4242 |
masterGroup := winGrp previousGroup. |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4243 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4244 |
winGrpForBusyCursor := masterGroup ? winGrp. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4245 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4246 |
item := ev item. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4247 |
itemIndex := ev itemIndex. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4248 |
itemValue := ev itemValue. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4249 |
menuReceiver := ev menuReceiver. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4250 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4251 |
acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4252 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4253 |
(item showBusyCursorWhilePerforming |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4254 |
and:[winGrpForBusyCursor notNil]) |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4255 |
ifTrue:[ |
4657 | 4256 |
winGrpForBusyCursor withWaitCursorDo:acceptAction |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4257 |
] ifFalse:[ |
4657 | 4258 |
acceptAction value |
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4259 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4260 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4261 |
"Modified: / 29-06-2011 / 16:32:36 / cg" |
388 | 4262 |
! ! |
4263 |
||
2251 | 4264 |
!MenuPanel methodsFor:'focus handling'! |
4265 |
||
3187 | 4266 |
canTab |
4267 |
"depends whether I'am a toolbar and selectable items exists |
|
4268 |
" |
|
4269 |
|selectableItem| |
|
4270 |
||
4271 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3938 | 4272 |
selectableItem := self firstItemSelectable. |
4273 |
^ selectableItem notNil |
|
3187 | 4274 |
]. |
4275 |
^ false |
|
4276 |
! |
|
4277 |
||
4278 |
focusComesByTab |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4279 |
"returns true if focus comes by tab and should be drawn" |
3187 | 4280 |
|
4281 |
focusComesByTab == true ifTrue:[ |
|
4657 | 4282 |
(shown and:[self hasFocus]) ifTrue:[ |
4283 |
^ true |
|
4284 |
]. |
|
4285 |
focusComesByTab := false. |
|
3187 | 4286 |
]. |
4287 |
^ false |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4288 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4289 |
"Modified: / 29-06-2011 / 16:23:09 / cg" |
3187 | 4290 |
! |
4291 |
||
4292 |
focusComesByTab:aBoolean |
|
4293 |
"only handled for toolBars" |
|
4294 |
||
4295 |
|selectableItem| |
|
4296 |
||
4297 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
4657 | 4298 |
focusComesByTab := aBoolean. |
4299 |
||
4300 |
self hasSelection ifTrue:[ |
|
4301 |
^ self |
|
4302 |
]. |
|
4303 |
||
4304 |
aBoolean ifTrue:[ |
|
4305 |
selectableItem := self firstItemSelectable. |
|
4306 |
]. |
|
4307 |
self selection:selectableItem openMenu:false. |
|
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4308 |
]. |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4309 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
4310 |
"Modified: / 29-06-2011 / 16:23:19 / cg" |
3187 | 4311 |
! |
4312 |
||
2251 | 4313 |
hasKeyboardFocus:aBoolean |
2715 | 4314 |
"notification from the windowGroup that I got/lost the keyboard focus." |
4315 |
||
2251 | 4316 |
self isPopUpView ifTrue:[ |
4657 | 4317 |
"/ not visible for popup menus |
4318 |
^ super hasKeyboardFocus:aBoolean |
|
2251 | 4319 |
]. |
4320 |
||
4631 | 4321 |
"/ (aBoolean not and:[hasImplicitGrap ~~ true]) ifTrue:[ |
4322 |
"/ (windowGroup focusView ~~ self) ifTrue:[ |
|
4323 |
"/ self selection:nil. |
|
4324 |
"/ ]. |
|
4325 |
"/ ]. |
|
2251 | 4326 |
super hasKeyboardFocus:aBoolean. |
3142 | 4327 |
! |
4328 |
||
3187 | 4329 |
showFocus:focusComesByTab |
4330 |
self focusComesByTab:focusComesByTab. |
|
4331 |
super showFocus:focusComesByTab. |
|
4332 |
! |
|
4333 |
||
4334 |
showNoFocus:focusByTab |
|
4335 |
self focusComesByTab:false. |
|
4336 |
super showNoFocus:focusByTab. |
|
4337 |
! |
|
4338 |
||
4339 |
supportsFocusOnTab |
|
4340 |
"returns true if focus is supported |
|
4341 |
" |
|
4342 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 4343 |
! |
4344 |
||
4345 |
wantsFocusWithButtonPress |
|
3187 | 4346 |
"needs only the focus if I'am a toolbar; all events are delegated |
4347 |
to my subMenus" |
|
4348 |
||
4153 | 4349 |
"/ old: |
4350 |
"/ ^ self isPopUpView not |
|
4351 |
||
4342 | 4352 |
"/ I am not sure how this really should be - |
4353 |
"/ I guess, it needs a more intelligent and dynamic decision. |
|
4354 |
"/ for now, the menuPanelTakesFocusOnClick returns true, otherwise, |
|
4355 |
"/ we cannot control menus with the keyboard. |
|
4356 |
self isPopUpView ifTrue:[ |
|
4657 | 4357 |
^ false |
4342 | 4358 |
] ifFalse:[ |
4657 | 4359 |
^ UserPreferences current menuPanelTakesFocusOnClick. |
4342 | 4360 |
] |
2251 | 4361 |
! ! |
4362 |
||
388 | 4363 |
!MenuPanel methodsFor:'grabbing'! |
4364 |
||
1699 | 4365 |
doGrab |
4366 |
relativeGrabOrigin := nil. |
|
4367 |
||
4368 |
superMenu notNil ifTrue:[ |
|
4717 | 4369 |
superMenu doGrab |
1699 | 4370 |
] ifFalse:[ |
4717 | 4371 |
hasImplicitGrap ~~ true ifTrue:[ |
4372 |
self grabMouseAndKeyboard. |
|
4373 |
hasImplicitGrap := true |
|
4374 |
] |
|
1699 | 4375 |
] |
4376 |
! |
|
4377 |
||
4378 |
doUngrab:forceDo |
|
4379 |
||
4380 |
relativeGrabOrigin := nil. |
|
1767 | 4381 |
self clearImplicitGrab. |
1699 | 4382 |
|
4383 |
superMenu notNil ifTrue:[ |
|
3938 | 4384 |
forceDo ifTrue:[ |
4385 |
superMenu doUngrab:true |
|
4386 |
]. |
|
4387 |
^ self |
|
1699 | 4388 |
]. |
4389 |
||
4390 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3938 | 4391 |
^ self |
1699 | 4392 |
]. |
4393 |
||
4394 |
forceDo ifFalse:[ |
|
3938 | 4395 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
4396 |
^ self |
|
4397 |
]. |
|
1699 | 4398 |
]. |
4399 |
self ungrabMouseAndKeyboard. |
|
4400 |
self selection:nil. |
|
4401 |
hasImplicitGrap := nil. |
|
1703 | 4402 |
prevFocusView := nil. |
1699 | 4403 |
! |
4404 |
||
1630 | 4405 |
grabKeyboard |
2715 | 4406 |
"grap the keyboard; keep previous grab" |
4407 |
||
5001 | 4408 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 4409 |
^ super grabKeyboard |
1630 | 4410 |
! |
4411 |
||
388 | 4412 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4413 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
4414 |
|
3754 | 4415 |
|winGroup sensor activeGrab| |
3142 | 4416 |
|
4417 |
winGroup := self windowGroup. |
|
4418 |
||
4419 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
5001 | 4420 |
prevFocusView isNil ifTrue:[ |
4421 |
prevFocusView := winGroup focusView. |
|
4422 |
]. |
|
4423 |
sensor := self sensor. |
|
4424 |
||
4425 |
device activePointerGrab ~~ self ifTrue:[ |
|
4426 |
sensor flushMotionEventsFor:nil. |
|
4427 |
||
4428 |
(self grabPointer) ifFalse:[ |
|
4429 |
Delay waitForSeconds:0.1. |
|
4430 |
(self grabPointer) ifFalse:[ |
|
4431 |
"give up" |
|
4432 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
|
4433 |
self unmap |
|
4434 |
] |
|
4435 |
] |
|
4436 |
]. |
|
4437 |
||
4438 |
(activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[ |
|
4439 |
device sync. |
|
4440 |
"/ cg: mhmh - should we flush for all or for the activeGrab only ? |
|
3754 | 4441 |
"/ activeGrab notNil ifTrue:[ |
4442 |
"/ sensor flushKeyboardFor:activeGrab. |
|
4443 |
"/ ]. |
|
5001 | 4444 |
sensor flushKeyboardFor:nil. |
4445 |
self grabKeyboard. |
|
4446 |
] |
|
388 | 4447 |
] |
4448 |
||
3158 | 4449 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4450 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 4451 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 4452 |
! |
4453 |
||
1630 | 4454 |
grabPointerWithCursor:aCursorOrNil |
2715 | 4455 |
"grap the pointer; keep previous grab" |
4456 |
||
5001 | 4457 |
previousPointerGrab := device activePointerGrab. |
1699 | 4458 |
hasImplicitGrap := true. |
2715 | 4459 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 4460 |
! |
4461 |
||
4462 |
ungrabKeyboard |
|
2715 | 4463 |
"ungrap the keyboard; restore previous grab" |
4464 |
||
1630 | 4465 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4466 |
|
2579 | 4467 |
(previousKeyboardGrab notNil |
4468 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
5001 | 4469 |
device grabKeyboardInView:previousKeyboardGrab. |
2579 | 4470 |
]. |
1630 | 4471 |
! |
4472 |
||
388 | 4473 |
ungrabMouseAndKeyboard |
2715 | 4474 |
"ungrab resources (mouse and keyboard)" |
4475 |
||
1630 | 4476 |
self ungrabPointer. |
4477 |
self ungrabKeyboard. |
|
4478 |
! |
|
4479 |
||
4480 |
ungrabPointer |
|
2715 | 4481 |
"ungrap the pointer; restore previous grab" |
4482 |
||
1630 | 4483 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4484 |
|
2579 | 4485 |
(previousPointerGrab notNil |
4486 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
5001 | 4487 |
device grabPointerInView:previousPointerGrab. |
1630 | 4488 |
]. |
388 | 4489 |
! ! |
4490 |
||
1251 | 4491 |
!MenuPanel methodsFor:'help'! |
4492 |
||
3441 | 4493 |
flyByHelpSpec |
4494 |
"allows subclasses to provide texts" |
|
4495 |
||
4910 | 4496 |
pluggableHelpSpecProvider notNil ifTrue:[ |
4497 |
^ pluggableHelpSpecProvider flyByHelpSpec. |
|
4498 |
]. |
|
5190 | 4499 |
^ Dictionary new. |
4910 | 4500 |
! |
4501 |
||
4502 |
flyByHelpSpecProvider:aSpecProvider |
|
4503 |
"pluggable helpspec provider" |
|
4504 |
||
4505 |
pluggableHelpSpecProvider := aSpecProvider |
|
3441 | 4506 |
! |
4507 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4508 |
flyByHelpTextAt:aPoint |
2058 | 4509 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4510 |
If there is a selection, that items helpText is used (ignoring the given point)." |
4511 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4512 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4513 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4514 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4515 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4516 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4517 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4518 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4519 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4520 |
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
|
4521 |
^ nil |
2058 | 4522 |
! |
4523 |
||
4524 |
flyByHelpTextForItem:anItem |
|
2715 | 4525 |
"returns the helpText for an item (empty if none)" |
4526 |
||
2063 | 4527 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4528 |
^ anItem flyByHelpText. |
2058 | 4529 |
! |
4530 |
||
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4531 |
flyByHelpTextForKey:aKey |
4910 | 4532 |
|app text spec| |
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4533 |
|
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4534 |
app := self application. |
3441 | 4535 |
app notNil ifTrue:[ |
4910 | 4536 |
text := app flyByHelpTextForKey:aKey. |
4537 |
text notNil ifTrue:[^ text]. |
|
4538 |
]. |
|
4539 |
spec := self flyByHelpSpec. |
|
4540 |
spec isNil ifTrue:[^ nil]. |
|
4541 |
^ spec at:aKey ifAbsent:nil |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4542 |
! |
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4543 |
|
1251 | 4544 |
helpText |
2715 | 4545 |
"return the helpText for the currently selected item (empty if none)" |
4546 |
||
1613 | 4547 |
^ self helpTextForItem:selection |
1251 | 4548 |
! |
4549 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4550 |
helpTextAt:aPoint |
1252 | 4551 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 4552 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
4553 |
||
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4554 |
|scrollerDirectionOrNil| |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4555 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4556 |
"/ is a scroller-button present and hit ? |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4557 |
scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4558 |
scrollerDirectionOrNil notNil ifTrue:[ |
3938 | 4559 |
^ 'Scroll Menu Items' |
3695
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4560 |
]. |
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4561 |
|
3d24467f66cc
fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents:
3630
diff
changeset
|
4562 |
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
|
4563 |
^ nil |
1613 | 4564 |
! |
4565 |
||
4566 |
helpTextForItem:anItem |
|
2715 | 4567 |
"returns the helpText for an item (empty if none)" |
4568 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
4569 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4570 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4571 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4572 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4573 |
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
|
4574 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4575 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
4576 |
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
|
4577 |
dstMenu notNil ifTrue:[ |
3938 | 4578 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
4579 |
item := dstMenu itemAtPoint:dstPoint. |
|
4580 |
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
|
4581 |
] |
1251 | 4582 |
! ! |
4583 |
||
794 | 4584 |
!MenuPanel methodsFor:'image registration'! |
4585 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
4586 |
imageOnMyDevice:anImage |
2715 | 4587 |
"returns image registered on device" |
4588 |
||
5001 | 4589 |
^ self class image:anImage value onDevice:device |
794 | 4590 |
! |
4591 |
||
4592 |
lightenedImageOnDevice:anImage |
|
2715 | 4593 |
"returns lightened image registered on device" |
4594 |
||
5001 | 4595 |
^ self class lightenedImage:anImage onDevice:device |
794 | 4596 |
! ! |
4597 |
||
1688 | 4598 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 4599 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4600 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4601 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4602 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
4603 |
|
388 | 4604 |
create |
2715 | 4605 |
"create the shadow view for a none contained submenu" |
4606 |
||
388 | 4607 |
super create. |
4608 |
||
4609 |
self isPopUpView ifTrue:[ |
|
5001 | 4610 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
4611 |
shadowView isNil ifTrue:[ |
|
4612 |
shadowView := (ShadowView onDevice:device) for:self |
|
4613 |
] ifFalse:[ |
|
4614 |
self saveUnder:true. |
|
4615 |
]. |
|
4616 |
] |
|
388 | 4617 |
] ifFalse:[ |
5001 | 4618 |
self hasExplicitExtent ifTrue:[ |
4619 |
(self width) == (superView width) ifTrue:[ |
|
4620 |
self verticalLayout:false |
|
4621 |
] |
|
4622 |
] |
|
388 | 4623 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4624 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4625 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 4626 |
! |
4627 |
||
4628 |
destroy |
|
2715 | 4629 |
"destroy items and shadowView; remove dependencies" |
4630 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4631 |
self clearLastActiveMenu. |
2051 | 4632 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 4633 |
items := nil. |
4634 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4635 |
|
388 | 4636 |
super destroy. |
3142 | 4637 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4638 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4639 |
|
2051 | 4640 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4641 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4642 |
|
616 | 4643 |
fetchDeviceResources |
2715 | 4644 |
"fetch device colors, to avoid reallocation at redraw time" |
4645 |
||
2219 | 4646 |
|style| |
4647 |
||
2374 | 4648 |
superMenu notNil ifTrue:[ |
5001 | 4649 |
styleSheet := superMenu styleSheet |
2219 | 4650 |
]. |
616 | 4651 |
|
4652 |
super fetchDeviceResources. |
|
4653 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
4654 |
"/ 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
|
4655 |
"/ (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
|
4656 |
|
616 | 4657 |
superMenu isNil ifTrue:[ |
5001 | 4658 |
rightArrow isNil ifTrue:[ |
4659 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
|
4660 |
]. |
|
4661 |
fgColor := fgColor onDevice:device. |
|
4662 |
style := styleSheet name. |
|
4663 |
||
4664 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
|
4665 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
4666 |
] ifFalse:[ |
|
4667 |
rightArrowShadow := nil |
|
4668 |
]. |
|
616 | 4669 |
] ifFalse:[ |
5001 | 4670 |
rightArrow := superMenu rightArrow. |
4671 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4672 |
||
4673 |
self foregroundColor:(superMenu foregroundColor). |
|
4674 |
self font:(superMenu font). |
|
2761 | 4675 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4676 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4677 |
|
1829 | 4678 |
items notNil ifTrue:[ |
5001 | 4679 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 4680 |
]. |
4681 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
4682 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 4683 |
! |
4684 |
||
580 | 4685 |
initStyle |
4686 |
"initialize style specific stuff" |
|
4687 |
||
2919 | 4688 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
4893 | 4689 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
4690 |
#'menu.itemHorizontalSpace' |
|
4691 |
#'menu.extraMargin' |
|
4692 |
#'button.activeBackgroundColor' |
|
4693 |
#'button.buttonEnteredBackgroundColor' |
|
4694 |
#'button.buttonPassiveBackgroundColor' |
|
4695 |
#'popup.hideOnRelease' |
|
4696 |
)> |
|
2609 | 4697 |
|fn| |
4698 |
||
580 | 4699 |
super initStyle. |
616 | 4700 |
|
2883 | 4701 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
4702 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4703 |
buttonInsetX := buttonInsetX abs. |
|
4704 |
||
4705 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
4706 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
4707 |
buttonInsetY := buttonInsetY abs. |
|
4708 |
||
4709 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
4893 | 4710 |
itemSpace isNil ifTrue:[ |
4711 |
itemSpace := styleSheet at:#'menu.itemSpace' default:[ gc font widthOf:' '] |
|
4712 |
]. |
|
4713 |
extraMargin := styleSheet at:#'menu.extraMargin' default:0. |
|
2883 | 4714 |
|
4061 | 4715 |
fgColor := DefaultForegroundColor. |
4716 |
fgColor isNil ifTrue:[ fgColor := Color black ]. |
|
2609 | 4717 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
4718 |
fn := self class defaultFont. |
|
2610 | 4719 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 4720 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4721 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4722 |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4723 |
buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4724 |
buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4725 |
buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'. |
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4726 |
|
4893 | 4727 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:nil. |
4728 |
buttonActiveLevel isNil ifTrue:[ |
|
4729 |
buttonActiveLevel := styleSheet at:#'button.activeLevel' default:0. |
|
4730 |
]. |
|
4731 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel' default:nil. |
|
4732 |
buttonPassiveLevel isNil ifTrue:[ |
|
4733 |
buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:0. |
|
4734 |
]. |
|
4735 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:nil. |
|
4736 |
buttonEnteredLevel isNil ifTrue:[ |
|
4737 |
buttonEnteredLevel := styleSheet at:#'button.enteredLevel' default:0. |
|
4738 |
]. |
|
4739 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4740 |
self updateLevelAndBorder. |
4061 | 4741 |
|
4098
98ff3ed9c62e
fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents:
4092
diff
changeset
|
4742 |
"Modified (format): / 19-01-2012 / 13:19:19 / cg" |
580 | 4743 |
! |
4744 |
||
388 | 4745 |
initialize |
2715 | 4746 |
"set default configuration" |
4747 |
||
4454 | 4748 |
mustRearrange := false. |
4628 | 4749 |
sizeFixed := true. |
4893 | 4750 |
extraMargin := 0. |
4751 |
||
388 | 4752 |
super initialize. |
616 | 4753 |
|
2877 | 4754 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4755 |
enabled := true. |
3881 | 4756 |
self originChangedFlag:false extentChangedFlag:false. |
3334
50374a42b3d9
use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents:
3332
diff
changeset
|
4757 |
"/ explicitExtent := nil. |
2253 | 4758 |
shortKeyInset := 0. |
4759 |
showSeparatingLines := false. |
|
4760 |
showGroupDivider := true. |
|
3780 | 4761 |
hideOnRelease := defaultHideOnRelease. |
388 | 4762 |
! |
4763 |
||
1573 | 4764 |
map |
3938 | 4765 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4766 |
If the grab fails, try again and unmap myself if that fails too." |
4767 |
||
1791 | 4768 |
|loIndices loItems| |
388 | 4769 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4770 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4771 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4772 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4773 |
self becomesActiveMenu. |
1573 | 4774 |
super map. |
2681 | 4775 |
self addDependencies. |
388 | 4776 |
|
1785 | 4777 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4778 |
loItems := items ? #[]. |
4779 |
||
4780 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4781 |
|
388 | 4782 |
self isPopUpView ifTrue:[ |
3938 | 4783 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4784 |
] ifFalse:[ |
3938 | 4785 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4786 |
]. |
1791 | 4787 |
loItems do:[:el| el updateIndicators ]. |
388 | 4788 |
|
1785 | 4789 |
loIndices size > 0 ifTrue:[ |
3938 | 4790 |
self redrawX:0 y:0 width:width height:height. |
4791 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4792 |
]. |
4793 |
||
1177 | 4794 |
"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
|
4795 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4796 |
! |
4797 |
||
4798 |
realize |
|
2715 | 4799 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4800 |
|
2761 | 4801 |
|bgColor| |
4802 |
||
388 | 4803 |
self isPopUpView ifTrue:[ |
3938 | 4804 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4805 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4806 |
||
4807 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
|
4808 |
shadowView must be realized before self" |
|
4809 |
self hiddenOnRealize:true. |
|
4810 |
super realize. |
|
4811 |
self resize. |
|
4812 |
self makeFullyVisible. |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4813 |
"/ self mustRearrange. |
3938 | 4814 |
shadowView notNil ifTrue:[ |
4815 |
shadowView realize. |
|
4816 |
]. |
|
4817 |
self raise. |
|
4818 |
self map. |
|
736 | 4819 |
] ifFalse:[ |
3938 | 4820 |
super realize. |
1767 | 4821 |
]. |
4822 |
self allSubViewsDo:[:aView| aView realize ]. |
|
3780 | 4823 |
"/ hideOnRelease := defaultHideOnRelease. |
388 | 4824 |
! |
4825 |
||
4826 |
recreate |
|
1832 | 4827 |
"this is called after a snapin or a migration. |
2715 | 4828 |
If the image was saved with an active menu, hide the menu" |
4829 |
||
1455 | 4830 |
selection := nil. |
388 | 4831 |
super recreate. |
4832 |
! |
|
4833 |
||
1130 | 4834 |
reinitStyle |
4835 |
"handle style change while being open (win32 only - for now)" |
|
4836 |
||
4837 |
super reinitStyle. |
|
4838 |
||
4839 |
self fetchDeviceResources. |
|
1811 | 4840 |
self mustRearrange. "/ care for changed font sizes etc. |
4841 |
||
4842 |
self do:[:anItem | |
|
3938 | 4843 |
anItem reinitStyle |
1811 | 4844 |
]. |
1130 | 4845 |
|
4846 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4847 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4848 |
! |
4849 |
||
388 | 4850 |
unmap |
1330 | 4851 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4852 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4853 |
|
3203 | 4854 |
mapTime := nil. |
4855 |
||
3975 | 4856 |
"hide all submenus opened within the menu" |
4857 |
self itemsDo:[:eachItem| |
|
4657 | 4858 |
eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ]. |
3975 | 4859 |
]. |
4860 |
||
2681 | 4861 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4862 |
self clearLastActiveMenu. |
1699 | 4863 |
self doUngrab:(superMenu isNil). |
4864 |
"/ self isPopUpView ifTrue:[ |
|
4865 |
"/ self doUngrab:(superMenu isNil) |
|
4866 |
"/ ]. |
|
3142 | 4867 |
prevFocusView := nil. |
388 | 4868 |
super unmap. |
4869 |
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
|
4870 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4871 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4872 |
updateLevelAndBorder |
3820 | 4873 |
"update level & border" |
4874 |
||
4875 |
<resource: #style (#'popup.borderWidth' |
|
5168 | 4876 |
#'popup.borderColor' |
4877 |
#'popup.level' |
|
4878 |
#'pullDownMenu.level' |
|
4879 |
)> |
|
3820 | 4880 |
|
4881 |
|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
|
4882 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4883 |
self isPopUpView ifTrue:[ |
5168 | 4884 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
4885 |
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
|
4886 |
] ifFalse:[ |
5168 | 4887 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
4888 |
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
|
4889 |
]. |
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4890 |
bw ~~ 0 ifTrue:[ |
5168 | 4891 |
bc := styleSheet at:#'popup.borderColor' default:self blackColor. |
4892 |
self borderColor:bc |
|
3823
81781fb283b5
changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents:
3820
diff
changeset
|
4893 |
]. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4894 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4895 |
self level:lvl. |
388 | 4896 |
! ! |
4897 |
||
1878 | 4898 |
!MenuPanel methodsFor:'keyboard control'! |
4899 |
||
4900 |
mnemonicViewNext:aKeyEvent |
|
4901 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4902 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4903 |
return the topMenu otherwise nil." |
4904 |
||
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4905 |
|menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel| |
2112 | 4906 |
|
4907 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4908 |
shown ifFalse:[^ nil]. |
4909 |
||
4910 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4911 |
lKey := uKey asLowercase. |
|
2112 | 4912 |
|
4657 | 4913 |
accessCharacterMatchQuery := |
4914 |
[:el| |
|
4915 |
|k| |
|
4916 |
||
4917 |
k := el accessCharacter. |
|
4918 |
k == uKey or:[k == lKey] |
|
4919 |
]. |
|
3363
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4920 |
maxShortCutSearchLevel := self class maxShortCutSearchLevel. |
33e881abd5b2
accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
4921 |
|
2112 | 4922 |
selection notNil ifTrue:[ |
4657 | 4923 |
"first lookup the current grapMenu before starting in the topMenu |
4924 |
" |
|
4925 |
menu := self detectGrabMenu. |
|
4926 |
||
4927 |
[ menu ~~ self ] whileTrue:[ |
|
4928 |
index := menu selectionIndex. |
|
4929 |
list := menu |
|
4930 |
selectItemIndicesFor:accessCharacterMatchQuery |
|
4931 |
maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999 |
|
4932 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
|
4933 |
||
4934 |
list size ~~ 0 ifTrue:[ |
|
4935 |
"/ has item which responds to the mnemonic |
|
4936 |
menu processCollectedShortcutIndices:list. |
|
4937 |
^ self |
|
4938 |
]. |
|
4939 |
menu := menu superMenu. |
|
4940 |
]. |
|
4941 |
index := self selectionIndex. |
|
4942 |
list := self |
|
4943 |
selectItemIndicesFor:accessCharacterMatchQuery |
|
4944 |
maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999 |
|
4945 |
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
|
4946 |
|
2112 | 4947 |
] ifFalse:[ |
4657 | 4948 |
index := 99999. |
4949 |
list := nil. |
|
3938 | 4950 |
]. |
2112 | 4951 |
|
2374 | 4952 |
list isNil ifTrue:[ |
4657 | 4953 |
list := self |
4954 |
selectItemIndicesFor:accessCharacterMatchQuery |
|
4955 |
maxDepth:maxShortCutSearchLevel from:1 to:index |
|
4956 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
|
4957 |
||
4958 |
||
4959 |
list isNil ifTrue:[ |
|
4960 |
"/ must clear existing selection |
|
4961 |
self selection:nil. |
|
4962 |
^ nil |
|
4963 |
] |
|
2112 | 4964 |
]. |
4965 |
||
4966 |
"/ has item which responds to the mnemonic |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4967 |
self processCollectedShortcutIndices:list. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4968 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4969 |
"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
|
4970 |
! |
1878 | 4971 |
|
4972 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4973 |
"open all menus derived from sequence of item indices" |
4974 |
||
1878 | 4975 |
|item| |
4976 |
||
4977 |
anItemIndiceList size == 0 ifTrue:[ |
|
3938 | 4978 |
^ self |
1878 | 4979 |
]. |
4980 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4981 |
||
4982 |
(item notNil and:[item enabled]) ifTrue:[ |
|
3938 | 4983 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4984 |
self selection:item openMenu:true. |
|
4985 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4986 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4987 |
! |
1878 | 4988 |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
4989 |
processCollectedShortcutIndices:indices |
1878 | 4990 |
|menu item| |
4991 |
||
4992 |
indices size == 0 ifTrue:[ |
|
4657 | 4993 |
^ self |
1878 | 4994 |
]. |
4995 |
menu := self. |
|
4996 |
||
3192 | 4997 |
"/ first lookup in current open submenus |
1878 | 4998 |
[menu selectionIndex == indices first] whileTrue:[ |
4657 | 4999 |
( (item := menu selection) isNil |
5000 |
or:[(menu := item currentSubmenu) isNil] |
|
5001 |
) ifTrue:[ "/ selected but no submenu open - not handled |
|
5002 |
^ self |
|
5003 |
]. |
|
5004 |
indices removeFirst. |
|
5005 |
||
5006 |
indices isEmpty ifTrue:[ |
|
5007 |
menu selection:nil. |
|
5008 |
^ self |
|
5009 |
] |
|
1878 | 5010 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5011 |
menu openMenusFromItemIndices:indices. |
4026
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
5012 |
|
ed8b8c2f6c98
comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents:
4025
diff
changeset
|
5013 |
"Modified: / 24-03-2011 / 11:19:38 / cg" |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5014 |
"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
|
5015 |
! |
1878 | 5016 |
|
5017 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
5018 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
5019 |
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
|
5020 |
Otherwise return false." |
2715 | 5021 |
|
3431 | 5022 |
|menu rawKey logicalKey list item selectableItem| |
1878 | 5023 |
|
5024 |
superMenu notNil ifTrue:[ |
|
4657 | 5025 |
^ superMenu processShortcut:aKeyEvent |
1878 | 5026 |
]. |
5027 |
shown ifFalse:[^ false]. |
|
5028 |
||
3431 | 5029 |
logicalKey := aKeyEvent key. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5030 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5031 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5032 |
|
3192 | 5033 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
3431 | 5034 |
) includes:logicalKey |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5035 |
) ifTrue:[ |
4657 | 5036 |
^ false. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5037 |
]. |
4628 | 5038 |
|
3431 | 5039 |
rawKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5040 |
item := nil. |
3328
037d6d506879
no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
5041 |
menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu |
1878 | 5042 |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5043 |
"/ 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
|
5044 |
aKeyEvent isKeyReleaseEvent ifTrue:[ |
4657 | 5045 |
selection isNil ifTrue:[ |
5046 |
prevFocusView := self windowGroup focusView. |
|
5047 |
self requestFocus. "/ self windowGroup focusView:self. |
|
5048 |
selectableItem := self firstItemSelectable. |
|
5049 |
self selection:selectableItem openMenu:false. |
|
5050 |
] ifFalse:[ |
|
5051 |
prevFocusView requestFocus. |
|
5052 |
self selection:nil. |
|
5053 |
]. |
|
5054 |
^ true |
|
3394
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5055 |
]. |
90e7bc4402b5
Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents:
3384
diff
changeset
|
5056 |
|
1878 | 5057 |
[true] whileTrue:[ |
4657 | 5058 |
list := menu |
5059 |
selectItemIndicesFor:[:el| |
|
5060 |
|skey| |
|
5061 |
||
5062 |
item := el. |
|
5063 |
el ignoreShortcutKeys ifTrue:[ |
|
5064 |
false |
|
5065 |
] ifFalse:[ |
|
5066 |
skey := el shortcutKey. |
|
5067 |
skey == rawKey or:[skey == logicalKey] |
|
5068 |
] |
|
5069 |
] |
|
5070 |
maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999 |
|
5071 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
|
5072 |
||
5073 |
list size ~~ 0 ifTrue:[ |
|
5074 |
"/ has item which responds to the shortcut |
|
5075 |
item hasSubmenu ifFalse:[ |
|
5076 |
menu accept:item |
|
5077 |
] ifTrue:[ |
|
5078 |
menu processCollectedShortcutIndices:list. |
|
5079 |
self requestFocus. "/ self windowGroup focusView:self. |
|
5080 |
]. |
|
5081 |
^ true |
|
5082 |
]. |
|
5083 |
||
5084 |
menu == self ifTrue:[ ^ false ]. |
|
5085 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5086 |
]. |
2219 | 5087 |
^ false "/ never reached |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5088 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
5089 |
"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
|
5090 |
! |
1878 | 5091 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5092 |
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
|
5093 |
"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
|
5094 |
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
|
5095 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5096 |
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
|
5097 |
is created and passed through if the block returns false. |
2715 | 5098 |
Otherwise the item is not asked for its submenu." |
5099 |
||
2112 | 5100 |
|start stop| |
5101 |
||
5102 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
5103 |
||
5104 |
start := aStart max:1. |
|
5105 |
stop := aStop min:(items size). |
|
5106 |
||
3938 | 5107 |
start to:stop do:[:i| |
5108 |
|item menu result| |
|
5109 |
||
5110 |
item := items at:i. |
|
5111 |
(item enabled and:[item isVisible]) ifTrue:[ |
|
5112 |
(aOneArgBlock value:item) ifTrue:[ |
|
5113 |
^ OrderedCollection with:i |
|
5114 |
]. |
|
5115 |
||
5116 |
maxDepth > 1 ifTrue:[ |
|
5117 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
|
5118 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
|
5119 |
menu := item setupSubmenu. |
|
5120 |
||
5121 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
|
5122 |
result := menu |
|
5123 |
selectItemIndicesFor:aOneArgBlock |
|
5124 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
|
5125 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
|
5126 |
||
5127 |
result notNil ifTrue:[ |
|
5128 |
result addFirst:i. |
|
5129 |
^ result |
|
5130 |
]. |
|
5131 |
]. |
|
5132 |
]. |
|
5133 |
]. |
|
5134 |
]. |
|
5135 |
]. |
|
1878 | 5136 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5137 |
^ nil |
3128 | 5138 |
|
5139 |
"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
|
5140 |
! ! |
1878 | 5141 |
|
388 | 5142 |
!MenuPanel methodsFor:'misc'! |
5143 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
5144 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
5145 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
5146 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
5147 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
5148 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
5149 |
|
388 | 5150 |
superMenu |
2715 | 5151 |
"returns supermenu or nil" |
5152 |
||
388 | 5153 |
^ superMenu |
5154 |
! |
|
5155 |
||
5156 |
topMenu |
|
2715 | 5157 |
"returns the topMenu; the one having no superMenu" |
5158 |
||
1791 | 5159 |
|menu smenu| |
5160 |
||
5161 |
menu := self. |
|
5162 |
||
5163 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
3938 | 5164 |
menu := smenu |
1791 | 5165 |
]. |
5166 |
^ menu |
|
388 | 5167 |
! ! |
5168 |
||
1825 | 5169 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5170 |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5171 |
printOn:aStream |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5172 |
|label| |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5173 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5174 |
aStream nextPutAll:'Menu:'. |
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5175 |
|
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5176 |
self do:[:eachItem| |
5193 | 5177 |
label := eachItem label. |
5178 |
label notEmptyOrNil ifTrue:[ |
|
5179 |
aStream nextPutAll:' '. |
|
5180 |
label printOn:aStream. |
|
5181 |
]. |
|
3360
f329bc4a2254
Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents:
3334
diff
changeset
|
5182 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5183 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5184 |
|
388 | 5185 |
!MenuPanel methodsFor:'private'! |
5186 |
||
434 | 5187 |
application |
2715 | 5188 |
"optimize access to retrive the application" |
5189 |
||
2374 | 5190 |
application notNil ifTrue:[^ application ]. |
434 | 5191 |
|
5192 |
superMenu notNil ifTrue:[ |
|
3938 | 5193 |
application := superMenu application. |
5194 |
^ application |
|
2253 | 5195 |
]. |
5196 |
application := super application. |
|
2374 | 5197 |
^ application |
1872 | 5198 |
! |
434 | 5199 |
|
3725 | 5200 |
detectItem:aBlock |
5201 |
"returns the item for which aBlock returns true." |
|
5202 |
||
5203 |
items notNil ifTrue:[ |
|
3938 | 5204 |
items keysAndValuesDo:[:anIndex :anItem| |
5205 |
(aBlock value:anItem) ifTrue:[^ anItem]. |
|
5206 |
]. |
|
3725 | 5207 |
]. |
5208 |
^ nil |
|
5209 |
! |
|
5210 |
||
1572 | 5211 |
detectItemForKey:aKey |
5212 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 5213 |
if no item is detected nil is returned." |
5214 |
||
1572 | 5215 |
|cIdx uKey lKey item| |
5216 |
||
1699 | 5217 |
items isNil ifTrue:[^ nil]. |
5218 |
||
1572 | 5219 |
cIdx := self selectionIndex. |
5220 |
uKey := aKey asUppercase. |
|
5221 |
lKey := aKey asLowercase. |
|
5222 |
||
3938 | 5223 |
items keysAndValuesDo:[:anIndex :anItem| |
5224 |
|char label| |
|
5225 |
||
5226 |
( anIndex ~~ cIdx |
|
5227 |
and:[anItem canSelect |
|
5228 |
and:[(label := anItem textLabel) notNil |
|
5229 |
and:[label size ~~ 0]]] |
|
5230 |
) ifTrue:[ |
|
5231 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
5232 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
5233 |
^ anItem |
|
5234 |
] |
|
5235 |
] ifFalse:[ |
|
5236 |
char := label at:1. |
|
5237 |
||
5238 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
5239 |
anIndex > cIdx ifTrue:[ |
|
5240 |
^ anItem |
|
5241 |
]. |
|
5242 |
item isNil ifTrue:[item := anItem] |
|
5243 |
] |
|
5244 |
] |
|
5245 |
] |
|
1572 | 5246 |
]. |
5247 |
^ item |
|
5248 |
! |
|
5249 |
||
3725 | 5250 |
detectItemForLabel:aLabel |
5251 |
^ self detectItem:[:anItem | anItem label = aLabel]. |
|
5252 |
! |
|
5253 |
||
5254 |
detectItemForNameKey:aKey |
|
5255 |
^ self detectItem:[:anItem | anItem nameKey == aKey]. |
|
5256 |
! |
|
5257 |
||
388 | 5258 |
onEachPerform:aSelector withArgList:aList |
2715 | 5259 |
"on each item perform selector with an argument derived from aList" |
5260 |
||
388 | 5261 |
aList isCollection ifTrue:[ |
3938 | 5262 |
items size >= aList size ifTrue:[ |
5263 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
5264 |
(items at:anIndex) perform:aSelector with:anArg |
|
5265 |
] |
|
5266 |
] |
|
388 | 5267 |
] ifFalse:[ |
3938 | 5268 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 5269 |
] |
5270 |
! |
|
5271 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5272 |
registerImageOnDevice:anImage |
2269 | 5273 |
anImage isNil ifTrue:[ ^ nil ]. |
5001 | 5274 |
^ self class image:anImage onDevice:device |
2269 | 5275 |
|
5276 |
"/ |image| |
|
5277 |
"/ |
|
5278 |
"/ (image := anImage) notNil ifTrue:[ |
|
5279 |
"/ image device ~~ device ifTrue:[ |
|
5280 |
"/ image := image copy. |
|
5281 |
"/ ]. |
|
5282 |
"/ image := image onDevice:device. |
|
5283 |
"/ image := image clearMaskedPixels. |
|
5284 |
"/ ]. |
|
5285 |
"/ ^ image |
|
2355 | 5286 |
! |
5287 |
||
5288 |
superMenu:aSuperMenu |
|
2715 | 5289 |
"set my supermenu from which i'am activated" |
5290 |
||
2355 | 5291 |
superMenu := aSuperMenu. |
5292 |
||
2374 | 5293 |
superMenu notNil ifTrue:[ |
3938 | 5294 |
styleSheet := superMenu styleSheet. |
5295 |
rightArrow := superMenu rightArrow. |
|
5296 |
rightArrowShadow := superMenu rightArrowShadow. |
|
2355 | 5297 |
]. |
388 | 5298 |
! ! |
5299 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5300 |
!MenuPanel methodsFor:'private-activation'! |
687 | 5301 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5302 |
activeMenu |
2715 | 5303 |
"returns the current active menu or self (the top menu)" |
5304 |
||
687 | 5305 |
^ lastActiveMenu ? self |
5306 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5307 |
"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
|
5308 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5309 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5310 |
activeMenu:aMenu |
2715 | 5311 |
"set the current active menu" |
5312 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5313 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5314 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5315 |
"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
|
5316 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5317 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5318 |
becomesActiveMenu |
2715 | 5319 |
"submenu becomes the active menu" |
5320 |
||
3224 | 5321 |
mapTime isNil ifTrue:[ |
4657 | 5322 |
"/ set the mapTime if not yet done |
5323 |
mapTime := Timestamp now. |
|
3224 | 5324 |
]. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5325 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5326 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5327 |
"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
|
5328 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5329 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5330 |
clearLastActiveMenu |
2715 | 5331 |
"reset the current active menu" |
5332 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5333 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5334 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5335 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5336 |
|
2251 | 5337 |
"/ prevFocusView notNil ifTrue:[ |
5338 |
"/ self windowGroup focusView:prevFocusView. |
|
5339 |
"/ prevFocusView := nil. |
|
5340 |
"/ ]. |
|
5341 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5342 |
top activeMenu == self ifTrue:[ |
3938 | 5343 |
top activeMenu:nil |
687 | 5344 |
] |
5345 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5346 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 5347 |
! |
5348 |
||
5349 |
mapTime |
|
3203 | 5350 |
"get the time the menu was activated or nil" |
2715 | 5351 |
|
687 | 5352 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5353 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
5354 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
3203 | 5355 |
! |
5356 |
||
5357 |
mapTime:aTimestamp |
|
5358 |
"set the time the menu was activated" |
|
5359 |
||
5360 |
mapTime := aTimestamp. |
|
5361 |
||
5362 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
|
687 | 5363 |
! ! |
5364 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5365 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 5366 |
|
5367 |
hasScrollerAt:aDirection |
|
2715 | 5368 |
"returns true if a visible scroller at a direction exists" |
5369 |
||
4826 | 5370 |
self hasScrollers ifTrue:[ |layout| |
5371 |
aDirection == #PREV ifTrue:[ |
|
5372 |
layout := items first layout. |
|
5373 |
||
5374 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
5375 |
ifFalse:[ layout left < margin] |
|
5376 |
]. |
|
5377 |
aDirection == #NEXT ifTrue:[ |item| |
|
5378 |
"/ must check for visibility |
|
5379 |
item := items detectLast:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ]. |
|
5380 |
layout := item layout. |
|
5381 |
||
5382 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
5383 |
ifFalse:[ layout right > (width - margin)] |
|
5384 |
]. |
|
5385 |
]. |
|
5386 |
^ false |
|
2016 | 5387 |
! |
5388 |
||
5389 |
hasScrollers |
|
2715 | 5390 |
"returns true if scrollers are needed" |
5391 |
||
2018 | 5392 |
|maxExtent first last isVert| |
5393 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5394 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 5395 |
|
5396 |
isVert := self verticalLayout. |
|
5397 |
||
5398 |
superView notNil ifTrue:[ |
|
3938 | 5399 |
((first := items first layout) isNil |
5400 |
or:[(last := items last layout) isNil] |
|
5401 |
) ifTrue:[ |
|
5402 |
^ false |
|
5403 |
]. |
|
5404 |
isVert ifTrue:[ |
|
5405 |
^ first top < 0 or:[last bottom > height] |
|
5406 |
]. |
|
5407 |
^ first left < 0 or:[last right > width] |
|
2018 | 5408 |
]. |
5409 |
maxExtent := self maxExtent. |
|
5410 |
isVert ifTrue:[ |
|
3938 | 5411 |
^ (height >= maxExtent y) |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5412 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
5413 |
^ (width >= maxExtent x) |
2016 | 5414 |
! |
5415 |
||
4826 | 5416 |
indexOfFirstItemShown |
5417 |
"answer the index of the first item shown (scrolling) or 0" |
|
5418 |
items size == 0 ifTrue:[^ 0]. |
|
5419 |
||
5420 |
self verticalLayout ifTrue:[ |
|
5421 |
^ items findFirst:[:each|(each layout notNil and:[each layout top >= 0 and:[each isVisible]])]. |
|
5422 |
]. |
|
5423 |
^ items findFirst:[:each|(each layout notNil and:[each layout left >= 0 and:[each isVisible]])]. |
|
5424 |
! |
|
5425 |
||
2016 | 5426 |
indexOfItemAtScroller:aDirection |
4826 | 5427 |
<resource: #obsolete> |
5428 |
||
2715 | 5429 |
"returns the index of the item under the scroller or 0" |
5430 |
||
2016 | 5431 |
|bounds min max layout| |
5432 |
||
2860 | 5433 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 5434 |
bounds := self scrollerBoundsAt:aDirection. |
5435 |
||
5436 |
self verticalLayout ifTrue:[ |
|
4826 | 5437 |
min := bounds top. |
5438 |
max := bounds bottom. |
|
5439 |
||
5440 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5441 |
anItem isVisible ifTrue:[ |
|
5442 |
layout := anItem layout. |
|
5443 |
||
5444 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
5445 |
^ anIndex |
|
5446 |
]. |
|
5447 |
]. |
|
5448 |
]. |
|
2016 | 5449 |
] ifFalse:[ |
4826 | 5450 |
min := bounds left. |
5451 |
max := bounds right. |
|
5452 |
||
5453 |
items keysAndValuesDo:[:anIndex :anItem| |
|
5454 |
anItem isVisible ifTrue:[ |
|
5455 |
layout := anItem layout. |
|
5456 |
||
5457 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
5458 |
^ anIndex |
|
5459 |
]. |
|
5460 |
]. |
|
5461 |
] |
|
2016 | 5462 |
]. |
5463 |
^ 0 |
|
5464 |
! |
|
5465 |
||
4826 | 5466 |
indexOfLastItemShown |
5467 |
"answer the index of the last item shown (scrolling) or 0" |
|
5468 |
||
5469 |
items size == 0 ifTrue:[^ 0]. |
|
5470 |
||
5471 |
self verticalLayout ifTrue:[ |
|
5472 |
^ items findLast:[:each|(each layout notNil and:[each layout bottom <= height and:[each isVisible]])]. |
|
5473 |
]. |
|
5474 |
^ items findLast:[:each|(each layout notNil and:[each layout right <= width and:[each isVisible]])]. |
|
5475 |
! |
|
5476 |
||
2016 | 5477 |
makeItemVisible:anItem |
2715 | 5478 |
"make an item visible" |
5479 |
||
2018 | 5480 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
5481 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 5482 |
inv1 inv2| |
2018 | 5483 |
|
5484 |
( anItem notNil |
|
5485 |
and:[self hasScrollers |
|
5486 |
and:[(layout := anItem layout) notNil]] |
|
5487 |
) ifFalse:[ |
|
3938 | 5488 |
^ self |
2016 | 5489 |
]. |
2018 | 5490 |
index := self indexOfItem:anItem. |
2016 | 5491 |
boundsPREV := self scrollerBoundsAt:#PREV. |
5492 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
5493 |
||
2018 | 5494 |
isVertical := self verticalLayout. |
5495 |
||
5496 |
isVertical ifTrue:[ |
|
3938 | 5497 |
boundsMin := boundsPREV bottom. |
5498 |
boundsMax := boundsNEXT top. |
|
5499 |
layoutMin := layout top. |
|
5500 |
layoutMax := layout bottom. |
|
5501 |
windowSz := height. |
|
2018 | 5502 |
] ifFalse:[ |
3938 | 5503 |
boundsMin := boundsPREV right. |
5504 |
boundsMax := boundsNEXT left. |
|
5505 |
layoutMin := layout left. |
|
5506 |
layoutMax := layout right. |
|
5507 |
windowSz := width. |
|
2018 | 5508 |
]. |
5509 |
||
5510 |
||
5511 |
layoutMin < boundsMin ifTrue:[ |
|
3938 | 5512 |
layoutMin >= 0 ifTrue:[ |
5513 |
^ self |
|
5514 |
]. |
|
5515 |
"/ test whether is first visible item |
|
5516 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
|
5517 |
||
5518 |
index == 0 ifTrue:[ scr0 := margin ] |
|
5519 |
ifFalse:[ scr0 := boundsMin ]. |
|
5520 |
||
5521 |
delta := layoutMin negated + scr0. |
|
2016 | 5522 |
] ifFalse:[ |
3938 | 5523 |
layoutMax > boundsMax ifFalse:[ |
5524 |
^ self |
|
5525 |
]. |
|
5526 |
"/ test whether is last visible item |
|
5527 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
|
5528 |
||
5529 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
|
5530 |
ifFalse:[ scr0 := boundsMax ]. |
|
5531 |
||
5532 |
delta := scr0 - layoutMax. |
|
2018 | 5533 |
]. |
5534 |
delta == 0 ifTrue:[ ^ self ]. |
|
5535 |
||
2016 | 5536 |
doScroll := false. |
5537 |
||
5538 |
shown ifTrue:[ |
|
3938 | 5539 |
delta abs < (windowSz / 2) ifTrue:[ |
5540 |
doScroll := true. |
|
5541 |
self repairDamage |
|
5542 |
] |
|
2016 | 5543 |
]. |
2018 | 5544 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
5545 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 5546 |
|
5547 |
doScroll ifFalse:[ |
|
3938 | 5548 |
self invalidate. |
5549 |
^ self |
|
2016 | 5550 |
]. |
5551 |
||
2018 | 5552 |
windowSz := windowSz - margin - margin. |
5553 |
||
5554 |
scr0 := boundsMin. |
|
5555 |
scr1 := scr0 + delta abs. |
|
5556 |
scrSz := boundsMax - scr1. |
|
5557 |
||
5558 |
delta < 0 ifTrue:[ |
|
3938 | 5559 |
isVertical ifTrue:[ |
5560 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
|
5561 |
width:windowSz height:scrSz async:false. |
|
5562 |
||
5563 |
scr1 := scr0 + scrSz. |
|
5564 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
|
5565 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
|
5566 |
] ifFalse:[ |
|
5567 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
|
5568 |
width:scrSz height:windowSz async:false. |
|
5569 |
||
5570 |
scr1 := scr0 + scrSz. |
|
5571 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
|
5572 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
|
5573 |
]. |
|
5574 |
inv1 := boundsPREV. |
|
2016 | 5575 |
] ifFalse:[ |
3938 | 5576 |
isVertical ifTrue:[ |
5577 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
|
5578 |
width:windowSz height:scrSz async:false. |
|
5579 |
||
5580 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
|
5581 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
|
5582 |
] ifFalse:[ |
|
5583 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
|
5584 |
width:scrSz height:windowSz async:false. |
|
5585 |
||
5586 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
|
5587 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
|
5588 |
]. |
|
5589 |
inv1 := boundsNEXT. |
|
2042 | 5590 |
]. |
5591 |
self invalidate:inv1. |
|
5592 |
self invalidate:inv2. |
|
2048 | 5593 |
|
5594 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 5595 |
! |
5596 |
||
4826 | 5597 |
pageDown |
5598 |
"scroll one page down" |
|
5599 |
|index delta foundItem isVertical| |
|
5600 |
||
5601 |
(self hasScrollerAt:#NEXT) ifFalse:[^ self]. |
|
5602 |
||
5603 |
index := self indexOfLastItemShown. |
|
5604 |
index == 0 ifTrue:[^ self]. |
|
5605 |
||
5606 |
isVertical := self verticalLayout. |
|
5607 |
delta := isVertical ifTrue:[self height] ifFalse:[self width]. |
|
5608 |
delta := delta - 15. "/ bounds |
|
5609 |
||
5610 |
[delta > 0] whileTrue:[ |item| |
|
5611 |
item := items at:index ifAbsent:nil. |
|
5612 |
item isNil ifTrue:[ |
|
5613 |
delta := 0 |
|
5614 |
] ifFalse:[ |
|
5615 |
(item layout notNil and:[item isVisible]) ifTrue:[ |
|
5616 |
isVertical ifTrue:[delta := delta - item layout height] |
|
5617 |
ifFalse:[delta := delta - item layout width]. |
|
5618 |
foundItem := item. |
|
5619 |
] |
|
5620 |
]. |
|
5621 |
index := index + 1. |
|
5622 |
]. |
|
5623 |
self makeItemVisible:foundItem. |
|
5624 |
! |
|
5625 |
||
5626 |
pageUp |
|
5627 |
"scroll one page up" |
|
5628 |
|index delta foundItem isVertical| |
|
5629 |
||
5630 |
(self hasScrollerAt:#PREV) ifFalse:[^ self]. |
|
5631 |
||
5632 |
index := self indexOfFirstItemShown. |
|
5633 |
index == 0 ifTrue:[^ self]. |
|
5634 |
||
5635 |
isVertical := self verticalLayout. |
|
5636 |
delta := isVertical ifTrue:[self height] ifFalse:[self width]. |
|
5637 |
delta := delta - 15. "/ bounds |
|
5638 |
||
5639 |
[delta > 0] whileTrue:[ |item| |
|
5640 |
item := items at:index ifAbsent:nil. |
|
5641 |
item isNil ifTrue:[ |
|
5642 |
delta := 0 |
|
5643 |
] ifFalse:[ |
|
5644 |
(item layout notNil and:[item isVisible]) ifTrue:[ |
|
5645 |
isVertical ifTrue:[delta := delta - item layout height] |
|
5646 |
ifFalse:[delta := delta - item layout width]. |
|
5647 |
foundItem := item. |
|
5648 |
] |
|
5649 |
]. |
|
5650 |
index := index - 1. |
|
5651 |
]. |
|
5652 |
self makeItemVisible:foundItem. |
|
5653 |
! |
|
5654 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5655 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5656 |
"returns the one and only scrollActivity - data holder |
2715 | 5657 |
for a menu and all contained submenus" |
5658 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5659 |
superMenu notNil ifTrue:[ |
3938 | 5660 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5661 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5662 |
scrollActivity isNil ifTrue:[ |
3938 | 5663 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5664 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5665 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5666 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5667 |
|
4826 | 5668 |
scrollDown |
5669 |
"scroll one line down" |
|
5670 |
|item index| |
|
5671 |
||
5672 |
(self hasScrollerAt:#NEXT) ifFalse:[^ self]. |
|
5673 |
||
5674 |
index := self indexOfLastItemShown. |
|
5675 |
index > 0 ifTrue:[ |
|
5676 |
item := items |
|
5677 |
detect:[:each| (each layout notNil and:[each isVisible]) ] |
|
5678 |
startingAt:(index + 1) |
|
5679 |
ifNone:nil. |
|
5680 |
]. |
|
5681 |
item notNil ifTrue:[self makeItemVisible:item] |
|
5682 |
ifFalse:[self scrollToBottom]. |
|
5683 |
! |
|
5684 |
||
5685 |
scrollToBottom |
|
5686 |
"scroll to last visible item" |
|
5687 |
|item| |
|
5688 |
||
5689 |
(self hasScrollerAt:#NEXT) ifFalse:[^ self]. |
|
5690 |
||
5691 |
item := items |
|
5692 |
detectLast:[:each| (each layout notNil and:[each isVisible]) ] |
|
5693 |
ifNone:nil. |
|
5694 |
||
5695 |
self makeItemVisible:item. |
|
5696 |
! |
|
5697 |
||
5698 |
scrollToTop |
|
5699 |
"scroll to first visible item" |
|
5700 |
|item| |
|
5701 |
||
5702 |
(self hasScrollerAt:#PREV) ifFalse:[^ self]. |
|
5703 |
||
5704 |
item := items |
|
5705 |
detect:[:each| (each layout notNil and:[each isVisible]) ] |
|
5706 |
ifNone:nil. |
|
5707 |
||
5708 |
self makeItemVisible:item. |
|
5709 |
! |
|
5710 |
||
5711 |
scrollUp |
|
5712 |
"scroll one line up" |
|
5713 |
|item index| |
|
5714 |
||
5715 |
(self hasScrollerAt:#PREV) ifFalse:[^ self]. |
|
5716 |
||
5717 |
index := self indexOfFirstItemShown. |
|
5718 |
index > 1 ifTrue:[ |
|
5719 |
item := items |
|
5720 |
detectLast:[:each| (each layout notNil and:[each isVisible]) ] |
|
5721 |
startingAt:(index - 1) |
|
5722 |
ifNone:nil. |
|
5723 |
]. |
|
5724 |
item notNil ifTrue:[self makeItemVisible:item] |
|
5725 |
ifFalse:[self scrollToTop]. |
|
5726 |
! |
|
5727 |
||
2016 | 5728 |
scrollerBoundsAt:aDirection |
2860 | 5729 |
"returns the bounds of the scroller at a direction" |
2715 | 5730 |
|
4843 | 5731 |
|y x w h| |
5732 |
||
5733 |
x := 0. |
|
5734 |
y := 0. |
|
5735 |
w := 15. |
|
5736 |
h := 15. |
|
2016 | 5737 |
|
5738 |
self verticalLayout ifTrue:[ |
|
4843 | 5739 |
aDirection == #NEXT ifTrue:[ |
5740 |
y := height - h. |
|
5741 |
]. |
|
5742 |
w := width. |
|
2016 | 5743 |
] ifFalse:[ |
4843 | 5744 |
aDirection == #NEXT ifTrue:[ |
5745 |
x := width - w. |
|
5746 |
]. |
|
5747 |
h := height. |
|
2016 | 5748 |
]. |
5749 |
^ Rectangle left:x top:y width:w height:h |
|
5750 |
! |
|
5751 |
||
2046 | 5752 |
scrollerDirectionAtPoint:aPoint |
2715 | 5753 |
"returns the scroller-direction at aPoint, or nil" |
5754 |
||
2046 | 5755 |
self hasScrollers ifTrue:[ |
4843 | 5756 |
#( PREV NEXT ) do:[:aDirection| |
5757 |
|bounds| |
|
5758 |
||
5759 |
(self hasScrollerAt:aDirection) ifTrue:[ |
|
5760 |
bounds := self scrollerBoundsAt:aDirection. |
|
5761 |
||
5762 |
(bounds containsPoint:aPoint) ifTrue:[^ aDirection] |
|
5763 |
] |
|
5764 |
] |
|
2046 | 5765 |
]. |
5766 |
^ nil |
|
5767 |
||
5768 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 5769 |
! ! |
5770 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5771 |
!MenuPanel methodsFor:'private-searching'! |
388 | 5772 |
|
1699 | 5773 |
detectGrabMenu |
2715 | 5774 |
"returns the menu which is responsible for the grap; the last opened menu" |
5775 |
||
1699 | 5776 |
|subMenu| |
5777 |
||
5778 |
selection notNil ifTrue:[ |
|
3938 | 5779 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
5780 |
^ subMenu detectGrabMenu |
|
5781 |
] |
|
1699 | 5782 |
]. |
5783 |
^ self |
|
5784 |
! |
|
5785 |
||
5786 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 5787 |
"returns the menu which contains the grab-point" |
5788 |
||
1699 | 5789 |
|dstMenu dstPoint firstMenu| |
5790 |
||
5791 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
5792 |
||
5793 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
3938 | 5794 |
firstMenu := self. |
1699 | 5795 |
]. |
5796 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5797 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
3938 | 5798 |
^ firstMenu |
1699 | 5799 |
]. |
5800 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 5801 |
^ dstMenu ? firstMenu |
1699 | 5802 |
! |
5803 |
||
1767 | 5804 |
detectViewAtX:x y:y in:aTopView |
2715 | 5805 |
"detect view at x@y" |
5806 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5807 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5808 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5809 |
"/ 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
|
5810 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5811 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5812 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5813 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5814 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5815 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5816 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5817 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5818 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5819 |
"/ 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
|
5820 |
"/ ^ 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
|
5821 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5822 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5823 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5824 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5825 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5826 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5827 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 5828 |
! |
5829 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5830 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5831 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 5832 |
If no item match nil is returned." |
5833 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5834 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5835 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5836 |
stringOrNumberOrPoint isPoint ifTrue:[ |
3938 | 5837 |
^ self itemAtPoint:stringOrNumberOrPoint |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5838 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5839 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5840 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 5841 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5842 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5843 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5844 |
itemAtPoint:aPoint |
2715 | 5845 |
"returns the item at aPoint or nil if none detected" |
5846 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5847 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5848 |
|
1699 | 5849 |
items notNil ifTrue:[ |
3938 | 5850 |
x := aPoint x. |
5851 |
y := aPoint y. |
|
5852 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
|
1699 | 5853 |
]. |
5854 |
^ nil |
|
388 | 5855 |
! |
5856 |
||
2048 | 5857 |
superMenuAtPoint:aPoint |
2715 | 5858 |
"returns the superMenu which contains aPoint, or nil if none detected" |
5859 |
||
1699 | 5860 |
|grabPoint superMenu| |
5861 |
||
2048 | 5862 |
(self containsPoint:aPoint) ifTrue:[ |
3938 | 5863 |
^ self |
1699 | 5864 |
]. |
5865 |
||
2048 | 5866 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 5867 |
superMenu := self. |
5868 |
||
5869 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
3938 | 5870 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
5871 |
^ superMenu |
|
5872 |
] |
|
2715 | 5873 |
]. |
5874 |
^ nil |
|
1699 | 5875 |
|
2048 | 5876 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 5877 |
! ! |
5878 |
||
5879 |
!MenuPanel methodsFor:'queries'! |
|
5880 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5881 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5882 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5883 |
aView notNil ifTrue:[ |
3147 | 5884 |
"/ I am no longer a popUpView |
5885 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5886 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5887 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
5888 |
|
388 | 5889 |
containsPoint:aPoint |
2715 | 5890 |
"returns true if the argument, aPoint is contained by the view" |
5891 |
||
388 | 5892 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
5893 |
! |
|
5894 |
||
5895 |
containsPointX:x y:y |
|
2715 | 5896 |
"returns true if point is contained by the view" |
5897 |
||
708 | 5898 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 5899 |
! |
5900 |
||
390 | 5901 |
hasGroupDividerAt:anIndex |
2715 | 5902 |
"returns true if a divider is defined at an index" |
5903 |
||
388 | 5904 |
|i| |
5905 |
||
5906 |
groupSizes size ~~ 0 ifTrue:[ |
|
3938 | 5907 |
i := 0. |
5908 |
||
5909 |
groupSizes do:[:t| |
|
5910 |
(i := i + t) == anIndex ifTrue:[ |
|
5911 |
^ true |
|
5912 |
] |
|
5913 |
] |
|
2715 | 5914 |
]. |
5915 |
^ false |
|
388 | 5916 |
! |
5917 |
||
390 | 5918 |
hasGroupDividers |
2715 | 5919 |
"returns true if any group divider exists" |
5920 |
||
5921 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 5922 |
! |
5923 |
||
4042
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5924 |
hasPerformed |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5925 |
^ hasPerformed ? false |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5926 |
|
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5927 |
"Created: / 29-06-2011 / 16:24:14 / cg" |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5928 |
! |
c67a4227f0e3
eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents:
4033
diff
changeset
|
5929 |
|
390 | 5930 |
isFitPanel |
4657 | 5931 |
"returns true if the panel is the first in the menu hierarchy |
4384 | 5932 |
and must be fit to the extent of its superView; |
5933 |
Obsolete: NO LONGER SUPPORTED" |
|
2715 | 5934 |
|
1699 | 5935 |
^ false |
390 | 5936 |
! |
5937 |
||
388 | 5938 |
isPopUpView |
5939 |
"return true if view is a popup view; without decoration |
|
2715 | 5940 |
and popUp to top immediately" |
5941 |
||
388 | 5942 |
^ superView isNil |
5943 |
! |
|
5944 |
||
5945 |
isVerticalLayout |
|
2715 | 5946 |
"returns true if vertical layout otherwise false( horizontal layout )" |
5947 |
||
1699 | 5948 |
^ self verticalLayout |
416 | 5949 |
! |
5950 |
||
1793 | 5951 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
5952 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 5953 |
! |
5954 |
||
416 | 5955 |
type |
428 | 5956 |
^ nil. |
416 | 5957 |
|
388 | 5958 |
! ! |
5959 |
||
5960 |
!MenuPanel methodsFor:'selection'! |
|
5961 |
||
5962 |
hasSelection |
|
2715 | 5963 |
"returns true if a selection exists" |
5964 |
||
388 | 5965 |
^ self selection notNil |
5966 |
! |
|
5967 |
||
2199 | 5968 |
openDelayed:anItem |
3187 | 5969 |
self openDelayed:anItem afterSeconds:0.5. |
5970 |
! |
|
5971 |
||
4185 | 5972 |
openDelayed:anItemOrNil afterSeconds:seconds |
4347 | 5973 |
|b| |
2199 | 5974 |
|
2374 | 5975 |
superMenu notNil ifTrue:[ |
4657 | 5976 |
superMenu openDelayed:anItemOrNil afterSeconds:seconds. |
5977 |
^ self |
|
2374 | 5978 |
]. |
4347 | 5979 |
(b := openDelayedMenuBlock notNil) ifTrue:[ |
4657 | 5980 |
openDelayedMenuBlock := nil. |
5981 |
Processor removeTimedBlock:b. |
|
4185 | 5982 |
]. |
5983 |
(anItemOrNil notNil and:[anItemOrNil hasSubmenu]) ifFalse:[ |
|
4657 | 5984 |
openDelayedMenuBlock := nil. |
5985 |
^ self |
|
5986 |
]. |
|
5987 |
||
5988 |
openDelayedMenuBlock := |
|
5989 |
[ |
|
5990 |
openDelayedMenuBlock := nil. |
|
5991 |
anItemOrNil openDelayedSubmenu |
|
5992 |
]. |
|
2253 | 5993 |
|
3187 | 5994 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
4347 | 5995 |
|
5996 |
"Modified: / 29-08-2013 / 09:40:28 / cg" |
|
2199 | 5997 |
! |
5998 |
||
3975 | 5999 |
selectAndOpenDelayed:anItemOrNil |
6000 |
"change selection to an item or nil" |
|
6001 |
||
4347 | 6002 |
|helpListener oldSelect delayedOpenSeconds b| |
3975 | 6003 |
|
6004 |
anItemOrNil == selection ifTrue:[ ^ self ]. |
|
4193 | 6005 |
"/ self openDelayed:nil. |
3975 | 6006 |
|
4455 | 6007 |
(b := closeDelayedMenuBlock notNil) ifTrue:[ |
4657 | 6008 |
closeDelayedMenuBlock := nil. |
6009 |
Processor removeTimedBlock:b. |
|
4455 | 6010 |
]. |
4347 | 6011 |
(b := openDelayedMenuBlock notNil) ifTrue:[ |
4657 | 6012 |
openDelayedMenuBlock := nil. |
6013 |
Processor removeTimedBlock:b. |
|
4347 | 6014 |
]. |
6015 |
||
6016 |
delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu. |
|
4617 | 6017 |
"/ self verticalLayout ifFalse:[ delayedOpenSeconds := 0.1 ]. |
4347 | 6018 |
|
3975 | 6019 |
oldSelect := selection. |
6020 |
selection := nil. |
|
6021 |
||
4657 | 6022 |
"/ redraw current selection cleared |
3975 | 6023 |
oldSelect notNil ifTrue:[ |
4657 | 6024 |
|oldSubmenu| |
6025 |
||
6026 |
oldSubmenu := oldSelect visibleSubmenu. |
|
6027 |
oldSubmenu notNil ifTrue:[ |
|
6028 |
"/ if the new item has a submenu, any current submenu will be closed, when that |
|
6029 |
"/ one eventuall opens. However, if it is a simple item, |
|
6030 |
"/ it would remain open. So schedule a delayed close action for it. |
|
6031 |
closeDelayedMenuBlock := |
|
6032 |
[ |
|
6033 |
"/ but only if we have not reentered the item with the submenu we want to close |
|
6034 |
selection ~~ oldSelect ifTrue:[ |
|
6035 |
(oldSelect hasSubmenu |
|
6036 |
and:[ oldSelect visibleSubmenu notNil ]) ifTrue:[ |
|
6037 |
oldSelect hideSubmenu. |
|
6038 |
]. |
|
6039 |
]. |
|
6040 |
]. |
|
6041 |
Processor addTimedBlock:closeDelayedMenuBlock afterSeconds:delayedOpenSeconds. |
|
4455 | 6042 |
"/ mhmh - seems to not only not needed, but actually hurting (leftover menus) |
6043 |
"/ Processor addTimedBlock:[ |
|
6044 |
"/ selection ~~ anItemOrNil ifTrue:[ |
|
6045 |
"/ "cancels the current delayed operation" |
|
6046 |
"/ oldSelect hideSubmenu. |
|
6047 |
"/ |
|
6048 |
"/ ( selection notNil |
|
6049 |
"/ and:[selection hasSubmenu |
|
6050 |
"/ and:[selection visibleSubmenu isNil]] |
|
6051 |
"/ ) ifTrue:[ |
|
6052 |
"/ "setup new delayed operation.." |
|
6053 |
"/ self openDelayed:selection afterSeconds:delayedOpenSeconds "0.1" |
|
6054 |
"/ ]. |
|
6055 |
"/ ]. |
|
6056 |
"/ ] afterSeconds:delayedOpenSeconds. |
|
4657 | 6057 |
]. |
6058 |
oldSelect invalidate. |
|
3975 | 6059 |
]. |
6060 |
||
6061 |
anItemOrNil notNil ifTrue:[ |
|
4657 | 6062 |
self makeItemVisible:anItemOrNil. |
6063 |
anItemOrNil canSelect ifTrue:[ |
|
6064 |
selection := anItemOrNil |
|
6065 |
]. |
|
3975 | 6066 |
]. |
6067 |
selection isNil ifTrue:[^ self]. |
|
6068 |
||
6069 |
ActiveHelp isActive ifTrue:[ |
|
4657 | 6070 |
helpListener := ActiveHelp currentHelpListener. |
6071 |
helpListener initiateHelpFor:self at:nil now:true. |
|
3975 | 6072 |
]. |
4193 | 6073 |
|
3975 | 6074 |
shown ifTrue:[ |
4657 | 6075 |
"/ self rearrangeItems. |
6076 |
selection invalidate. |
|
6077 |
selection hasSubmenu ifTrue:[ |
|
6078 |
"/ cg: disabled: prevents delayed menu when moving over a separator item |
|
6079 |
false "(oldSelect isNil or:[oldSelect visibleSubmenu isNil])" ifTrue:[ |
|
6080 |
self openDelayed:selection afterSeconds:0. |
|
6081 |
] ifFalse:[ |
|
6082 |
self openDelayed:selection afterSeconds:delayedOpenSeconds. |
|
6083 |
] |
|
6084 |
]. |
|
3975 | 6085 |
]. |
4347 | 6086 |
|
6087 |
"Modified: / 29-08-2013 / 09:44:06 / cg" |
|
3975 | 6088 |
! |
6089 |
||
388 | 6090 |
selection |
2715 | 6091 |
"returns current selected item or nil" |
6092 |
||
388 | 6093 |
^ selection |
6094 |
! |
|
6095 |
||
6096 |
selection:anItemOrNil |
|
2016 | 6097 |
"change selection to an item or nil |
2715 | 6098 |
if the item has a submenu the first item might be selected (style-sheet)" |
6099 |
||
2249 | 6100 |
|openMenu openOnSelect submenu item| |
6101 |
||
6102 |
selection == anItemOrNil ifTrue:[^ self]. |
|
6103 |
||
6104 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
3938 | 6105 |
self selection:anItemOrNil openMenu:false. |
6106 |
^ self |
|
2249 | 6107 |
]. |
6108 |
||
6109 |
openMenu := self isPopUpView not. |
|
6110 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
6111 |
||
6112 |
openMenu ifFalse:[ |
|
3938 | 6113 |
openMenu := openOnSelect. |
2249 | 6114 |
]. |
6115 |
self selection:anItemOrNil openMenu:openMenu. |
|
6116 |
||
6117 |
openOnSelect ifFalse:[ |
|
3938 | 6118 |
"/ select first item in submenu |
6119 |
||
6120 |
submenu := anItemOrNil currentSubmenu. |
|
6121 |
||
6122 |
submenu notNil ifTrue:[ |
|
6123 |
item := submenu itemAt:1. |
|
6124 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
|
6125 |
submenu selection:item openMenu:false |
|
6126 |
] |
|
6127 |
]. |
|
2249 | 6128 |
]. |
6129 |
! |
|
6130 |
||
6131 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 6132 |
"change selection to an item or nil" |
6133 |
||
2251 | 6134 |
|helpListener oldSelect| |
2249 | 6135 |
|
6136 |
anItemOrNil == selection ifTrue:[ |
|
4657 | 6137 |
^ self |
2016 | 6138 |
]. |
2199 | 6139 |
self openDelayed:nil. |
388 | 6140 |
|
2251 | 6141 |
oldSelect := selection. |
6142 |
selection := nil. |
|
2249 | 6143 |
|
2374 | 6144 |
anItemOrNil notNil ifTrue:[ |
4657 | 6145 |
self makeItemVisible:anItemOrNil. |
6146 |
anItemOrNil canSelect ifTrue:[ |
|
6147 |
selection := anItemOrNil |
|
6148 |
] ifFalse:[ |
|
6149 |
oldSelect isNil ifTrue:[^ self]. |
|
6150 |
]. |
|
2249 | 6151 |
]. |
2374 | 6152 |
oldSelect notNil ifTrue:[ |
4657 | 6153 |
"/ clear current selection |
6154 |
oldSelect isSelected:false. |
|
4631 | 6155 |
]. |
6156 |
selection isNil ifTrue:[ |
|
4657 | 6157 |
^ self |
4631 | 6158 |
]. |
2251 | 6159 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
6160 |
"/ selection == enteredItem ifTrue:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
6161 |
"/ enteredItem := nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
6162 |
"/ ] ifFalse:[ |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
6163 |
"/ self pointerEntersItem:nil |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
6164 |
"/ ]. |
2016 | 6165 |
ActiveHelp isActive ifTrue:[ |
4657 | 6166 |
helpListener := ActiveHelp currentHelpListener. |
6167 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 6168 |
]. |
6169 |
shown ifTrue:[ |
|
4657 | 6170 |
"/ self rearrangeItems. |
6171 |
||
6172 |
openMenu ifFalse:[ |
|
6173 |
selection invalidate. |
|
6174 |
] |
|
2249 | 6175 |
]. |
6176 |
openMenu ifTrue:[ |
|
4657 | 6177 |
selection isSelected:true. |
2249 | 6178 |
]. |
388 | 6179 |
! |
6180 |
||
6181 |
selectionIndex |
|
2715 | 6182 |
"returns index of current selection or 0" |
6183 |
||
388 | 6184 |
|item| |
6185 |
||
6186 |
(item := self selection) notNil ifTrue:[ |
|
3938 | 6187 |
^ self findFirst:[:el| el == item ] |
388 | 6188 |
]. |
6189 |
^ 0 |
|
6190 |
! |
|
6191 |
||
6192 |
selectionIndex:anIndex |
|
2715 | 6193 |
"set selection at an index" |
6194 |
||
388 | 6195 |
self selection:(self itemAt:anIndex) |
6196 |
! ! |
|
6197 |
||
1791 | 6198 |
!MenuPanel methodsFor:'translation'! |
6199 |
||
6200 |
translateGrabPoint:aGrabPoint |
|
2715 | 6201 |
"translate the grab point into self" |
6202 |
||
1791 | 6203 |
superMenu isNil ifTrue:[ |
3938 | 6204 |
"I am the grabView" |
6205 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
6206 |
^ aGrabPoint |
|
1791 | 6207 |
]. |
6208 |
||
6209 |
relativeGrabOrigin isNil ifTrue:[ |
|
3938 | 6210 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
6211 |
relativeGrabOrigin isNil ifTrue:[ |
|
6212 |
"I am the grabView" |
|
6213 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
6214 |
^ aGrabPoint |
|
6215 |
]. |
|
1791 | 6216 |
]. |
6217 |
^ relativeGrabOrigin + aGrabPoint |
|
6218 |
! |
|
6219 |
||
6220 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 6221 |
"translate a point into another menu its point" |
6222 |
||
1791 | 6223 |
|grapPoint| |
6224 |
||
6225 |
aMenu == self ifTrue:[ |
|
3938 | 6226 |
^ aPoint |
1791 | 6227 |
]. |
6228 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
6229 |
||
2715 | 6230 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 6231 |
! |
6232 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
6233 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 6234 |
"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
|
6235 |
|
5001 | 6236 |
^ device |
6237 |
translatePoint:aPoint asPoint |
|
6238 |
fromView:self |
|
6239 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
6240 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
6241 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 6242 |
! ! |
6243 |
||
388 | 6244 |
!MenuPanel::Item class methodsFor:'accessing'! |
6245 |
||
689 | 6246 |
horizontalInset |
6247 |
^ HorizontalInset |
|
6248 |
! |
|
6249 |
||
388 | 6250 |
labelRightOffset |
6251 |
^ LabelRightOffset |
|
6252 |
! |
|
6253 |
||
689 | 6254 |
verticalInset |
6255 |
^ VerticalInset |
|
1765 | 6256 |
! |
6257 |
||
6258 |
verticalPopUpInset |
|
6259 |
^ VerticalPopUpInset |
|
388 | 6260 |
! ! |
6261 |
||
616 | 6262 |
!MenuPanel::Item class methodsFor:'defaults'! |
6263 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6264 |
halfSeparatorSize |
2870 | 6265 |
"returns the size of a space-separator" |
6266 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6267 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6268 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6269 |
|
1699 | 6270 |
separatorSize |
2870 | 6271 |
"returns the size of a separator" |
6272 |
||
1699 | 6273 |
^ 10 |
616 | 6274 |
! |
6275 |
||
6276 |
updateStyleCache |
|
2777 | 6277 |
"extract values from the styleSheet and cache them in class variables" |
6278 |
||
1765 | 6279 |
<resource: #style (#'menuPanel.verticalInset')> |
6280 |
||
1699 | 6281 |
HorizontalInset := 2. |
1765 | 6282 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
6283 |
VerticalPopUpInset := 2. |
|
727 | 6284 |
|
6285 |
HorizontalButtonInset := 3. |
|
6286 |
VerticalButtonInset := 3. |
|
6287 |
||
681 | 6288 |
LabelRightOffset := 15. |
1765 | 6289 |
|
2777 | 6290 |
" |
6291 |
self updateStyleCache |
|
6292 |
" |
|
1124 | 6293 |
! ! |
1078 | 6294 |
|
388 | 6295 |
!MenuPanel::Item class methodsFor:'instance creation'! |
6296 |
||
6297 |
in:aSuperMenu |
|
6298 |
^ self in:aSuperMenu label:nil |
|
6299 |
! |
|
6300 |
||
6301 |
in:aSuperMenu label:aLabel |
|
6302 |
|item| |
|
6303 |
||
6304 |
item := self new in:aSuperMenu. |
|
6305 |
item label:aLabel. |
|
2870 | 6306 |
^ item |
388 | 6307 |
! |
6308 |
||
6309 |
in:aSuperMenu menuItem:aMenuItem |
|
6310 |
|item| |
|
6311 |
||
6312 |
item := self in:aSuperMenu. |
|
6313 |
item menuItem:aMenuItem. |
|
2870 | 6314 |
^ item. |
2359 | 6315 |
! |
6316 |
||
6317 |
new |
|
6318 |
^ self basicNew initialize |
|
388 | 6319 |
! ! |
6320 |
||
1808 | 6321 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 6322 |
|
420 | 6323 |
canAccept |
2870 | 6324 |
"returns true if item is acceptable" |
6325 |
||
2199 | 6326 |
self enabled ifFalse:[ ^ false]. |
6327 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
6328 |
||
6329 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
3558 | 6330 |
^ subMenu isNil or:[subMenu shown not] |
524 | 6331 |
! |
6332 |
||
6333 |
toggleIndication |
|
2870 | 6334 |
"toggle indication or choice" |
6335 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6336 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6337 |
|
3938 | 6338 |
indication notNil ifTrue:[ |
4657 | 6339 |
arg := self indicationValue not. |
6340 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6341 |
] ifFalse:[ |
4657 | 6342 |
(choice notNil and:[choice isValueModel])ifTrue:[ |
6343 |
choice value:(menuItem choiceValue). |
|
6344 |
^ true |
|
6345 |
]. |
|
524 | 6346 |
]. |
6347 |
^ arg |
|
389 | 6348 |
! ! |
6349 |
||
388 | 6350 |
!MenuPanel::Item methodsFor:'accessing'! |
6351 |
||
6352 |
accessCharacter |
|
2870 | 6353 |
"returns my accessCharacter or nil" |
6354 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6355 |
^ accessCharacter |
388 | 6356 |
! |
6357 |
||
6358 |
accessCharacterPosition |
|
2870 | 6359 |
"get the access character position or nil" |
6360 |
||
2359 | 6361 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6362 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6363 |
|
3938 | 6364 |
accessCharacterPosition:anIndex |
2870 | 6365 |
"set the access character position or nil" |
6366 |
||
2359 | 6367 |
menuItem accessCharacterPosition:anIndex. |
388 | 6368 |
! |
6369 |
||
6370 |
argument |
|
2870 | 6371 |
"gets the argument" |
6372 |
||
2359 | 6373 |
^ menuItem argument |
388 | 6374 |
! |
6375 |
||
6376 |
argument:anArgument |
|
2870 | 6377 |
"sets the argument" |
6378 |
||
2359 | 6379 |
menuItem argument:anArgument. |
389 | 6380 |
! |
6381 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6382 |
displayLabel |
2870 | 6383 |
"returns my printable Label" |
6384 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6385 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6386 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6387 |
|
2614 | 6388 |
displayLabelExtent |
2870 | 6389 |
"returns the labels extent" |
6390 |
||
3837 | 6391 |
|myFont prevFont w h| |
2614 | 6392 |
|
6393 |
displayLabelExtent notNil ifTrue:[ |
|
3938 | 6394 |
^ displayLabelExtent |
2614 | 6395 |
]. |
6396 |
||
6397 |
displayLabel isNil ifTrue:[ |
|
3938 | 6398 |
displayLabelExtent := 0@0. |
6399 |
^ displayLabelExtent |
|
2614 | 6400 |
]. |
3837 | 6401 |
|
6402 |
myFont := self font. |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
6403 |
myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ]. |
3837 | 6404 |
myFont := myFont onDevice:menuPanel device. |
6405 |
||
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6406 |
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
|
6407 |
|
3837 | 6408 |
displayLabel isString ifTrue:[ |
3938 | 6409 |
w := displayLabel widthOn:menuPanel. |
6410 |
h := displayLabel heightOn:menuPanel. |
|
6411 |
"/ 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
|
6412 |
"/ h := myFont heightOf:displayLabel. |
3938 | 6413 |
] ifFalse:[ |
6414 |
displayLabel isArray ifTrue:[ |
|
6415 |
w := h := 0. |
|
6416 |
||
6417 |
displayLabel do:[:aSubLabel| |
|
6418 |
aSubLabel notNil ifTrue:[ |
|
6419 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
6420 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
6421 |
] ifFalse:[ |
|
6422 |
h := h + (self spaceBetweenEmptyLines) |
|
6423 |
] |
|
6424 |
] |
|
6425 |
] ifFalse:[ |
|
6426 |
w := displayLabel widthOn:menuPanel. |
|
6427 |
h := displayLabel heightOn:menuPanel. |
|
6428 |
]. |
|
3845
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6429 |
]. |
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6430 |
|
81fa525dcfa7
fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents:
3837
diff
changeset
|
6431 |
menuPanel setFont:prevFont. "/ restore previous font |
3837 | 6432 |
|
2614 | 6433 |
"/ care for italic fonts - give a few more pixels at the end |
3837 | 6434 |
myFont italic ifTrue:[ |
3938 | 6435 |
w := w + 2. |
2614 | 6436 |
]. |
6437 |
displayLabelExtent := w@h. |
|
6438 |
^ displayLabelExtent |
|
3928
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
6439 |
|
d175aca884ce
fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
6440 |
"Modified: / 17-08-2010 / 10:46:06 / cg" |
2614 | 6441 |
! |
6442 |
||
1727 | 6443 |
font |
2870 | 6444 |
"returns the user configured font or nil (default menu font)" |
6445 |
||
2373 | 6446 |
|font| |
6447 |
||
6448 |
menuPanel isNil ifTrue:[^ nil]. |
|
6449 |
||
6450 |
font := menuItem font. |
|
6451 |
||
6452 |
font notNil ifTrue:[ |
|
3938 | 6453 |
font := font onDevice:(menuPanel device). |
6454 |
menuItem font:font. |
|
2373 | 6455 |
]. |
1727 | 6456 |
^ font |
6457 |
! |
|
6458 |
||
6459 |
font:aFont |
|
2870 | 6460 |
"returns the user configured font or nil (default menu font)" |
6461 |
||
2373 | 6462 |
menuItem font:aFont. |
1727 | 6463 |
! |
6464 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6465 |
ignoreMnemonicKeys |
4076 | 6466 |
"if true, mnemonic (access character) in the submenus under the item are ignored. |
6467 |
Set this to speedup accelerator key processing for slow dynamci menus" |
|
2870 | 6468 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6469 |
^ menuItem ignoreMnemonicKeys |
4076 | 6470 |
|
6471 |
"Modified (comment): / 08-09-2011 / 04:29:47 / cg" |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6472 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6473 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6474 |
ignoreMnemonicKeys:aBoolean |
2870 | 6475 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
6476 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6477 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6478 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6479 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6480 |
ignoreShortcutKeys |
2870 | 6481 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
6482 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6483 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6484 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6485 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6486 |
ignoreShortcutKeys:aBoolean |
2870 | 6487 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
6488 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6489 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6490 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
6491 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6492 |
itemValue |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6493 |
"gets the item's value" |
2870 | 6494 |
|
2360 | 6495 |
^ menuItem itemValue |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6496 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6497 |
"Modified (comment): / 06-03-2012 / 14:41:27 / cg" |
2360 | 6498 |
! |
6499 |
||
6500 |
itemValue:aValue |
|
2870 | 6501 |
"argument could be a value holder, an action or selector" |
6502 |
||
2360 | 6503 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6504 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6505 |
|
388 | 6506 |
label |
2870 | 6507 |
"returns the label" |
6508 |
||
388 | 6509 |
^ label |
6510 |
! |
|
6511 |
||
6512 |
label:aLabel |
|
399 | 6513 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 6514 |
handle characters $& (ST-80 compatibility)" |
6515 |
||
2614 | 6516 |
|size char oldExtent| |
6517 |
||
6518 |
oldExtent := displayLabelExtent. |
|
6519 |
displayLabelExtent := nil. "/ force a recomputation |
|
6520 |
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
|
6521 |
|
baefcb629718
Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents:
3447
diff
changeset
|
6522 |
"Stefan: Why do we use #value two times??" |
2614 | 6523 |
label := aLabel value. |
6524 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6525 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6526 |
displayLabel isString ifTrue:[ |
4657 | 6527 |
"CHECK FOR SEPARATOR" |
6528 |
||
6529 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
|
6530 |
size := displayLabel size. |
|
6531 |
||
6532 |
size == 0 ifTrue:[ |
|
6533 |
displayLabel := nil. "blank separator" |
|
6534 |
^ self |
|
6535 |
]. |
|
6536 |
||
6537 |
size == 1 ifTrue:[ |
|
6538 |
char := displayLabel first. |
|
6539 |
||
6540 |
(char == $- or:[char == $=]) ifTrue:[ |
|
6541 |
label := displayLabel. "line separator" |
|
6542 |
displayLabel := nil. |
|
6543 |
^ self |
|
6544 |
] |
|
6545 |
] |
|
6546 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6547 |
] ifFalse:[ |
4657 | 6548 |
displayLabel isCollection ifTrue:[ |
6549 |
displayLabel := displayLabel asArray. |
|
6550 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6551 |
]. |
4218 | 6552 |
menuPanel notNil ifTrue:[ |
4657 | 6553 |
menuPanel doAccessCharacterTranslation ifTrue:[ |
6554 |
displayLabel notNil ifTrue:[ |
|
6555 |
displayLabel isArray ifTrue:[ |
|
6556 |
displayLabel keysAndValuesDo:[:i :el| |
|
6557 |
el notNil ifTrue:[ |
|
6558 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
6559 |
]. |
|
6560 |
]. |
|
6561 |
] ifFalse:[ |
|
6562 |
displayLabel isImageOrForm ifFalse:[ |
|
6563 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
6564 |
]. |
|
6565 |
]. |
|
6566 |
]. |
|
6567 |
]. |
|
6568 |
||
6569 |
menuPanel shown ifTrue:[ |
|
6570 |
self fetchImages. |
|
6571 |
||
6572 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
6573 |
self invalidate |
|
6574 |
] ifFalse:[ |
|
6575 |
menuPanel mustRearrange |
|
6576 |
] |
|
6577 |
]. |
|
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6578 |
]. |
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6579 |
|
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
6580 |
"Modified: / 06-10-2011 / 16:36:53 / cg" |
388 | 6581 |
! |
6582 |
||
6583 |
menuPanel |
|
2870 | 6584 |
"returns my menuPanel" |
6585 |
||
399 | 6586 |
^ menuPanel |
388 | 6587 |
! |
6588 |
||
6589 |
nameKey |
|
2870 | 6590 |
"gets the nameKey" |
6591 |
||
2359 | 6592 |
^ menuItem nameKey |
388 | 6593 |
! |
6594 |
||
6595 |
nameKey:aNameKey |
|
2870 | 6596 |
"sets the nameKey" |
6597 |
||
2359 | 6598 |
menuItem nameKey:aNameKey. |
388 | 6599 |
! |
6600 |
||
6601 |
rawLabel |
|
2870 | 6602 |
"returns my raw, unprocessed label" |
6603 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6604 |
^ menuItem rawLabel |
388 | 6605 |
! |
6606 |
||
6607 |
shortcutKey |
|
6608 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 6609 |
no submenu exists evaluate the action assigned to the item (accept)." |
6610 |
||
2359 | 6611 |
^ menuItem shortcutKey |
388 | 6612 |
! |
6613 |
||
6614 |
shortcutKey:aKey |
|
6615 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 6616 |
no submenu exists evaluate the action assigned to the item (accept)." |
6617 |
||
2359 | 6618 |
menuItem shortcutKey ~= aKey ifTrue:[ |
3938 | 6619 |
menuItem shortcutKey:aKey. |
6620 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6621 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
6622 |
! |
388 | 6623 |
|
710 | 6624 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6625 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6626 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6627 |
|
2359 | 6628 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6629 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6630 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 6631 |
! |
6632 |
||
6633 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6634 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6635 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 6636 |
|
2359 | 6637 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6638 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
6639 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 6640 |
! |
6641 |
||
388 | 6642 |
submenu |
3133 | 6643 |
"returns my submenu or creates it if its defined via a selector or channel. |
6644 |
May return nil, if there is really no menu" |
|
6645 |
||
6646 |
subMenu isNil ifTrue:[ |
|
3938 | 6647 |
self setupSubmenu |
3133 | 6648 |
]. |
6649 |
^ subMenu |
|
6650 |
||
6651 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 6652 |
! |
6653 |
||
6654 |
submenu:aSubMenu |
|
3938 | 6655 |
"set a new submenu; an existing submenu will be destroyed. |
2870 | 6656 |
This might lead to a redraw if 'hasSubmenu' changed" |
6657 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6658 |
|widget| |
1767 | 6659 |
|
4196
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6660 |
subMenu notNil ifTrue:[ |
4657 | 6661 |
subMenu ~~ aSubMenu ifTrue:[ |
6662 |
subMenu destroy. |
|
6663 |
subMenu := nil. |
|
6664 |
]. |
|
4196
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6665 |
]. |
fa01dec84e31
class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents:
4193
diff
changeset
|
6666 |
|
1767 | 6667 |
aSubMenu isNil ifTrue:[ |
4657 | 6668 |
subMenu notNil ifTrue:[ |
6669 |
subMenu destroy. |
|
6670 |
subMenu := nil. |
|
6671 |
]. |
|
6672 |
^ self |
|
1767 | 6673 |
]. |
6674 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6675 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
4657 | 6676 |
subMenu := MenuPanel new. |
6677 |
||
6678 |
menuPanel notNil ifTrue:[ |
|
6679 |
subMenu receiver:menuPanel receiver. |
|
6680 |
]. |
|
6681 |
subMenu superMenu:menuPanel. |
|
6682 |
||
6683 |
menuItem horizontalLayout == true ifTrue:[ |
|
6684 |
subMenu verticalLayout:false |
|
6685 |
]. |
|
6686 |
subMenu menu:aSubMenu. |
|
1767 | 6687 |
] ifFalse:[ |
4657 | 6688 |
aSubMenu isView ifFalse:[ |
6689 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
6690 |
"/ ... mhhhh .... |
|
6691 |
^ menuItem submenuChannel:aSubMenu |
|
6692 |
]. |
|
6693 |
widget := SimpleView new. |
|
6694 |
widget client:aSubMenu. |
|
6695 |
] ifTrue:[ |
|
6696 |
widget := aSubMenu. |
|
6697 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
6698 |
]. |
|
6699 |
||
6700 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
6701 |
subMenu := widget. |
|
6702 |
||
6703 |
menuItem horizontalLayout == true ifTrue:[ |
|
6704 |
subMenu verticalLayout:false |
|
6705 |
]. |
|
6706 |
] ifFalse:[ |
|
6707 |
subMenu := MenuPanel new. |
|
6708 |
subMenu receiver:menuPanel receiver. |
|
6709 |
subMenu addSubView:widget. |
|
6710 |
subMenu extent:(widget preferredExtent). |
|
6711 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
6712 |
]. |
|
6713 |
subMenu superMenu:menuPanel. |
|
2360 | 6714 |
]. |
389 | 6715 |
! |
6716 |
||
3133 | 6717 |
submenuOrNil |
6718 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
6719 |
||
6720 |
^ subMenu |
|
6721 |
||
6722 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
6723 |
! |
|
6724 |
||
390 | 6725 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6726 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6727 |
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
|
6728 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6729 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6730 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6731 |
displayLabel notNil ifTrue:[ |
3938 | 6732 |
displayLabel isArray ifFalse:[ |
6733 |
^ displayLabel perform:#string ifNotUnderstood:nil |
|
6734 |
]. |
|
6735 |
||
6736 |
displayLabel do:[:el| |
|
6737 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
|
6738 |
^ txt |
|
6739 |
] |
|
6740 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6741 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6742 |
^ nil |
390 | 6743 |
! |
6744 |
||
1841 | 6745 |
triggerOnDown |
2870 | 6746 |
"return true if triggering the action if pressed" |
6747 |
||
2359 | 6748 |
menuItem triggerOnDown ifTrue:[ |
3938 | 6749 |
self hasSubmenu ifFalse:[^ true]. |
1841 | 6750 |
]. |
6751 |
^ false |
|
6752 |
! |
|
6753 |
||
6754 |
triggerOnDown:aBool |
|
2870 | 6755 |
"setup to trigger the action if pressed" |
6756 |
||
2359 | 6757 |
menuItem triggerOnDown:aBool. |
1841 | 6758 |
! |
6759 |
||
389 | 6760 |
value |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6761 |
"gets the item's value |
2870 | 6762 |
Left here for ST80 compatibility - value is a bad name" |
6763 |
||
2360 | 6764 |
^ menuItem itemValue |
4112
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6765 |
|
df82e28ca882
changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents:
4110
diff
changeset
|
6766 |
"Modified (comment): / 06-03-2012 / 14:41:23 / cg" |
2360 | 6767 |
! |
6768 |
||
6769 |
value:aValue |
|
389 | 6770 |
"could be a value holder, an action or selector |
2870 | 6771 |
Left here for ST80 compatibility - value: is a bad name" |
6772 |
||
2360 | 6773 |
menuItem itemValue:aValue. |
502 | 6774 |
! |
6775 |
||
6776 |
value:aValue argument:anArgument |
|
2870 | 6777 |
"set the value and an argument" |
6778 |
||
2360 | 6779 |
menuItem itemValue:aValue. |
6780 |
menuItem argument:anArgument. |
|
388 | 6781 |
! ! |
6782 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6783 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 6784 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6785 |
choice |
2870 | 6786 |
"implements a radio group; the field" |
6787 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6788 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6789 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6790 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6791 |
choice:something |
2870 | 6792 |
"set choice indication" |
6793 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6794 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6795 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6796 |
choice isValueModel ifTrue:[ |
4657 | 6797 |
choice removeDependent:self |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6798 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6799 |
|
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6800 |
choice := something. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6801 |
choice notNil ifTrue:[ |
4657 | 6802 |
choice isSymbol ifTrue:[ |
6803 |
choice := (self aspectAt:choice) ? choice. |
|
6804 |
]. |
|
6805 |
choice isValueModel ifTrue:[ |
|
6806 |
choice addDependent:self |
|
6807 |
] |
|
1699 | 6808 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6809 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6810 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6811 |
choiceValue |
2870 | 6812 |
"implements a radio group; the value writen to the choice if selected" |
6813 |
||
2359 | 6814 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6815 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6816 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6817 |
choiceValue:something |
2870 | 6818 |
"implements a radio group; the value writen to the choice if selected" |
6819 |
||
2359 | 6820 |
menuItem choiceValue ~= something ifTrue:[ |
3938 | 6821 |
menuItem choiceValue:something. |
6822 |
choice notNil ifTrue:[ self invalidate ]. |
|
2359 | 6823 |
]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6824 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6825 |
|
388 | 6826 |
enabled |
2870 | 6827 |
"returns the enabled state" |
6828 |
||
524 | 6829 |
|state| |
6830 |
||
4756 | 6831 |
menuPanel isNil ifTrue:[ ^ false]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6832 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6833 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6834 |
enableChannel isSymbol ifTrue:[ |
4756 | 6835 |
state := self aspectAt:enableChannel. |
6836 |
state isValueModel ifTrue:[ |
|
6837 |
enableChannel := state. |
|
6838 |
enableChannel addDependent:self. |
|
6839 |
]. |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6840 |
] ifFalse:[ |
4756 | 6841 |
state := enableChannel. |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6842 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
6843 |
^ state value ~~ false |
388 | 6844 |
! |
6845 |
||
389 | 6846 |
enabled:something |
2870 | 6847 |
"change the enabled state; if the state changed, a redraw is performed" |
6848 |
||
390 | 6849 |
|oldState newState| |
6850 |
||
6851 |
enableChannel isNil ifTrue:[ |
|
3938 | 6852 |
oldState := true |
390 | 6853 |
] ifFalse:[ |
3938 | 6854 |
oldState := enableChannel value. |
6855 |
enableChannel isValueModel ifTrue:[ |
|
6856 |
enableChannel removeDependent:self |
|
6857 |
] |
|
388 | 6858 |
]. |
390 | 6859 |
enableChannel := something. |
6860 |
||
6861 |
enableChannel isNil ifTrue:[ |
|
3938 | 6862 |
menuPanel shown ifFalse:[^ self]. |
6863 |
newState := true |
|
390 | 6864 |
] ifFalse:[ |
3938 | 6865 |
enableChannel isValueModel ifTrue:[ |
6866 |
enableChannel addDependent:self |
|
6867 |
] ifFalse:[ |
|
6868 |
enableChannel isSymbol ifTrue:[^ self] |
|
6869 |
]. |
|
6870 |
menuPanel shown ifFalse:[^ self]. |
|
6871 |
newState := enableChannel value. |
|
390 | 6872 |
]. |
6873 |
||
6874 |
newState ~~ oldState ifTrue:[ |
|
3938 | 6875 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6876 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6877 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6878 |
|
1670 | 6879 |
hideMenuOnActivated |
2870 | 6880 |
"hide the menu when the item was activated; the default is true" |
6881 |
||
2359 | 6882 |
^ menuItem hideMenuOnActivated |
1670 | 6883 |
! |
6884 |
||
6885 |
hideMenuOnActivated:aBool |
|
2870 | 6886 |
"hide the menu when the item was activated; the default is true" |
6887 |
||
2359 | 6888 |
menuItem hideMenuOnActivated:aBool. |
1670 | 6889 |
! |
6890 |
||
2216 | 6891 |
ifNotInUIBuilderInfoPrintCR:aMessage |
6892 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
6893 |
||
3732 | 6894 |
|app| |
6895 |
||
6896 |
app := menuPanel application. |
|
6897 |
||
5024
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6898 |
"/ JV@2016-04-15: Fix for https://swing.fit.cvut.cz/projects/stx-jv/ticket/78 |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6899 |
"/ The isKinfOf: below is a super ugly, whip me hard, |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6900 |
"/ but a correct fix, i.e., adding isUIPainter to UISelectionPanel |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6901 |
"/ would require to fork stx:libtool2 which I'd like to avoid for now. |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6902 |
"/ If more fixes would go to stx:libtool2 then I will fork, and |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6903 |
"/ remove this code. |
2216 | 6904 |
(menuPanel receiver isNil |
3732 | 6905 |
and:[ app notNil |
5024
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6906 |
and:[ (app askFor:#isUIPainter) or:[app isKindOf: (Smalltalk at:#UISelectionPanel)]]]) |
2216 | 6907 |
ifTrue:[ |
5024
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
6908 |
^ self "/ suppressed |
3414
b0fb84e3e809
more info about missing channel
Claus Gittinger <cg@exept.de>
parents:
3411
diff
changeset
|
6909 |
]. |
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
6910 |
Logger info: aMessage |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
6911 |
|
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
6912 |
"Modified: / 15-04-2016 / 18:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2216 | 6913 |
! |
6914 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6915 |
indication |
2870 | 6916 |
"get on/off indication" |
6917 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6918 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6919 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6920 |
|
4226 | 6921 |
indication:aValueHolder |
2870 | 6922 |
"set on/off indication" |
6923 |
||
4226 | 6924 |
indication == aValueHolder ifTrue:[^ self]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6925 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6926 |
indication isValueModel ifTrue:[ |
4657 | 6927 |
indication removeDependent:self |
4226 | 6928 |
]. |
6929 |
||
6930 |
(indication := aValueHolder) notNil ifTrue:[ |
|
4657 | 6931 |
indication isValueModel ifTrue:[ |
6932 |
indication addDependent:self |
|
6933 |
] ifFalse:[ |
|
6934 |
"/ to force an update of the value |
|
6935 |
self indicationValue |
|
6936 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6937 |
]. |
464 | 6938 |
! |
6939 |
||
1767 | 6940 |
keepLinkedMenu |
2870 | 6941 |
"get the keepLinkedMenu flag" |
6942 |
||
2359 | 6943 |
^ menuItem keepLinkedMenu |
6944 |
! |
|
6945 |
||
6946 |
keepLinkedMenu:aBool |
|
2870 | 6947 |
"get the keepLinkedMenu flag" |
6948 |
||
2359 | 6949 |
menuItem keepLinkedMenu:aBool. |
1767 | 6950 |
! |
6951 |
||
2331 | 6952 |
sendToOriginator |
6953 |
"if true, the message is sent to the originating widget; |
|
6954 |
otherwise (the default), it it sent to the receiver/application." |
|
6955 |
||
2359 | 6956 |
^ menuItem sendToOriginator |
2331 | 6957 |
! |
6958 |
||
6959 |
sendToOriginator:aBoolean |
|
6960 |
"if true, the message is sent to the originating widget; |
|
6961 |
otherwise (the default), it it sent to the receiver/application." |
|
6962 |
||
2359 | 6963 |
menuItem sendToOriginator:aBoolean. |
2331 | 6964 |
! |
6965 |
||
464 | 6966 |
submenuChannel |
2870 | 6967 |
"get the submenu channel" |
6968 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6969 |
^ menuItem submenuChannel |
464 | 6970 |
! |
6971 |
||
6972 |
submenuChannel:aSelectorOrNil |
|
2870 | 6973 |
"returns the submenu channel" |
6974 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6975 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 6976 |
! ! |
6977 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
6978 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 6979 |
|
2016 | 6980 |
moveBy:aPoint |
2870 | 6981 |
"move the layouts origin" |
6982 |
||
2016 | 6983 |
layout moveBy:aPoint. |
6984 |
! |
|
6985 |
||
1699 | 6986 |
preferredExtent |
2870 | 6987 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
6988 |
||
2614 | 6989 |
|isVertical icon wIcon isButton labelExtent |
1699 | 6990 |
x "{ Class:SmallInteger }" |
6991 |
y "{ Class:SmallInteger }" |
|
6992 |
s "{ Class:SmallInteger }" |
|
6993 |
| |
|
6994 |
self isVisible ifFalse:[^ 0@0 ]. |
|
6995 |
||
2359 | 6996 |
isButton := menuItem isButton. |
6997 |
||
1699 | 6998 |
isButton ifTrue:[ |
4657 | 6999 |
s := menuPanel maxAbsoluteButtonLevel ? 0. |
7000 |
x := s + HorizontalButtonInset. |
|
7001 |
y := s + VerticalButtonInset. |
|
1699 | 7002 |
] ifFalse:[ |
4657 | 7003 |
x := HorizontalInset. |
7004 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
|
1699 | 7005 |
]. |
7006 |
x := x * 2. |
|
7007 |
y := y * 2. |
|
7008 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7009 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7010 |
|
2362 | 7011 |
self isSeparator ifTrue:[ |
4657 | 7012 |
s := self class separatorSize. |
7013 |
label = '' ifTrue:[ |
|
7014 |
s := self class halfSeparatorSize. |
|
7015 |
]. |
|
7016 |
||
7017 |
"width of doubleSeparator is 5 !!!!" |
|
7018 |
isVertical ifFalse:[ |
|
7019 |
x := x max:s. |
|
7020 |
y := y + 5. |
|
7021 |
] ifTrue:[ |
|
7022 |
y := y max:s. |
|
7023 |
x := x + 5. |
|
7024 |
]. |
|
1699 | 7025 |
] ifFalse:[ |
4657 | 7026 |
labelExtent := self displayLabelExtent. |
7027 |
||
7028 |
x := x + labelExtent x. |
|
7029 |
y := y + labelExtent y. |
|
7030 |
x := x + (menuPanel stringOffsetXfor:self). |
|
7031 |
||
7032 |
isButton ifFalse:[ |
|
7033 |
menuPanel showSeparatingLines ifTrue:[ |
|
7034 |
"width of separator is 2 plus right offset 1 := 3" |
|
7035 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
|
7036 |
]. |
|
7037 |
]. |
|
7038 |
wIcon := 0. |
|
7039 |
self hasMenuIndicator ifTrue:[ |
|
7040 |
icon := MenuPanel menuIndicator. |
|
7041 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
|
7042 |
] ifFalse:[ |
|
7043 |
self hasDelayedMenuIndicator ifTrue:[ |
|
7044 |
icon := MenuPanel delayedMenuIndicator. |
|
7045 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
|
7046 |
] |
|
7047 |
]. |
|
7048 |
x := x + wIcon. |
|
1699 | 7049 |
]. |
7050 |
^ x@y |
|
3987 | 7051 |
|
7052 |
"Modified: / 19-01-2011 / 21:20:35 / cg" |
|
3421
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7053 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7054 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7055 |
preferredHeight |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7056 |
^ self preferredExtent y |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7057 |
! |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7058 |
|
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7059 |
preferredWidth |
de7368c2dd11
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3415
diff
changeset
|
7060 |
^ self preferredExtent x |
388 | 7061 |
! ! |
7062 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
7063 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 7064 |
|
7065 |
activeHelpKey |
|
2870 | 7066 |
"get the active helpKey; the key to retrieve the helpText from the application" |
7067 |
||
2359 | 7068 |
^ menuItem activeHelpKey |
1613 | 7069 |
! |
7070 |
||
7071 |
activeHelpKey:aHelpKey |
|
2870 | 7072 |
"set the active helpKey; the key to retrieve the helpText from the application" |
7073 |
||
2359 | 7074 |
menuItem activeHelpKey:aHelpKey. |
7075 |
activeHelpText := nil. |
|
1613 | 7076 |
! |
7077 |
||
7078 |
activeHelpText |
|
2870 | 7079 |
"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
|
7080 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7081 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7082 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7083 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7084 |
|
3938 | 7085 |
((key := self activeHelpKey) notNil |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7086 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
3938 | 7087 |
^ app helpTextForKey:key. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7088 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7089 |
^ nil |
1613 | 7090 |
! |
7091 |
||
7092 |
activeHelpText:aText |
|
2870 | 7093 |
"set the active helpText" |
7094 |
||
1613 | 7095 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7096 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7097 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7098 |
flyByHelpText |
2870 | 7099 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7100 |
|
4717 | 7101 |
|text key app keyUsed itemsActionSelector| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7102 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7103 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7104 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
7105 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
7106 |
|
2471 | 7107 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
7108 |
"/ (if you have an argument for that let us know..) |
|
7109 |
"/ self isButton ifFalse:[^ nil]. |
|
7110 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7111 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
7112 |
"/ if an activeHelpKey was explicitely given, use that one |
4712 | 7113 |
key := keyUsed := self activeHelpKey. |
7114 |
keyUsed isNil ifTrue:[ |
|
7115 |
"/ try action as key |
|
4717 | 7116 |
(itemsActionSelector := menuItem itemValue) isSymbol ifTrue:[ |
7117 |
keyUsed := itemsActionSelector. |
|
7118 |
]. |
|
4712 | 7119 |
]. |
2895 | 7120 |
|
7121 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
4712 | 7122 |
(keyUsed isAssociation) ifTrue:[ |
7123 |
app := keyUsed key. |
|
7124 |
keyUsed := keyUsed value. |
|
7125 |
] ifFalse:[ |
|
7126 |
app := menuPanel application. |
|
7127 |
]. |
|
7128 |
||
7129 |
keyUsed notNil ifTrue:[ |
|
7130 |
app notNil ifTrue:[ |
|
7131 |
text := app flyByHelpTextForKey:keyUsed. |
|
7132 |
]. |
|
7133 |
text isNil ifTrue:[ |
|
7134 |
text := menuPanel flyByHelpTextForKey:keyUsed. |
|
7135 |
]. |
|
7136 |
"/ if the key used is NOT the activeHelpKey, but the action name, |
|
7137 |
"/ then do not accept the default |
|
7138 |
((text = keyUsed) and:[key isNil]) ifTrue:[ |
|
7139 |
text := nil. |
|
7140 |
]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7141 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7142 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
7143 |
"/ 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
|
7144 |
text isNil ifTrue:[ |
4712 | 7145 |
self hasSubmenu ifTrue:[ |
7146 |
^ key |
|
7147 |
]. |
|
7148 |
||
7149 |
"/ then use the original activeHelpKey (but not the action) |
|
7150 |
text := key. |
|
7151 |
text isNil ifTrue:[ |
|
7152 |
displayLabel isString ifTrue:[ |
|
7153 |
text := displayLabel string. |
|
7154 |
]. |
|
7155 |
]. |
|
7156 |
text isNil ifTrue:[ |
|
7157 |
text := self rawLabel. |
|
7158 |
text isString ifFalse:[ |
|
7159 |
text := menuItem rawLabel. |
|
7160 |
text isString ifFalse:[ |
|
7161 |
text := nil. |
|
7162 |
] |
|
7163 |
]. |
|
7164 |
text notNil ifTrue:[ |
|
7165 |
(text includes:$&) ifTrue:[ |
|
7166 |
text := (self updateAccessCharacterFor:text) string. |
|
7167 |
]. |
|
7168 |
]. |
|
7169 |
]. |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7170 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7171 |
|
3402
5941cc1ff429
flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
7172 |
(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
|
7173 |
text = displayLabel ifTrue:[ |
4712 | 7174 |
"for text menus: it does not make sense to show the label's string again |
7175 |
(i.e. in a pull down menu)" |
|
7176 |
^ nil |
|
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7177 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7178 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7179 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7180 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7181 |
flyByHelpText:aText |
2870 | 7182 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
7183 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
7184 |
flyByHelpText := aText. |
1613 | 7185 |
! ! |
7186 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7187 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7188 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7189 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7190 |
"on default submenus has a vertical layout; |
2870 | 7191 |
true, the submenu has a horizontal layout." |
7192 |
||
2360 | 7193 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7194 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7195 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7196 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7197 |
"on default submenus has a vertical layout; |
2870 | 7198 |
true, the submenu has a horizontal layout." |
7199 |
||
2360 | 7200 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7201 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7202 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7203 |
isButton |
2870 | 7204 |
"returns whether the item looks like a Button" |
7205 |
||
2359 | 7206 |
^ menuItem isButton |
7207 |
! |
|
7208 |
||
7209 |
isButton:aBool |
|
2870 | 7210 |
"set/clear the item to look like a Button" |
7211 |
||
2359 | 7212 |
menuItem isButton ~~ aBool ifTrue:[ |
3938 | 7213 |
menuItem isButton:aBool. |
7214 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7215 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7216 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7217 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7218 |
layout |
2870 | 7219 |
"returns my layout ( Rectangle )" |
7220 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7221 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7222 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7223 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7224 |
layout:aLayout |
2870 | 7225 |
"set a new layout ( Rectangle )" |
7226 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7227 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7228 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7229 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7230 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7231 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7232 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 7233 |
while performing the menu action. Defaults to false." |
7234 |
||
2359 | 7235 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7236 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7237 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7238 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7239 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 7240 |
while performing the menu action. Defaults to false." |
7241 |
||
2359 | 7242 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7243 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7244 |
|
2504 | 7245 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 7246 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7247 |
currentSubmenu |
2870 | 7248 |
"returns the current submenu or nil" |
7249 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7250 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7251 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7252 |
|
1705 | 7253 |
hideSubmenu |
2870 | 7254 |
"hide submenu" |
7255 |
||
2199 | 7256 |
self hideSubmenu:subMenu. |
7257 |
! |
|
7258 |
||
7259 |
hideSubmenu:aSubmenu |
|
2870 | 7260 |
"hide submenu" |
7261 |
||
2871 | 7262 |
|id wg| |
1705 | 7263 |
|
2374 | 7264 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 7265 |
aSubmenu removeDependencies. |
2199 | 7266 |
|
7267 |
aSubmenu realized ifFalse:[ |
|
3938 | 7268 |
id := aSubmenu id. |
7269 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
|
2199 | 7270 |
] ifTrue:[ |
3938 | 7271 |
aSubmenu hide |
2199 | 7272 |
]. |
7273 |
||
2870 | 7274 |
aSubmenu windowGroup:nil. |
2871 | 7275 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
3938 | 7276 |
wg removeView:aSubmenu. |
2871 | 7277 |
]. |
2199 | 7278 |
|
7279 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7280 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
3938 | 7281 |
menuItem keepLinkedMenu ifFalse:[ |
7282 |
subMenu := nil |
|
7283 |
] |
|
2199 | 7284 |
]. |
7285 |
! |
|
7286 |
||
7287 |
openDelayedSubmenu |
|
2870 | 7288 |
"called to open now my delayed submenu" |
7289 |
||
3133 | 7290 |
|subMenuBeforeOpening| |
2199 | 7291 |
|
7292 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
2374 | 7293 |
subMenu notNil ifTrue:[ |
4726 | 7294 |
subMenu realized ifTrue:[ |
7295 |
"/ already open |
|
7296 |
^ self |
|
7297 |
]. |
|
7298 |
]. |
|
7299 |
||
7300 |
"/ bugfix : check if delayed menu canbe open (only for toolbars and items having a delayed menu) |
|
7301 |
(menuPanel isPopUpView |
|
7302 |
or:[self hasDelayedMenu not |
|
7303 |
or:[menuPanel sensor anyButtonPressed]] |
|
7304 |
) ifFalse:[ |
|
7305 |
"/ check if any menu already is open than accept otherwise ignore |
|
7306 |
||
7307 |
menuPanel items |
|
7308 |
detect:[:el|(el currentSubmenu isView and:[el currentSubmenu realized])] |
|
7309 |
ifNone:[^ self]. |
|
2199 | 7310 |
]. |
4556 | 7311 |
|
3133 | 7312 |
self setupSubmenu. |
7313 |
subMenu isNil ifTrue:[^ self]. |
|
4241 | 7314 |
subMenu hasItems ifFalse:[^ self]. |
3133 | 7315 |
subMenuBeforeOpening := subMenu. |
2199 | 7316 |
self openSubmenu. |
7317 |
||
3133 | 7318 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
4726 | 7319 |
"/ closed during building or opening the submenu |
7320 |
self hideSubmenu:subMenuBeforeOpening. |
|
3133 | 7321 |
]. |
7322 |
||
7323 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 7324 |
! |
1701 | 7325 |
|
7326 |
openSubmenu |
|
7327 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
7328 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 7329 |
nescessary." |
7330 |
||
3203 | 7331 |
|p o device isVertical topMenu windGrp prefExtent lastEvent |
1701 | 7332 |
devBot "{ Class:SmallInteger }" |
7333 |
devRight "{ Class:SmallInteger }" |
|
7334 |
width "{ Class:SmallInteger }" |
|
7335 |
height "{ Class:SmallInteger }" |
|
7336 |
top "{ Class:SmallInteger }" |
|
7337 |
left "{ Class:SmallInteger }" |
|
7338 |
| |
|
7339 |
||
4150 | 7340 |
(subMenu isNil or:[subMenu shown or:[self isSelected not or:[menuPanel realized not]]]) ifTrue:[ |
4657 | 7341 |
^ self |
3975 | 7342 |
]. |
7343 |
"close all other open submenus assigned to the menuPanel I'am located in" |
|
7344 |
||
7345 |
menuPanel itemsDo:[:eachItem| |
|
4657 | 7346 |
(eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[ |
7347 |
eachItem hideSubmenu. |
|
7348 |
]. |
|
3975 | 7349 |
]. |
1701 | 7350 |
topMenu := menuPanel topMenu. |
1829 | 7351 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
4657 | 7352 |
subMenu releaseDeviceResources. |
7353 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
7354 |
subMenu recreate. |
|
1829 | 7355 |
]. |
7356 |
||
1701 | 7357 |
windGrp := topMenu windowGroup. |
3203 | 7358 |
windGrp notNil ifTrue:[ |
4657 | 7359 |
lastEvent := windGrp lastEvent. |
7360 |
||
7361 |
(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[ |
|
7362 |
subMenu mapTime:(lastEvent timeStamp). |
|
7363 |
]. |
|
3203 | 7364 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7365 |
subMenu superMenu:menuPanel. |
1701 | 7366 |
subMenu becomesActiveMenu. |
7367 |
subMenu cursor:Cursor hand. |
|
7368 |
||
7369 |
windGrp notNil ifTrue:[ |
|
4657 | 7370 |
subMenu windowGroup:windGrp. |
7371 |
windGrp addTopView:subMenu. |
|
1701 | 7372 |
]. |
7373 |
||
2111 | 7374 |
"Q&D kludge - test whether the layout is nil; |
4657 | 7375 |
if true recompute the layouts |
2111 | 7376 |
" |
2374 | 7377 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 7378 |
|
4150 | 7379 |
isVertical := menuPanel verticalLayout. |
7380 |
||
7381 |
p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft]. |
|
7382 |
menuPanel isPopUpView ifTrue:[ |
|
4657 | 7383 |
o := menuPanel origin + p |
4150 | 7384 |
] ifFalse:[ |
4657 | 7385 |
o := menuPanel translatePoint:p to:nil. "/ translate to root window |
4150 | 7386 |
]. |
7387 |
subMenu origin:o. "set temporary origin to compute preferredExtent" |
|
7388 |
||
1701 | 7389 |
" Q&D kludge - if any visibility attributes are blocks; |
7390 |
TODO: only invoke mustRearrange if any are blocks |
|
4657 | 7391 |
(since I react correctly on valueHolder changes) |
1701 | 7392 |
" |
7393 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
7394 |
subMenu fixSize. |
|
7395 |
||
4150 | 7396 |
"compute origin of subMenu" |
1701 | 7397 |
device := menuPanel device. |
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
7398 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
7399 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
7400 |
width := prefExtent x. |
4150 | 7401 |
devBot := device usableHeightAt:o. |
1701 | 7402 |
devRight := device usableWidth. |
7403 |
||
7404 |
left := o x. |
|
7405 |
top := o y. |
|
7406 |
||
2016 | 7407 |
top + height > devBot ifTrue:[ |
4657 | 7408 |
top := isVertical ifTrue:[devBot - height] |
7409 |
ifFalse:[top - layout height - height + 2] |
|
3938 | 7410 |
]. |
2016 | 7411 |
|
7412 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
7413 |
"/ top < menuPanel bottom ifTrue:[ |
|
7414 |
"/ left := left + layout width. |
|
7415 |
"/ ]. |
|
7416 |
"/ left + width > devRight ifTrue:[ |
|
7417 |
"/ left := o x - width - 2 |
|
7418 |
"/ ]. |
|
7419 |
"/ ]. |
|
3938 | 7420 |
|
1701 | 7421 |
left + width > devRight ifTrue:[ |
4657 | 7422 |
left := isVertical ifTrue:[left - layout width - width + 2] |
7423 |
ifFalse:[devRight - width] |
|
3938 | 7424 |
]. |
7425 |
||
7426 |
"/ ***** MULTI SCREEN |
|
7427 |
"/ top := top max:0. |
|
7428 |
"/ left := left max:0. |
|
1701 | 7429 |
|
7430 |
subMenu origin:(left@top). |
|
7431 |
||
7432 |
subMenu realized ifFalse:[ |
|
4657 | 7433 |
subMenu realize. |
1701 | 7434 |
] ifTrue:[ |
4657 | 7435 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7436 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7437 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7438 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7439 |
toggleSubmenuVisibility |
2870 | 7440 |
"toggle the visibility of the submenu" |
7441 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7442 |
subMenu notNil ifTrue:[ |
3938 | 7443 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7444 |
] ifFalse:[ |
3938 | 7445 |
self setupSubmenu. |
7446 |
subMenu isNil ifTrue:[ |
|
7447 |
"/ cannot open a submenu |
|
7448 |
^ self |
|
7449 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7450 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7451 |
self openSubmenu. |
3133 | 7452 |
|
7453 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7454 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7455 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7456 |
visibleSubmenu |
2870 | 7457 |
"returns the current visible submenu or nil" |
7458 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7459 |
subMenu notNil ifTrue:[ |
3938 | 7460 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7461 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
7462 |
^ nil |
1701 | 7463 |
! ! |
7464 |
||
524 | 7465 |
!MenuPanel::Item methodsFor:'building'! |
7466 |
||
7467 |
aspectAt:aKey |
|
3092 | 7468 |
"returns the value assigned to key or nil" |
2870 | 7469 |
|
524 | 7470 |
|appl value| |
7471 |
||
7472 |
appl := menuPanel receiver. |
|
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
7473 |
(appl isValueModel) ifTrue:[ |
4782 | 7474 |
^ appl value:aKey |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7475 |
]. |
2123 | 7476 |
appl isNil ifTrue:[ |
4782 | 7477 |
appl := menuPanel application. |
7478 |
appl isNil ifTrue:[ ^ nil]. |
|
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
7479 |
]. |
2123 | 7480 |
|
7481 |
MessageNotUnderstood handle:[:ex| |
|
4782 | 7482 |
ex selector ~~ aKey ifTrue:[ |
7483 |
ex reject |
|
7484 |
]. |
|
7485 |
self ifNotInUIBuilderInfoPrintCR: |
|
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
7486 |
('application (%1) does not provide aspect: %2 (in %3)' |
4782 | 7487 |
bindWith:appl classNameWithArticle |
7488 |
with:aKey |
|
7489 |
with:(label isString ifTrue:[label] ifFalse:[self nameKey ? self itemValue ? '???'])). |
|
2123 | 7490 |
] do:[ |
4782 | 7491 |
aKey argumentCount == 1 ifTrue:[ |
7492 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
7493 |
] ifFalse:[ |
|
7494 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
7495 |
value := appl aspectFor:aKey |
|
7496 |
] ifFalse:[ |
|
7497 |
value := appl perform:aKey |
|
7498 |
] |
|
7499 |
] |
|
524 | 7500 |
]. |
7501 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
7502 |
|
4316 | 7503 |
"Modified: / 02-08-2013 / 16:44:28 / cg" |
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
7504 |
"Modified: / 15-04-2016 / 18:29:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
524 | 7505 |
! ! |
7506 |
||
390 | 7507 |
!MenuPanel::Item methodsFor:'change & update'! |
7508 |
||
2614 | 7509 |
fontChanged |
2870 | 7510 |
"called whenever the font changed" |
7511 |
||
2614 | 7512 |
displayLabel notNil ifTrue:[ |
3938 | 7513 |
displayLabelExtent := nil. |
7514 |
||
7515 |
subMenu notNil ifTrue:[ |
|
7516 |
subMenu font:(menuPanel font). |
|
7517 |
]. |
|
2614 | 7518 |
]. |
7519 |
! |
|
7520 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7521 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7522 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7523 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7524 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7525 |
(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
|
7526 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7527 |
self isSeparator ifFalse:[ |
4657 | 7528 |
"/ NOT A SEPARATOR |
7529 |
||
7530 |
menuPanel shown ifTrue:[ |
|
7531 |
changedObject == enableChannel ifTrue:[ |
|
7532 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
7533 |
^ menuPanel selection:nil. |
|
7534 |
]. |
|
7535 |
^ self invalidate |
|
7536 |
]. |
|
7537 |
||
7538 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
7539 |
menuItem isButton ifTrue:[ |
|
7540 |
self invalidate |
|
7541 |
] ifFalse:[ |
|
7542 |
"/ invalidate the interactor only |
|
7543 |
"/ take any interactor; interactors has the same extent |
|
7544 |
form := menuPanel iconIndicationOff. |
|
7545 |
||
7546 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
7547 |
top:(layout top) |
|
7548 |
width:(form width) |
|
7549 |
height:(layout height). |
|
7550 |
||
7551 |
menuPanel invalidate:rect repairNow:false |
|
7552 |
]. |
|
7553 |
^ self |
|
7554 |
]. |
|
7555 |
self invalidate. |
|
7556 |
]. |
|
498 | 7557 |
]. |
712 | 7558 |
|
7559 |
changedObject == isVisible ifTrue:[ |
|
4657 | 7560 |
menuPanel mustRearrange. |
7561 |
"/ actually: the following is wrong, because we have to delay the rearrangement |
|
7562 |
"/ until the next redraw event comes. Otherwise, we might compute new layouts |
|
7563 |
"/ too early if more items change their visibility. |
|
7564 |
"/ redraw will call rearrangeItems, if the mustRearrange is set. |
|
7565 |
||
7566 |
"/ menuPanel rearrangeItems. |
|
7567 |
^ self. |
|
712 | 7568 |
]. |
7569 |
||
498 | 7570 |
super update:something with:aParameter from:changedObject |
4090
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7571 |
|
9f67a25034b7
fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents:
4089
diff
changeset
|
7572 |
"Modified (comment): / 24-11-2011 / 19:01:42 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7573 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7574 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7575 |
updateIndicators |
2870 | 7576 |
"update indicators " |
7577 |
||
2934 | 7578 |
indication notNil ifTrue:[ |
3938 | 7579 |
(indication isSymbol |
7580 |
or:[menuItem hideMenuOnActivated not]) |
|
7581 |
ifTrue:[ |
|
7582 |
"indication is a selector; |
|
7583 |
otherwise no need to redraw, because |
|
7584 |
a change notification is raised from the model !!!!" |
|
7585 |
self update:nil with:nil from:indication |
|
7586 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
7587 |
] |
390 | 7588 |
! ! |
7589 |
||
388 | 7590 |
!MenuPanel::Item methodsFor:'converting'! |
7591 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7592 |
asMenuItem |
2870 | 7593 |
"convert to a MenuItem" |
7594 |
||
2359 | 7595 |
^ menuItem |
388 | 7596 |
! |
7597 |
||
2827 | 7598 |
menuItem |
7599 |
^ menuItem |
|
7600 |
! |
|
7601 |
||
388 | 7602 |
menuItem:aMenuItem |
2870 | 7603 |
"setup attributes from a MenuItem" |
7604 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7605 |
|lbl| |
389 | 7606 |
|
388 | 7607 |
menuPanel disabledRedrawDo:[ |
3938 | 7608 |
menuItem := aMenuItem. |
7609 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
7610 |
||
7611 |
label := displayLabel := activeHelpText := nil. |
|
7612 |
||
7613 |
self enabled:(menuItem enabled). |
|
7614 |
self indication:(menuItem indication). |
|
7615 |
self choice:(menuItem choice). |
|
7616 |
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
|
7617 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7618 |
"/ 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
|
7619 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
7620 |
|
3938 | 7621 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
7622 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
7623 |
]. |
|
7624 |
||
7625 |
self submenu:(menuItem submenu). |
|
7626 |
self label:lbl. |
|
388 | 7627 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
7628 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
7629 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 7630 |
! ! |
7631 |
||
2681 | 7632 |
!MenuPanel::Item methodsFor:'dependents access'! |
7633 |
||
7634 |
addDependencies |
|
2870 | 7635 |
"add all dependencies" |
7636 |
||
2681 | 7637 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
7638 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
7639 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
7640 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
7641 |
! |
|
7642 |
||
7643 |
removeDependencies |
|
2870 | 7644 |
"remove all dependencies" |
7645 |
||
2681 | 7646 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
7647 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
7648 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
7649 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
7650 |
! ! |
|
7651 |
||
388 | 7652 |
!MenuPanel::Item methodsFor:'drawing'! |
7653 |
||
2768 | 7654 |
choiceForm |
2870 | 7655 |
"returns choice form or nil" |
7656 |
||
2768 | 7657 |
|isOn| |
7658 |
||
7659 |
choice isNil ifTrue:[^ nil]. |
|
7660 |
||
7661 |
isOn := (choice value = menuItem choiceValue). |
|
7662 |
self enabled ifFalse:[ |
|
3938 | 7663 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
7664 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
2768 | 7665 |
]. |
3565 | 7666 |
self isSelected ifTrue:[ |
3938 | 7667 |
^ isOn == true |
7668 |
ifTrue:[menuPanel iconRadioGroupEnteredOn] |
|
7669 |
ifFalse:[menuPanel iconRadioGroupEnteredOff] |
|
3565 | 7670 |
]. |
2768 | 7671 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
3938 | 7672 |
ifFalse:[menuPanel iconRadioGroupOff] |
2768 | 7673 |
! |
7674 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7675 |
draw |
2870 | 7676 |
"redraw this item" |
7677 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7678 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7679 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7680 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7681 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7682 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7683 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7684 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7685 |
self isVisible ifFalse:[^ self]. |
4152 | 7686 |
layout isNil ifTrue:[ |
4657 | 7687 |
"/ cg: why does this happen - it does!! |
7688 |
^ self |
|
4152 | 7689 |
]. |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7690 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7691 |
self isSeparator ifTrue:[ |
4657 | 7692 |
self drawSeparator. |
7693 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7694 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7695 |
menuItem isButton ifTrue:[ |
4657 | 7696 |
self drawButton. |
7697 |
^ self |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7698 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7699 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7700 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7701 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7702 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7703 |
bgColor := menuPanel backgroundColor. |
3938 | 7704 |
paint := isSelected |
4657 | 7705 |
ifTrue:[self activeBackgroundColor] |
7706 |
ifFalse:[ |
|
7707 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
|
7708 |
menuPanel enteredBackgroundColor |
|
7709 |
] ifFalse:[ |
|
7710 |
bgColor |
|
7711 |
]]. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7712 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7713 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
4657 | 7714 |
paint := ownBgCol |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7715 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7716 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7717 |
paint ~= bgColor ifTrue:[ |
4657 | 7718 |
menuPanel paint:paint. |
7719 |
menuPanel fillRectangle:layout. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7720 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7721 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7722 |
menuPanel showSeparatingLines ifTrue:[ |
4657 | 7723 |
self drawSeparatingLines |
3938 | 7724 |
]. |
7725 |
||
7726 |
self drawLabel. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7727 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7728 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
4657 | 7729 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
7730 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
|
7731 |
||
7732 |
x := layout left. |
|
7733 |
y := layout top. |
|
7734 |
w := layout width. |
|
7735 |
h := layout height. |
|
7736 |
||
7737 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
|
7738 |
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
|
7739 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7740 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7741 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7742 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7743 |
drawButton |
2870 | 7744 |
"draw as button" |
7745 |
||
2362 | 7746 |
|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
|
7747 |
x "{ Class:SmallInteger }" |
2143 | 7748 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7749 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7750 |
drawObject := displayLabel. |
2362 | 7751 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7752 |
isSelected := self isSelected. |
4632 | 7753 |
|
2362 | 7754 |
isSelected ifFalse:[ |
4657 | 7755 |
"/ test whether button has pressed toggle behaviour |
7756 |
showSelected := (self isToggle and:[self indicationValue]). |
|
2362 | 7757 |
] ifTrue:[ |
4657 | 7758 |
showSelected := isSelected |
2362 | 7759 |
]. |
7760 |
||
7761 |
showSelected ifTrue:[ |
|
4657 | 7762 |
bg := self activeBackgroundColor. |
7763 |
fg := self activeForegroundColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7764 |
] ifFalse:[ |
4657 | 7765 |
self isEntered ifTrue:[ |
7766 |
bg := self buttonEnteredBackgroundColor |
|
7767 |
] ifFalse:[ |
|
7768 |
bg := self backgroundColor |
|
7769 |
]. |
|
7770 |
isEnabled ifTrue:[ |
|
7771 |
fg := menuPanel foregroundColor |
|
7772 |
] ifFalse:[ |
|
7773 |
fg := menuPanel disabledForegroundColor. |
|
7774 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
7775 |
drawObject := self disabledRawLabel |
|
7776 |
] |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7777 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7778 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7779 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
4657 | 7780 |
bg := ownBgCol |
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7781 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
7782 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7783 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7784 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4657 | 7785 |
menuPanel paint:bg. |
7786 |
menuPanel fillRectangle:layout. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7787 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7788 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7789 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 7790 |
|
7791 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
4657 | 7792 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
2337 | 7793 |
]. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7794 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7795 |
isSelected ifFalse:[ |
4657 | 7796 |
"check whether button should be drawn selected; indicator or radio button" |
7797 |
||
7798 |
indication notNil ifTrue:[ |
|
7799 |
"button is indicator and set" |
|
7800 |
isSelected := self indicationValue |
|
7801 |
] ifFalse:[ |
|
7802 |
isSelected := (choice notNil and:[choice value = menuItem choiceValue]). |
|
7803 |
] |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7804 |
]. |
2143 | 7805 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7806 |
|
3938 | 7807 |
isSelected ifTrue:[ |
4657 | 7808 |
level := menuPanel buttonActiveLevel. |
7809 |
x := x + 1 "level abs". |
|
7810 |
y := y + 1 "level abs". |
|
3938 | 7811 |
] ifFalse:[ |
4657 | 7812 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
7813 |
ifFalse:[menuPanel buttonPassiveLevel]. |
|
2059 | 7814 |
]. |
7815 |
||
2817 | 7816 |
drawObject notEmptyOrNil ifTrue:[ |
4657 | 7817 |
etchFg notNil ifTrue:[ |
7818 |
"/ donot draw images twice.. images are shown lightened |
|
7819 |
drawObject isImageOrForm ifFalse:[ |
|
7820 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
7821 |
]. |
|
7822 |
]. |
|
7823 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
2362 | 7824 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7825 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7826 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7827 |
level ~~ 0 ifTrue:[ |
4657 | 7828 |
menuPanel drawButtonEdgesFor:self level:level |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7829 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7830 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
7831 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7832 |
drawLabel |
2870 | 7833 |
"draw a labeled entry; no button, no separator." |
7834 |
||
3938 | 7835 |
|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
|
7836 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7837 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7838 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7839 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7840 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7841 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7842 |
drawObject := displayLabel. |
2362 | 7843 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7844 |
isSelected := self isSelected. |
2362 | 7845 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7846 |
isSelected ifTrue:[ |
4657 | 7847 |
fg := self activeForegroundColor |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7848 |
] ifFalse:[ |
4657 | 7849 |
isEnabled ifTrue:[ |
7850 |
self isEntered ifTrue:[ |
|
7851 |
fg := menuPanel enteredForegroundColor |
|
7852 |
] ifFalse:[ |
|
7853 |
fg := menuPanel foregroundColor |
|
7854 |
] |
|
7855 |
] ifFalse:[ |
|
7856 |
fg := menuPanel disabledForegroundColor. |
|
7857 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
7858 |
drawObject := self disabledRawLabel |
|
7859 |
] |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7860 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7861 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7862 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7863 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7864 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7865 |
|
3131 | 7866 |
( (form := self indicatorForm) notNil |
7867 |
or:[(form := self choiceForm) notNil] |
|
7868 |
) ifTrue:[ |
|
4657 | 7869 |
y := t + ((h - form height) // 2). |
7870 |
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
|
7871 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7872 |
|
2817 | 7873 |
drawObject notEmptyOrNil ifTrue:[ |
4657 | 7874 |
x := x + (menuPanel stringOffsetXfor:self). |
7875 |
||
7876 |
etchFg notNil ifTrue:[ |
|
7877 |
"/ donot draw images twice.. images are shown lightened |
|
7878 |
drawObject isImageOrForm ifFalse:[ |
|
7879 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
7880 |
]. |
|
7881 |
]. |
|
7882 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
2362 | 7883 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7884 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7885 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7886 |
"/ DRAW SHORTCUT KEY |
2359 | 7887 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7888 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7889 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7890 |
) ifTrue:[ |
4657 | 7891 |
x := layout left + x. |
7892 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
|
7893 |
y := y + menuPanel font ascent. |
|
7894 |
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
|
7895 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7896 |
|
3403 | 7897 |
"/ DRAW SUBMENU INDICATION (if a vertical menu with submenu) |
7898 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[ |
|
4657 | 7899 |
arrow := menuPanel rightArrow. |
7900 |
x := layout right - arrow width - HorizontalInset. |
|
7901 |
y := t + ((h - arrow height) // 2). |
|
7902 |
||
7903 |
(menuPanel styleSheet is3D not |
|
7904 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
7905 |
menuPanel displayForm:arrow x:x y:y. |
|
7906 |
] ifFalse:[ |
|
7907 |
cLa := menuPanel shadowColor. |
|
7908 |
cLb := menuPanel lightColor. |
|
7909 |
||
7910 |
isSelected ifFalse:[ |
|
7911 |
fg := cLa. |
|
7912 |
cLa := cLb. |
|
7913 |
cLb := fg |
|
7914 |
]. |
|
7915 |
menuPanel paint:cLa. |
|
7916 |
menuPanel displayForm:arrow x:x y:y. |
|
7917 |
menuPanel paint:cLb. |
|
7918 |
menuPanel displayForm:drawObject x:x y:y. |
|
7919 |
]. |
|
3403 | 7920 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7921 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7922 |
"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
|
7923 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7924 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7925 |
drawMenuIndicator |
2870 | 7926 |
"draw a menu indicator if the item has a menu or delayed menu." |
7927 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7928 |
|x y icon bAbsLevel verticalPosition| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7929 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7930 |
icon := self menuIndicatorIcon. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7931 |
icon isNil ifTrue:[ |
3938 | 7932 |
^ self |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7933 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7934 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7935 |
x := layout right - icon width. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7936 |
verticalPosition := menuPanel menuIndicatorVerticalPosition. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7937 |
verticalPosition == #center ifTrue:[ |
3938 | 7938 |
y := (layout height - icon height) // 2 + layout top. |
2220 | 7939 |
] ifFalse:[ |
3938 | 7940 |
verticalPosition == #top ifTrue:[ |
7941 |
y := layout top + 2. |
|
7942 |
] ifFalse:[ |
|
7943 |
y := layout bottom - icon height - 2. |
|
7944 |
] |
|
2220 | 7945 |
]. |
7946 |
||
7947 |
bAbsLevel := 0. |
|
2359 | 7948 |
menuItem isButton ifTrue:[ |
3938 | 7949 |
self isSelected ifTrue:[ |
7950 |
x := x + 1. |
|
7951 |
y := y + 1. |
|
7952 |
]. |
|
7953 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
7954 |
x := x - bAbsLevel. |
|
7955 |
y := y - bAbsLevel. |
|
2220 | 7956 |
]. |
7957 |
x := x - 1 "- HorizontalInset". |
|
7958 |
||
7959 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
3938 | 7960 |
icon := menuPanel lightenedImageOnDevice:icon |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7961 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7962 |
icon displayOn:menuPanel x:x y:y. |
2220 | 7963 |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
7964 |
(menuPanel drawMenuIndicatorSeparatorLine |
3938 | 7965 |
and:[ self isEntered |
7966 |
and:[ menuPanel buttonEnteredLevel ~~ 0] ]) |
|
7967 |
ifTrue:[ |
|
7968 |
menuPanel paint:menuPanel buttonShadowColor. |
|
7969 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
7970 |
menuPanel paint:menuPanel buttonLightColor. |
|
7971 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
2220 | 7972 |
]. |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7973 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7974 |
|
2059 | 7975 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 7976 |
"draw a labeled entry; no button, no separator." |
7977 |
||
3486 | 7978 |
|oldFont labelExtent |
1727 | 7979 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7980 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7981 |
x0 "{ Class:SmallInteger }" |
4679 | 7982 |
isSelected| |
7983 |
||
7984 |
isSelected := self isSelected. |
|
2059 | 7985 |
|
3486 | 7986 |
oldFont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7987 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7988 |
menuPanel paint:fg. |
2614 | 7989 |
labelExtent := self displayLabelExtent. |
7990 |
||
4232 | 7991 |
y := layout top + ((layout height - labelExtent y) // 2) + yOffset. |
2337 | 7992 |
"/ menuPanel centerItems ifTrue:[self halt]. |
3938 | 7993 |
aLabel isArray ifFalse:[ |
4679 | 7994 |
|printLabel| |
7995 |
||
7996 |
(aLabel isText or:[aLabel isLabelAndIcon]) ifTrue:[ |
|
7997 |
"/ background of label has already been drawn |
|
7998 |
"/ cg: 1.12.2014: remove any emphasis (in case we draw grey on light blue) |
|
7999 |
isSelected ifTrue:[ |
|
8000 |
printLabel := aLabel withoutAnyColorEmphasis. |
|
8001 |
] ifFalse:[ |
|
8002 |
printLabel := aLabel withoutBackgroundColorEmphasis. |
|
8003 |
]. |
|
8004 |
] ifFalse:[ |
|
8005 |
printLabel := aLabel. |
|
8006 |
]. |
|
8007 |
y := y + (printLabel ascentOn:menuPanel). |
|
8008 |
printLabel displayOn:menuPanel x:x y:y. |
|
1727 | 8009 |
] ifTrue:[ |
4679 | 8010 |
aLabel do:[:eachLine| |
8011 |
|shownLine| |
|
8012 |
||
8013 |
eachLine notNil ifTrue:[ |
|
8014 |
"/ cg: 1.12.2014: remove any emphasis (in case we draw grey on light blue) |
|
8015 |
isSelected ifTrue:[ |
|
8016 |
shownLine := eachLine withoutAnyColorEmphasis. |
|
8017 |
] ifFalse:[ |
|
8018 |
shownLine := eachLine withoutBackgroundColorEmphasis. |
|
8019 |
]. |
|
8020 |
||
8021 |
y0 := y + (shownLine ascentOn:menuPanel). |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8022 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8023 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8024 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8025 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8026 |
"/ ]. |
4679 | 8027 |
x0 := x + ((labelExtent x - (shownLine widthOn:menuPanel)) // 2). |
8028 |
shownLine displayOn:menuPanel x:x0 y:y0. |
|
8029 |
y := y + 1 + (shownLine heightOn:menuPanel) |
|
8030 |
] ifFalse:[ |
|
8031 |
y := y + (self spaceBetweenEmptyLines) |
|
8032 |
] |
|
8033 |
]. |
|
1727 | 8034 |
]. |
3486 | 8035 |
menuPanel setFont:oldFont |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8036 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8037 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8038 |
drawSeparatingLines |
2870 | 8039 |
"draw separating lines" |
8040 |
||
2059 | 8041 |
|myIndex lfSep rtSep items prevItem nextItem |
8042 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8043 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8044 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8045 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8046 |
b "{ Class:SmallInteger }" |
706 | 8047 |
| |
2059 | 8048 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8049 |
items := menuPanel items. |
2059 | 8050 |
myIndex := items identityIndexOf:self. |
8051 |
||
8052 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
8053 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
8054 |
||
8055 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
8056 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
8057 |
||
8058 |
(lfSep or:[rtSep]) ifFalse:[ |
|
4893 | 8059 |
^ self |
8060 |
]. |
|
8061 |
||
8062 |
menuPanel suppressSeparatingLines ifTrue:[^ self]. |
|
2059 | 8063 |
|
8064 |
lightColor := menuPanel lightColor. |
|
8065 |
shadowColor := menuPanel shadowColor. |
|
8066 |
||
8067 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8068 |
|
608 | 8069 |
l := layout left. |
8070 |
t := layout top. |
|
8071 |
r := layout right. |
|
8072 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8073 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8074 |
menuPanel verticalLayout ifTrue:[ |
4893 | 8075 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
8076 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
8077 |
||
8078 |
menuPanel paint:shadowColor. |
|
8079 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
8080 |
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
|
8081 |
] ifFalse:[ |
4893 | 8082 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
8083 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
8084 |
||
8085 |
menuPanel paint:shadowColor. |
|
8086 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
8087 |
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
|
8088 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8089 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8090 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8091 |
drawSeparator |
2870 | 8092 |
"draw as separator" |
8093 |
||
2059 | 8094 |
|type lightColor shadowColor isDouble |
8095 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8096 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8097 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8098 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8099 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8100 |
| |
2059 | 8101 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8102 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8103 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
4893 | 8104 |
^ self |
8105 |
]. |
|
8106 |
menuPanel suppressSeparatingLines ifTrue:[^ self]. |
|
8107 |
||
2059 | 8108 |
isDouble := type == #doubleLine. |
8109 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8110 |
lightColor := menuPanel lightColor. |
2059 | 8111 |
shadowColor := menuPanel shadowColor. |
8112 |
menuPanel paint:shadowColor. |
|
8113 |
||
8114 |
left := layout left. |
|
8115 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8116 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8117 |
menuPanel verticalLayout ifTrue:[ |
4893 | 8118 |
x0 := left + HorizontalInset. |
8119 |
x1 := layout right - HorizontalInset. |
|
8120 |
y0 := top - 1 + (layout height // 2). |
|
8121 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
8122 |
||
8123 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
8124 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
8125 |
||
8126 |
menuPanel paint:lightColor. |
|
8127 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
8128 |
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
|
8129 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8130 |
] ifFalse:[ |
4893 | 8131 |
y1 := layout bottom. |
8132 |
x0 := left - 1 + (layout width // 2). |
|
8133 |
y0 := top. |
|
8134 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
8135 |
||
8136 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
8137 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
8138 |
||
8139 |
menuPanel paint:lightColor. |
|
8140 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
8141 |
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
|
8142 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8143 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
8144 |
|
2768 | 8145 |
indicatorForm |
2870 | 8146 |
"returns indication form or nil" |
8147 |
||
3565 | 8148 |
|isOn| |
2768 | 8149 |
|
8150 |
indication isNil ifTrue:[^ nil]. |
|
8151 |
||
3565 | 8152 |
isOn := self indicationValue. |
2768 | 8153 |
self enabled ifFalse:[ |
3938 | 8154 |
^ isOn == true |
8155 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
8156 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 8157 |
]. |
3565 | 8158 |
"/ self isSelected ifTrue:[ |
3938 | 8159 |
"/ ^ isOn == true |
3565 | 8160 |
"/ ifTrue:[menuPanel iconIndicationEnteredOn] |
8161 |
"/ ifFalse:[menuPanel iconIndicationEnteredOff] |
|
8162 |
"/ ]. |
|
8163 |
||
3938 | 8164 |
^ isOn == true |
8165 |
ifTrue:[menuPanel iconIndicationOn] |
|
8166 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 8167 |
! |
8168 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8169 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8170 |
|
2362 | 8171 |
layout isNil ifTrue:[^ self]. |
8172 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8173 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
3938 | 8174 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8175 |
] |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8176 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8177 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8178 |
menuIndicatorIcon |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8179 |
"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
|
8180 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8181 |
self hasDelayedMenuIndicator ifTrue:[ |
3938 | 8182 |
^ MenuPanel delayedMenuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8183 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8184 |
self hasMenuIndicator ifTrue:[ |
3938 | 8185 |
^ MenuPanel menuIndicator. |
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8186 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8187 |
^ nil |
388 | 8188 |
! ! |
8189 |
||
8190 |
!MenuPanel::Item methodsFor:'initialization'! |
|
8191 |
||
8192 |
destroy |
|
2870 | 8193 |
"destroy submenus, remove dependencies" |
8194 |
||
616 | 8195 |
self submenu:nil. |
2681 | 8196 |
self removeDependencies. |
616 | 8197 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8198 |
menuPanel := nil. |
616 | 8199 |
! |
8200 |
||
794 | 8201 |
in:aPanel |
2870 | 8202 |
"create item in a menuPanel" |
8203 |
||
794 | 8204 |
menuPanel := aPanel. |
2359 | 8205 |
|
8206 |
menuItem isNil ifTrue:[ |
|
3938 | 8207 |
self breakPoint:#ca. |
8208 |
menuItem := MenuItem new |
|
2359 | 8209 |
]. |
8210 |
! |
|
8211 |
||
8212 |
initialize |
|
8213 |
menuItem := MenuItem new. |
|
1811 | 8214 |
! |
8215 |
||
8216 |
reinitStyle |
|
8217 |
||
8218 |
subMenu notNil ifTrue:[ |
|
3147 | 8219 |
subMenu reinitStyle |
1811 | 8220 |
]. |
8221 |
||
8222 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
8223 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 8224 |
! ! |
8225 |
||
8226 |
!MenuPanel::Item methodsFor:'label basics'! |
|
8227 |
||
8228 |
disabledRawLabel |
|
2870 | 8229 |
"returns the label used if the item is disabled" |
8230 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8231 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8232 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8233 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8234 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8235 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8236 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8237 |
disabledDisplayLabel isString ifTrue:[ |
3938 | 8238 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8239 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8240 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8241 |
block := [:el| |rslt| |
3938 | 8242 |
(rslt := el) notNil ifTrue:[ |
8243 |
el isImageOrForm ifTrue:[ |
|
8244 |
el colorMap notNil ifTrue:[ |
|
8245 |
rslt := menuPanel lightenedImageOnDevice:el |
|
8246 |
] |
|
8247 |
] ifFalse:[ |
|
8248 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
|
8249 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
|
8250 |
form := menuPanel lightenedImageOnDevice:form |
|
8251 |
]. |
|
8252 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
|
8253 |
image := menuPanel lightenedImageOnDevice:image |
|
8254 |
]. |
|
8255 |
rslt := LabelAndIcon form:form image:image string:(el string). |
|
8256 |
] |
|
8257 |
] |
|
8258 |
]. |
|
8259 |
rslt |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8260 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8261 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8262 |
displayLabel isArray ifTrue:[ |
3938 | 8263 |
disabledDisplayLabel := Array new:(displayLabel size). |
8264 |
||
8265 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
|
8266 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
|
8267 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8268 |
] ifFalse:[ |
3938 | 8269 |
disabledDisplayLabel := block value:displayLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8270 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8271 |
^ disabledDisplayLabel |
794 | 8272 |
! |
8273 |
||
1829 | 8274 |
fetchDeviceResources |
2373 | 8275 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8276 |
disabledDisplayLabel := nil. |
1829 | 8277 |
self fetchImages. |
8278 |
! |
|
8279 |
||
616 | 8280 |
fetchImages |
2870 | 8281 |
"fetch my icon images" |
8282 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
8283 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
8284 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8285 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
3938 | 8286 |
^ self |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8287 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8288 |
displayLabel isImageOrForm ifTrue:[ |
3938 | 8289 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
8290 |
^ self. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8291 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8292 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8293 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
3938 | 8294 |
(icon := displayLabel image) notNil ifTrue:[ |
8295 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
|
8296 |
]. |
|
8297 |
(icon := displayLabel icon) notNil ifTrue:[ |
|
8298 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
|
8299 |
]. |
|
8300 |
^ self |
|
8301 |
]. |
|
8302 |
||
8303 |
displayLabel isArray ifFalse:[^ self]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8304 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8305 |
displayLabel keysAndValuesDo:[:i :el| |
3938 | 8306 |
(el notNil and:[el isString not]) ifTrue:[ |
8307 |
el isImageOrForm ifTrue:[ |
|
8308 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
|
8309 |
] ifFalse:[ |
|
8310 |
el class == LabelAndIcon ifTrue:[ |
|
8311 |
(icon := el image) notNil ifTrue:[ |
|
8312 |
el image:(menuPanel imageOnMyDevice:icon) |
|
8313 |
]. |
|
8314 |
(icon := el icon) notNil ifTrue:[ |
|
8315 |
el icon:(menuPanel imageOnMyDevice:icon) |
|
8316 |
] |
|
8317 |
] |
|
8318 |
] |
|
8319 |
] |
|
1078 | 8320 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8321 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8322 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8323 |
updateAccessCharacterFor:aLabel |
4086
d4818ca73683
added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents:
4082
diff
changeset
|
8324 |
"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
|
8325 |
|
3192 | 8326 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8327 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8328 |
aLabel isString ifFalse:[ |
4657 | 8329 |
aLabel class == LabelAndIcon ifTrue:[ |
8330 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
8331 |
]. |
|
8332 |
^ aLabel |
|
8333 |
]. |
|
8334 |
||
8335 |
^ MenuPanel |
|
8336 |
processAmpersandCharactersFor:aLabel |
|
8337 |
withAccessCharacterPosition:(menuItem accessCharacterPosition). |
|
4108
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
8338 |
|
5d14a85e112e
refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents:
4098
diff
changeset
|
8339 |
"Modified: / 15-02-2012 / 18:53:11 / cg" |
388 | 8340 |
! ! |
8341 |
||
1573 | 8342 |
!MenuPanel::Item methodsFor:'printing & storing'! |
8343 |
||
4556 | 8344 |
printOn:aGCOrStream |
4657 | 8345 |
aGCOrStream |
8346 |
nextPutAll:self class name; |
|
8347 |
nextPut:$(. |
|
4139
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
8348 |
label displayOn:aGCOrStream. |
77a120ffc684
Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
4122
diff
changeset
|
8349 |
aGCOrStream nextPut:$). |
1573 | 8350 |
! ! |
8351 |
||
388 | 8352 |
!MenuPanel::Item methodsFor:'private'! |
8353 |
||
650 | 8354 |
activeBackgroundColor |
2870 | 8355 |
"returns the active background color derived from menuPanel" |
8356 |
||
2359 | 8357 |
menuItem isButton ifTrue:[ |
3938 | 8358 |
^ menuPanel buttonActiveBackgroundColor |
2359 | 8359 |
]. |
8360 |
^ menuPanel activeBackgroundColor |
|
650 | 8361 |
! |
8362 |
||
8363 |
activeForegroundColor |
|
2870 | 8364 |
"returns the active foreground color derived from menuPanel" |
650 | 8365 |
|
3441 | 8366 |
menuItem isButton ifTrue:[ |
3938 | 8367 |
^ menuPanel buttonActiveForegroundColor |
3441 | 8368 |
]. |
650 | 8369 |
^menuPanel activeForegroundColor |
8370 |
! |
|
8371 |
||
727 | 8372 |
backgroundColor |
2870 | 8373 |
"returns the background color derived from menuPanel" |
8374 |
||
2359 | 8375 |
menuItem isButton ifTrue:[ |
3938 | 8376 |
^ menuPanel buttonPassiveBackgroundColor |
2359 | 8377 |
]. |
8378 |
^ menuPanel backgroundColor |
|
727 | 8379 |
! |
8380 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8381 |
backgroundColorFromLabel |
2870 | 8382 |
"returns the background color derived from label or nil" |
8383 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8384 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8385 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8386 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8387 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8388 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8389 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8390 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8391 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8392 |
run size == 0 ifTrue:[ |
3938 | 8393 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
8394 |
^ run value |
|
8395 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8396 |
] ifFalse:[ |
3938 | 8397 |
run do:[:r| |
8398 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
8399 |
^ r value |
|
8400 |
] |
|
8401 |
] |
|
388 | 8402 |
]. |
8403 |
^ nil |
|
8404 |
! |
|
8405 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8406 |
buttonEnteredBackgroundColor |
3938 | 8407 |
"returns the background color to use when thhe mouse has entered |
2870 | 8408 |
derived from menuPanel" |
8409 |
||
2359 | 8410 |
menuItem isButton ifTrue:[ |
3938 | 8411 |
^ menuPanel buttonEnteredBackgroundColor |
2359 | 8412 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8413 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8414 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8415 |
|
663 | 8416 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8417 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8418 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8419 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8420 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
8421 |
|
3866
fbdbf71489d8
show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents:
3845
diff
changeset
|
8422 |
|subm sel numArgs gotMenu| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8423 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8424 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8425 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8426 |
sel := menuItem submenuChannel. |
3934 | 8427 |
(sel isString or:[sel isSymbol]) ifFalse:[^ nil]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8428 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
8429 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
8430 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
8431 |
numArgs == 0 ifTrue:[ |
4657 | 8432 |
gotMenu := false. |
8433 |
MessageNotUnderstood handle:[:ex | |
|
8434 |
|selector| |
|
8435 |
||
8436 |
((selector := ex selector) == sel |
|
8437 |
or:[selector == #aspectFor:]) ifFalse:[ |
|
8438 |
ex reject |
|
8439 |
]. |
|
8440 |
] do:[ |
|
8441 |
subm := aRecv aspectFor:sel. |
|
8442 |
gotMenu := true. |
|
8443 |
]. |
|
8444 |
"/ used to be subm notNil; however, this is a bad test, |
|
8445 |
"/ as it does not allow for the app to return nil for no-menu. |
|
8446 |
gotMenu ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8447 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8448 |
|
2043 | 8449 |
(Array with:(aRecv) with:(aRecv class)) |
8450 |
do:[:aPossibleReceiver | |
|
4657 | 8451 |
MessageNotUnderstood handle:[:ex| |
8452 |
ex message selector == sel ifFalse:[ ex reject ] |
|
8453 |
] do:[ |
|
8454 |
numArgs == 0 ifTrue:[ |
|
8455 |
subm := aPossibleReceiver perform:sel |
|
8456 |
] ifFalse:[ |
|
8457 |
numArgs == 1 ifTrue:[ |
|
8458 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
8459 |
] ifFalse:[ |
|
8460 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
8461 |
] |
|
8462 |
] |
|
8463 |
]. |
|
8464 |
subm notNil ifTrue:[^ subm]. |
|
8465 |
Smalltalk isSmalltalkDevelopmentSystem ifTrue:[ |
|
8466 |
"/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR. |
|
8467 |
] |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8468 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
8469 |
|
663 | 8470 |
^ subm |
2043 | 8471 |
|
4027 | 8472 |
"Modified: / 24-03-2011 / 11:20:24 / cg" |
663 | 8473 |
! |
8474 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8475 |
indicationValue |
2870 | 8476 |
"returns indication value or nil in case of no indication" |
8477 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8478 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8479 |
|
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8480 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8481 |
|
3938 | 8482 |
indication isSymbol ifFalse:[ |
4657 | 8483 |
^ indication value == true "block or model" |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8484 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8485 |
|
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8486 |
numArgs := indication numArgs. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8487 |
numArgs == 2 ifTrue:[ |
4657 | 8488 |
recv := menuPanel receiver ? menuPanel application. |
8489 |
(recv notNil and:[recv isValueModel not]) ifTrue:[ |
|
8490 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
8491 |
sel := sel asSymbol. |
|
8492 |
||
8493 |
MessageNotUnderstood handle:[:ex| |
|
8494 |
ex selector ~~ sel ifTrue:[ |
|
8495 |
ex reject. |
|
8496 |
]. |
|
8497 |
] do:[ |
|
8498 |
sel := recv perform:sel with:(menuItem argument). |
|
8499 |
] |
|
8500 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8501 |
] ifFalse:[ |
4657 | 8502 |
numArgs == 0 ifTrue:[ |
8503 |
sel := indication |
|
8504 |
] ifFalse:[ |
|
8505 |
sel := (indication copyButLast:1) asSymbol. |
|
8506 |
]. |
|
8507 |
sel := self aspectAt:sel. |
|
8508 |
sel isValueModel ifTrue:[ |
|
8509 |
indication := sel. |
|
8510 |
indication addDependent:self. |
|
8511 |
]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8512 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8513 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8514 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8515 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8516 |
indicationValue:aValue |
2870 | 8517 |
"set the indication value" |
8518 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8519 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8520 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8521 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8522 |
|
3938 | 8523 |
indication isSymbol ifFalse:[ |
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8524 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8525 |
^ self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8526 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8527 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8528 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8529 |
^ self |
1218 | 8530 |
]. |
8531 |
||
524 | 8532 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8533 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8534 |
|
1218 | 8535 |
recv isNil ifTrue:[ |
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8536 |
recv := menuPanel application. |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8537 |
recv isNil ifTrue:[^ self]. |
3938 | 8538 |
]. |
8539 |
||
8540 |
MessageNotUnderstood handle:[:ex| |
|
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8541 |
(ex selector ~~ indication) ifTrue:[ |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8542 |
ex reject |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8543 |
]. |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8544 |
self ifNotInUIBuilderInfoPrintCR: |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8545 |
('application (%1) does not respond to: %2' |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8546 |
bindWith:recv classNameWithArticle |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8547 |
with:indication). |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8548 |
] do:[ |
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8549 |
numArgs == 1 ifTrue:[ |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8550 |
recv perform:indication with:aValue |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8551 |
] ifFalse:[ |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8552 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8553 |
] |
4316 | 8554 |
]. |
8555 |
||
8556 |
"Modified (format): / 02-08-2013 / 16:42:20 / cg" |
|
5025
22261417679a
MenuPanel: Use Logger instead of old #infoPrintCR: / #errorPrintCR:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5024
diff
changeset
|
8557 |
"Modified: / 15-04-2016 / 18:28:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8558 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8559 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8560 |
isEntered |
2870 | 8561 |
"returns true if the mouse pointer is over the item" |
8562 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8563 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8564 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8565 |
"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
|
8566 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
8567 |
|
464 | 8568 |
separatorType |
2870 | 8569 |
"returns type of separator line or nil" |
8570 |
||
390 | 8571 |
|c lbl| |
388 | 8572 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8573 |
self isSeparator ifFalse:[ |
3938 | 8574 |
^ nil |
388 | 8575 |
]. |
8576 |
||
390 | 8577 |
(lbl := label value) isNil ifTrue:[ |
3938 | 8578 |
^ #singleLine |
388 | 8579 |
]. |
8580 |
||
390 | 8581 |
lbl size == 1 ifTrue:[ |
3938 | 8582 |
c := lbl first. |
8583 |
c == $- ifTrue:[^ #singleLine]. |
|
8584 |
c == $= ifTrue:[^ #doubleLine]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8585 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8586 |
^ #blankLine |
1130 | 8587 |
! |
8588 |
||
8589 |
setupSubmenu |
|
3938 | 8590 |
|appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding |
3934 | 8591 |
channel whoProvidedMenu t| |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8592 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8593 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8594 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8595 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8596 |
subMenu notNil ifTrue:[ |
3938 | 8597 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8598 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8599 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8600 |
channel isSymbol ifFalse:[ |
3938 | 8601 |
submenuHolder := channel |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8602 |
] ifTrue:[ |
3938 | 8603 |
"/ submenu is specified by a selector in submenuChannel. |
8604 |
"/ who gets me the menu: |
|
8605 |
"/ 1) submenuProvider (if not nil) |
|
8606 |
"/ 2) menuPanel application |
|
8607 |
"/ 3) menuPanel receiver |
|
8608 |
"/ 4) menuPanel application master-chain |
|
8609 |
"/ 5) menuPanel receiver master-chain |
|
8610 |
||
8611 |
(submenuProvider := menuItem submenuProvider) notNil ifTrue:[ |
|
8612 |
submenuHolder := self findSubMenuIn:submenuProvider. |
|
8613 |
whoProvidedMenu := submenuProvider. |
|
8614 |
]. |
|
8615 |
submenuHolder isNil ifTrue:[ |
|
8616 |
appl := menuPanel application. |
|
8617 |
(appl notNil and:[appl ~~ submenuProvider]) ifTrue:[ |
|
8618 |
submenuHolder := self findSubMenuIn:appl. |
|
8619 |
whoProvidedMenu := appl. |
|
8620 |
]. |
|
8621 |
submenuHolder isNil ifTrue:[ |
|
8622 |
recv := menuPanel receiver. |
|
8623 |
(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[ |
|
8624 |
submenuHolder := self findSubMenuIn:recv. |
|
8625 |
whoProvidedMenu := recv. |
|
8626 |
]. |
|
8627 |
(submenuHolder isNil and:[appl notNil]) ifTrue:[ |
|
8628 |
t := appl. |
|
8629 |
[ submenuHolder isNil |
|
8630 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8631 |
] whileTrue:[ |
|
8632 |
( master ~~ appl |
|
8633 |
and:[ master ~~ recv |
|
8634 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8635 |
submenuHolder := self findSubMenuIn:master. |
|
8636 |
]. |
|
8637 |
t := master. |
|
8638 |
whoProvidedMenu := master. |
|
8639 |
] |
|
8640 |
]. |
|
8641 |
(submenuHolder isNil and:[recv notNil]) ifTrue:[ |
|
8642 |
t := recv. |
|
8643 |
[ submenuHolder isNil |
|
8644 |
and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ] |
|
8645 |
] whileTrue:[ |
|
8646 |
( master ~~ appl |
|
8647 |
and:[ master ~~ recv |
|
8648 |
and:[ master ~~ submenuProvider ]] ) ifTrue:[ |
|
8649 |
submenuHolder := self findSubMenuIn:master. |
|
8650 |
]. |
|
8651 |
t := master. |
|
8652 |
whoProvidedMenu := master. |
|
8653 |
] |
|
8654 |
]. |
|
8655 |
]. |
|
8656 |
]. |
|
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8657 |
"/ submenuHolder isNil ifTrue:[ |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8658 |
"/ self halt:'did not find any menu' |
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8659 |
"/ ]. |
3934 | 8660 |
|
8661 |
"/ appl := menuPanel application. |
|
8662 |
"/ appl isNil ifTrue:[ |
|
8663 |
"/ appl := menuPanel receiver. |
|
8664 |
"/ appl notNil ifTrue:[ |
|
8665 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
|
3938 | 8666 |
"/ [submenuHolder isNil |
3934 | 8667 |
"/ and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
8668 |
"/ and:[master ~~ appl]]] whileTrue:[ |
|
8669 |
"/ appl := master. |
|
8670 |
"/ submenuHolder := self findSubMenuIn:appl. |
|
8671 |
"/ ]. |
|
8672 |
"/ ] |
|
8673 |
"/ ]. |
|
8674 |
"/ ]. |
|
3938 | 8675 |
"/ submenuHolder isNil ifTrue:[ |
3934 | 8676 |
"/ (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
8677 |
"/ (recv := menuPanel receiver) ~~ appl ifTrue:[ |
|
8678 |
"/ appl := recv. |
|
8679 |
"/ submenuHolder := self findSubMenuIn:appl |
|
8680 |
"/ ] |
|
8681 |
"/ ] |
|
8682 |
"/ ] |
|
8683 |
]. |
|
8684 |
||
8685 |
(newSubmenu := submenuHolder value) isArray ifTrue:[ |
|
3938 | 8686 |
submenuEncoding := newSubmenu. |
8687 |
newSubmenu := Menu decodeFromLiteralArray:submenuEncoding. |
|
8688 |
"/ cg: linked menus also may contain translations ... |
|
8689 |
newSubmenu notNil ifTrue:[ |
|
8690 |
whoProvidedMenu "appl" notNil ifTrue:[ |
|
8691 |
newSubmenu findGuiResourcesIn:whoProvidedMenu "appl". |
|
8692 |
] |
|
8693 |
]. |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8694 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
8695 |
"/ appl notNil ifTrue:[submenu application:appl]. |
3934 | 8696 |
self submenu:newSubmenu. |
1130 | 8697 |
^ subMenu |
8698 |
||
3935
852001cc6bd5
no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents:
3934
diff
changeset
|
8699 |
"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
|
8700 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8701 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
8702 |
spaceBetweenEmptyLines |
3938 | 8703 |
^ 3 |
388 | 8704 |
! ! |
8705 |
||
8706 |
!MenuPanel::Item methodsFor:'queries'! |
|
8707 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8708 |
canChangeVisibility |
1699 | 8709 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 8710 |
otherwise there is a change notification raised if the model changed" |
8711 |
||
3122 | 8712 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 8713 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 8714 |
|
8715 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 8716 |
"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
|
8717 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
8718 |
|
388 | 8719 |
canSelect |
1699 | 8720 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 8721 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
8722 |
||
2362 | 8723 |
self isSeparator ifTrue:[^ false]. |
8724 |
||
8725 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
3938 | 8726 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
8727 |
^ true |
|
8728 |
]. |
|
1078 | 8729 |
]. |
8730 |
^ false |
|
388 | 8731 |
! |
8732 |
||
2046 | 8733 |
containsPoint:aPoint |
2870 | 8734 |
"returns true if aPoint is contained in my layout" |
8735 |
||
2046 | 8736 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8737 |
^ layout containsPoint:aPoint |
2046 | 8738 |
]. |
8739 |
^ false |
|
8740 |
||
8741 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
8742 |
! |
|
8743 |
||
388 | 8744 |
containsPointX:x y:y |
2870 | 8745 |
"returns true if point is contained in my layout" |
8746 |
||
712 | 8747 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8748 |
^ layout containsPointX:x y:y |
505 | 8749 |
]. |
8750 |
^ false |
|
388 | 8751 |
! |
8752 |
||
2199 | 8753 |
hasDelayedMenu |
2870 | 8754 |
"returns true if a delayed menu exists" |
8755 |
||
2360 | 8756 |
self hasSubmenu ifFalse:[ |
3938 | 8757 |
^ false |
2199 | 8758 |
]. |
2360 | 8759 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
8760 |
||
8761 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
3938 | 8762 |
^ false |
2199 | 8763 |
]. |
8764 |
^ true |
|
8765 |
! |
|
8766 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8767 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8768 |
"returns true if the item has a delayed menu |
2870 | 8769 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8770 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8771 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8772 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8773 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8774 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8775 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
8776 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8777 |
hasIndication |
2870 | 8778 |
"returns true if on/off indication exists" |
8779 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
8780 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8781 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
8782 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8783 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8784 |
"returns true if the item has a delayed menu |
2870 | 8785 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
8786 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8787 |
menuPanel isPopUpView ifFalse:[ |
3938 | 8788 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8789 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8790 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8791 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
8792 |
|
388 | 8793 |
hasSubmenu |
2870 | 8794 |
"returns true if the item is configured as an subMenu entry" |
3938 | 8795 |
|
2870 | 8796 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
388 | 8797 |
! |
8798 |
||
8799 |
isEnabled |
|
2870 | 8800 |
"returns the enabled state" |
8801 |
||
388 | 8802 |
^ self enabled |
8803 |
! |
|
8804 |
||
608 | 8805 |
isSeparator |
2870 | 8806 |
"returns true if item is a separator" |
8807 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8808 |
^ displayLabel isNil |
608 | 8809 |
! |
8810 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8811 |
isToggle |
2870 | 8812 |
"returns true if on/off indication exists" |
8813 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8814 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8815 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
8816 |
|
712 | 8817 |
isVisible |
2870 | 8818 |
"returns the visibility state" |
8819 |
||
712 | 8820 |
|state| |
8821 |
||
4757 | 8822 |
menuPanel isNil ifTrue:[^ false]. |
8823 |
||
712 | 8824 |
isVisible isSymbol ifTrue:[ |
4757 | 8825 |
state := self aspectAt:isVisible. |
8826 |
state isValueModel ifTrue:[ |
|
8827 |
isVisible := state. |
|
8828 |
isVisible addDependent:self. |
|
8829 |
]. |
|
712 | 8830 |
] ifFalse:[ |
4757 | 8831 |
state := isVisible |
4119
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8832 |
]. |
f5cb7a477fbe
Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents:
4118
diff
changeset
|
8833 |
^ state value ~~ false |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8834 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8835 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 8836 |
! |
8837 |
||
8838 |
isVisible:something |
|
2870 | 8839 |
"change the visibility state; if the state changed, a redraw is performed" |
8840 |
||
712 | 8841 |
|oldState newState| |
8842 |
||
8843 |
isVisible isNil ifTrue:[ |
|
3938 | 8844 |
oldState := true |
712 | 8845 |
] ifFalse:[ |
3938 | 8846 |
oldState := isVisible value. |
8847 |
isVisible isValueModel ifTrue:[ |
|
8848 |
isVisible removeDependent:self |
|
8849 |
] |
|
712 | 8850 |
]. |
8851 |
isVisible := something. |
|
8852 |
||
8853 |
isVisible isNil ifTrue:[ |
|
3938 | 8854 |
newState := true |
712 | 8855 |
] ifFalse:[ |
3938 | 8856 |
isVisible isValueModel ifTrue:[ |
8857 |
isVisible addDependent:self |
|
8858 |
] ifFalse:[ |
|
8859 |
isVisible isSymbol ifTrue:[^ self] |
|
8860 |
]. |
|
8861 |
menuPanel shown ifFalse:[^ self]. |
|
8862 |
newState := isVisible value. |
|
712 | 8863 |
]. |
8864 |
||
8865 |
newState ~~ oldState ifTrue:[ |
|
3938 | 8866 |
menuPanel mustRearrange |
712 | 8867 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8868 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
8869 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 8870 |
! |
8871 |
||
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8872 |
menuIndicatorContains:aPoint |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8873 |
"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
|
8874 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8875 |
|icon xSep| |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8876 |
|
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8877 |
(self isVisible and:[layout notNil]) ifTrue:[ |
3938 | 8878 |
(layout containsPoint:aPoint) ifTrue:[ |
8879 |
icon := self menuIndicatorIcon. |
|
8880 |
icon notNil ifTrue:[ |
|
8881 |
xSep := layout right - icon width. |
|
8882 |
^ aPoint x >= xSep |
|
8883 |
] |
|
8884 |
] |
|
3411
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8885 |
]. |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8886 |
^ false |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8887 |
! |
a7a58a10cdcd
extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents:
3403
diff
changeset
|
8888 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8889 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8890 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8891 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
8892 |
|
388 | 8893 |
shortcutKeyAsString |
3601 | 8894 |
"converts shortcutKey to a text object for the menu-label-hint. |
8895 |
returns nil, if the key has no assignment." |
|
2870 | 8896 |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8897 |
|shortcutKey| |
2359 | 8898 |
|
8899 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 8900 |
|
8901 |
shortcutKey isNil ifTrue:[ |
|
3938 | 8902 |
^ nil |
1609 | 8903 |
]. |
8904 |
shortcutKey isCharacter ifTrue:[ |
|
3938 | 8905 |
shortcutKey == Character space ifFalse:[ |
8906 |
^ 'Space' |
|
8907 |
]. |
|
8908 |
^ shortcutKey asString |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8909 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8910 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8911 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
8912 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 8913 |
! ! |
8914 |
||
8915 |
!MenuPanel::Item methodsFor:'selection'! |
|
8916 |
||
8917 |
isSelected |
|
2870 | 8918 |
"returns true if item is selected" |
1998 | 8919 |
|
8920 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 8921 |
! |
8922 |
||
2249 | 8923 |
isSelected:isSelected |
5127 | 8924 |
"change selection to a state. Depending on the state open or hide an existing |
2870 | 8925 |
submenu and perform a redraw" |
8926 |
||
2249 | 8927 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
5127 | 8928 |
self invalidate. |
8929 |
self hideSubmenu. |
|
8930 |
^ self |
|
2249 | 8931 |
]. |
8932 |
||
2199 | 8933 |
menuPanel realized ifFalse:[ ^ self ]. |
8934 |
||
2359 | 8935 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
5127 | 8936 |
self invalidate |
2199 | 8937 |
]. |
8938 |
self hasSubmenu ifFalse:[ ^ self]. |
|
8939 |
||
8940 |
self hasDelayedMenu ifTrue:[ |
|
5127 | 8941 |
menuPanel openDelayed:self |
2199 | 8942 |
] ifFalse:[ |
5127 | 8943 |
self setupSubmenu. |
8944 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
|
1701 | 8945 |
]. |
3133 | 8946 |
|
8947 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 8948 |
! ! |
8949 |
||
4755 | 8950 |
!MenuPanel::Item methodsFor:'testing'! |
8951 |
||
8952 |
isMenuItem |
|
8953 |
"return true, if the receiver is a menu item inside a MenuPanel, Menu or PopUpmenu. |
|
8954 |
true is returned here - I am a menuitem" |
|
8955 |
||
8956 |
^ true |
|
8957 |
! ! |
|
8958 |
||
2692 | 8959 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
8960 |
||
8961 |
argument2 |
|
8962 |
||
8963 |
^ argument2 |
|
8964 |
! |
|
8965 |
||
8966 |
argument2:anArgumentOrNil |
|
8967 |
||
8968 |
argument2 := anArgumentOrNil |
|
8969 |
! ! |
|
8970 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
8971 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 8972 |
|
2018 | 8973 |
icon |
4843 | 8974 |
^ self iconGrey |
8975 |
! ! |
|
8976 |
||
8977 |
!MenuPanel::ScrollActivity class methodsFor:'image specs'! |
|
8978 |
||
8979 |
iconBlack |
|
8980 |
"This resource specification was automatically generated |
|
8981 |
by the ImageEditor of ST/X." |
|
8982 |
||
8983 |
"Do not manually edit this!! If it is corrupted, |
|
8984 |
the ImageEditor may not be able to read the specification." |
|
8985 |
||
8986 |
" |
|
8987 |
self iconBlack inspect |
|
8988 |
ImageEditor openOnClass:self andSelector:#iconBlack |
|
8989 |
Icon flushCachedIcons |
|
8990 |
" |
|
8991 |
||
4587
aab0e076929e
Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents:
4556
diff
changeset
|
8992 |
<resource: #image> |
4843 | 8993 |
|
8994 |
^Icon |
|
8995 |
constantNamed:'MenuPanel::ScrollActivity iconBlack' |
|
8996 |
ifAbsentPut:[(Depth1Image width:11 height:11) bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') colorMapFromArray:#[0 0 0 255 255 255] mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a'); yourself); yourself] |
|
8997 |
! |
|
8998 |
||
8999 |
iconGrey |
|
2016 | 9000 |
"This resource specification was automatically generated |
9001 |
by the ImageEditor of ST/X." |
|
4843 | 9002 |
|
9003 |
"Do not manually edit this!! If it is corrupted, |
|
9004 |
the ImageEditor may not be able to read the specification." |
|
9005 |
||
9006 |
" |
|
9007 |
self iconGrey inspect |
|
9008 |
ImageEditor openOnClass:self andSelector:#iconGrey |
|
9009 |
Icon flushCachedIcons |
|
9010 |
" |
|
9011 |
||
9012 |
<resource: #image> |
|
9013 |
||
9014 |
^Icon |
|
9015 |
constantNamed:'MenuPanel::ScrollActivity iconGrey' |
|
9016 |
ifAbsentPut:[(Depth1Image width:11 height:11) bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') colorMapFromArray:#[91 91 91 255 255 255] mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a'); yourself); yourself] |
|
9017 |
! |
|
9018 |
||
9019 |
iconGrey3D |
|
9020 |
"This resource specification was automatically generated |
|
9021 |
by the ImageEditor of ST/X." |
|
9022 |
||
9023 |
"Do not manually edit this!! If it is corrupted, |
|
9024 |
the ImageEditor may not be able to read the specification." |
|
9025 |
||
9026 |
" |
|
9027 |
self iconGrey inspect |
|
9028 |
ImageEditor openOnClass:self andSelector:#iconGrey |
|
9029 |
Icon flushCachedIcons |
|
9030 |
" |
|
9031 |
||
9032 |
<resource: #image> |
|
9033 |
||
9034 |
^Icon |
|
9035 |
constantNamed:'MenuPanel::ScrollActivity iconGrey' |
|
9036 |
ifAbsentPut:[(Depth1Image width:11 height:11) bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') colorMapFromArray:#[91 91 91 255 255 255] mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a'); yourself); yourself] |
|
9037 |
! |
|
9038 |
||
9039 |
iconScrollLeft |
|
9040 |
"This resource specification was automatically generated |
|
9041 |
by the ImageEditor of ST/X." |
|
9042 |
||
2016 | 9043 |
"Do not manually edit this!! If it is corrupted, |
9044 |
the ImageEditor may not be able to read the specification." |
|
4843 | 9045 |
|
2016 | 9046 |
" |
4843 | 9047 |
self iconScrollLeft inspect |
9048 |
ImageEditor openOnClass:self andSelector:#iconScrollLeft |
|
9049 |
Icon flushCachedIcons |
|
9050 |
" |
|
9051 |
||
9052 |
<resource: #image> |
|
9053 |
||
9054 |
^Icon |
|
9055 |
constantNamed:'MenuPanel::ScrollActivity iconScrollLeft' |
|
9056 |
ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:' |
|
9057 |
@@@@@@@@@@@@@@@@@@@@@@@1H14@@@@@@@@@@A4R@A@@@@@@@@@@J@8I@" @@@@@@@@ B28)@Q8@@@@@@A$$F!! FG @@@@@@C@P,E (^@@@@@@@@CAPWA2,@ |
|
9058 |
@@@@@@@@@@L%D2X"@@@@@@@@@@@HCPT[EP@@@@@@@@@@BB<*G0X@@@@@@@@@@@0''KP<@@@@@@@@@@C@\K"@@@@@@@@@@@@@^DQ8@@@@@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@@G@@<@G0@?@G8@?@C8@G0@O @_@@<@C0@G@@@a'); yourself); yourself] |
|
9059 |
! |
|
9060 |
||
9061 |
iconScrollLeftM |
|
9062 |
"This resource specification was automatically generated |
|
9063 |
by the ImageEditor of ST/X." |
|
9064 |
||
9065 |
"Do not manually edit this!! If it is corrupted, |
|
9066 |
the ImageEditor may not be able to read the specification." |
|
9067 |
||
9068 |
" |
|
9069 |
self iconScrollLeftM inspect |
|
9070 |
ImageEditor openOnClass:self andSelector:#iconScrollLeftM |
|
9071 |
Icon flushCachedIcons |
|
9072 |
" |
|
9073 |
||
9074 |
<resource: #image> |
|
9075 |
||
9076 |
^Icon |
|
9077 |
constantNamed:'MenuPanel::ScrollActivity iconScrollLeftM' |
|
9078 |
ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:' |
|
9079 |
@@@@@@@@@@@@@@@@@@@@@@@1H14@@A4@@@@@@A4R@A@@@@@]@@@@J@8I@ @]@A4@@@@ B28)@Q8@GP@@@A$$F!! FG @]@A4@C@P,E (^GQ4@GP@]CAPWA2,] |
|
9080 |
GP@]@A4@@@L%D2X"GQ4@GP@@@@@HCPT[EP@]@A4@@@@@BB<*G0X@GP@]@@@@@@0''KP<]@A4@@@@@@@@\K"@@GP@@@@@@@@@@DQ8]@A4@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@@GH@<PG*@?PG: ?5C>(G=@O*@_T@> A4@C(@@a'); yourself); yourself] |
|
9081 |
! |
|
9082 |
||
9083 |
iconScrollRight |
|
9084 |
"This resource specification was automatically generated |
|
9085 |
by the ImageEditor of ST/X." |
|
9086 |
||
9087 |
"Do not manually edit this!! If it is corrupted, |
|
9088 |
the ImageEditor may not be able to read the specification." |
|
9089 |
||
9090 |
" |
|
9091 |
self iconScrollRight inspect |
|
9092 |
ImageEditor openOnClass:self andSelector:#iconScrollRight |
|
9093 |
Icon flushCachedIcons |
|
9094 |
" |
|
9095 |
||
9096 |
<resource: #image> |
|
9097 |
||
9098 |
^Icon |
|
9099 |
constantNamed:'MenuPanel::ScrollActivity iconScrollRight' |
|
9100 |
ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:' |
|
9101 |
@@@@@@@@@@@@@@@@@@@@@A4#LP@@@@@@@@@@@A@@D!!4@@@@@@@@@@B BBP8(@@@@@@@@@A8AJR8KH@@@@@@@@@@^A!! ZIA$@@@@@@@@@G (VK@PL@@@@@@@@ |
|
9102 |
@B,GE1PL@@@@@@@@H"XSIPL@@@@@@@@UF0TMB@@@@@@@@@X_J"<H@@@@@@@@@@<-I00@@@@@@@@@@B@.GC@@@@@@@@@@@A8QG @@@@@@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@@N@@<@C8@O0@_ @?@A<@O A<@O @<@C0@N@@@a'); yourself); yourself] |
|
9103 |
! |
|
9104 |
||
9105 |
iconScrollRightM |
|
9106 |
"This resource specification was automatically generated |
|
9107 |
by the ImageEditor of ST/X." |
|
9108 |
||
9109 |
"Do not manually edit this!! If it is corrupted, |
|
9110 |
the ImageEditor may not be able to read the specification." |
|
9111 |
||
9112 |
" |
|
9113 |
self iconScrollRightM inspect |
|
9114 |
ImageEditor openOnClass:self andSelector:#iconScrollRightM |
|
9115 |
Icon flushCachedIcons |
|
9116 |
" |
|
9117 |
||
9118 |
<resource: #image> |
|
9119 |
||
9120 |
^Icon |
|
9121 |
constantNamed:'MenuPanel::ScrollActivity iconScrollRightM' |
|
9122 |
ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:' |
|
9123 |
@@@@@@@@@@@@@@@@@A4@@A4#LP@@@@@@GP@@@A@@D!!4@@@@@@A4@GP@BBP8(@@@@@@@]@A8AJR8KH@@@@A4@GP@^A!! ZIA$@GP@]@A4]G (VK@PL@A4@GP@] |
|
9124 |
GR,GE1PL@@@]@A4]H"XSIPL@@A4@GP@UF0TMB@@@GP@]@@X_J"<H@@@@@A4@GP<-I00@@@@@@@@]@B@.G@@@@@@@@A4@GQ8Q@@@@@@@@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@AN@H<@U8@/0E_ +?AW<B? U<B/ E<@K A\@@@a'); yourself); yourself] |
|
2016 | 9125 |
! ! |
9126 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
9127 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 9128 |
|
9129 |
new |
|
9130 |
^ self basicNew initialize |
|
9131 |
! ! |
|
9132 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
9133 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 9134 |
|
9135 |
activeMenu |
|
9136 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 9137 |
is returned if scrolling is deactivated" |
9138 |
||
2016 | 9139 |
^ activeMenu |
9140 |
! |
|
9141 |
||
9142 |
direction |
|
2870 | 9143 |
"returns the scroll-direction" |
9144 |
||
2016 | 9145 |
^ direction |
9146 |
! |
|
9147 |
||
9148 |
iconAt:aDirection on:aMenu |
|
5001 | 9149 |
|icon menusDevice index| |
9150 |
||
9151 |
menusDevice := aMenu device. |
|
2016 | 9152 |
|
9153 |
aDirection == #PREV ifTrue:[ |
|
5001 | 9154 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
9155 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 9156 |
] ifFalse:[ |
5001 | 9157 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
9158 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 9159 |
]. |
9160 |
||
9161 |
icon := icons at:index. |
|
9162 |
||
5001 | 9163 |
(icon isNil or:[icon device ~~ menusDevice]) ifTrue:[ |
9164 |
icon := self class icon. |
|
9165 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
9166 |
ifFalse:[ icon := icon copy ]. |
|
9167 |
||
9168 |
icon := icon onDevice:menusDevice. |
|
9169 |
icons at:index put:icon |
|
2018 | 9170 |
]. |
9171 |
^ icon |
|
2016 | 9172 |
! ! |
9173 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
9174 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 9175 |
|
9176 |
initialize |
|
9177 |
||
4173 | 9178 |
semaLock := RecursionLock new name:'MenuPanel ScrollActivity'. |
2018 | 9179 |
icons := Array new:4. |
2016 | 9180 |
! ! |
9181 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
9182 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 9183 |
|
9184 |
isActive |
|
2870 | 9185 |
"returns true if scrolling is activated" |
9186 |
||
2016 | 9187 |
^ activeMenu notNil |
9188 |
! ! |
|
9189 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
9190 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 9191 |
|
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
9192 |
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress |
2870 | 9193 |
"start scrolling; returns true if scrolling is activated" |
9194 |
||
4826 | 9195 |
|isScrolledMenu| |
9196 |
"/true ifTrue:[^ self __startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress]. |
|
2860 | 9197 |
|
9198 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 9199 |
|
4826 | 9200 |
semaLock critical:[ |bounds boundsOnRoot| |
9201 |
self stop. |
|
9202 |
||
9203 |
(aMenu notNil and:[aMenu shown and:[aMenu hasScrollerAt:aDirection]]) ifTrue:[ |
|
9204 |
bounds := aMenu scrollerBoundsAt:aDirection. |
|
9205 |
||
9206 |
comesViaButtonPress ifFalse:[ |
|
9207 |
boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu) |
|
9208 |
extent:(bounds extent). |
|
9209 |
]. |
|
9210 |
"clear selection" |
|
9211 |
aMenu selection:nil openMenu:false. |
|
9212 |
||
9213 |
activeMenu := aMenu. |
|
9214 |
direction := aDirection. |
|
9215 |
||
9216 |
(aMenu hasScrollerAt:aDirection) ifTrue:[ |
|
9217 |
scrollTask := |
|
9218 |
[ |
|
9219 |
|continue| |
|
9220 |
||
9221 |
[ |
|
9222 |
aDirection == #PREV ifTrue:[aMenu scrollUp] ifFalse:[aMenu scrollDown]. |
|
9223 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
9224 |
||
9225 |
[ |
|
9226 |
continue := aMenu shown. |
|
9227 |
||
9228 |
boundsOnRoot notNil ifTrue:[ |
|
9229 |
continue ifTrue:[ |
|
9230 |
continue := boundsOnRoot containsPoint:aMenu sensor mousePoint. |
|
9231 |
] ifFalse:[ |
|
9232 |
boundsOnRoot := nil. |
|
9233 |
] |
|
9234 |
]. |
|
9235 |
continue |
|
9236 |
] whileTrue:[ |
|
9237 |
aDirection == #PREV ifTrue:[aMenu scrollUp] ifFalse:[aMenu scrollDown]. |
|
9238 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
9239 |
]. |
|
9240 |
] ensure:[ |
|
9241 |
activeMenu := direction := scrollTask := nil. |
|
9242 |
aMenu invalidate:bounds. |
|
9243 |
]. |
|
9244 |
] forkAt:8. |
|
9245 |
] ifFalse:[ |
|
9246 |
aMenu invalidate:bounds. |
|
9247 |
]. |
|
9248 |
]. |
|
9249 |
]. |
|
9250 |
^ scrollTask notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
9251 |
|
2048 | 9252 |
"Created: ca" |
9253 |
||
9254 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 9255 |
! |
9256 |
||
9257 |
stop |
|
2870 | 9258 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
9259 |
||
2016 | 9260 |
|task resp| |
9261 |
||
9262 |
activeMenu isNil ifTrue:[ |
|
3938 | 9263 |
^ false |
2016 | 9264 |
]. |
3295
53616022ca5f
activate scroller if button is pressed and moved over scroller
ca
parents:
3246
diff
changeset
|
9265 |
|
2016 | 9266 |
semaLock critical:[ |
3938 | 9267 |
resp := activeMenu notNil. |
9268 |
||
9269 |
(task := scrollTask) notNil ifTrue:[ |
|
9270 |
scrollTask := nil. |
|
9271 |
||
9272 |
Error handle:[:ex| |
|
9273 |
] do:[ |
|
9274 |
task terminateWithAllSubprocessesInGroup. |
|
9275 |
task waitUntilTerminated. |
|
9276 |
]. |
|
9277 |
]. |
|
9278 |
activeMenu := direction := nil. |
|
2016 | 9279 |
]. |
9280 |
^ resp |
|
9281 |
! ! |
|
9282 |
||
388 | 9283 |
!MenuPanel class methodsFor:'documentation'! |
9284 |
||
4109 | 9285 |
version |
4786 | 9286 |
^ '$Header$' |
4109 | 9287 |
! |
9288 |
||
3780 | 9289 |
version_CVS |
4786 | 9290 |
^ '$Header$' |
5024
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
9291 |
! |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
9292 |
|
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
9293 |
version_HG |
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
9294 |
|
228412f59c2c
Issue #78: Do not show confusing error message when in UI painter mode
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5009
diff
changeset
|
9295 |
^ '$Changeset: <not expanded> $' |
388 | 9296 |
! ! |
2199 | 9297 |
|
4167 | 9298 |
|
388 | 9299 |
MenuPanel initialize! |