author | ca |
Mon, 05 Mar 2007 13:46:53 +0100 | |
changeset 3192 | a64a9c9143c4 |
parent 3189 | a2e61ce4a7cb |
child 3203 | 97d6c1d7b7d7 |
permissions | -rw-r--r-- |
2005 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 3 |
All Rights Reserved |
2005 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1750 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
2182
59a770bbb95a
changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
14 |
View subclass:#MenuPanel |
3147 | 15 |
instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu |
16 |
shortKeyInset selection items groupSizes receiver enabled |
|
17 |
lastActiveMenu enteredItem prevFocusView previousPointerGrab |
|
18 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
|
19 |
scrollActivity rightArrowShadow rightArrow fgColor verticalLayout |
|
20 |
showSeparatingLines showGroupDivider implicitGrabView |
|
21 |
lastPointerView openDelayedMenuBlock preferredWidth application |
|
22 |
originator centerItems hideOnRelease defaultHideOnRelease |
|
23 |
buttonInsetX buttonInsetY itemSpace activeBackgroundColor |
|
24 |
stringOffsetX' |
|
25 |
classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages |
|
26 |
DefaultForegroundColor DefaultBackgroundColor IconIndicationOn |
|
27 |
IconIndicationOff IconRadioOn IconRadioOff |
|
28 |
IconDisabledIndicationOn IconDisabledIndicationOff |
|
29 |
IconDisabledRadioOn IconDisabledRadioOff' |
|
30 |
poolDictionaries:'' |
|
31 |
category:'Views-Menus' |
|
388 | 32 |
! |
33 |
||
34 |
Object subclass:#Item |
|
3147 | 35 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
36 |
disabledDisplayLabel enableChannel label activeHelpText |
|
37 |
flyByHelpText isVisible indication choice accessCharacter' |
|
38 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
|
39 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:MenuPanel |
|
388 | 42 |
! |
43 |
||
2692 | 44 |
Object subclass:#Adornment |
3147 | 45 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
46 |
choice choiceValue' |
|
47 |
classVariableNames:'' |
|
48 |
poolDictionaries:'' |
|
49 |
privateIn:MenuPanel::Item |
|
2692 | 50 |
! |
51 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
52 |
Object subclass:#ScrollActivity |
3147 | 53 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
54 |
classVariableNames:'' |
|
55 |
poolDictionaries:'' |
|
56 |
privateIn:MenuPanel |
|
2016 | 57 |
! |
58 |
||
388 | 59 |
!MenuPanel class methodsFor:'documentation'! |
60 |
||
2005 | 61 |
copyright |
62 |
" |
|
63 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3147 | 64 |
All Rights Reserved |
2005 | 65 |
|
66 |
This software is furnished under a license and may be used |
|
67 |
only in accordance with the terms of that license and with the |
|
68 |
inclusion of the above copyright notice. This software may not |
|
69 |
be provided or otherwise made available to, or used by, any |
|
70 |
other person. No title to or ownership of the software is |
|
71 |
hereby transferred. |
|
72 |
" |
|
73 |
||
388 | 74 |
! |
75 |
||
76 |
documentation |
|
77 |
" |
|
78 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
79 |
||
2170 | 80 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 81 |
(and hopefully be ST-80 compatible ...) |
82 |
||
502 | 83 |
To create a menu, there exists a MenuEditor which will generate |
84 |
a menu specification. |
|
85 |
||
86 |
||
2061 | 87 |
Notice: |
88 |
This is going to replace the obsolete MenuView. |
|
89 |
||
388 | 90 |
[author:] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
91 |
Claus Atzkern |
388 | 92 |
|
93 |
[see also:] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
94 |
Menu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
95 |
MenuItem |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
96 |
MenuEditor |
2170 | 97 |
|
98 |
cg: this code is so ugly - needs a complete rewrite... |
|
99 |
||
388 | 100 |
" |
101 |
! |
|
102 |
||
103 |
examples |
|
104 |
||
105 |
" |
|
106 |
start as PullDownMenu |
|
3147 | 107 |
[exBegin] |
388 | 108 |
|top subView mview desc s1 s2 s3 img lbs labels| |
109 |
||
110 |
top := StandardSystemView new. |
|
111 |
||
436 | 112 |
mview := MenuPanel in:top. |
388 | 113 |
|
502 | 114 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 115 |
mview level:2. |
116 |
mview verticalLayout:false. |
|
117 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 118 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 119 |
mview labels:lbs. |
120 |
mview shortcutKeyAt:2 put:#Cut. |
|
121 |
mview accessCharacterPositionAt:1 put:1. |
|
122 |
mview accessCharacterPositionAt:2 put:2. |
|
123 |
||
124 |
mview enabledAt:5 put:false. |
|
125 |
mview groupSizes:#( 2 2 ). |
|
436 | 126 |
s1 := MenuPanel labels:labels. |
388 | 127 |
s1 accessCharacterPositionAt:1 put:1. |
128 |
s1 accessCharacterPositionAt:2 put:2. |
|
129 |
s1 groupSizes:#( 2 2 ). |
|
436 | 130 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
131 |
s3 := MenuPanel labels:lbs. |
|
388 | 132 |
|
133 |
s1 subMenuAt:2 put:s2. |
|
436 | 134 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 135 |
s2 subMenuAt:3 put:s3. |
436 | 136 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 137 |
s3 shortcutKeyAt:3 put:$q. |
138 |
||
139 |
mview subMenuAt:1 put:s1. |
|
436 | 140 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 141 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
142 |
s1 shortcutKeyAt:1 put:#Copy. |
|
143 |
s1 shortcutKeyAt:3 put:#Paste. |
|
144 |
||
436 | 145 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 146 |
top extent:(mview preferredExtent). |
388 | 147 |
top open. |
3147 | 148 |
[exEnd] |
149 |
||
150 |
[exBegin] |
|
1767 | 151 |
|top menu view item| |
152 |
||
153 |
top := StandardSystemView extent:240@100. |
|
154 |
menu := MenuPanel in:top. |
|
155 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
156 |
menu verticalLayout:false. |
|
157 |
||
158 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
159 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
160 |
||
161 |
view := ClockView new. |
|
162 |
view preferredExtent:100@100. |
|
163 |
item := menu itemAt:3. |
|
164 |
item submenu:view. |
|
165 |
||
166 |
view := SimpleView new. |
|
167 |
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new). |
|
168 |
view preferredExtent:(400@50). |
|
169 |
item := menu itemAt:2. |
|
170 |
item submenu:view. |
|
171 |
||
172 |
menu origin:0@0 corner:1.0@30. |
|
173 |
top open. |
|
3147 | 174 |
[exEnd] |
388 | 175 |
|
176 |
||
177 |
start as PopUpMenu |
|
3147 | 178 |
[exBegin] |
388 | 179 |
|subView mview desc s1 s2 s3 img lbs labels| |
180 |
||
436 | 181 |
mview := MenuPanel new. |
502 | 182 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 183 |
mview level:2. |
184 |
||
185 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 186 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 187 |
mview labels:lbs. |
188 |
||
436 | 189 |
s1 := MenuPanel labels:labels. |
190 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
191 |
s3 := MenuPanel labels:lbs. |
|
388 | 192 |
s1 subMenuAt:2 put:s2. |
436 | 193 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 194 |
s2 subMenuAt:3 put:s3. |
436 | 195 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 196 |
s3 shortcutKeyAt:3 put:$q. |
197 |
||
198 |
mview subMenuAt:1 put:s1. |
|
436 | 199 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 200 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
201 |
s1 shortcutKeyAt:1 put:#Copy. |
|
202 |
s1 shortcutKeyAt:3 put:#Paste. |
|
203 |
||
436 | 204 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 205 |
mview startUp |
3147 | 206 |
[exEnd] |
388 | 207 |
|
208 |
||
209 |
start from menu spec |
|
3147 | 210 |
[exBegin] |
388 | 211 |
|menu| |
212 |
||
436 | 213 |
menu := MenuPanel menu: |
3147 | 214 |
#(#Menu #( #(#MenuItem |
215 |
#label: 'File' |
|
216 |
#submenu: |
|
217 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
218 |
(#MenuItem |
|
219 |
#label: 'edit' |
|
220 |
#submenu: |
|
221 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
222 |
#(#MenuItem #label: 'close' #value:#close) |
|
223 |
) |
|
224 |
nil |
|
225 |
nil |
|
226 |
) |
|
227 |
) |
|
228 |
#(#MenuItem #label: 'help' #value:#help ) |
|
229 |
) |
|
230 |
nil |
|
231 |
nil |
|
232 |
) |
|
233 |
) |
|
234 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
235 |
#(#MenuItem #label: 'Bar' |
|
236 |
#submenu: |
|
237 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
238 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
239 |
) |
|
240 |
nil |
|
241 |
nil |
|
242 |
) |
|
243 |
) |
|
244 |
) |
|
245 |
#( 2 ) |
|
246 |
nil |
|
247 |
) decodeAsLiteralArray. |
|
388 | 248 |
|
249 |
menu verticalLayout:false. |
|
250 |
Transcript showCR:(menu startUp). |
|
3147 | 251 |
[exEnd] |
388 | 252 |
|
253 |
" |
|
254 |
||
255 |
! ! |
|
256 |
||
257 |
!MenuPanel class methodsFor:'instance creation'! |
|
258 |
||
259 |
fromSpec:aSpec |
|
260 |
^ self fromSpec:aSpec receiver:nil |
|
261 |
! |
|
262 |
||
263 |
fromSpec:aSpec receiver:aReceiver |
|
264 |
|menu| |
|
265 |
||
266 |
aSpec notNil ifTrue:[ |
|
3147 | 267 |
menu := Menu new. |
268 |
menu receiver:aReceiver. |
|
269 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 270 |
]. |
271 |
^ self menu:menu receiver:aReceiver |
|
272 |
! |
|
273 |
||
274 |
labels:labels |
|
275 |
^ self labels:labels nameKeys:nil receiver:nil |
|
276 |
! |
|
277 |
||
278 |
labels:labels nameKeys:nameKeys |
|
279 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
280 |
! |
|
281 |
||
282 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
283 |
|mview| |
|
284 |
||
285 |
mview := self menu:nil receiver:aReceiver. |
|
286 |
mview labels:labels. |
|
287 |
mview nameKeys:nameKeys. |
|
288 |
^ mview |
|
289 |
||
290 |
! |
|
291 |
||
502 | 292 |
labels:labels receiver:aReceiver |
293 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
294 |
! |
|
295 |
||
388 | 296 |
menu:aMenu |
297 |
^ self menu:aMenu receiver:nil |
|
298 |
! |
|
299 |
||
300 |
menu:aMenu receiver:aReceiver |
|
301 |
|mview| |
|
302 |
||
303 |
mview := self new. |
|
1955 | 304 |
|
305 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
3147 | 306 |
"/ no receiver specified in the menu; thus set the receiver immediately |
307 |
mview receiver:aReceiver |
|
1955 | 308 |
]. |
309 |
||
388 | 310 |
mview menu:aMenu. |
311 |
||
1955 | 312 |
|
388 | 313 |
"/ a menu itself may contain a receiver |
314 |
"/ thus we do not overwrite the receiver |
|
315 |
||
316 |
aReceiver notNil ifTrue:[ |
|
3147 | 317 |
mview receiver:aReceiver |
388 | 318 |
]. |
319 |
^ mview |
|
320 |
! ! |
|
321 |
||
322 |
!MenuPanel class methodsFor:'class initialization'! |
|
323 |
||
324 |
initialize |
|
325 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
2253 | 326 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 327 |
]. |
328 |
||
2715 | 329 |
" |
330 |
self initialize |
|
331 |
" |
|
332 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
333 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 334 |
! |
335 |
||
336 |
preSnapshot |
|
2715 | 337 |
"remove all resources" |
338 |
||
794 | 339 |
Images := nil. |
340 |
LigthenedImages := nil. |
|
616 | 341 |
! ! |
342 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
343 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
344 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
345 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
346 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
347 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
348 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
349 |
"Do not manually edit this!! If it is corrupted, |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
350 |
the ImageEditor may not be able to read the specification." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
351 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
352 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
353 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
355 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
356 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
357 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
358 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
359 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
360 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
361 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
362 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
363 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
364 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
365 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
366 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
367 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
368 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
369 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
370 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
371 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
372 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
373 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
375 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
376 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
377 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
378 |
|
2755 | 379 |
IconDisabledIndicationOff isNil ifTrue:[ |
380 |
IconDisabledIndicationOff := Icon |
|
381 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
|
382 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
383 |
]. |
|
384 |
^ IconDisabledIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
385 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
386 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
387 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
388 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
390 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
391 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
392 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
393 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
394 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
395 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
396 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
397 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
398 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
399 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
400 |
|
2755 | 401 |
IconDisabledIndicationOn isNil ifTrue:[ |
402 |
IconDisabledIndicationOn := Icon |
|
403 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
|
404 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
405 |
]. |
|
406 |
^ IconDisabledIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
407 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
408 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
409 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
410 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
411 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
415 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
416 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
417 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
418 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
419 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
420 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
422 |
|
2752 | 423 |
IconIndicationOff isNil ifTrue:[ |
424 |
IconIndicationOff := Icon |
|
425 |
constantNamed:#'MenuPanel iconIndicationOff' |
|
426 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
427 |
]. |
|
428 |
^ IconIndicationOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
429 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
430 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
431 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
432 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
433 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
434 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
435 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
436 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
437 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
438 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
439 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
440 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
441 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
442 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
443 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
444 |
|
2752 | 445 |
IconIndicationOn isNil ifTrue:[ |
446 |
IconIndicationOn := Icon |
|
447 |
constantNamed:#'MenuPanel iconIndicationOn' |
|
448 |
ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself] |
|
449 |
]. |
|
450 |
^ IconIndicationOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
451 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
452 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
453 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
454 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
455 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
456 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
457 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
459 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
460 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
461 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
462 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
463 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
464 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
465 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
466 |
|
2755 | 467 |
IconDisabledRadioOff isNil ifTrue:[ |
468 |
IconDisabledRadioOff := Icon |
|
469 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
|
470 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DZ**(AJ**+AJ***LR***#D***(1J***LR***#AZ**#@Z**(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
471 |
]. |
|
472 |
^ IconDisabledRadioOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
473 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
474 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
475 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
476 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
477 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
478 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
479 |
"Do not manually edit this!! If it is corrupted, |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
480 |
the ImageEditor may not be able to read the specification." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
481 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
482 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
483 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
484 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 485 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
486 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
487 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
488 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
489 |
|
2755 | 490 |
IconDisabledRadioOn isNil ifTrue:[ |
491 |
IconDisabledRadioOn := Icon |
|
492 |
constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
|
493 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DYUZ(AIUU+AIUUVLRUUU#D%UUX1IUUVLRUUU#AYUU#@Z%U(0A** 0@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
494 |
]. |
|
495 |
^ IconDisabledRadioOn |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
496 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
497 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
498 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
499 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
500 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
501 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
502 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
503 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
504 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
505 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
506 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
507 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
508 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
509 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
510 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
511 |
|
2754 | 512 |
IconRadioOff isNil ifTrue:[ |
513 |
IconRadioOff := Icon |
|
514 |
constantNamed:#'MenuPanel iconRadioGroupOff' |
|
515 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D_?>(AO??;AO???LS???3D???<1O???LS???3A_??3@Z??<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
516 |
]. |
|
517 |
^ IconRadioOff |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
518 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
519 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
520 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
521 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
522 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
523 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
524 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
525 |
the ImageEditor may not be able to read the specification." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
526 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
527 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
528 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
529 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
530 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
531 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
532 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
533 |
|
2754 | 534 |
IconRadioOn isNil ifTrue:[ |
535 |
IconRadioOn := Icon |
|
536 |
constantNamed:#'MenuPanel iconRadioGroupOn' |
|
537 |
ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D]@^(AL@@;AM@@GLS@@@3D0@@L1L@@CLSP@A3A\@@3@Z4A<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself] |
|
538 |
]. |
|
539 |
^ IconRadioOn |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
540 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
541 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
542 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
543 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
544 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
545 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
546 |
"Do not manually edit this!! If it is corrupted, |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
547 |
the ImageEditor may not be able to read the specification." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
548 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
549 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
550 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
551 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
552 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
553 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
554 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
555 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
556 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
557 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
558 |
constantNamed:#'MenuPanel::Item class menuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
559 |
ifAbsentPut:[(Depth1Image new) width: 7; height: 4; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@B@0 @a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 4; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?''08D@@a') ; yourself); yourself] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
560 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
561 |
|
616 | 562 |
!MenuPanel class methodsFor:'defaults'! |
450 | 563 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
564 |
defaultBackgroundColor |
2609 | 565 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 566 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
567 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
568 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
569 |
defaultLevel |
2372 | 570 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
571 |
" |
|
572 |
self defaultLevel |
|
573 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
574 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
575 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
576 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
577 |
"returns an additional offset between the label and the |
2715 | 578 |
delayedMenu indication (i.e. the down-arrow icon)" |
579 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
580 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
581 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
582 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
583 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
584 |
"returns an additional offset between the label and the |
2715 | 585 |
delayedMenu indication (i.e. the down-arrow icon)" |
586 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
587 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
588 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
589 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
590 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
591 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
592 |
ex: |
2715 | 593 |
&File mnemonic := Cmdf |
594 |
F&ile mnemonic := Cmdi |
|
595 |
....." |
|
596 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
597 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
598 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
599 |
|
450 | 600 |
updateStyleCache |
2777 | 601 |
"extract values from the styleSheet and cache them in class variables" |
657 | 602 |
|
2219 | 603 |
<resource: #style ( |
604 |
#'popup.borderWidth' #'popup.level' |
|
605 |
#'selection.disabledForegroundColor' |
|
606 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
607 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
2883 | 608 |
#'menu.itemSpace' #'menu.buttonItemVerticalSpace' |
2219 | 609 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
610 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
611 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
612 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
613 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
614 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
615 |
#'menu.selectionFollowsMouse' |
|
616 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
617 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
618 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
619 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
2752 | 620 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
2754 | 621 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
622 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
|
623 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
|
2755 | 624 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
625 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
|
626 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
|
627 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
|
2219 | 628 |
)> |
629 |
||
630 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 631 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 632 |
|
2611 | 633 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
634 |
which returns the default cashed DefaultBackgroundColor |
|
635 |
" |
|
636 |
DefaultBackgroundColor := nil. |
|
637 |
||
2219 | 638 |
MenuView updateStyleCache. |
639 |
SelectionInListView updateStyleCache. |
|
1699 | 640 |
|
2372 | 641 |
styleSheet := StyleSheet. |
642 |
style := styleSheet name. |
|
643 |
||
2607 | 644 |
DefaultFont := MenuView defaultFont. |
2883 | 645 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' |
646 |
default:[styleSheet |
|
647 |
colorAt:#'menu.foregroundColor' |
|
648 |
default:Color black]. |
|
2609 | 649 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
2219 | 650 |
|
651 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 652 |
var isNil ifTrue:[ |
2219 | 653 |
style == #motif ifTrue:[ var := backgroundColor ] |
654 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
655 |
]. |
|
656 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
657 |
||
658 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 659 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 660 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
661 |
||
662 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 663 |
var isNil ifTrue:[ |
2219 | 664 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 665 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 666 |
]. |
667 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
668 |
||
669 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 670 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 671 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
672 |
||
673 |
||
674 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 675 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 676 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
677 |
||
678 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 679 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 680 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
681 |
||
682 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
683 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
684 |
||
685 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
686 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
687 |
||
688 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 689 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 690 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
691 |
]. |
|
692 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
693 |
||
694 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 695 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 696 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
697 |
||
698 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 699 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 700 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
701 |
||
702 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 703 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 704 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
705 |
||
706 |
Item updateStyleCache. |
|
2607 | 707 |
|
2754 | 708 |
getBitmapOrFile := [:key :fileKey | |
709 |
|var| |
|
710 |
||
711 |
var := styleSheet at:key ifAbsent:nil. |
|
712 |
var isNil ifTrue:[ |
|
713 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
2752 | 714 |
var notNil ifTrue:[ |
2754 | 715 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
2752 | 716 |
]. |
717 |
]. |
|
2754 | 718 |
var |
719 |
]. |
|
720 |
||
2883 | 721 |
IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
722 |
IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
723 |
IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
|
724 |
IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
725 |
||
726 |
IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
|
727 |
IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
728 |
IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
|
729 |
IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
2752 | 730 |
|
2607 | 731 |
" |
732 |
self updateStyleCache |
|
733 |
" |
|
388 | 734 |
! ! |
735 |
||
794 | 736 |
!MenuPanel class methodsFor:'image registration'! |
737 |
||
738 |
image:anImage onDevice:aDevice |
|
739 |
" |
|
740 |
Images := nil |
|
741 |
" |
|
2269 | 742 |
|deviceImages| |
794 | 743 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
744 |
anImage device == aDevice ifTrue:[ |
2269 | 745 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
746 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
747 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
748 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 749 |
|
1097 | 750 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 751 |
Images at:aDevice put:(deviceImages := Dictionary new) |
752 |
]. |
|
753 |
||
754 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
755 |
image := anImage copy onDevice:aDevice. |
|
756 |
image clearMaskedPixels. |
|
757 |
deviceImages at:anImage put:image. |
|
758 |
image |
|
759 |
]. |
|
794 | 760 |
! |
761 |
||
762 |
lightenedImage:anImage onDevice:aDevice |
|
763 |
" |
|
764 |
LigthenedImages := nil |
|
765 |
" |
|
2374 | 766 |
|deviceImages image colorMap| |
794 | 767 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
768 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 769 |
|
1097 | 770 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 771 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 772 |
]. |
773 |
||
774 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 775 |
^ image |
776 |
]. |
|
777 |
||
778 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
779 |
||
780 |
colorMap notNil ifTrue:[ |
|
781 |
image := anImage copy lightened onDevice:aDevice. |
|
782 |
image clearMaskedPixels. |
|
794 | 783 |
] ifFalse:[ |
2374 | 784 |
image := self image:anImage onDevice:aDevice |
794 | 785 |
]. |
1097 | 786 |
deviceImages at:anImage put:image. |
794 | 787 |
^ image |
788 |
! ! |
|
789 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
790 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
791 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
792 |
subMenu:aSubMenu |
2715 | 793 |
"create a submenu; can be redifined in derived classes" |
794 |
||
795 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
796 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
797 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
798 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
799 |
|
1808 | 800 |
!MenuPanel methodsFor:'accepting'! |
389 | 801 |
|
802 |
accept |
|
2715 | 803 |
"accept current selected item" |
804 |
||
1670 | 805 |
^ self acceptItem:(self selection) inMenu:self |
389 | 806 |
! |
807 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
808 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
809 |
"this is the topMenu: accept item " |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
810 |
|
3142 | 811 |
|item tgState itemIdx recv panel masterGroup winGrp acceptAction focusView| |
1630 | 812 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
813 |
self superMenu notNil ifTrue:[ |
2253 | 814 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
815 |
]. |
3142 | 816 |
prevFocusView ~~ self ifTrue:[ |
817 |
focusView := prevFocusView. |
|
818 |
]. |
|
819 |
prevFocusView := nil. |
|
820 |
||
2199 | 821 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
822 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
823 |
self selection:nil. |
420 | 824 |
|
825 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 826 |
tgState := anItem toggleIndication. |
827 |
panel := anItem menuPanel. |
|
828 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
829 |
item := anItem. |
|
830 |
recv := panel receiver. |
|
389 | 831 |
]. |
1699 | 832 |
self doUngrab:true. |
389 | 833 |
|
510 | 834 |
self isPopUpView ifFalse:[ |
2253 | 835 |
self do:[:el| el updateIndicators]. |
3143 | 836 |
(winGrp := self windowGroup) notNil ifTrue:[ |
3142 | 837 |
winGrp processExposeEvents. |
838 |
]. |
|
524 | 839 |
] ifTrue:[ |
2253 | 840 |
self unmap. |
2712 | 841 |
self device sync. "/ round trip - all expose events are now received |
3143 | 842 |
|
843 |
(winGrp := self windowGroup) notNil ifTrue:[ |
|
2253 | 844 |
"/ give expose event a chance to arrive |
845 |
[shown and:[realized]] whileTrue:[ |
|
846 |
winGrp processExposeEventsFor:self |
|
847 |
]. |
|
848 |
masterGroup := winGrp previousGroup. |
|
849 |
]. |
|
850 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
851 |
"/ self destroy. |
|
852 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 853 |
]. |
1710 | 854 |
|
3144 | 855 |
acceptAction := [ |
856 |
|winGrp| |
|
857 |
||
3189 | 858 |
(focusView notNil and:[(winGrp := self windowGroup) notNil]) ifTrue:[ |
859 |
winGrp focusView:focusView. |
|
3142 | 860 |
]. |
3187 | 861 |
self accept:item index:itemIdx toggle:tgState receiver:recv. |
3189 | 862 |
|
2826 | 863 |
]. |
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
864 |
|
1710 | 865 |
(item notNil |
866 |
and:[item showBusyCursorWhilePerforming |
|
867 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
868 |
ifTrue:[ |
|
2253 | 869 |
winGrp withWaitCursorDo:acceptAction |
3144 | 870 |
] ifFalse:[ |
871 |
acceptAction value |
|
872 |
]. |
|
524 | 873 |
|
874 |
self isPopUpView ifTrue:[ |
|
2253 | 875 |
self menuAdornmentAt:#item put:item. |
524 | 876 |
]. |
1699 | 877 |
^ item. |
524 | 878 |
|
3144 | 879 |
"Modified: / 08-11-2006 / 17:14:06 / cg" |
524 | 880 |
! |
881 |
||
882 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
2715 | 883 |
"accept an item" |
884 |
||
2253 | 885 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
886 |
app master fallBack| |
524 | 887 |
|
888 |
anItem isNil ifTrue:[ |
|
2253 | 889 |
self menuAdornmentAt:#hasPerformed put:true. |
890 |
^ nil |
|
891 |
]. |
|
892 |
||
893 |
isValueModel := aReceiver isValueModel. |
|
894 |
||
895 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 896 |
|
897 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 898 |
^ anIndex |
524 | 899 |
]. |
900 |
||
901 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 902 |
argument := aState ? anItem |
389 | 903 |
]. |
524 | 904 |
|
905 |
value isSymbol ifFalse:[ |
|
2253 | 906 |
"/ a valueHolder or block |
907 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
908 |
^ value |
|
909 |
]. |
|
910 |
||
911 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
912 |
||
913 |
numArgs == 0 ifTrue:[ |
|
914 |
args := nil |
|
915 |
] ifFalse:[ |
|
916 |
numArgs == 1 ifTrue:[ |
|
917 |
args := Array with:argument |
|
918 |
] ifFalse:[ |
|
919 |
args := Array with:argument with:self |
|
920 |
] |
|
921 |
]. |
|
922 |
||
923 |
value valueWithArguments:args. |
|
924 |
||
925 |
self menuAdornmentAt:#hasPerformed put:true. |
|
926 |
^ anIndex |
|
524 | 927 |
]. |
928 |
||
2331 | 929 |
anItem sendToOriginator ifTrue:[ |
2473 | 930 |
rec := self originator. |
931 |
rec isNil ifTrue:[ |
|
2844 | 932 |
self error:'no originating widget (no target for message)' mayProceed:true. |
2473 | 933 |
]. |
2331 | 934 |
] ifFalse:[ |
935 |
rec := aReceiver |
|
936 |
]. |
|
937 |
||
938 |
rec isNil ifTrue:[ |
|
2253 | 939 |
^ value |
940 |
]. |
|
941 |
||
942 |
isValueModel ifTrue:[ |
|
2331 | 943 |
rec value:value |
465 | 944 |
] ifFalse:[ |
2253 | 945 |
arg2 := self. |
946 |
||
947 |
"/ support for ST80 style applications |
|
948 |
"/ (expecting the message to go to the application |
|
949 |
"/ if not understood by the view) |
|
950 |
"/ These expect the controller to be passed as argument. |
|
951 |
"/ sigh. |
|
952 |
||
2331 | 953 |
(rec isView |
954 |
and:[(rec respondsTo:value) not |
|
955 |
and:[(app := rec application) ~~ rec |
|
2253 | 956 |
and:[app notNil]]]) ifTrue:[ |
2331 | 957 |
arg2 := rec controller. "/ the Views controller |
2253 | 958 |
rec := app. |
959 |
]. |
|
960 |
||
961 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
962 |
args := nil |
|
963 |
] ifFalse:[ |
|
964 |
numArgs == 1 ifTrue:[ |
|
965 |
args := Array with:argument |
|
966 |
] ifFalse:[ |
|
967 |
args := Array with:argument with:arg2 |
|
968 |
] |
|
969 |
]. |
|
970 |
||
971 |
fallBack := |
|
972 |
[ |
|
973 |
"/ mhmh - the receiver did not respond to that message; |
|
974 |
"/ if there is a master-application, try that one |
|
975 |
"/ (recursive) |
|
976 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
977 |
master notNil ifTrue:[ |
|
978 |
rec := master. |
|
979 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
980 |
] ifFalse:[ |
|
981 |
self |
|
982 |
error:'unimplemented (or error in) menu message: ' , value |
|
983 |
mayProceed:true |
|
984 |
]. |
|
985 |
]. |
|
986 |
||
987 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 988 |
]. |
524 | 989 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
990 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
991 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
992 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 993 |
! |
994 |
||
1670 | 995 |
acceptItem:anItem inMenu:aMenu |
2199 | 996 |
|tgState topMenu| |
997 |
||
998 |
topMenu := self topMenu. |
|
999 |
topMenu openDelayed:nil. |
|
1670 | 1000 |
|
1841 | 1001 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2934 | 1002 |
topMenu accept:anItem |
1670 | 1003 |
] ifFalse:[ |
2934 | 1004 |
anItem canAccept ifTrue:[ |
1005 |
tgState := anItem toggleIndication. |
|
1006 |
||
1007 |
self accept:anItem |
|
1008 |
index:(aMenu selectionIndex) |
|
1009 |
toggle:tgState |
|
1010 |
receiver:(aMenu receiver). |
|
1011 |
||
1012 |
aMenu do:[:el| el updateIndicators]. |
|
1013 |
anItem hideMenuOnActivated ifFalse:[ |
|
1014 |
aMenu invalidate |
|
1015 |
]. |
|
1016 |
] |
|
1670 | 1017 |
] |
1018 |
! |
|
1019 |
||
389 | 1020 |
lastItemAccepted |
2715 | 1021 |
"returns last item selected or nil" |
1022 |
||
390 | 1023 |
^ self topMenu menuAdornmentAt:#item |
389 | 1024 |
! |
1025 |
||
1026 |
lastValueAccepted |
|
2715 | 1027 |
"returns last value accepted or nil" |
1028 |
||
2253 | 1029 |
^ self lastItemAccepted value |
389 | 1030 |
! ! |
1031 |
||
388 | 1032 |
!MenuPanel methodsFor:'accessing'! |
1033 |
||
1034 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1035 |
"get the access character position for a textLabel" |
1036 |
||
2059 | 1037 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1038 |
! |
1039 |
||
1040 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1041 |
"get the access character position for a textLabel" |
1042 |
||
388 | 1043 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1044 |
! |
|
1045 |
||
1046 |
accessCharacterPositions |
|
2715 | 1047 |
"returns a collection of accessCharacterPositions or nil" |
1048 |
||
388 | 1049 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1050 |
! |
|
1051 |
||
1052 |
accessCharacterPositions:something |
|
2715 | 1053 |
"define accessCharacterPositions for each item" |
1054 |
||
388 | 1055 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1056 |
! |
|
1057 |
||
1058 |
args |
|
2715 | 1059 |
"returns a collection of arguments or nil" |
1060 |
||
388 | 1061 |
^ self collect:[:anItem| anItem argument ] |
1062 |
! |
|
1063 |
||
1064 |
args:something |
|
2715 | 1065 |
"define arguments for each item" |
1066 |
||
388 | 1067 |
self onEachPerform:#argument: withArgList:something |
1068 |
! |
|
1069 |
||
1070 |
argsAt:stringOrNumber |
|
2715 | 1071 |
"gets the argument of an item or nil" |
1072 |
||
2059 | 1073 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1074 |
! |
1075 |
||
1076 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1077 |
"sets the argument of an item" |
1078 |
||
388 | 1079 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1080 |
! |
|
1081 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1082 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1083 |
"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
|
1084 |
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
|
1085 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1086 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1087 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1088 |
"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
|
1089 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1090 |
|
388 | 1091 |
groupSizes |
2715 | 1092 |
"gets collection of group sizes" |
1093 |
||
388 | 1094 |
^ groupSizes |
1095 |
! |
|
1096 |
||
1097 |
groupSizes:aGroupSizes |
|
2715 | 1098 |
"sets collection of group sizes" |
1099 |
||
388 | 1100 |
aGroupSizes = groupSizes ifFalse:[ |
2715 | 1101 |
groupSizes := aGroupSizes copy. |
1102 |
self mustRearrange. |
|
388 | 1103 |
]. |
1104 |
! |
|
1105 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1106 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1107 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1108 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1109 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1110 |
hideOnRelease:something |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1111 |
hideOnRelease := something. |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1112 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1113 |
|
388 | 1114 |
labelAt:stringOrNumber |
2715 | 1115 |
"gets the label of an item or nil" |
1116 |
||
388 | 1117 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1118 |
! |
|
1119 |
||
1120 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1121 |
"sets the label of an item" |
1122 |
||
388 | 1123 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1124 |
! |
|
1125 |
||
1126 |
labels |
|
2715 | 1127 |
"returns a collection of labels's or nil" |
1128 |
||
388 | 1129 |
^ self collect:[:anItem| anItem label ] |
1130 |
! |
|
1131 |
||
1132 |
labels:labels |
|
2715 | 1133 |
"define labels for each item" |
1134 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1135 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1136 |
|
388 | 1137 |
self disabledRedrawDo:[ |
2715 | 1138 |
self removeAll. |
1139 |
size := labels size. |
|
1140 |
||
1141 |
size > 0 ifTrue:[ |
|
1142 |
items := OrderedCollection new:size. |
|
1143 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1144 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1145 |
]. |
388 | 1146 |
! |
1147 |
||
1999 | 1148 |
menuPerformer:anObject |
1149 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1150 |
from all submenus no specific receiver is defined )." |
1151 |
||
1999 | 1152 |
^ self receiver:anObject |
1153 |
! |
|
1154 |
||
388 | 1155 |
nameKeyAt:stringOrNumber |
2715 | 1156 |
"gets the nameKey of an item or nil" |
1157 |
||
1158 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1159 |
! |
1160 |
||
1161 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1162 |
"sets the nameKey of an item" |
1163 |
||
388 | 1164 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1165 |
! |
|
1166 |
||
1167 |
nameKeys |
|
2715 | 1168 |
"returns a collection of nameKeyss or nil" |
1169 |
||
388 | 1170 |
^ self collect:[:anItem| anItem nameKey ] |
1171 |
! |
|
1172 |
||
1173 |
nameKeys:something |
|
2715 | 1174 |
"define nameKeys for each item" |
1175 |
||
388 | 1176 |
self onEachPerform:#nameKey: withArgList:something |
1177 |
! |
|
1178 |
||
1179 |
numberOfItems |
|
2715 | 1180 |
"gets number of items" |
1181 |
||
388 | 1182 |
^ items size |
1183 |
! |
|
1184 |
||
2331 | 1185 |
originator |
1186 |
originator notNil ifTrue:[^ originator]. |
|
1187 |
superMenu notNil ifTrue:[ |
|
1188 |
^ superMenu originator |
|
1189 |
]. |
|
1190 |
^ nil |
|
1191 |
! |
|
1192 |
||
388 | 1193 |
receiver |
1194 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1195 |
from all submenus no specific receiver is defined )." |
1196 |
||
389 | 1197 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2715 | 1198 |
^ superMenu receiver |
388 | 1199 |
]. |
389 | 1200 |
^ receiver |
388 | 1201 |
! |
1202 |
||
1203 |
receiver:anObject |
|
1204 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1205 |
from all submenus no specific receiver is defined )." |
1206 |
||
389 | 1207 |
receiver := anObject |
388 | 1208 |
! |
1209 |
||
1210 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1211 |
"gets the shortCutKey of an item or nil" |
1212 |
||
1213 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1214 |
! |
1215 |
||
1216 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1217 |
"sets the shortCutKey of an item" |
1218 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1219 |
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
|
1220 |
! |
388 | 1221 |
|
1222 |
shortcutKeys |
|
2715 | 1223 |
"returns a collection of shortcutKeys or nil" |
1224 |
||
388 | 1225 |
^ self collect:[:anItem| anItem shortcutKey ] |
1226 |
! |
|
1227 |
||
1228 |
shortcutKeys:something |
|
2715 | 1229 |
"define shortcutKeys for each item" |
1230 |
||
388 | 1231 |
self onEachPerform:#shortcutKey: withArgList:something |
1232 |
! |
|
1233 |
||
1234 |
valueAt:stringOrNumber |
|
2715 | 1235 |
"gets value of an item; a block, valueHolder, ..." |
1236 |
||
1237 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1238 |
! |
1239 |
||
1240 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1241 |
"sets value of an item; a block, valueHolder, ..." |
1242 |
||
388 | 1243 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1244 |
! |
|
1245 |
||
1246 |
values:something |
|
2715 | 1247 |
"define values for each item" |
1248 |
||
388 | 1249 |
self onEachPerform:#value: withArgList:something |
1250 |
! ! |
|
1251 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1252 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1253 |
|
1254 |
disableAll |
|
2715 | 1255 |
"disable all items; not the menu in case of enabled" |
1256 |
||
498 | 1257 |
self do:[:anItem| anItem enabled:false] |
388 | 1258 |
! |
1259 |
||
1260 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1261 |
"disable an collection of items" |
1262 |
||
388 | 1263 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1264 |
! |
|
1265 |
||
1266 |
enableAll |
|
2715 | 1267 |
"enable all items; not the menu in case of disabled" |
1268 |
||
498 | 1269 |
self do:[:anItem| anItem enabled:true] |
388 | 1270 |
! |
1271 |
||
1272 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1273 |
"enable an collection of items" |
1274 |
||
388 | 1275 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1276 |
! |
|
1277 |
||
1278 |
enabled |
|
2715 | 1279 |
"returns enabled state" |
1280 |
||
498 | 1281 |
^ enabled |
388 | 1282 |
! |
1283 |
||
1284 |
enabled:aState |
|
2715 | 1285 |
"change enabled state of menu" |
1286 |
||
545 | 1287 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1288 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1289 |
state := aState ? true. |
388 | 1290 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1291 |
enabled ~~ state ifTrue:[ |
2715 | 1292 |
enabled := state. |
1293 |
self invalidate. |
|
498 | 1294 |
]. |
388 | 1295 |
! |
1296 |
||
1297 |
enabledAt:stringOrNumber |
|
2715 | 1298 |
"gets the enabled state of an item or false" |
1299 |
||
388 | 1300 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1301 |
! |
|
1302 |
||
1303 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1304 |
"sets the enabled state of an item" |
1305 |
||
388 | 1306 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1307 |
! |
|
1308 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1309 |
exclusivePointer:aBoolean |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1310 |
"Do nothing here. Compatibility with PopUpListController" |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1311 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1312 |
^ self |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1313 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1314 |
|
388 | 1315 |
isEnabled:stringOrNumber |
2715 | 1316 |
"gets the enabled state of an item or false" |
1317 |
||
388 | 1318 |
^ self enabledAt:stringOrNumber |
1319 |
! ! |
|
1320 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1321 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1322 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1323 |
enableChannel:aValueHolder |
2715 | 1324 |
"set my enableChannel" |
1325 |
||
498 | 1326 |
enableChannel notNil ifTrue:[ |
2715 | 1327 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1328 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1329 |
|
498 | 1330 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2715 | 1331 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1332 |
]. |
498 | 1333 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1334 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1335 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1336 |
menuHolder:aValueHolder |
2715 | 1337 |
"set my menuHolder" |
1338 |
||
498 | 1339 |
menuHolder notNil ifTrue:[ |
2715 | 1340 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1341 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1342 |
|
498 | 1343 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2715 | 1344 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1345 |
]. |
498 | 1346 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1347 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1348 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1349 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1350 |
|
616 | 1351 |
activeBackgroundColor |
2715 | 1352 |
"get the background drawing color used to highlight selection" |
1353 |
||
2219 | 1354 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1355 |
! |
1356 |
||
1357 |
activeForegroundColor |
|
2715 | 1358 |
"get the foreground color used to highlight selections" |
1359 |
||
2219 | 1360 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1361 |
! |
1362 |
||
390 | 1363 |
backgroundColor |
2715 | 1364 |
"return the background color" |
1365 |
||
502 | 1366 |
^ super viewBackground |
390 | 1367 |
! |
1368 |
||
1369 |
backgroundColor:aColor |
|
1370 |
"set the background drawing color. You should not use this method; |
|
2715 | 1371 |
instead, leave the value as defined in the styleSheet." |
1372 |
||
1373 |
self backgroundColor ~~ aColor ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1374 |
super viewBackground:aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1375 |
self invalidate "/ RepairNow:true |
616 | 1376 |
] |
1377 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1378 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1379 |
! |
1380 |
||
727 | 1381 |
buttonActiveBackgroundColor |
2715 | 1382 |
"get the background drawing color used to highlight button selection" |
1383 |
||
2219 | 1384 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1385 |
default:(self viewBackground) |
|
727 | 1386 |
! |
1387 |
||
730 | 1388 |
buttonEdgeStyle |
2715 | 1389 |
"get the button edge style" |
1390 |
||
2219 | 1391 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1392 |
! |
1393 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1394 |
buttonEnteredBackgroundColor |
2715 | 1395 |
"get the background drawing color used to highlight entered button items" |
1396 |
||
2219 | 1397 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1398 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1399 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1400 |
buttonEnteredLevel |
2715 | 1401 |
"get the 3D-level used to highlight entered button items" |
1402 |
||
2219 | 1403 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1404 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1405 |
|
730 | 1406 |
buttonHalfLightColor |
2715 | 1407 |
"get the background drawing color used to half light button frame" |
1408 |
||
2219 | 1409 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1410 |
! |
1411 |
||
1412 |
buttonHalfShadowColor |
|
2715 | 1413 |
"get the background drawing color used to half shadow button frame" |
1414 |
||
2219 | 1415 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1416 |
! |
1417 |
||
1418 |
buttonLightColor |
|
2715 | 1419 |
"get the background drawing color used to light button frame" |
1420 |
||
2219 | 1421 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1422 |
! |
1423 |
||
1424 |
buttonPassiveBackgroundColor |
|
2715 | 1425 |
"get the background drawing color used for button" |
1426 |
||
2219 | 1427 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1428 |
! |
1429 |
||
1430 |
buttonShadowColor |
|
2715 | 1431 |
"get the background drawing color used to shadow button frame" |
1432 |
||
2219 | 1433 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1434 |
! |
1435 |
||
1436 |
disabledEtchedForegroundColor |
|
1437 |
"return the color used for etching disabled items. |
|
2715 | 1438 |
If nil, no 3D effect is drawn." |
1439 |
||
2219 | 1440 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1441 |
! |
1442 |
||
390 | 1443 |
disabledForegroundColor |
2715 | 1444 |
"return the foreground color used by disabled items" |
1445 |
||
2219 | 1446 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1447 |
! |
1448 |
||
2170 | 1449 |
enteredBackgroundColor |
2715 | 1450 |
"return the background color for entered items" |
1451 |
||
2219 | 1452 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1453 |
default:(self backgroundColor) |
|
2170 | 1454 |
! |
1455 |
||
1456 |
enteredForegroundColor |
|
2715 | 1457 |
"return the foreground color for entered items" |
1458 |
||
2219 | 1459 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1460 |
! |
1461 |
||
390 | 1462 |
font:aFont |
2715 | 1463 |
"set the font" |
1464 |
||
2614 | 1465 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1466 |
||
1467 |
super font:aFont. |
|
1468 |
self do:[:anItem| anItem fontChanged ]. |
|
1469 |
||
1470 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1471 |
self extent:(self preferredExtent) |
|
1472 |
]. |
|
1473 |
self mustRearrange. |
|
390 | 1474 |
! |
1475 |
||
1476 |
foregroundColor |
|
2715 | 1477 |
"return the passive foreground color" |
1478 |
||
2059 | 1479 |
^ fgColor |
390 | 1480 |
! |
1481 |
||
1482 |
foregroundColor:aColor |
|
1483 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1484 |
instead leave the value as defined in the styleSheet." |
1485 |
||
2219 | 1486 |
aColor ~= fgColor ifTrue:[ |
1478 | 1487 |
fgColor := aColor onDevice:device. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1488 |
self invalidate |
2219 | 1489 |
]. |
580 | 1490 |
! |
1491 |
||
1699 | 1492 |
maxAbsoluteButtonLevel |
1493 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1494 |
extent of a button" |
1495 |
||
2219 | 1496 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1497 |
! |
1498 |
||
730 | 1499 |
selectionFrameBrightColor |
2715 | 1500 |
"get the selection frame bright color" |
1501 |
||
2219 | 1502 |
^ Color white |
730 | 1503 |
! |
1504 |
||
1505 |
selectionFrameDarkColor |
|
2715 | 1506 |
"get the selection frame dark color" |
1507 |
||
2219 | 1508 |
^ Color black |
730 | 1509 |
! |
1510 |
||
1727 | 1511 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1512 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1513 |
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
|
1514 |
|
1727 | 1515 |
|currentFont| |
1516 |
||
1517 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1518 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1519 |
super font:aFont. |
1727 | 1520 |
]. |
1521 |
^ currentFont |
|
2761 | 1522 |
! |
1523 |
||
1524 |
viewBackground:aColor |
|
1525 |
super viewBackground:aColor |
|
390 | 1526 |
! ! |
1527 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1528 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1529 |
|
1530 |
height |
|
2715 | 1531 |
"default height" |
1532 |
||
388 | 1533 |
(explicitExtent ~~ true) ifTrue:[ |
2715 | 1534 |
^ self preferredExtent y |
388 | 1535 |
]. |
1536 |
^ super height |
|
1537 |
! |
|
1538 |
||
2016 | 1539 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1540 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1541 |
device notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1542 |
^ device usableExtent - 2. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1543 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1544 |
superMenu notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1545 |
^ superMenu maxExtent |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1546 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1547 |
"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
|
1548 |
self error:'don''t know maxExtent'. |
2016 | 1549 |
! |
1550 |
||
388 | 1551 |
preferredExtent |
2715 | 1552 |
"compute and returns my preferred extent" |
1553 |
||
2253 | 1554 |
|maxExtent usedExtent| |
2024 | 1555 |
|
2016 | 1556 |
preferredExtent notNil ifTrue:[ |
2253 | 1557 |
^ preferredExtent |
2016 | 1558 |
]. |
2024 | 1559 |
usedExtent := self preferredExtentOfItems. |
1560 |
||
1561 |
superView isNil ifTrue:[ |
|
2253 | 1562 |
"/ is standalone |
2374 | 1563 |
preferredWidth notNil ifTrue:[ |
2253 | 1564 |
usedExtent x < preferredWidth ifTrue:[ |
1565 |
usedExtent := preferredWidth @ usedExtent y. |
|
1566 |
] |
|
1567 |
] |
|
2024 | 1568 |
]. |
1569 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1570 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1571 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1572 |
usedExtent := usedExtent min:maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1573 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1574 |
^ usedExtent |
2024 | 1575 |
|
1576 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1577 |
! |
1578 |
||
1579 |
preferredExtentOfItems |
|
1580 |
"compute and returns my preferred extent including all items |
|
2715 | 1581 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
1582 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1583 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1584 |
x "{ Class:SmallInteger }" |
1585 |
y "{ Class:SmallInteger }" |
|
1586 |
size "{ Class:SmallInteger }" |
|
2883 | 1587 |
buttonInsetX2 "{ Class:SmallInteger }" |
1588 |
buttonInsetY2 "{ Class:SmallInteger }" |
|
2219 | 1589 |
labelInsetX "{ Class:SmallInteger }" |
1590 |
labelInsetY "{ Class:SmallInteger }" |
|
1591 |
itemMargin "{ Class:SmallInteger }" |
|
1592 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1593 |
| |
388 | 1594 |
|
1699 | 1595 |
(size := items size) == 0 ifTrue:[ |
2219 | 1596 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1597 |
^ 32 @ 32 |
2219 | 1598 |
]. |
3131 | 1599 |
stringOffsetX := nil. |
2883 | 1600 |
buttonInsetX2 := 2 * buttonInsetX. |
1601 |
buttonInsetY2 := 2 * buttonInsetY. |
|
1699 | 1602 |
|
1603 |
self isPopUpView ifFalse:[ |
|
2219 | 1604 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1605 |
] ifTrue:[ |
2145 | 1606 |
labelInsetX := labelInsetY := 0. |
1699 | 1607 |
]. |
1608 |
||
1609 |
x := 0. |
|
1610 |
y := 0. |
|
2219 | 1611 |
groupDividerSize := self groupDividerSize. |
388 | 1612 |
|
1613 |
self verticalLayout ifFalse:[ |
|
1699 | 1614 |
items keysAndValuesDo:[:key :el| |eX eY| |
1615 |
extent := el preferredExtent. |
|
1616 |
||
1617 |
"/ check for visibility (extent x ~~ 0) |
|
1618 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1619 |
eY := extent y. |
|
1620 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1621 |
el isButton ifTrue:[ |
2883 | 1622 |
eX := eX + buttonInsetX2. |
1623 |
eY := eY + buttonInsetY2. |
|
1699 | 1624 |
] ifFalse:[ |
2145 | 1625 |
eX := eX + labelInsetX. |
1626 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1627 |
]. |
1699 | 1628 |
key ~~ size ifTrue:[ |
1629 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1630 |
x := x + groupDividerSize |
|
1631 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1632 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1633 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1634 |
] |
1699 | 1635 |
] |
1636 |
]. |
|
1637 |
x := eX + x. |
|
1638 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1639 |
] |
1699 | 1640 |
] |
388 | 1641 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1642 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1643 |
shCtKey := 0. |
1699 | 1644 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1645 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1646 |
x := 0. |
2219 | 1647 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1648 |
|
1699 | 1649 |
items keysAndValuesDo:[:key :el| |eX eY| |
1650 |
extent := el preferredExtent. |
|
1651 |
||
1652 |
"/ check for visibility (extent x ~~ 0) |
|
1653 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1654 |
eY := extent y. |
|
1655 |
||
1656 |
el isButton ifTrue:[ |
|
2883 | 1657 |
eX := eX + buttonInsetX2. |
1658 |
eY := eY + buttonInsetY2. |
|
1699 | 1659 |
] ifFalse:[ |
2145 | 1660 |
eX := eX + labelInsetX. |
1661 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1662 |
]. |
1699 | 1663 |
hasMenu ifFalse:[ |
1664 |
hasMenu := el hasSubmenu |
|
1665 |
]. |
|
1666 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1667 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1668 |
]. |
|
1669 |
key ~~ size ifTrue:[ |
|
1670 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1671 |
y := y + groupDividerSize |
|
1672 |
] |
|
1673 |
]. |
|
1674 |
y := eY + y. |
|
1675 |
x := eX max:x. |
|
1676 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1677 |
]. |
2219 | 1678 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1679 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1680 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1681 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1682 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1683 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1684 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1685 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1686 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1687 |
]. |
1699 | 1688 |
"/ to have a small inset |
1689 |
y := y + 1. |
|
1690 |
"/ x := x + 1. |
|
1691 |
]. |
|
1692 |
x := x + margin + margin. |
|
1693 |
y := y + margin + margin. |
|
1694 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1695 |
^ x @ y |
388 | 1696 |
! |
1697 |
||
2253 | 1698 |
preferredWidth:aWidthOrNil |
1699 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1700 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1701 |
If not nil, the width is the maximum from the contained items and the required width." |
1702 |
||
2253 | 1703 |
preferredWidth := aWidthOrNil. |
2024 | 1704 |
! |
1705 |
||
388 | 1706 |
shortKeyInset |
2715 | 1707 |
"left inset of shortcutKey" |
1708 |
||
1709 |
^ shortKeyInset |
|
616 | 1710 |
! |
1711 |
||
3131 | 1712 |
stringOffsetXfor:anItem |
1713 |
"return the x offset for a MenuItem where to draw the text |
|
1714 |
" |
|
1715 |
|label w| |
|
1716 |
||
1717 |
anItem isButton ifTrue:[ ^ 0 ]. |
|
1718 |
||
1719 |
stringOffsetX isNil ifTrue:[ |
|
1720 |
stringOffsetX := 0. |
|
1721 |
||
1722 |
(self isPopUpView and:[self verticalLayout]) ifTrue:[ |
|
1723 |
self do:[:el| |
|
1724 |
el isVisible ifTrue:[ |
|
1725 |
( (label := el indicatorForm) notNil |
|
1726 |
or:[(label := el choiceForm) notNil] |
|
1727 |
) ifTrue:[ |
|
1728 |
stringOffsetX := stringOffsetX max:(label width + 2). |
|
1729 |
] ifFalse:[ |
|
1730 |
label := el displayLabel. |
|
1731 |
label class == LabelAndIcon ifTrue:[ |
|
1732 |
stringOffsetX := stringOffsetX max:(label xOfString). |
|
1733 |
]. |
|
1734 |
]. |
|
1735 |
]. |
|
1736 |
]. |
|
1737 |
]. |
|
1738 |
]. |
|
1739 |
w := 0. |
|
1740 |
||
1741 |
( (label := anItem indicatorForm) notNil |
|
1742 |
or:[(label := anItem choiceForm) notNil] |
|
1743 |
) ifTrue:[ |
|
1744 |
w := label width + 2. |
|
1745 |
]. |
|
1746 |
stringOffsetX == 0 ifTrue:[ |
|
1747 |
^ w |
|
1748 |
]. |
|
1749 |
w == 0 ifTrue:[ |
|
1750 |
label := anItem displayLabel. |
|
1751 |
||
1752 |
label class == LabelAndIcon ifTrue:[ |
|
1753 |
^ stringOffsetX - label xOfString |
|
1754 |
]. |
|
1755 |
]. |
|
1756 |
^ stringOffsetX. |
|
1757 |
! |
|
1758 |
||
616 | 1759 |
subMenuIndicationWidth |
2219 | 1760 |
^ self rightArrow width |
388 | 1761 |
! ! |
1762 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1763 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1764 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1765 |
iconIndicationDisabledOff |
2219 | 1766 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1767 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1768 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1769 |
iconIndicationDisabledOn |
2219 | 1770 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1771 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1772 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1773 |
iconIndicationOff |
2219 | 1774 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1775 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1776 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1777 |
iconIndicationOn |
2219 | 1778 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1779 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1780 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1781 |
iconRadioGroupDisabledOff |
2219 | 1782 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1783 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1784 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1785 |
iconRadioGroupDisabledOn |
2219 | 1786 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1787 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1788 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1789 |
iconRadioGroupOff |
2219 | 1790 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1791 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1792 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1793 |
iconRadioGroupOn |
2219 | 1794 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1795 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1796 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1797 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1798 |
|
1799 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1800 |
"evaluate the block for an item and return the result from the block. In case that |
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1801 |
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
|
1802 |
|
388 | 1803 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1804 |
! |
|
1805 |
||
1806 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1807 |
"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
|
1808 |
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
|
1809 |
|
388 | 1810 |
|item| |
1811 |
||
1812 |
item := self itemAt:stringOrNumber. |
|
1813 |
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
|
1814 |
^ exceptionBlock value |
706 | 1815 |
! |
1816 |
||
1817 |
itemAtIndex:anIndex |
|
2715 | 1818 |
"returns item at an index or nil" |
1819 |
||
706 | 1820 |
^ 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
|
1821 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1822 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1823 |
items |
2715 | 1824 |
"returns list of items or nil" |
1825 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1826 |
^ items |
388 | 1827 |
! ! |
1828 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1829 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1830 |
|
727 | 1831 |
buttonActiveLevel |
2715 | 1832 |
"get the buttons active level" |
1833 |
||
2219 | 1834 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1835 |
! |
1836 |
||
1837 |
buttonPassiveLevel |
|
2715 | 1838 |
"get the buttons passive level" |
1839 |
||
2219 | 1840 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
727 | 1841 |
! |
1842 |
||
2337 | 1843 |
centerItems |
1844 |
^ centerItems ? false |
|
1845 |
! |
|
1846 |
||
1847 |
centerItems:aBoolean |
|
1848 |
centerItems := aBoolean |
|
1849 |
! |
|
1850 |
||
390 | 1851 |
fitFirstPanel |
1852 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1853 |
to the extent of its superView |
|
1699 | 1854 |
|
2715 | 1855 |
NOT SUPPORTED" |
1856 |
||
2219 | 1857 |
^ false |
388 | 1858 |
! |
1859 |
||
390 | 1860 |
fitFirstPanel:aState |
1861 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1862 |
to the extent of its superView |
|
1699 | 1863 |
|
2715 | 1864 |
NOT SUPPORTED" |
616 | 1865 |
! |
1866 |
||
1093 | 1867 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1868 |
anInt ~~ level ifTrue:[ |
3147 | 1869 |
super level:anInt. |
1870 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1871 |
] |
2052 | 1872 |
|
1873 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1874 |
! |
1875 |
||
616 | 1876 |
rightArrow |
2374 | 1877 |
rightArrow isNil ifTrue:[ |
1878 |
device isNil ifTrue:[ |
|
2219 | 1879 |
^ SelectionInListView rightArrowFormOn:Display |
1880 |
]. |
|
1881 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1882 |
]. |
|
616 | 1883 |
^ rightArrow |
1884 |
! |
|
1885 |
||
1886 |
rightArrowShadow |
|
1887 |
^ rightArrowShadow |
|
388 | 1888 |
! |
1889 |
||
390 | 1890 |
showGroupDivider |
2715 | 1891 |
"get the enabled flag for showing groupDiveders" |
1892 |
||
2253 | 1893 |
^ showGroupDivider |
388 | 1894 |
! |
1895 |
||
390 | 1896 |
showGroupDivider:aState |
2715 | 1897 |
"set the enabled flag for showing groupDiveders" |
1898 |
||
2253 | 1899 |
showGroupDivider ~~ aState ifTrue:[ |
1900 |
showGroupDivider := aState. |
|
1901 |
self mustRearrange. |
|
653 | 1902 |
] |
388 | 1903 |
! |
1904 |
||
1905 |
showSeparatingLines |
|
2715 | 1906 |
"gets true if drawing of separating lines is enabled." |
1907 |
||
2253 | 1908 |
^ showSeparatingLines |
388 | 1909 |
! |
1910 |
||
390 | 1911 |
showSeparatingLines:aState |
2715 | 1912 |
"turn on/off drawing of separating lines." |
1913 |
||
2253 | 1914 |
aState ~~ showSeparatingLines ifTrue:[ |
1915 |
showSeparatingLines := aState. |
|
1916 |
self mustRearrange |
|
1917 |
]. |
|
388 | 1918 |
! |
1919 |
||
1920 |
verticalLayout |
|
2715 | 1921 |
"get the layout: vertical( true ) or horizontal( false )" |
1922 |
||
2374 | 1923 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 1924 |
|
1925 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1926 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
2374 | 1927 |
^ verticalLayout |
388 | 1928 |
! |
1929 |
||
1930 |
verticalLayout:aState |
|
2715 | 1931 |
"set the layout: vertical( true ) or horizontal( false )" |
1932 |
||
2253 | 1933 |
aState ~~ verticalLayout ifTrue:[ |
1934 |
verticalLayout isNil ifTrue:[ |
|
1935 |
verticalLayout := aState |
|
1936 |
] ifFalse:[ |
|
1937 |
verticalLayout := aState. |
|
1938 |
self mustRearrange. |
|
1939 |
]. |
|
1940 |
]. |
|
388 | 1941 |
! ! |
1942 |
||
2219 | 1943 |
!MenuPanel methodsFor:'accessing-style'! |
1944 |
||
1945 |
buttonInsetX |
|
2715 | 1946 |
"returns the verical button space" |
1947 |
||
2883 | 1948 |
^ buttonInsetX |
2219 | 1949 |
! |
1950 |
||
1951 |
buttonInsetY |
|
2715 | 1952 |
"returns the verical button space" |
1953 |
||
2883 | 1954 |
^ buttonInsetY |
2219 | 1955 |
! |
1956 |
||
1957 |
enteredLevel |
|
2715 | 1958 |
"returns the enter-level for an unselected item moved through" |
1959 |
||
2219 | 1960 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
1961 |
! |
|
1962 |
||
1963 |
groupDividerSize |
|
2715 | 1964 |
"returns the width of a group divider" |
1965 |
||
2219 | 1966 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
1967 |
! |
|
1968 |
||
1969 |
itemMargin |
|
2715 | 1970 |
"returns the margin of an item" |
1971 |
||
2219 | 1972 |
^ styleSheet at:#'menu.itemMargin' default:0 |
1973 |
! |
|
1974 |
||
1975 |
itemSpace |
|
2715 | 1976 |
"returns the additional space for an item in a (vertical) panel" |
1977 |
||
2883 | 1978 |
^ itemSpace |
2219 | 1979 |
! |
1980 |
||
1981 |
selectionFollowsMouse |
|
2715 | 1982 |
"returns true if the selection follows the mouse" |
1983 |
||
2219 | 1984 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
1985 |
! |
|
1986 |
||
1987 |
shortcutKeyOffset |
|
2715 | 1988 |
"returns the offset for a shortcutKey" |
1989 |
||
2219 | 1990 |
^ 5 |
1991 |
! ! |
|
1992 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1993 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1994 |
|
1995 |
subMenuAt:stringOrNumber |
|
3192 | 1996 |
"gets the current submenu of an item; if the submenu is nil, the |
1997 |
submenu is generated if specified otherwise nil is returned." |
|
1998 |
||
1999 |
|submenu| |
|
2000 |
||
2001 |
||
2002 |
self itemAt:stringOrNumber do:[:anItem| |
|
2003 |
submenu := anItem currentSubmenu. |
|
2004 |
submenu isNil ifTrue:[ |
|
2005 |
submenu := anItem setupSubmenu |
|
2006 |
]. |
|
2007 |
]. |
|
2008 |
^ submenu |
|
388 | 2009 |
! |
2010 |
||
2011 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 2012 |
"sets the submenu of an item" |
2013 |
||
388 | 2014 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
2015 |
! |
|
2016 |
||
2017 |
subMenuShown |
|
2715 | 2018 |
"return the currently visible submenu - or nil if there is none" |
2019 |
||
3192 | 2020 |
|item submenu| |
2021 |
||
2022 |
item := self selection. |
|
2023 |
||
2024 |
item notNil ifTrue:[ |
|
2025 |
submenu := item currentSubmenu. |
|
2026 |
||
2027 |
(submenu notNil and:[submenu shown]) ifTrue:[ |
|
2028 |
^ submenu |
|
2029 |
]. |
|
2715 | 2030 |
]. |
2031 |
^ nil |
|
388 | 2032 |
! ! |
2033 |
||
2504 | 2034 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 2035 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2036 |
closeMenus |
2715 | 2037 |
"close all menus without accepting" |
2038 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2039 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2040 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
2041 |
|
388 | 2042 |
hide |
2715 | 2043 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2044 |
|
2407 | 2045 |
"/ TODO: replace with LeaveSignal raise. |
2046 |
||
388 | 2047 |
self selection:nil. |
2048 |
self unmap. |
|
2049 |
! |
|
2050 |
||
2051 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2052 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2053 |
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
|
2054 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2055 |
to some performer)" |
2056 |
||
2057 |
^ self showAt:(self origin) resizing:true |
|
388 | 2058 |
! |
2059 |
||
2060 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2061 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2062 |
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
|
2063 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2064 |
to some performer)" |
2065 |
||
388 | 2066 |
^ self showAt:aPoint resizing:true |
2067 |
! |
|
2068 |
||
2069 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2070 |
"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
|
2071 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2072 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2073 |
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
|
2074 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2075 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2076 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2077 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2078 |
|
2079 |
aBoolean ifTrue:[ |
|
2715 | 2080 |
self fixSize. |
388 | 2081 |
]. |
2082 |
self origin:aPoint. |
|
1459 | 2083 |
"/ self makeFullyVisible. -- done in realize |
388 | 2084 |
self openModal:[true]. "realize " |
2085 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2086 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2087 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2088 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2089 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2715 | 2090 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2091 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2092 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2093 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2094 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2095 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 2096 |
! |
2097 |
||
2098 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2099 |
"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
|
2100 |
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
|
2101 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2102 |
to some performer)" |
2103 |
||
388 | 2104 |
^ self showAt:(device pointerPosition) resizing:true |
2105 |
! |
|
2106 |
||
2107 |
showCenteredIn:aView |
|
2108 |
"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
|
2109 |
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
|
2110 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2111 |
to some performer)" |
2112 |
||
388 | 2113 |
|top| |
2114 |
||
2115 |
top := aView topView. |
|
2116 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2117 |
^ 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
|
2118 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2119 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2120 |
! |
2121 |
||
2122 |
startUp |
|
2123 |
"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
|
2124 |
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
|
2125 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2126 |
to some performer)" |
2127 |
||
388 | 2128 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2129 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2130 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2131 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2132 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2133 |
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
|
2134 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2135 |
to some performer)" |
2136 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2137 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2138 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2139 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2140 |
! |
2141 |
||
2332 | 2142 |
startUpFor:originatingWidget |
2143 |
"realize the menu at the current pointer position |
|
2144 |
return the value of the selectedItem or nil, of none was selected |
|
2145 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2146 |
to some performer)" |
2147 |
||
2332 | 2148 |
originator := originatingWidget. |
2149 |
^ self startUp |
|
2150 |
! |
|
2151 |
||
1750 | 2152 |
startUpOrNil |
2153 |
"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
|
2154 |
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
|
2155 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2156 |
to some performer)" |
2157 |
||
1750 | 2158 |
^ self showAtPointer |
388 | 2159 |
! ! |
2160 |
||
2161 |
!MenuPanel methodsFor:'adding & removing'! |
|
2162 |
||
2163 |
createAtIndex:anIndexOrNil |
|
1800 | 2164 |
"create an item and add this item to the index. In case of nil, the item |
2165 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2166 |
otherwise the new created item is returned." |
2167 |
||
388 | 2168 |
|max item| |
2169 |
||
2170 |
max := (items size) + 1. |
|
2171 |
||
2172 |
anIndexOrNil notNil ifTrue:[ |
|
2715 | 2173 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2174 |
^ nil |
|
2175 |
] |
|
388 | 2176 |
]. |
2177 |
items isNil ifTrue:[ |
|
2715 | 2178 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2179 |
] ifFalse:[ |
2715 | 2180 |
items := items asOrderedCollection |
388 | 2181 |
]. |
2182 |
item := Item in:self. |
|
2183 |
||
2184 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2715 | 2185 |
items add:item |
388 | 2186 |
] ifFalse:[ |
2715 | 2187 |
items add:item beforeIndex:anIndexOrNil |
388 | 2188 |
]. |
2189 |
^ item |
|
2190 |
! |
|
2191 |
||
2192 |
remove:stringOrNumber |
|
2193 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2194 |
if found, remove and return it" |
2195 |
||
388 | 2196 |
|item| |
2197 |
||
2198 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2715 | 2199 |
items remove:item. |
2200 |
item destroy. |
|
2201 |
items isEmpty ifTrue:[items := nil]. |
|
2202 |
self mustRearrange. |
|
388 | 2203 |
]. |
2204 |
^ item |
|
2205 |
! |
|
2206 |
||
2207 |
removeAll |
|
2715 | 2208 |
"remove all items and submenus" |
2209 |
||
388 | 2210 |
self disabledRedrawDo:[ |
2715 | 2211 |
self selection:nil. |
2212 |
groupSizes := nil. |
|
2213 |
items notNil ifTrue:[ |
|
2214 |
items copy do:[:el| el destroy ]. |
|
2215 |
]. |
|
2216 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2217 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2218 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2219 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2220 |
! ! |
2221 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2222 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2223 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2224 |
update:something with:aParameter from:changedObject |
498 | 2225 |
|
2226 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2227 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2228 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2229 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2230 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2231 |
|
388 | 2232 |
!MenuPanel methodsFor:'converting'! |
2233 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2234 |
asMenu |
2715 | 2235 |
"convert contents to menu" |
2236 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2237 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2238 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2239 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2240 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2241 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2242 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2243 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2244 |
|
388 | 2245 |
fromSpec:aMenuSpec |
2715 | 2246 |
"build from spec" |
2247 |
||
388 | 2248 |
|menu| |
2249 |
||
2250 |
menu := Menu new. |
|
2251 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2252 |
self menu:menu |
|
2253 |
! |
|
2254 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2255 |
menu:aMenu |
2715 | 2256 |
"convert to Menu" |
2257 |
||
388 | 2258 |
self disabledRedrawDo:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2259 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2260 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2261 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2262 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2263 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2264 |
(aMenu isCollection) ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2265 |
menu := Menu new. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2266 |
menu fromLiteralArrayEncoding:aMenu. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2267 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2268 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2269 |
menuReceiver notNil ifTrue:[ |
2793 | 2270 |
self receiver:menuReceiver. |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2271 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2272 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2273 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2274 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2275 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2276 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2277 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2278 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2279 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2280 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2281 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2282 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2283 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2284 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2285 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2286 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2287 |
! ! |
2288 |
||
2681 | 2289 |
!MenuPanel methodsFor:'dependents access'! |
2290 |
||
2291 |
addDependencies |
|
2715 | 2292 |
"add all dependencies" |
2293 |
||
2681 | 2294 |
self do:[:anItem| anItem addDependencies ]. |
2295 |
||
2296 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2297 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2298 |
! |
|
2299 |
||
2300 |
removeDependencies |
|
2715 | 2301 |
"remove all dependencies" |
2302 |
||
2681 | 2303 |
self do:[:anItem| anItem removeDependencies ]. |
2304 |
||
2305 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2306 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2307 |
! ! |
|
2308 |
||
388 | 2309 |
!MenuPanel methodsFor:'drawing'! |
2310 |
||
2311 |
disabledRedrawDo:aBlock |
|
2312 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2313 |
of the block a redraw might be performed" |
2314 |
||
388 | 2315 |
|state| |
2316 |
||
2317 |
state := mustRearrange. |
|
2318 |
mustRearrange := true. |
|
2319 |
aBlock value. |
|
2320 |
mustRearrange := state. |
|
2321 |
self mustRearrange |
|
2322 |
! |
|
2323 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2324 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2325 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2326 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2327 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2328 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2329 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2330 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2331 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2332 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2333 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2334 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2335 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2336 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2337 |
level:aLevel |
2219 | 2338 |
shadow:(self buttonShadowColor) |
2339 |
light:(self buttonLightColor) |
|
2340 |
halfShadow:(self buttonHalfShadowColor) |
|
2341 |
halfLight:(self buttonHalfLightColor) |
|
2342 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2343 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2344 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2345 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2346 |
|
3187 | 2347 |
drawFocusForItem:anItem |
2348 |
|lytItem| |
|
2349 |
||
2350 |
lytItem := anItem layout. |
|
2351 |
self paint:(Color black). |
|
2352 |
||
2353 |
self displayDottedRectangleX:(lytItem left) |
|
2354 |
y:(lytItem top) |
|
2355 |
width:(lytItem width) |
|
2356 |
height:(lytItem height). |
|
2357 |
! |
|
2358 |
||
2016 | 2359 |
drawItemsX:x y:y width:w height:h |
2715 | 2360 |
"redraw items and groups in a damage" |
2361 |
||
2016 | 2362 |
|isVertical item layout prevClip |
2363 |
x1 "{ Class:SmallInteger }" |
|
2364 |
x2 "{ Class:SmallInteger }" |
|
2365 |
y1 "{ Class:SmallInteger }" |
|
2366 |
y2 "{ Class:SmallInteger }" |
|
2367 |
start "{ Class:SmallInteger }" |
|
2368 |
stop "{ Class:SmallInteger }" |
|
2369 |
size "{ Class:SmallInteger }" |
|
2370 |
groupDivInset "{ Class:SmallInteger }" |
|
2371 |
| |
|
2372 |
||
2373 |
size := items size. |
|
2374 |
isVertical := self verticalLayout. |
|
2375 |
||
2376 |
isVertical ifTrue:[ |
|
2064 | 2377 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2378 |
start == 0 ifTrue:[ ^ self ]. |
2379 |
y1 := y + h. |
|
2064 | 2380 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2381 |
startingAt:(start + 1). |
|
2016 | 2382 |
] ifFalse:[ |
2064 | 2383 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2384 |
start == 0 ifTrue:[ ^ self ]. |
2385 |
x1 := x + w. |
|
2064 | 2386 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2387 |
startingAt:(start + 1). |
|
2016 | 2388 |
]. |
2389 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2390 |
||
2253 | 2391 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2392 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2393 |
|
2394 |
groupDivInset ~~ 0 ifTrue:[ |
|
2395 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2396 |
start := start - 1 |
|
2397 |
] |
|
2398 |
]. |
|
2399 |
] ifFalse:[ |
|
2400 |
groupDivInset := 0 |
|
2401 |
]. |
|
2402 |
||
2403 |
prevClip := clipRect. |
|
2404 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2405 |
||
2406 |
start to:stop do:[:i| |
|
2407 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2408 |
item draw. |
2016 | 2409 |
|
2410 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2411 |
layout := item layout. |
|
2412 |
||
2413 |
isVertical ifTrue:[ |
|
2414 |
x1 := layout left. |
|
2415 |
x2 := layout right. |
|
2416 |
y1 := layout bottom + groupDivInset. |
|
2417 |
y2 := y1. |
|
2418 |
] ifFalse:[ |
|
2419 |
y1 := layout top. |
|
2420 |
y2 := layout bottom. |
|
2421 |
x1 := layout right + groupDivInset. |
|
2422 |
x2 := x1. |
|
2423 |
]. |
|
2424 |
self paint:shadowColor. |
|
2425 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2426 |
self paint:lightColor. |
|
2427 |
||
2428 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2429 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2430 |
||
2431 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
3187 | 2432 |
]. |
2433 |
selection == item ifTrue:[ |
|
2434 |
self focusComesByTab ifTrue:[ |
|
2435 |
self drawFocusForItem:item. |
|
2436 |
]. |
|
2437 |
]. |
|
2016 | 2438 |
]. |
2439 |
self clippingRectangle:prevClip. |
|
2440 |
! |
|
2441 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2442 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2443 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2444 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2445 |
isSelected ifTrue:[ |
2219 | 2446 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2447 |
] ifFalse:[ |
2219 | 2448 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2449 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2450 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2451 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2452 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2453 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2454 |
|
1691 | 2455 |
self drawEdgesForX:(layout left) |
2456 |
y:(layout top) |
|
2457 |
width:(layout width) |
|
2458 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2459 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2460 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2461 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2462 |
|
2016 | 2463 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2464 |
"draw a scroller" |
2465 |
||
2016 | 2466 |
|scrolling icon level x y w h| |
2467 |
||
2468 |
x := bounds left. |
|
2469 |
y := bounds top. |
|
2470 |
w := bounds width. |
|
2471 |
h := bounds height. |
|
2472 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2473 |
scrolling := self scrollActivity. |
2016 | 2474 |
|
2475 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2715 | 2476 |
level := -2 |
2016 | 2477 |
] ifFalse:[ |
2715 | 2478 |
level := 1 |
2016 | 2479 |
]. |
2480 |
||
2481 |
level ~~ 0 ifTrue:[ |
|
2715 | 2482 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2483 |
]. |
2484 |
icon := scrolling iconAt:aDirection on:self. |
|
2485 |
||
2486 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2715 | 2487 |
y:(y + (h - icon height // 2)). |
2016 | 2488 |
! |
2489 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2490 |
invalidateItem:anItem repairNow:aBool |
2715 | 2491 |
"an item changed; invalidate the items layout" |
2492 |
||
2016 | 2493 |
|layout| |
2494 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2495 |
(mustRearrange not and:[shown]) ifTrue:[ |
2715 | 2496 |
layout := anItem layout. |
2497 |
||
2498 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2499 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2500 |
] |
|
1728 | 2501 |
]. |
2502 |
||
2503 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2504 |
! |
2505 |
||
388 | 2506 |
mustRearrange |
2715 | 2507 |
"force rearrange (i.e. set the rearrange flag)" |
2508 |
||
2080 | 2509 |
mustRearrange ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2510 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2511 |
self invalidate "/ RepairNow:true |
388 | 2512 |
] |
590 | 2513 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2514 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2515 |
! |
2516 |
||
710 | 2517 |
rearrangeGroups |
3126
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2518 |
"implements the groupIdentifier #right/#conditionalRight in a horizontal menu" |
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2519 |
|
8dca3b01f1db
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3125
diff
changeset
|
2520 |
<resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')> |
2715 | 2521 |
|
1699 | 2522 |
|layout point |
710 | 2523 |
dltX "{ Class:SmallInteger }" |
2524 |
start "{ Class:SmallInteger }" |
|
2525 |
| |
|
2526 |
||
2527 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2715 | 2528 |
^ self |
710 | 2529 |
]. |
2530 |
||
2531 |
layout := items last layout. |
|
2532 |
||
1699 | 2533 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2715 | 2534 |
^ self "/ no free space |
710 | 2535 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2536 |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2537 |
"/ The behavior of #conditionalRight is controlled by the styleSheet. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2538 |
"/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2539 |
"/ otherwise, it is treated like #right. |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
2540 |
"/ 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
|
2541 |
"/ non-right under win32 (as is used woth the help-menus). |
3148 | 2542 |
(StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[ |
2543 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2544 |
] ifFalse:[ |
|
2545 |
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
|
2546 |
]. |
710 | 2547 |
start == 0 ifTrue:[ |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2548 |
^ self "/ no right-group item detected |
1699 | 2549 |
]. |
2550 |
point := dltX @ 0. |
|
2551 |
||
2552 |
"/ move items layout to right |
|
710 | 2553 |
items from:start do:[:anItem| |
2715 | 2554 |
anItem isVisible ifTrue:[ |
2555 |
anItem layout moveBy:point. |
|
2556 |
] |
|
710 | 2557 |
]. |
3125
25a0bdbe879a
startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents:
3122
diff
changeset
|
2558 |
|
3148 | 2559 |
"Modified: / 09-11-2006 / 13:09:59 / cg" |
710 | 2560 |
! |
2561 |
||
388 | 2562 |
rearrangeItems |
1699 | 2563 |
"recompute the layout of each item |
2715 | 2564 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2565 |
||
1791 | 2566 |
|isVertical extent isPopUpMenu |
2219 | 2567 |
x "{ Class:SmallInteger }" |
2568 |
y "{ Class:SmallInteger }" |
|
2569 |
x0 "{ Class:SmallInteger }" |
|
2570 |
y0 "{ Class:SmallInteger }" |
|
2571 |
x1 "{ Class:SmallInteger }" |
|
2572 |
y1 "{ Class:SmallInteger }" |
|
2573 |
size "{ Class:SmallInteger }" |
|
2574 |
insetX "{ Class:SmallInteger }" |
|
2575 |
insetY "{ Class:SmallInteger }" |
|
2576 |
labelInsetX "{ Class:SmallInteger }" |
|
2577 |
labelInsetY "{ Class:SmallInteger }" |
|
2578 |
itemMargin "{ Class:SmallInteger }" |
|
2579 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2580 |
| |
1699 | 2581 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2582 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2583 |
^ self |
390 | 2584 |
]. |
2219 | 2585 |
|
2080 | 2586 |
"/ DON'T SET THIS!! |
2587 |
"/ item layout: below of first item -> item invalidate |
|
2588 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2589 |
"/ -> invalidate:rapairDamage: |
|
2590 |
"/ -> redrawX:y:width:height: |
|
2591 |
"/ tries to get uninitialized layout from second item. |
|
2592 |
"/ This happens in a modal debugger!! |
|
2593 |
"/ mustRearrange := false. |
|
2219 | 2594 |
isVertical := self verticalLayout. |
2595 |
groupDividerSize := self groupDividerSize. |
|
2596 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2597 |
|
2598 |
isPopUpMenu ifFalse:[ |
|
2219 | 2599 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2600 |
] ifTrue:[ |
2145 | 2601 |
labelInsetX := labelInsetY := 0 |
388 | 2602 |
]. |
390 | 2603 |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2604 |
(isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[ |saveExtent maxExtent extentToSet| |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2605 |
extent := self preferredExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2606 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2607 |
isPopUpMenu ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2608 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2609 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2610 |
extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2611 |
ifFalse:[(extent x min:(maxExtent x)) @ extent y]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2612 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2613 |
] ifFalse:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2614 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
1478 | 2615 |
]. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2616 |
self extent:extentToSet. |
390 | 2617 |
] ifFalse:[ |
1699 | 2618 |
extent := self computeExtent |
390 | 2619 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2620 |
|
1093 | 2621 |
x := y := margin. |
2622 |
||
1699 | 2623 |
isVertical ifFalse:[ |
2624 |
y0 := margin. |
|
2625 |
y1 := extent y - margin. |
|
2626 |
||
2627 |
items keysAndValuesDo:[:anIndex :el| |
|
2628 |
el isVisible ifFalse:[ |
|
2629 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2630 |
] ifTrue:[ |
|
1478 | 2631 |
el isButton ifTrue:[ |
2145 | 2632 |
insetX := buttonInsetX. |
2633 |
insetY := buttonInsetY. |
|
2062 | 2634 |
] ifFalse:[ |
2145 | 2635 |
insetX := labelInsetX. |
2636 |
insetY := labelInsetY. |
|
1478 | 2637 |
]. |
2145 | 2638 |
x0 := x + insetX. |
2171 | 2639 |
x1 := x0 + (el preferredExtent x). |
2145 | 2640 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2641 |
x := x1 + insetX. |
|
1699 | 2642 |
|
2643 |
size ~~ anIndex ifTrue:[ |
|
2644 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2645 |
x := x + groupDividerSize |
|
2646 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2647 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2648 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2649 |
] |
1699 | 2650 |
] |
2651 |
] |
|
1478 | 2652 |
]. |
1699 | 2653 |
]. |
2654 |
] ifTrue:[ |
|
2219 | 2655 |
itemMargin := self itemMargin. |
1699 | 2656 |
x0 := margin. |
2219 | 2657 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2658 |
|
2659 |
items keysAndValuesDo:[:anIndex :el| |
|
2660 |
el isVisible ifFalse:[ |
|
2661 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2662 |
] ifTrue:[ |
|
2663 |
el isButton ifTrue:[ |
|
2145 | 2664 |
insetX := buttonInsetX. |
2665 |
insetY := buttonInsetY. |
|
1699 | 2666 |
] ifFalse:[ |
2145 | 2667 |
insetX := labelInsetX. |
2668 |
insetY := labelInsetY. |
|
1699 | 2669 |
]. |
2145 | 2670 |
y0 := y + insetY. |
1699 | 2671 |
y1 := y0 + el preferredExtent y. |
2219 | 2672 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2673 |
y := y1 + insetY. |
1699 | 2674 |
|
2675 |
size ~~ anIndex ifTrue:[ |
|
2676 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2677 |
y := y + groupDividerSize |
|
2678 |
] |
|
2679 |
] |
|
1478 | 2680 |
] |
2681 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2682 |
]. |
710 | 2683 |
self rearrangeGroups. |
2048 | 2684 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2685 |
mustRearrange := false. |
2048 | 2686 |
|
2687 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2688 |
! |
2689 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2690 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2691 |
"check for items which can change its visibility; |
2715 | 2692 |
if at least one item exists, rearrange all items" |
2693 |
||
1464 | 2694 |
items isNil ifTrue:[^ self]. |
1699 | 2695 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2696 |
items do:[:item | |
2715 | 2697 |
item canChangeVisibility ifTrue:[ |
2698 |
mustRearrange := true. |
|
2699 |
self rearrangeItems. |
|
2700 |
^ self |
|
2701 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2702 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2703 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2704 |
|
388 | 2705 |
redrawX:x y:y width:w height:h |
2715 | 2706 |
"redraw a damage" |
2707 |
||
2860 | 2708 |
|y0 y1 x0 x1| |
388 | 2709 |
|
710 | 2710 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2711 |
|
1699 | 2712 |
mustRearrange ifTrue:[ |
2569 | 2713 |
self isPopUpView ifFalse:[explicitExtent := true]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2714 |
self rearrangeItems. |
2569 | 2715 |
self invalidate. |
2716 |
^ self |
|
1699 | 2717 |
]. |
2888 | 2718 |
"/ self paint:(self viewBackground). |
1699 | 2719 |
self clearRectangleX:x y:y width:w height:h. |
2720 |
||
2016 | 2721 |
items size == 0 ifTrue:[ |
1699 | 2722 |
^ self |
2723 |
]. |
|
2016 | 2724 |
y0 := y. |
2725 |
y1 := y + h. |
|
2018 | 2726 |
x0 := x. |
2727 |
x1 := x + w. |
|
2016 | 2728 |
|
2860 | 2729 |
self isPopUpView ifFalse:[ |mustDraw prvBound nxtBound| |
2730 |
self hasScrollers ifTrue:[ |
|
2731 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2732 |
prvBound := self scrollerBoundsAt:#PREV. |
|
2733 |
||
2734 |
self verticalLayout ifTrue:[ |
|
2735 |
(mustDraw := (prvBound bottom > y)) ifTrue:[ |
|
2736 |
y0 := prvBound bottom. |
|
2737 |
]. |
|
2738 |
] ifFalse:[ |
|
2739 |
(mustDraw := (prvBound right > x)) ifTrue:[ |
|
2740 |
x0 := prvBound right. |
|
2741 |
]. |
|
2018 | 2742 |
]. |
2860 | 2743 |
mustDraw ifTrue:[ |
2744 |
self drawScrollerAt:#PREV bounds:prvBound. |
|
2018 | 2745 |
]. |
2052 | 2746 |
]. |
2860 | 2747 |
|
2748 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2749 |
nxtBound := self scrollerBoundsAt:#NEXT. |
|
2750 |
||
2751 |
self verticalLayout ifTrue:[ |
|
2752 |
(mustDraw := (nxtBound top < y1)) ifTrue:[ |
|
2753 |
y1 := nxtBound top. |
|
2754 |
] |
|
2755 |
] ifFalse:[ |
|
2756 |
(mustDraw := (nxtBound left < x1)) ifTrue:[ |
|
2757 |
x1 := nxtBound left. |
|
2758 |
] |
|
2759 |
]. |
|
2760 |
mustDraw ifTrue:[ |
|
2761 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
|
2762 |
]. |
|
2052 | 2763 |
]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2764 |
]. |
2860 | 2765 |
self menuAdornmentAt:#lastDrawnScrollerNextBounds put:nxtBound. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2766 |
]. |
2018 | 2767 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2768 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2769 |
]. |
2052 | 2770 |
|
2771 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2772 |
! ! |
2773 |
||
2774 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2775 |
||
2776 |
collect:aOneArgBlock |
|
2777 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 2778 |
and return a collection of the results" |
2779 |
||
388 | 2780 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 2781 |
^ nil |
388 | 2782 |
! |
2783 |
||
2784 |
do:aOneArgBlock |
|
2715 | 2785 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
2786 |
||
388 | 2787 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
2788 |
! |
|
2789 |
||
2790 |
findFirst:aOneArgBlock |
|
2791 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2792 |
returns true; return its index or 0 if none detected." |
2793 |
||
388 | 2794 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 2795 |
^ 0 |
388 | 2796 |
! |
2797 |
||
2798 |
findLast:aOneArgBlock |
|
2799 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2800 |
returns true; return its index or 0 if none detected." |
2801 |
||
388 | 2802 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 2803 |
^ 0 |
388 | 2804 |
! |
2805 |
||
3187 | 2806 |
firstItemSelectable |
2807 |
"returns the first item which is selectable or nil |
|
2808 |
" |
|
2809 |
items size > 0 ifTrue:[ |
|
2810 |
^ items detect:[:anItem| anItem canSelect ] ifNone:nil |
|
2811 |
]. |
|
2812 |
^ nil |
|
2813 |
! |
|
2814 |
||
390 | 2815 |
indexOf:something |
2816 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 2817 |
If no item match 0 is returned. No range checks are performed on a number argument" |
2818 |
||
390 | 2819 |
|i v| |
2820 |
||
2821 |
something isNumber ifTrue:[ ^ something ]. |
|
2822 |
something isNil ifTrue:[ ^ 0 ]. |
|
2823 |
||
1218 | 2824 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2825 |
|
2826 |
i ~~ 0 ifTrue:[ |
|
2715 | 2827 |
^ i |
388 | 2828 |
]. |
390 | 2829 |
|
2830 |
something isSymbol ifTrue:[ |
|
2715 | 2831 |
i := self findFirst:[:el| |
2832 |
v := el value. |
|
2833 |
v isSymbol and:[v == something] |
|
2834 |
]. |
|
2835 |
i ~~ 0 ifTrue:[ |
|
2836 |
^ i |
|
2837 |
] |
|
390 | 2838 |
]. |
2839 |
||
2840 |
(something respondsTo:#string) ifTrue:[ |
|
2715 | 2841 |
v := something string. |
1218 | 2842 |
^ self findFirst:[:el | el textLabel = v]. |
2843 |
]. |
|
2844 |
^ 0 |
|
388 | 2845 |
! |
2846 |
||
706 | 2847 |
indexOfItem:anItem |
2715 | 2848 |
"returns the index of the item or 0" |
2849 |
||
706 | 2850 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
2851 |
! |
|
2852 |
||
388 | 2853 |
keysAndValuesDo:aTwoArgBlock |
2715 | 2854 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
2855 |
||
388 | 2856 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
2857 |
! ! |
|
2858 |
||
2859 |
!MenuPanel methodsFor:'event handling'! |
|
2860 |
||
2861 |
buttonMotion:state x:x y:y |
|
2715 | 2862 |
"open or close the corresponding submenu" |
2863 |
||
2046 | 2864 |
|menue motionPoint translatedPoint sensor| |
1699 | 2865 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2866 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2867 |
^ self |
2016 | 2868 |
]. |
2869 |
||
1699 | 2870 |
sensor := self sensor. |
2871 |
||
2872 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2873 |
^ self |
1699 | 2874 |
]. |
2875 |
menue := self detectGrabMenu. |
|
1841 | 2876 |
|
2046 | 2877 |
motionPoint := x@y. |
2878 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2879 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2880 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2881 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2882 |
|
1699 | 2883 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2884 |
^ self |
1699 | 2885 |
]. |
2886 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2887 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2888 |
"/ selection on grabView withou a submenu (Button ...); check whether moving out |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2889 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2890 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2891 |
] |
1699 | 2892 |
]. |
2893 |
||
2048 | 2894 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2895 |
! |
2896 |
||
2897 |
buttonPress:button x:x y:y |
|
2715 | 2898 |
"any button pressed; open or close the corresponding submenus" |
2899 |
||
2016 | 2900 |
|menu point| |
2901 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2902 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2903 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2904 |
self scrollActivity stop. |
2016 | 2905 |
point := x@y. |
2906 |
menu := self detectMenuAtGrabPoint:point. |
|
2907 |
||
2908 |
menu isNil ifTrue:[ |
|
2133
293dadf237ad
hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
2909 |
"/ self accept:nil |
2016 | 2910 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2911 |
point := menu translateGrabPoint:point. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2912 |
menu handleButtonPressAtPoint:point. |
2016 | 2913 |
] |
2046 | 2914 |
|
2915 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2916 |
! |
2917 |
||
2918 |
buttonRelease:button x:x y:y |
|
2715 | 2919 |
"button release action; accept selection and close all views" |
2920 |
||
2679 | 2921 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
2715 | 2922 |
buttonReleaseTime menuOpenTime| |
2199 | 2923 |
|
2924 |
topMenu := self topMenu. |
|
2925 |
topMenu openDelayed:nil. |
|
1699 | 2926 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2927 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2928 |
^ self |
2016 | 2929 |
]. |
2930 |
||
1699 | 2931 |
dstMenu := topMenu activeMenu. |
2932 |
||
2679 | 2933 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
2934 |
||
2935 |
hideMenuAndPerformAction ifFalse:[ |
|
2936 |
hideOnRelease ifTrue:[ |
|
2937 |
buttonReleaseTime := Time millisecondClockValue. |
|
2938 |
menuOpenTime := dstMenu mapTime. |
|
2939 |
"/ t := windowGroup lastEvent timeStamp. |
|
2940 |
hideMenuAndPerformAction := (OperatingSystem millisecondTimeDeltaBetween:buttonReleaseTime and:menuOpenTime) |
|
2941 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
2942 |
]. |
|
2943 |
]. |
|
2944 |
||
2945 |
hideMenuAndPerformAction ifTrue:[ |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2946 |
srcPoint := x@y. |
1699 | 2947 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2948 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2949 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2950 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2951 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2952 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2953 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2954 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2955 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2956 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2957 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2958 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2959 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2960 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2961 |
|
2374 | 2962 |
subm notNil ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2963 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2964 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2965 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2966 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2967 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2968 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2969 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2970 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2971 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2972 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2973 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2974 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2975 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2976 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2977 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2978 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2979 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2980 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2981 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2982 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2983 |
self accept:nil. |
1699 | 2984 |
]. |
2985 |
! |
|
2986 |
||
2860 | 2987 |
handleSizeChanged:how |
2988 |
"used to handle the scrollers and groups in a none popUpView |
|
2989 |
" |
|
2990 |
|layouts damage isVertical scrollBound| |
|
2991 |
||
2992 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
2993 |
^ self |
|
2994 |
]. |
|
2995 |
mustRearrange := true. |
|
2996 |
||
2997 |
shown ifFalse:[ |
|
2998 |
^ self |
|
2999 |
]. |
|
3000 |
layouts := OrderedCollection new. |
|
3001 |
||
3002 |
items do:[:el| |layout| |
|
3003 |
(layout := el layout) isNil ifTrue:[ |
|
3004 |
self invalidate. |
|
3005 |
^ self. |
|
3006 |
]. |
|
3007 |
layouts add:layout. |
|
3008 |
]. |
|
3009 |
isVertical := self verticalLayout. |
|
3010 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
3011 |
||
3012 |
self rearrangeItems. |
|
3013 |
||
3014 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
3015 |
damage isNil ifTrue:[ |
|
3016 |
newLyt := el layout. |
|
3017 |
oldLyt := layouts at:i ifAbsent:newLyt. |
|
3018 |
||
3019 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
|
3020 |
start := 0. |
|
3021 |
||
3022 |
i > 1 ifTrue:[ |
|
3023 |
isVertical ifTrue:[ |
|
3024 |
x := 0. |
|
3025 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
|
3026 |
] ifFalse:[ |
|
3027 |
y := 0. |
|
3028 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
|
3029 |
]. |
|
3030 |
]. |
|
3031 |
start <= 20 ifTrue:[ |
|
3032 |
self invalidate. |
|
3033 |
^ self |
|
3034 |
]. |
|
3035 |
damage := Rectangle left:x top:y extent:(self extent). |
|
3036 |
]. |
|
3037 |
]. |
|
3038 |
]. |
|
3039 |
damage isNil ifTrue:[ |
|
3040 |
damage := scrollBound. |
|
3041 |
]. |
|
3042 |
scrollBound := self menuAdornmentAt:#lastDrawnScrollerNextBounds. |
|
3043 |
||
3044 |
scrollBound notNil ifTrue:[ |
|
3045 |
damage := damage merge:scrollBound |
|
3046 |
]. |
|
3047 |
self invalidate:damage. |
|
3048 |
! |
|
3049 |
||
1699 | 3050 |
keyPress:key x:x y:y |
2715 | 3051 |
"any key is pressed" |
3052 |
||
2869 | 3053 |
<resource: #keyboard (#Escape |
3054 |
#Tab #FocusNext #FocusPrevious |
|
3055 |
#CursorLeft #CursorRight )> |
|
3056 |
||
3057 |
|menu menusSuperMenu sensor| |
|
2251 | 3058 |
|
3059 |
sensor := self sensor. |
|
3158 | 3060 |
|
3061 |
"/ sensor anyButtonPressed ifTrue:[ |
|
3062 |
"/ ^ self "/ ignored while any button is pressed |
|
3063 |
"/ ]. |
|
1699 | 3064 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3065 |
self scrollActivity isActive ifTrue:[ |
2016 | 3066 |
key ~~ #Escape ifTrue:[ |
3067 |
^ self |
|
3068 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3069 |
self scrollActivity stop |
2016 | 3070 |
]. |
3071 |
||
1699 | 3072 |
(key == #Tab |
3073 |
or:[key == #FocusNext |
|
3074 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
3075 |
self accept:nil. |
|
2374 | 3076 |
^ super keyPress:key x:x y:y |
1699 | 3077 |
]. |
3078 |
||
3079 |
menu := self detectGrabMenu. |
|
2869 | 3080 |
menusSuperMenu := menu superMenu. |
1699 | 3081 |
|
3082 |
key == #Escape ifTrue:[ |
|
3083 |
"/ must hide the active menu |
|
2869 | 3084 |
(menusSuperMenu notNil and:[menusSuperMenu ~~ self]) ifTrue:[ |
1703 | 3085 |
"/ hide active menu but keep the grab |
2869 | 3086 |
menusSuperMenu selection:nil |
1699 | 3087 |
] ifFalse:[ |
1703 | 3088 |
"/ hide active menu and ungrab |
1699 | 3089 |
self accept:nil |
2251 | 3090 |
]. |
3091 |
^ self |
|
3092 |
]. |
|
3093 |
||
3094 |
menu isViewWrapper ifFalse:[ |
|
3095 |
sensor compressKeyPressEventsWithKey:key. |
|
3096 |
menu handleKeyPress:key. |
|
2374 | 3097 |
^ self |
2251 | 3098 |
]. |
2869 | 3099 |
menusSuperMenu == self ifFalse:[^ self]. |
2251 | 3100 |
|
3101 |
"/ allow cursor movement |
|
3102 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3103 |
(self containsPoint:x@y) ifTrue:[ |
|
3104 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3105 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3106 |
]. |
1699 | 3107 |
! |
3108 |
||
3109 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3110 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3111 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3112 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3113 |
|
1699 | 3114 |
self detectGrabMenu handlePointerLeave:state. |
3115 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3116 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 3117 |
^ self |
3118 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3119 |
|
2374 | 3120 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3121 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3122 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3123 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3124 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3125 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3126 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3127 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3128 |
sensor isNil ifTrue:[ |
2251 | 3129 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3130 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3131 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3132 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3133 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3134 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3135 |
]. |
2251 | 3136 |
] |
1699 | 3137 |
]. |
3138 |
! |
|
3139 |
||
3140 |
sizeChanged:how |
|
2715 | 3141 |
"redraw #right groups" |
3142 |
||
2860 | 3143 |
"/ self isPopUpView ifFalse:[ |
3144 |
"/ mustRearrange := true. |
|
3145 |
"/ self invalidate |
|
3146 |
"/ ]. |
|
3147 |
"/ ^ super sizeChanged:how. |
|
3148 |
||
3149 |
self handleSizeChanged:how. |
|
3150 |
super sizeChanged:how. |
|
1699 | 3151 |
! ! |
3152 |
||
2503 | 3153 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3154 |
|
1767 | 3155 |
clearImplicitGrab |
2253 | 3156 |
implicitGrabView := lastPointerView := nil. |
1767 | 3157 |
! |
3158 |
||
3159 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3160 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3161 |
|
2253 | 3162 |
|view x y p syntheticEvent menu| |
1767 | 3163 |
|
2658 | 3164 |
ev isDamage ifTrue:[ |
3165 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3166 |
]. |
|
3167 |
||
3142 | 3168 |
(superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[ |
3169 |
focusView ~~ self ifTrue:[prevFocusView := focusView]. |
|
3170 |
]. |
|
3171 |
||
1767 | 3172 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3173 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3174 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3175 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3176 |
self sensor leftButtonPressed ifFalse:[ |
3177 |
self clearImplicitGrab. |
|
3178 |
]. |
|
1767 | 3179 |
]. |
3180 |
||
3181 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 3182 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3183 |
]. |
3184 |
||
3185 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3186 |
ev isButtonEvent ifTrue:[ |
3187 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3188 |
ev view:implicitGrabView. |
|
3189 |
ev arguments at:2 put:p x. |
|
3190 |
ev arguments at:3 put:p y. |
|
3191 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3192 |
||
3193 |
ev isButtonReleaseEvent ifTrue:[ |
|
3194 |
self clearImplicitGrab. |
|
3195 |
]. |
|
3196 |
^ self |
|
3197 |
] |
|
1767 | 3198 |
]. |
3199 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3200 |
||
2016 | 3201 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 3202 |
self clearImplicitGrab. |
1767 | 3203 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
3204 |
]. |
|
3205 |
||
3206 |
p := menu translateGrabPoint:(x@y). |
|
3207 |
view := self detectViewAtX:(p x) y:(p y) in:menu. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3208 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3209 |
|
3210 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 3211 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3212 |
view requestFocus. |
|
3213 |
]. |
|
3214 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3215 |
implicitGrabView := view. |
|
3216 |
] |
|
3217 |
]. |
|
1767 | 3218 |
|
3219 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 3220 |
lastPointerView ~~ view ifTrue:[ |
3221 |
"/ must generate enter/leave ... (sigh) |
|
3222 |
lastPointerView notNil ifTrue:[ |
|
3223 |
"/ XXX: should be fixed |
|
3224 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3225 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3226 |
]. |
|
3227 |
view notNil ifTrue:[ |
|
3228 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3229 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3230 |
]. |
|
3231 |
lastPointerView := view. |
|
3232 |
]. |
|
1767 | 3233 |
]. |
3234 |
||
3235 |
ev view:view. |
|
3236 |
ev x:p x. |
|
3237 |
ev y:p y. |
|
3238 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3239 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3240 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3241 |
! |
3242 |
||
2048 | 3243 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3244 |
"open or close the corresponding submenus" |
3245 |
||
2251 | 3246 |
|menu item translatedPoint containsPoint| |
3247 |
||
3248 |
containsPoint := self containsPoint:motionPoint. |
|
3187 | 3249 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ]. |
2251 | 3250 |
|
3251 |
self pointerEntersItem:item. |
|
1699 | 3252 |
|
1910 | 3253 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
3187 | 3254 |
( self selectionFollowsMouse |
3255 |
and:[self topMenu focusComesByTab not] |
|
3256 |
) ifTrue:[ |
|
3257 |
self isPopUpView ifTrue:[ |
|
3258 |
item isNil ifTrue:[ |
|
3259 |
superMenu notNil ifTrue:[ |
|
3260 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu. |
|
3261 |
superMenu handleButtonMotion:state atPoint:translatedPoint. |
|
3262 |
] |
|
3263 |
] ifFalse:[ |
|
3264 |
self selection:item openMenu:false. |
|
3265 |
self openDelayed:item afterSeconds:0.1. |
|
3266 |
]. |
|
3267 |
] ifFalse:[ "/ processing in the toolbar |
|
3268 |
(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[ |
|
3269 |
self selection:item openMenu:true. |
|
3270 |
]. |
|
3271 |
]. |
|
3272 |
]. |
|
2048 | 3273 |
^ self |
3274 |
]. |
|
3275 |
||
2251 | 3276 |
containsPoint ifTrue:[ |
3277 |
self selection:item openMenu:true. |
|
2374 | 3278 |
^ self |
2251 | 3279 |
]. |
3280 |
||
3281 |
menu := self superMenuAtPoint:motionPoint. |
|
3282 |
||
2374 | 3283 |
menu notNil ifTrue:[ |
2046 | 3284 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3285 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3286 |
^ self |
2251 | 3287 |
]. |
3288 |
self isPopUpView ifTrue:[ |
|
3289 |
self selection:nil |
|
3290 |
]. |
|
2046 | 3291 |
! |
3292 |
||
3293 |
handleButtonPressAtPoint:aPoint |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3294 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3295 |
|
2251 | 3296 |
| item sensor direction wasSelected| |
2016 | 3297 |
|
2046 | 3298 |
item := self itemAtPoint:aPoint. |
2374 | 3299 |
item isNil ifTrue:[ |
2251 | 3300 |
self selection:nil openMenu:false. |
2374 | 3301 |
^ self |
2251 | 3302 |
]. |
3303 |
||
3304 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3305 |
direction notNil ifTrue:[ |
|
3306 |
(self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[ |
|
3307 |
self pointerEntersItem:nil. |
|
3308 |
^ self |
|
2238 | 3309 |
] |
2016 | 3310 |
]. |
2251 | 3311 |
|
3312 |
wasSelected := (selection == item). |
|
3313 |
wasSelected ifFalse:[ |
|
3314 |
self selection:item openMenu:true |
|
3315 |
]. |
|
2199 | 3316 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3317 |
|
2238 | 3318 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3319 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3320 |
item toggleSubmenuVisibility |
|
3321 |
]. |
|
2238 | 3322 |
^ self |
3323 |
]. |
|
3324 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3325 |
^ self |
|
3326 |
]. |
|
3327 |
self invalidateItem:item repairNow:true. |
|
3328 |
self acceptItem:item inMenu:self. |
|
3329 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3330 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3331 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3332 |
sensor flushUserEvents. |
2238 | 3333 |
self selection:nil. |
2046 | 3334 |
|
3335 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3336 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3337 |
! |
3338 |
||
1699 | 3339 |
handleCursorKey:aKey |
2715 | 3340 |
"handle a cursor key" |
3341 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3342 |
|next menu item isVrt backKey p1 p2 |
2354 | 3343 |
idx0 "{ Class:SmallInteger }" |
687 | 3344 |
idx "{ Class:SmallInteger }" |
1705 | 3345 |
size "{ Class:SmallInteger }" |
687 | 3346 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3347 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3348 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3349 |
^ self |
388 | 3350 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3351 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3352 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3353 |
|
2016 | 3354 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3355 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3356 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3357 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3358 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3359 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3360 |
^ superMenu handleCursorKey:aKey |
1699 | 3361 |
]. |
2016 | 3362 |
idx := 0. |
3363 |
||
3364 |
isVrt ifTrue:[ |
|
3365 |
"/ used because of vertical scrolling |
|
3366 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3367 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3368 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3369 |
] ifFalse:[ |
2016 | 3370 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3371 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3372 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3373 |
|
2354 | 3374 |
idx0 := idx. |
3375 |
size timesRepeat:[ |
|
3376 |
|el| |
|
3377 |
||
3378 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3379 |
||
3380 |
idx > size ifTrue:[ |
|
3381 |
idx := 0 "1" |
|
3382 |
] ifFalse:[ |
|
3383 |
idx < 0 ifTrue:[ |
|
3384 |
idx := size |
|
3385 |
] |
|
3386 |
]. |
|
3387 |
||
3388 |
idx == 0 ifTrue:[ |
|
3389 |
self selection:nil. |
|
3390 |
^ self |
|
3391 |
] ifFalse:[ |
|
3392 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3393 |
el canSelect ifTrue:[ |
|
3394 |
el hasDelayedMenu ifTrue:[ |
|
3395 |
"/ do not open menu |
|
3396 |
self selection:el openMenu:false |
|
3397 |
] ifFalse:[ |
|
3398 |
"/ open comes from style-sheet |
|
3399 |
self selection:el. |
|
3400 |
]. |
|
3401 |
^ self |
|
2249 | 3402 |
]. |
2354 | 3403 |
] |
3404 |
]. |
|
3405 |
idx == idx0 ifTrue:[ |
|
3406 |
^ self |
|
3407 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3408 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3409 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3410 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3411 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3412 |
superMenu notNil ifTrue:[ |
1791 | 3413 |
p1 := self translateGrabPoint:0. |
3414 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3415 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3416 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3417 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3418 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3419 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3420 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3421 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3422 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3423 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3424 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3425 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3426 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3427 |
backKey := #CursorUp. |
1699 | 3428 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3429 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3430 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3431 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3432 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3433 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3434 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3435 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3436 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3437 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3438 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3439 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3440 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3441 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3442 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3443 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3444 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3445 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3446 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3447 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3448 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3449 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3450 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3451 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3452 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3453 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3454 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3455 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3456 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3457 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3458 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3459 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3460 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3461 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3462 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3463 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3464 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3465 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3466 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3467 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3468 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3469 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3470 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3471 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3472 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3473 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3474 |
handleKeyPress:key |
2715 | 3475 |
"any key is pressed" |
3476 |
||
2219 | 3477 |
|item inMenu| |
1699 | 3478 |
|
3479 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3480 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3481 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3482 |
key isCharacter ifTrue:[ |
1862 | 3483 |
"/ selection notNil ifTrue:[ |
3484 |
"/ inMenu := self |
|
3485 |
"/ ] ifFalse:[ |
|
3486 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3487 |
"/ ]. |
|
3488 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3489 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3490 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3491 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3492 |
] |
1699 | 3493 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3494 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3495 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3496 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3497 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3498 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3499 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3500 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3501 |
! |
1699 | 3502 |
|
3503 |
handlePointerLeave:state |
|
3504 |
self pointerEntersItem:nil. |
|
3505 |
super pointerLeave:state |
|
3506 |
! |
|
3507 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3508 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3509 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3510 |
|
2238 | 3511 |
|sensor subm item| |
3512 |
||
3513 |
(item := selection) isNil ifTrue:[ |
|
3514 |
superMenu notNil ifTrue:[ |
|
2249 | 3515 |
item := superMenu selection. |
3516 |
||
3517 |
item value notNil ifTrue:[ |
|
3518 |
"/ is a delayed menu |
|
3519 |
self accept:item |
|
3520 |
] ifFalse:[ |
|
3521 |
item toggleSubmenuVisibility |
|
3522 |
] |
|
2238 | 3523 |
] ifFalse:[ |
3524 |
self accept |
|
3525 |
]. |
|
3526 |
^ self |
|
1841 | 3527 |
]. |
3528 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3529 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3530 |
selection toggleSubmenuVisibility. |
3531 |
^ self |
|
2238 | 3532 |
]. |
3533 |
subm := selection currentSubmenu. |
|
3534 |
||
3535 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3536 |
selection toggleSubmenuVisibility. |
3537 |
^ self |
|
2238 | 3538 |
]. |
3539 |
self openDelayed:nil |
|
1841 | 3540 |
]. |
3541 |
self accept. |
|
3542 |
||
2238 | 3543 |
" test for toggle " |
3544 |
item isToggle ifTrue:[ |
|
3545 |
self selection:item. |
|
3546 |
] ifFalse:[ |
|
3547 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3548 |
^ self |
|
3549 |
] |
|
3550 |
]. |
|
1841 | 3551 |
|
3552 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3553 |
^ self |
1841 | 3554 |
]. |
3555 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3556 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3557 |
sensor flushKeyboardFor:nil. |
2238 | 3558 |
Delay waitForSeconds:0.1. |
3559 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3560 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3561 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3562 |
|
1699 | 3563 |
pointerEntersItem:anItemOrNil |
3564 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3565 |
redraw the new item highlighted." |
3566 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3567 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3568 |
|
1699 | 3569 |
( anItemOrNil notNil |
3570 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3571 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3572 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3573 |
anItemOrNil isButton ifTrue:[ |
2219 | 3574 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3575 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3576 |
) ifTrue:[ |
1699 | 3577 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3578 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3579 |
] ifFalse:[ |
2219 | 3580 |
(self enteredLevel ~~ 0 |
3581 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3582 |
) ifTrue:[ |
|
1699 | 3583 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3584 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3585 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3586 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3587 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3588 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3589 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3590 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3591 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3592 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3593 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3594 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3595 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3596 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3597 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3598 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3599 |
]. |
388 | 3600 |
! ! |
3601 |
||
2251 | 3602 |
!MenuPanel methodsFor:'focus handling'! |
3603 |
||
3187 | 3604 |
canTab |
3605 |
"depends whether I'am a toolbar and selectable items exists |
|
3606 |
" |
|
3607 |
|selectableItem| |
|
3608 |
||
3609 |
(super canTab and:[self isPopUpView not]) ifTrue:[ |
|
3610 |
selectableItem := self firstItemSelectable. |
|
3611 |
^ selectableItem notNil |
|
3612 |
]. |
|
3613 |
^ false |
|
3614 |
! |
|
3615 |
||
3616 |
focusComesByTab |
|
3617 |
"returns true if focus comes by tab and should be drawn |
|
3618 |
" |
|
3619 |
|focusComesByTab| |
|
3620 |
||
3621 |
focusComesByTab := self menuAdornmentAt:#focusComesByTab. |
|
3622 |
||
3623 |
focusComesByTab == true ifTrue:[ |
|
3624 |
(shown and:[self hasFocus]) ifTrue:[ |
|
3625 |
^ true |
|
3626 |
]. |
|
3627 |
self menuAdornmentAt:#focusComesByTab put:false. |
|
3628 |
]. |
|
3629 |
^ false |
|
3630 |
! |
|
3631 |
||
3632 |
focusComesByTab:aBoolean |
|
3633 |
"only handled for toolBars" |
|
3634 |
||
3635 |
|selectableItem| |
|
3636 |
||
3637 |
(self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[ |
|
3638 |
self menuAdornmentAt:#focusComesByTab put:aBoolean. |
|
3639 |
||
3640 |
self hasSelection ifTrue:[ |
|
3641 |
^ self |
|
3642 |
]. |
|
3643 |
||
3644 |
aBoolean ifTrue:[ |
|
3645 |
selectableItem := self firstItemSelectable. |
|
3646 |
]. |
|
3647 |
self selection:selectableItem openMenu:false. |
|
3648 |
]. |
|
3649 |
! |
|
3650 |
||
2251 | 3651 |
hasKeyboardFocus:aBoolean |
2715 | 3652 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3653 |
||
2251 | 3654 |
|focusView| |
3655 |
||
3656 |
self isPopUpView ifTrue:[ |
|
3657 |
"/ not visible for popup menus |
|
3658 |
^ super hasKeyboardFocus:aBoolean |
|
3659 |
]. |
|
3660 |
||
3661 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3662 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3663 |
focusView := windowGroup focusView. |
|
3664 |
||
3665 |
focusView == self ifFalse:[ |
|
3666 |
self selection:nil. |
|
3667 |
] |
|
3668 |
] |
|
3669 |
]. |
|
3670 |
super hasKeyboardFocus:aBoolean. |
|
3142 | 3671 |
! |
3672 |
||
3187 | 3673 |
showFocus:focusComesByTab |
3674 |
self focusComesByTab:focusComesByTab. |
|
3675 |
super showFocus:focusComesByTab. |
|
3676 |
! |
|
3677 |
||
3678 |
showNoFocus:focusByTab |
|
3679 |
self focusComesByTab:false. |
|
3680 |
super showNoFocus:focusByTab. |
|
3681 |
! |
|
3682 |
||
3683 |
supportsFocusOnTab |
|
3684 |
"returns true if focus is supported |
|
3685 |
" |
|
3686 |
^ (styleSheet at:#'focusHighlightStyle') == #win95 |
|
3158 | 3687 |
! |
3688 |
||
3689 |
wantsFocusWithButtonPress |
|
3187 | 3690 |
"needs only the focus if I'am a toolbar; all events are delegated |
3691 |
to my subMenus" |
|
3692 |
||
3693 |
^ self isPopUpView not |
|
2251 | 3694 |
! ! |
3695 |
||
388 | 3696 |
!MenuPanel methodsFor:'grabbing'! |
3697 |
||
1699 | 3698 |
doGrab |
3699 |
relativeGrabOrigin := nil. |
|
3700 |
||
3701 |
superMenu notNil ifTrue:[ |
|
3158 | 3702 |
superMenu doGrab |
1699 | 3703 |
] ifFalse:[ |
3158 | 3704 |
hasImplicitGrap ~~ true ifTrue:[ |
3705 |
self grabMouseAndKeyboard. |
|
3706 |
hasImplicitGrap := true |
|
3707 |
] |
|
1699 | 3708 |
] |
3709 |
! |
|
3710 |
||
3711 |
doUngrab:forceDo |
|
3712 |
||
3713 |
relativeGrabOrigin := nil. |
|
1767 | 3714 |
self clearImplicitGrab. |
1699 | 3715 |
|
3716 |
superMenu notNil ifTrue:[ |
|
3158 | 3717 |
forceDo ifTrue:[ |
3718 |
superMenu doUngrab:true |
|
3719 |
]. |
|
3720 |
^ self |
|
1699 | 3721 |
]. |
3722 |
||
3723 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3158 | 3724 |
^ self |
1699 | 3725 |
]. |
3726 |
||
3727 |
forceDo ifFalse:[ |
|
3158 | 3728 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3729 |
^ self |
|
3730 |
]. |
|
1699 | 3731 |
]. |
3732 |
self ungrabMouseAndKeyboard. |
|
3733 |
self selection:nil. |
|
3734 |
hasImplicitGrap := nil. |
|
1703 | 3735 |
prevFocusView := nil. |
1699 | 3736 |
! |
3737 |
||
1630 | 3738 |
grabKeyboard |
2715 | 3739 |
"grap the keyboard; keep previous grab" |
3740 |
||
1630 | 3741 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 3742 |
^ super grabKeyboard |
1630 | 3743 |
! |
3744 |
||
388 | 3745 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3746 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3747 |
|
3142 | 3748 |
|winGroup sensor| |
3749 |
||
3750 |
winGroup := self windowGroup. |
|
3751 |
||
3752 |
(realized and:[winGroup notNil]) ifTrue:[ |
|
3753 |
prevFocusView isNil ifTrue:[ |
|
3754 |
prevFocusView := winGroup focusView. |
|
3755 |
]. |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3756 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3757 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3758 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3759 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3760 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3761 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3762 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3763 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3764 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3765 |
self unmap |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3766 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3767 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3768 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3769 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3770 |
device activeKeyboardGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3771 |
device sync. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3772 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3773 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3774 |
] |
388 | 3775 |
] |
3776 |
||
3158 | 3777 |
|
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3778 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3779 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3780 |
! |
3781 |
||
1630 | 3782 |
grabPointerWithCursor:aCursorOrNil |
2715 | 3783 |
"grap the pointer; keep previous grab" |
3784 |
||
1630 | 3785 |
previousPointerGrab := device activePointerGrab. |
1699 | 3786 |
hasImplicitGrap := true. |
2715 | 3787 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3788 |
! |
3789 |
||
3790 |
ungrabKeyboard |
|
2715 | 3791 |
"ungrap the keyboard; restore previous grab" |
3792 |
||
1630 | 3793 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3794 |
|
2579 | 3795 |
(previousKeyboardGrab notNil |
3796 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3797 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3798 |
]. |
|
1630 | 3799 |
! |
3800 |
||
388 | 3801 |
ungrabMouseAndKeyboard |
2715 | 3802 |
"ungrab resources (mouse and keyboard)" |
3803 |
||
1630 | 3804 |
self ungrabPointer. |
3805 |
self ungrabKeyboard. |
|
3806 |
! |
|
3807 |
||
3808 |
ungrabPointer |
|
2715 | 3809 |
"ungrap the pointer; restore previous grab" |
3810 |
||
1630 | 3811 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3812 |
|
2579 | 3813 |
(previousPointerGrab notNil |
3814 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3815 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3816 |
]. |
388 | 3817 |
! ! |
3818 |
||
1251 | 3819 |
!MenuPanel methodsFor:'help'! |
3820 |
||
2058 | 3821 |
flyByHelpTextAt:srcPoint |
3822 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2715 | 3823 |
If there is a selection, that items helpText is used (ignoring the given point)." |
3824 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3825 |
self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3826 |
^ nil |
2058 | 3827 |
! |
3828 |
||
3829 |
flyByHelpTextForItem:anItem |
|
2715 | 3830 |
"returns the helpText for an item (empty if none)" |
3831 |
||
2063 | 3832 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3833 |
^ anItem flyByHelpText. |
2058 | 3834 |
! |
3835 |
||
1251 | 3836 |
helpText |
2715 | 3837 |
"return the helpText for the currently selected item (empty if none)" |
3838 |
||
1613 | 3839 |
^ self helpTextForItem:selection |
1251 | 3840 |
! |
3841 |
||
1699 | 3842 |
helpTextAt:srcPoint |
1252 | 3843 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 3844 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
3845 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3846 |
self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu helpTextForItem:item]. |
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
3847 |
^ nil |
1613 | 3848 |
! |
3849 |
||
3850 |
helpTextForItem:anItem |
|
2715 | 3851 |
"returns the helpText for an item (empty if none)" |
3852 |
||
2884
6e060df8f158
fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents:
2883
diff
changeset
|
3853 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3854 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3855 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3856 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3857 |
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
|
3858 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3859 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3860 |
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
|
3861 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3862 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3863 |
item := dstMenu itemAtPoint:dstPoint. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3864 |
aBlock value:dstMenu value:item. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3865 |
] |
1251 | 3866 |
! ! |
3867 |
||
794 | 3868 |
!MenuPanel methodsFor:'image registration'! |
3869 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
3870 |
imageOnMyDevice:anImage |
2715 | 3871 |
"returns image registered on device" |
3872 |
||
2770 | 3873 |
^ self class image:anImage value onDevice:device |
794 | 3874 |
! |
3875 |
||
3876 |
lightenedImageOnDevice:anImage |
|
2715 | 3877 |
"returns lightened image registered on device" |
3878 |
||
794 | 3879 |
^ self class lightenedImage:anImage onDevice:device |
3880 |
! ! |
|
3881 |
||
1688 | 3882 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3883 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3884 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3885 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3886 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3887 |
|
388 | 3888 |
create |
2715 | 3889 |
"create the shadow view for a none contained submenu" |
3890 |
||
388 | 3891 |
super create. |
3892 |
||
3893 |
self isPopUpView ifTrue:[ |
|
2715 | 3894 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3895 |
shadowView isNil ifTrue:[ |
|
3896 |
shadowView := (ShadowView onDevice:device) for:self |
|
3897 |
] ifFalse:[ |
|
3898 |
self saveUnder:true. |
|
3899 |
]. |
|
3900 |
] |
|
388 | 3901 |
] ifFalse:[ |
2715 | 3902 |
explicitExtent == true ifTrue:[ |
3903 |
(self width) == (superView width) ifTrue:[ |
|
3904 |
self verticalLayout:false |
|
3905 |
] |
|
3906 |
] |
|
388 | 3907 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3908 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3909 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3910 |
! |
3911 |
||
3912 |
destroy |
|
2715 | 3913 |
"destroy items and shadowView; remove dependencies" |
3914 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3915 |
self clearLastActiveMenu. |
2051 | 3916 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 3917 |
items := nil. |
3918 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3919 |
|
388 | 3920 |
super destroy. |
3142 | 3921 |
prevFocusView := superMenu := nil. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3922 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3923 |
|
2051 | 3924 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3925 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3926 |
|
616 | 3927 |
fetchDeviceResources |
2715 | 3928 |
"fetch device colors, to avoid reallocation at redraw time" |
3929 |
||
2219 | 3930 |
|style| |
3931 |
||
2374 | 3932 |
superMenu notNil ifTrue:[ |
2219 | 3933 |
styleSheet := superMenu styleSheet |
3934 |
]. |
|
616 | 3935 |
|
3936 |
super fetchDeviceResources. |
|
3937 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3938 |
"/ 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
|
3939 |
"/ (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
|
3940 |
|
616 | 3941 |
superMenu isNil ifTrue:[ |
2374 | 3942 |
rightArrow isNil ifTrue:[ |
2219 | 3943 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 3944 |
]. |
2219 | 3945 |
fgColor := fgColor onDevice:device. |
3946 |
style := styleSheet name. |
|
3947 |
||
2761 | 3948 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
2219 | 3949 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
3950 |
] ifFalse:[ |
|
3951 |
rightArrowShadow := nil |
|
3952 |
]. |
|
616 | 3953 |
] ifFalse:[ |
2219 | 3954 |
rightArrow := superMenu rightArrow. |
3955 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3956 |
||
3957 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 3958 |
self font:(superMenu font). |
2761 | 3959 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3960 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3961 |
|
1829 | 3962 |
items notNil ifTrue:[ |
2219 | 3963 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 3964 |
]. |
3965 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3966 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3967 |
! |
3968 |
||
580 | 3969 |
initStyle |
3970 |
"initialize style specific stuff" |
|
3971 |
||
2919 | 3972 |
<resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
3973 |
#'menu.buttonItemVerticalSpace' #'menu.itemSpace' |
|
3974 |
#'menu.itemHorizontalSpace' |
|
3975 |
#'popup.hideOnRelease' |
|
3976 |
)> |
|
2609 | 3977 |
|fn| |
3978 |
||
580 | 3979 |
super initStyle. |
616 | 3980 |
|
2883 | 3981 |
buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
3982 |
buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
3983 |
buttonInsetX := buttonInsetX abs. |
|
3984 |
||
3985 |
buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
3986 |
buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
|
3987 |
buttonInsetY := buttonInsetY abs. |
|
3988 |
||
3989 |
itemSpace := styleSheet at:#'menu.itemHorizontalSpace'. |
|
3990 |
itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ font widthOf:' '] ]. |
|
3991 |
||
3992 |
||
2609 | 3993 |
fgColor := DefaultForegroundColor ? Color black. |
3994 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
3995 |
fn := self class defaultFont. |
|
2610 | 3996 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 3997 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3998 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3999 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4000 |
self updateLevelAndBorder. |
580 | 4001 |
! |
4002 |
||
388 | 4003 |
initialize |
2715 | 4004 |
"set default configuration" |
4005 |
||
388 | 4006 |
super initialize. |
616 | 4007 |
|
2877 | 4008 |
self enableMotionEvents. "/ for flyByHelp |
498 | 4009 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
4010 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
4011 |
self originChangedFlag:false. |
2253 | 4012 |
explicitExtent := nil. |
4013 |
shortKeyInset := 0. |
|
4014 |
mustRearrange := false. |
|
4015 |
showSeparatingLines := false. |
|
4016 |
showGroupDivider := true. |
|
388 | 4017 |
! |
4018 |
||
1573 | 4019 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4020 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 4021 |
If the grab fails, try again and unmap myself if that fails too." |
4022 |
||
1791 | 4023 |
|loIndices loItems| |
388 | 4024 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4025 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
4026 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
4027 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4028 |
self becomesActiveMenu. |
1573 | 4029 |
super map. |
2681 | 4030 |
self addDependencies. |
388 | 4031 |
|
1785 | 4032 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 4033 |
loItems := items ? #[]. |
4034 |
||
4035 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 4036 |
|
388 | 4037 |
self isPopUpView ifTrue:[ |
2681 | 4038 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4039 |
] ifFalse:[ |
2681 | 4040 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
4041 |
]. |
1791 | 4042 |
loItems do:[:el| el updateIndicators ]. |
388 | 4043 |
|
1785 | 4044 |
loIndices size > 0 ifTrue:[ |
2681 | 4045 |
self redrawX:0 y:0 width:width height:height. |
4046 |
self openMenusFromItemIndices:loIndices. |
|
388 | 4047 |
]. |
4048 |
||
1177 | 4049 |
"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
|
4050 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 4051 |
! |
4052 |
||
4053 |
realize |
|
2715 | 4054 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
4055 |
|
2761 | 4056 |
|bgColor| |
4057 |
||
388 | 4058 |
self isPopUpView ifTrue:[ |
2761 | 4059 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
4060 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
4061 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4062 |
"Because of #saveUnder of ShadowView the order of realize is significant: |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4063 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4064 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4065 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4066 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4067 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4068 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4069 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4070 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4071 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4072 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4073 |
self map. |
736 | 4074 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4075 |
super realize. |
1767 | 4076 |
]. |
4077 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4078 |
hideOnRelease := defaultHideOnRelease. |
388 | 4079 |
! |
4080 |
||
4081 |
recreate |
|
1832 | 4082 |
"this is called after a snapin or a migration. |
2715 | 4083 |
If the image was saved with an active menu, hide the menu" |
4084 |
||
1455 | 4085 |
selection := nil. |
388 | 4086 |
super recreate. |
4087 |
! |
|
4088 |
||
1130 | 4089 |
reinitStyle |
4090 |
"handle style change while being open (win32 only - for now)" |
|
4091 |
||
4092 |
super reinitStyle. |
|
4093 |
||
4094 |
self fetchDeviceResources. |
|
1811 | 4095 |
self mustRearrange. "/ care for changed font sizes etc. |
4096 |
||
4097 |
self do:[:anItem | |
|
4098 |
anItem reinitStyle |
|
4099 |
]. |
|
1130 | 4100 |
|
4101 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 4102 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 4103 |
! |
4104 |
||
388 | 4105 |
unmap |
1330 | 4106 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
4107 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 4108 |
|
2681 | 4109 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4110 |
self clearLastActiveMenu. |
1699 | 4111 |
self doUngrab:(superMenu isNil). |
4112 |
"/ self isPopUpView ifTrue:[ |
|
4113 |
"/ self doUngrab:(superMenu isNil) |
|
4114 |
"/ ]. |
|
3142 | 4115 |
prevFocusView := nil. |
388 | 4116 |
super unmap. |
4117 |
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
|
4118 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4119 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4120 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4121 |
"update level & border, when it is known if I am a popUpView" |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4122 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4123 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4124 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4125 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4126 |
bw := styleSheet at:#'popup.borderWidth' default:1. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4127 |
lvl := styleSheet at:#'popup.level' default:0. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4128 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4129 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 4130 |
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
|
4131 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4132 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4133 |
self level:lvl. |
388 | 4134 |
! ! |
4135 |
||
1878 | 4136 |
!MenuPanel methodsFor:'keyboard control'! |
4137 |
||
4138 |
mnemonicViewNext:aKeyEvent |
|
4139 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
4140 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 4141 |
return the topMenu otherwise nil." |
4142 |
||
2112 | 4143 |
|menu uKey lKey list index| |
4144 |
||
4145 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 4146 |
shown ifFalse:[^ nil]. |
4147 |
||
4148 |
uKey := aKeyEvent rawKey last asUppercase. |
|
4149 |
lKey := uKey asLowercase. |
|
2112 | 4150 |
|
4151 |
selection notNil ifTrue:[ |
|
2374 | 4152 |
"first lookup the current grapMenu before starting in the topMenu |
4153 |
" |
|
4154 |
menu := self detectGrabMenu. |
|
4155 |
||
4156 |
[ menu ~~ self ] whileTrue:[ |
|
4157 |
index := menu selectionIndex. |
|
4158 |
list := menu selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey]] |
|
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4159 |
maxDepth:10 from:(index + 1) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4160 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 4161 |
|
2374 | 4162 |
list size ~~ 0 ifTrue:[ |
4163 |
"/ has item which responds to the mnemonic |
|
4164 |
menu processCollectedIndices:list. |
|
4165 |
^ self |
|
4166 |
]. |
|
4167 |
menu := menu superMenu. |
|
4168 |
]. |
|
4169 |
index := self selectionIndex. |
|
4170 |
list := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ] |
|
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4171 |
maxDepth:10 from:(1 + index) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4172 |
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
|
4173 |
|
2112 | 4174 |
] ifFalse:[ |
2374 | 4175 |
index := 99999. |
4176 |
list := nil. |
|
2112 | 4177 |
]. |
4178 |
||
2374 | 4179 |
list isNil ifTrue:[ |
4180 |
list := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ] |
|
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4181 |
maxDepth:1 from:1 to:index |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4182 |
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
|
4183 |
|
2374 | 4184 |
|
4185 |
list isNil ifTrue:[ |
|
4186 |
"/ must clear existing selection |
|
4187 |
self selection:nil. |
|
4188 |
^ nil |
|
4189 |
] |
|
2112 | 4190 |
]. |
4191 |
||
4192 |
"/ has item which responds to the mnemonic |
|
4193 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4194 |
! |
1878 | 4195 |
|
4196 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4197 |
"open all menus derived from sequence of item indices" |
4198 |
||
1878 | 4199 |
|item| |
4200 |
||
4201 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 4202 |
^ self |
1878 | 4203 |
]. |
4204 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4205 |
||
4206 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 4207 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4208 |
self selection:item openMenu:true. |
|
4209 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4210 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4211 |
! |
1878 | 4212 |
|
4213 |
processCollectedIndices:indices |
|
4214 |
|menu item| |
|
4215 |
||
4216 |
indices size == 0 ifTrue:[ |
|
3192 | 4217 |
^ self |
1878 | 4218 |
]. |
4219 |
menu := self. |
|
4220 |
||
3192 | 4221 |
"/ first lookup in current open submenus |
1878 | 4222 |
[menu selectionIndex == indices first] whileTrue:[ |
3192 | 4223 |
( (item := menu selection) isNil |
4224 |
or:[(menu := item currentSubmenu) isNil] |
|
4225 |
) ifTrue:[ "/ selected but no submenu open - not handled |
|
4226 |
^ self |
|
4227 |
]. |
|
4228 |
indices removeFirst. |
|
4229 |
||
4230 |
indices isEmpty ifTrue:[ |
|
4231 |
menu selection:nil. |
|
4232 |
^ self |
|
4233 |
] |
|
1878 | 4234 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4235 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4236 |
! |
1878 | 4237 |
|
4238 |
processShortcut:aKeyEvent |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4239 |
"a shortcutKey event as forwarded from the keyboardProcessor. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4240 |
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
|
4241 |
Otherwise return false." |
2715 | 4242 |
|
2219 | 4243 |
|menu rKey lKey list item| |
1878 | 4244 |
|
4245 |
superMenu notNil ifTrue:[ |
|
4246 |
^ superMenu processShortcut:aKeyEvent |
|
4247 |
]. |
|
4248 |
shown ifFalse:[^ false]. |
|
4249 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4250 |
lKey := aKeyEvent key. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4251 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4252 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4253 |
|
3192 | 4254 |
( #( CursorDown CursorUp CursorRight CursorLeft Return Escape |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4255 |
) includes:lKey |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4256 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4257 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4258 |
]. |
1878 | 4259 |
rKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4260 |
item := nil. |
1878 | 4261 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
4262 |
||
4263 |
[true] whileTrue:[ |
|
2926
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4264 |
list := menu |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4265 |
selectItemIndicesFor:[:el| |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4266 |
|skey| |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4267 |
|
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4268 |
item := el. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4269 |
el ignoreShortcutKeys ifTrue:[ |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4270 |
false |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4271 |
] ifFalse:[ |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4272 |
skey := el shortcutKey. |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4273 |
skey == rKey or:[skey == lKey] |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4274 |
] |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4275 |
] |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4276 |
maxDepth:10 from:1 to:99999 |
0d6dc899b49f
ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents:
2919
diff
changeset
|
4277 |
ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ]. |
1878 | 4278 |
|
4279 |
list size ~~ 0 ifTrue:[ |
|
4280 |
"/ has item which responds to the shortcut |
|
4281 |
item hasSubmenu ifFalse:[ |
|
4282 |
menu accept:item |
|
4283 |
] ifTrue:[ |
|
4284 |
menu processCollectedIndices:list. |
|
4285 |
self windowGroup focusView:self. |
|
4286 |
]. |
|
4287 |
^ true |
|
4288 |
]. |
|
4289 |
||
4290 |
menu == self ifTrue:[ ^ false ]. |
|
4291 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4292 |
]. |
2219 | 4293 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4294 |
! |
1878 | 4295 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4296 |
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
|
4297 |
"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
|
4298 |
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
|
4299 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4300 |
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
|
4301 |
is created and passed through if the block returns false. |
2715 | 4302 |
Otherwise the item is not asked for its submenu." |
4303 |
||
2112 | 4304 |
|start stop| |
4305 |
||
4306 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4307 |
||
4308 |
start := aStart max:1. |
|
4309 |
stop := aStop min:(items size). |
|
4310 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4311 |
start to:stop do:[:i| |item menu result| |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4312 |
item := items at:i. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4313 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4314 |
(aOneArgBlock value:item) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4315 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4316 |
^ OrderedCollection with:i |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4317 |
] |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4318 |
] ifFalse:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4319 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4320 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4321 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
3192 | 4322 |
menu := item setupSubmenu. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4323 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4324 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4325 |
result := menu selectItemIndicesFor:aOneArgBlock |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4326 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4327 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4328 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4329 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4330 |
result addFirst:i. |
3128 | 4331 |
^ result |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4332 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4333 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4334 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4335 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4336 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4337 |
]. |
1878 | 4338 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4339 |
^ nil |
3128 | 4340 |
|
4341 |
"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
|
4342 |
! ! |
1878 | 4343 |
|
388 | 4344 |
!MenuPanel methodsFor:'misc'! |
4345 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4346 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4347 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4348 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4349 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4350 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4351 |
|
388 | 4352 |
superMenu |
2715 | 4353 |
"returns supermenu or nil" |
4354 |
||
388 | 4355 |
^ superMenu |
4356 |
! |
|
4357 |
||
4358 |
topMenu |
|
2715 | 4359 |
"returns the topMenu; the one having no superMenu" |
4360 |
||
1791 | 4361 |
|menu smenu| |
4362 |
||
4363 |
menu := self. |
|
4364 |
||
4365 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2715 | 4366 |
menu := smenu |
1791 | 4367 |
]. |
4368 |
^ menu |
|
388 | 4369 |
! ! |
4370 |
||
1825 | 4371 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4372 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4373 |
printString |
2715 | 4374 |
"return a printed representation of the menu" |
4375 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4376 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4377 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4378 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4379 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4380 |
self do:[:anItem| |
2715 | 4381 |
label := anItem label ? ''. |
4382 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4383 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4384 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4385 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4386 |
"Modified: / 27.2.1998 / 17:41:22 / cg" |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4387 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4388 |
|
388 | 4389 |
!MenuPanel methodsFor:'private'! |
4390 |
||
434 | 4391 |
application |
2715 | 4392 |
"optimize access to retrive the application" |
4393 |
||
2374 | 4394 |
application notNil ifTrue:[^ application ]. |
434 | 4395 |
|
4396 |
superMenu notNil ifTrue:[ |
|
2253 | 4397 |
application := superMenu application. |
2374 | 4398 |
^ application |
2253 | 4399 |
]. |
4400 |
application := super application. |
|
2374 | 4401 |
^ application |
1872 | 4402 |
! |
434 | 4403 |
|
1572 | 4404 |
detectItemForKey:aKey |
4405 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4406 |
if no item is detected nil is returned." |
4407 |
||
1572 | 4408 |
|cIdx uKey lKey item| |
4409 |
||
1699 | 4410 |
items isNil ifTrue:[^ nil]. |
4411 |
||
1572 | 4412 |
cIdx := self selectionIndex. |
4413 |
uKey := aKey asUppercase. |
|
4414 |
lKey := aKey asLowercase. |
|
4415 |
||
1699 | 4416 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2715 | 4417 |
( anIndex ~~ cIdx |
4418 |
and:[anItem canSelect |
|
4419 |
and:[(label := anItem textLabel) notNil |
|
4420 |
and:[label size ~~ 0]]] |
|
4421 |
) ifTrue:[ |
|
4422 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4423 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4424 |
^ anItem |
|
4425 |
] |
|
4426 |
] ifFalse:[ |
|
4427 |
char := label at:1. |
|
4428 |
||
4429 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4430 |
anIndex > cIdx ifTrue:[ |
|
4431 |
^ anItem |
|
4432 |
]. |
|
4433 |
item isNil ifTrue:[item := anItem] |
|
4434 |
] |
|
4435 |
] |
|
4436 |
] |
|
1572 | 4437 |
]. |
4438 |
^ item |
|
4439 |
! |
|
4440 |
||
390 | 4441 |
menuAdornmentAt:aSymbol |
2715 | 4442 |
"returns a value derived from adornment" |
4443 |
||
2374 | 4444 |
adornment isNil ifTrue:[^ nil]. |
4445 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4446 |
! |
4447 |
||
390 | 4448 |
menuAdornmentAt:aSymbol put:something |
2715 | 4449 |
"sets a value for the specific menu" |
4450 |
||
2253 | 4451 |
|oldValue| |
4452 |
||
653 | 4453 |
adornment isNil ifTrue:[ |
2374 | 4454 |
something isNil ifTrue:[^ self]. |
2253 | 4455 |
adornment := IdentityDictionary new. |
4456 |
] ifFalse:[ |
|
4457 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4458 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4459 |
]. |
4460 |
adornment at:aSymbol put:something. |
|
388 | 4461 |
! |
4462 |
||
4463 |
onEachPerform:aSelector withArgList:aList |
|
2715 | 4464 |
"on each item perform selector with an argument derived from aList" |
4465 |
||
388 | 4466 |
aList isCollection ifTrue:[ |
2715 | 4467 |
items size >= aList size ifTrue:[ |
4468 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4469 |
(items at:anIndex) perform:aSelector with:anArg |
|
4470 |
] |
|
4471 |
] |
|
388 | 4472 |
] ifFalse:[ |
2715 | 4473 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4474 |
] |
4475 |
! |
|
4476 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4477 |
registerImageOnDevice:anImage |
2269 | 4478 |
|
4479 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4480 |
^ self class image:anImage onDevice:device |
|
4481 |
||
4482 |
"/ |image| |
|
4483 |
"/ |
|
4484 |
"/ (image := anImage) notNil ifTrue:[ |
|
4485 |
"/ image device ~~ device ifTrue:[ |
|
4486 |
"/ image := image copy. |
|
4487 |
"/ ]. |
|
4488 |
"/ image := image onDevice:device. |
|
4489 |
"/ image := image clearMaskedPixels. |
|
4490 |
"/ ]. |
|
4491 |
"/ ^ image |
|
2355 | 4492 |
! |
4493 |
||
4494 |
superMenu:aSuperMenu |
|
2715 | 4495 |
"set my supermenu from which i'am activated" |
4496 |
||
2355 | 4497 |
superMenu := aSuperMenu. |
4498 |
||
2374 | 4499 |
superMenu notNil ifTrue:[ |
2355 | 4500 |
styleSheet := superMenu styleSheet. |
4501 |
rightArrow := superMenu rightArrow. |
|
4502 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4503 |
]. |
|
388 | 4504 |
! ! |
4505 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4506 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4507 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4508 |
activeMenu |
2715 | 4509 |
"returns the current active menu or self (the top menu)" |
4510 |
||
687 | 4511 |
^ lastActiveMenu ? self |
4512 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4513 |
"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
|
4514 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4515 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4516 |
activeMenu:aMenu |
2715 | 4517 |
"set the current active menu" |
4518 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4519 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4520 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4521 |
"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
|
4522 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4523 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4524 |
becomesActiveMenu |
2715 | 4525 |
"submenu becomes the active menu" |
4526 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4527 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4528 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4529 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4530 |
"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
|
4531 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4532 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4533 |
clearLastActiveMenu |
2715 | 4534 |
"reset the current active menu" |
4535 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4536 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4537 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4538 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4539 |
|
2251 | 4540 |
"/ prevFocusView notNil ifTrue:[ |
4541 |
"/ self windowGroup focusView:prevFocusView. |
|
4542 |
"/ prevFocusView := nil. |
|
4543 |
"/ ]. |
|
4544 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4545 |
top activeMenu == self ifTrue:[ |
2251 | 4546 |
top activeMenu:nil |
687 | 4547 |
] |
4548 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4549 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4550 |
! |
4551 |
||
4552 |
mapTime |
|
2715 | 4553 |
"returns the time when the menu becomes active" |
4554 |
||
687 | 4555 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4556 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4557 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4558 |
! ! |
4559 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4560 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4561 |
|
4562 |
hasScrollerAt:aDirection |
|
2715 | 4563 |
"returns true if a visible scroller at a direction exists" |
4564 |
||
2016 | 4565 |
|layout| |
4566 |
||
4567 |
self hasScrollers ifFalse:[ |
|
2715 | 4568 |
^ false |
2016 | 4569 |
]. |
4570 |
||
4571 |
aDirection == #PREV ifTrue:[ |
|
2715 | 4572 |
layout := items first layout. |
2016 | 4573 |
|
4574 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2715 | 4575 |
ifFalse:[ layout left < margin] |
2016 | 4576 |
]. |
4577 |
layout := items last layout. |
|
4578 |
||
4579 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2715 | 4580 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4581 |
! |
4582 |
||
4583 |
hasScrollers |
|
2715 | 4584 |
"returns true if scrollers are needed" |
4585 |
||
2018 | 4586 |
|maxExtent first last isVert| |
4587 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4588 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 4589 |
|
4590 |
isVert := self verticalLayout. |
|
4591 |
||
4592 |
superView notNil ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4593 |
((first := items first layout) isNil |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4594 |
or:[(last := items last layout) isNil] |
2715 | 4595 |
) ifTrue:[ |
4596 |
^ false |
|
4597 |
]. |
|
4598 |
isVert ifTrue:[ |
|
4599 |
^ first top < 0 or:[last bottom > height] |
|
4600 |
]. |
|
4601 |
^ first left < 0 or:[last right > width] |
|
2018 | 4602 |
]. |
4603 |
maxExtent := self maxExtent. |
|
4604 |
isVert ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4605 |
^ (height >= maxExtent y) |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4606 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4607 |
^ (width >= maxExtent x) |
2016 | 4608 |
! |
4609 |
||
4610 |
indexOfItemAtScroller:aDirection |
|
2715 | 4611 |
"returns the index of the item under the scroller or 0" |
4612 |
||
2016 | 4613 |
|bounds min max layout| |
4614 |
||
2860 | 4615 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 4616 |
bounds := self scrollerBoundsAt:aDirection. |
4617 |
||
4618 |
self verticalLayout ifTrue:[ |
|
2715 | 4619 |
min := bounds top. |
4620 |
max := bounds bottom. |
|
4621 |
||
4622 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4623 |
anItem isVisible ifTrue:[ |
|
4624 |
layout := anItem layout. |
|
4625 |
||
4626 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4627 |
^ anIndex |
|
4628 |
]. |
|
4629 |
]. |
|
4630 |
]. |
|
2016 | 4631 |
] ifFalse:[ |
2715 | 4632 |
min := bounds left. |
4633 |
max := bounds right. |
|
4634 |
||
4635 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4636 |
anItem isVisible ifTrue:[ |
|
4637 |
layout := anItem layout. |
|
4638 |
||
4639 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4640 |
^ anIndex |
|
4641 |
]. |
|
4642 |
]. |
|
4643 |
] |
|
2016 | 4644 |
]. |
4645 |
^ 0 |
|
4646 |
! |
|
4647 |
||
4648 |
makeItemVisible:anItem |
|
2715 | 4649 |
"make an item visible" |
4650 |
||
2018 | 4651 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4652 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4653 |
inv1 inv2| |
2018 | 4654 |
|
4655 |
( anItem notNil |
|
4656 |
and:[self hasScrollers |
|
4657 |
and:[(layout := anItem layout) notNil]] |
|
4658 |
) ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4659 |
^ self |
2016 | 4660 |
]. |
2018 | 4661 |
index := self indexOfItem:anItem. |
2016 | 4662 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4663 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4664 |
||
2018 | 4665 |
isVertical := self verticalLayout. |
4666 |
||
4667 |
isVertical ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4668 |
boundsMin := boundsPREV bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4669 |
boundsMax := boundsNEXT top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4670 |
layoutMin := layout top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4671 |
layoutMax := layout bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4672 |
windowSz := height. |
2018 | 4673 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4674 |
boundsMin := boundsPREV right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4675 |
boundsMax := boundsNEXT left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4676 |
layoutMin := layout left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4677 |
layoutMax := layout right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4678 |
windowSz := width. |
2018 | 4679 |
]. |
4680 |
||
4681 |
||
4682 |
layoutMin < boundsMin ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4683 |
layoutMin >= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4684 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4685 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4686 |
"/ test whether is first visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4687 |
index := items findLast:[:el| el isVisible] startingAt:(index - 1). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4688 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4689 |
index == 0 ifTrue:[ scr0 := margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4690 |
ifFalse:[ scr0 := boundsMin ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4691 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4692 |
delta := layoutMin negated + scr0. |
2016 | 4693 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4694 |
layoutMax > boundsMax ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4695 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4696 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4697 |
"/ test whether is last visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4698 |
index := items findFirst:[:el| el isVisible ] startingAt:(index + 1). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4699 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4700 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4701 |
ifFalse:[ scr0 := boundsMax ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4702 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4703 |
delta := scr0 - layoutMax. |
2018 | 4704 |
]. |
4705 |
delta == 0 ifTrue:[ ^ self ]. |
|
4706 |
||
2016 | 4707 |
doScroll := false. |
4708 |
||
4709 |
shown ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4710 |
delta abs < (windowSz / 2) ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4711 |
doScroll := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4712 |
self repairDamage |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4713 |
] |
2016 | 4714 |
]. |
2018 | 4715 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4716 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4717 |
|
4718 |
doScroll ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4719 |
self invalidate. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4720 |
^ self |
2016 | 4721 |
]. |
4722 |
||
2018 | 4723 |
windowSz := windowSz - margin - margin. |
4724 |
||
4725 |
scr0 := boundsMin. |
|
4726 |
scr1 := scr0 + delta abs. |
|
4727 |
scrSz := boundsMax - scr1. |
|
4728 |
||
4729 |
delta < 0 ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4730 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4731 |
self copyFrom:self x:margin y:scr1 toX:margin y:scr0 |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4732 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4733 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4734 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4735 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4736 |
"/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4737 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4738 |
self copyFrom:self x:scr1 y:margin toX:scr0 y:margin |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4739 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4740 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4741 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4742 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4743 |
"/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4744 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4745 |
inv1 := boundsPREV. |
2016 | 4746 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4747 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4748 |
self copyFrom:self x:margin y:scr0 toX:margin y:scr1 |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4749 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4750 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4751 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4752 |
"/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4753 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4754 |
self copyFrom:self x:scr0 y:margin toX:scr1 y:margin |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4755 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4756 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4757 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4758 |
"/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4759 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4760 |
inv1 := boundsNEXT. |
2042 | 4761 |
]. |
4762 |
self invalidate:inv1. |
|
4763 |
self invalidate:inv2. |
|
2048 | 4764 |
|
4765 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4766 |
! |
4767 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4768 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4769 |
"returns the one and only scrollActivity - data holder |
2715 | 4770 |
for a menu and all contained submenus" |
4771 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4772 |
superMenu notNil ifTrue:[ |
2715 | 4773 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4774 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4775 |
scrollActivity isNil ifTrue:[ |
2715 | 4776 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4777 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4778 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4779 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4780 |
|
2016 | 4781 |
scrollerBoundsAt:aDirection |
2860 | 4782 |
"returns the bounds of the scroller at a direction" |
2715 | 4783 |
|
2016 | 4784 |
|y x w h inset| |
4785 |
||
4786 |
inset := 0. |
|
4787 |
x := y := inset. |
|
4788 |
w := h := 15. |
|
4789 |
||
4790 |
self verticalLayout ifTrue:[ |
|
2715 | 4791 |
aDirection == #NEXT ifTrue:[ |
4792 |
y := height - h - inset. |
|
4793 |
]. |
|
4794 |
w := width - inset - inset. |
|
2016 | 4795 |
] ifFalse:[ |
2715 | 4796 |
aDirection == #NEXT ifTrue:[ |
4797 |
x := width - w - inset. |
|
4798 |
]. |
|
4799 |
h := height - inset - inset. |
|
2016 | 4800 |
]. |
4801 |
^ Rectangle left:x top:y width:w height:h |
|
4802 |
! |
|
4803 |
||
2046 | 4804 |
scrollerDirectionAtPoint:aPoint |
2715 | 4805 |
"returns the scroller-direction at aPoint, or nil" |
4806 |
||
2046 | 4807 |
self hasScrollers ifTrue:[ |
2715 | 4808 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
2860 | 4809 |
bounds := self scrollerBoundsAt:aDirection. |
4810 |
||
4811 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
2715 | 4812 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
4813 |
] |
|
4814 |
] |
|
2046 | 4815 |
]. |
4816 |
^ nil |
|
4817 |
||
4818 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4819 |
! ! |
4820 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4821 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4822 |
|
1699 | 4823 |
detectGrabMenu |
2715 | 4824 |
"returns the menu which is responsible for the grap; the last opened menu" |
4825 |
||
1699 | 4826 |
|subMenu| |
4827 |
||
4828 |
selection notNil ifTrue:[ |
|
2715 | 4829 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4830 |
^ subMenu detectGrabMenu |
|
4831 |
] |
|
1699 | 4832 |
]. |
4833 |
^ self |
|
4834 |
! |
|
4835 |
||
4836 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 4837 |
"returns the menu which contains the grab-point" |
4838 |
||
1699 | 4839 |
|dstMenu dstPoint firstMenu| |
4840 |
||
4841 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4842 |
||
4843 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2715 | 4844 |
firstMenu := self. |
1699 | 4845 |
]. |
4846 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4847 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2715 | 4848 |
^ firstMenu |
1699 | 4849 |
]. |
4850 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4851 |
^ dstMenu ? firstMenu |
1699 | 4852 |
! |
4853 |
||
1767 | 4854 |
detectViewAtX:x y:y in:aTopView |
2715 | 4855 |
"detect view at x@y" |
4856 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4857 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4858 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4859 |
"/ 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
|
4860 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4861 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4862 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4863 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4864 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4865 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4866 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4867 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4868 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4869 |
"/ 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
|
4870 |
"/ ^ 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
|
4871 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4872 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4873 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4874 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4875 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4876 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4877 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4878 |
! |
4879 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4880 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4881 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 4882 |
If no item match nil is returned." |
4883 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4884 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4885 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4886 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4887 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4888 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4889 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4890 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4891 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4892 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4893 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4894 |
itemAtPoint:aPoint |
2715 | 4895 |
"returns the item at aPoint or nil if none detected" |
4896 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4897 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4898 |
|
1699 | 4899 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4900 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4901 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4902 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 4903 |
]. |
4904 |
^ nil |
|
388 | 4905 |
! |
4906 |
||
2048 | 4907 |
superMenuAtPoint:aPoint |
2715 | 4908 |
"returns the superMenu which contains aPoint, or nil if none detected" |
4909 |
||
1699 | 4910 |
|grabPoint superMenu| |
4911 |
||
2048 | 4912 |
(self containsPoint:aPoint) ifTrue:[ |
2715 | 4913 |
^ self |
1699 | 4914 |
]. |
4915 |
||
2048 | 4916 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4917 |
superMenu := self. |
4918 |
||
4919 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2715 | 4920 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
4921 |
^ superMenu |
|
4922 |
] |
|
4923 |
]. |
|
4924 |
^ nil |
|
1699 | 4925 |
|
2048 | 4926 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4927 |
! ! |
4928 |
||
4929 |
!MenuPanel methodsFor:'queries'! |
|
4930 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4931 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4932 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4933 |
aView notNil ifTrue:[ |
3147 | 4934 |
"/ I am no longer a popUpView |
4935 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4936 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4937 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4938 |
|
388 | 4939 |
containsPoint:aPoint |
2715 | 4940 |
"returns true if the argument, aPoint is contained by the view" |
4941 |
||
388 | 4942 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
4943 |
! |
|
4944 |
||
4945 |
containsPointX:x y:y |
|
2715 | 4946 |
"returns true if point is contained by the view" |
4947 |
||
708 | 4948 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 4949 |
! |
4950 |
||
390 | 4951 |
hasGroupDividerAt:anIndex |
2715 | 4952 |
"returns true if a divider is defined at an index" |
4953 |
||
388 | 4954 |
|i| |
4955 |
||
4956 |
groupSizes size ~~ 0 ifTrue:[ |
|
2715 | 4957 |
i := 0. |
4958 |
||
4959 |
groupSizes do:[:t| |
|
4960 |
(i := i + t) == anIndex ifTrue:[ |
|
4961 |
^ true |
|
4962 |
] |
|
4963 |
] |
|
4964 |
]. |
|
4965 |
^ false |
|
388 | 4966 |
! |
4967 |
||
390 | 4968 |
hasGroupDividers |
2715 | 4969 |
"returns true if any group divider exists" |
4970 |
||
4971 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 4972 |
! |
4973 |
||
390 | 4974 |
isFitPanel |
4975 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4976 |
be fit to the extent of its superView; |
2715 | 4977 |
NOT SUPPORTED" |
4978 |
||
1699 | 4979 |
^ false |
390 | 4980 |
! |
4981 |
||
388 | 4982 |
isPopUpView |
4983 |
"return true if view is a popup view; without decoration |
|
2715 | 4984 |
and popUp to top immediately" |
4985 |
||
388 | 4986 |
^ superView isNil |
4987 |
! |
|
4988 |
||
4989 |
isVerticalLayout |
|
2715 | 4990 |
"returns true if vertical layout otherwise false( horizontal layout )" |
4991 |
||
1699 | 4992 |
^ self verticalLayout |
416 | 4993 |
! |
4994 |
||
1793 | 4995 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
4996 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 4997 |
! |
4998 |
||
416 | 4999 |
type |
428 | 5000 |
^ nil. |
416 | 5001 |
|
388 | 5002 |
! ! |
5003 |
||
5004 |
!MenuPanel methodsFor:'selection'! |
|
5005 |
||
5006 |
hasSelection |
|
2715 | 5007 |
"returns true if a selection exists" |
5008 |
||
388 | 5009 |
^ self selection notNil |
5010 |
! |
|
5011 |
||
2199 | 5012 |
openDelayed:anItem |
3187 | 5013 |
self openDelayed:anItem afterSeconds:0.5. |
5014 |
! |
|
5015 |
||
5016 |
openDelayed:anItem afterSeconds:seconds |
|
2199 | 5017 |
|
2374 | 5018 |
superMenu notNil ifTrue:[ |
3187 | 5019 |
superMenu openDelayed:anItem afterSeconds:seconds. |
2374 | 5020 |
^ self |
5021 |
]. |
|
5022 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 5023 |
Processor removeTimedBlock:openDelayedMenuBlock. |
5024 |
openDelayedMenuBlock := nil. |
|
5025 |
]. |
|
3187 | 5026 |
(anItem notNil and:[anItem hasSubmenu]) ifFalse:[ |
2253 | 5027 |
openDelayedMenuBlock := nil. |
2374 | 5028 |
^ self |
2253 | 5029 |
]. |
5030 |
openDelayedMenuBlock := [ |
|
5031 |
openDelayedMenuBlock := nil. |
|
5032 |
anItem openDelayedSubmenu |
|
5033 |
]. |
|
5034 |
||
3187 | 5035 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds. |
2199 | 5036 |
! |
5037 |
||
388 | 5038 |
selection |
2715 | 5039 |
"returns current selected item or nil" |
5040 |
||
388 | 5041 |
^ selection |
5042 |
! |
|
5043 |
||
5044 |
selection:anItemOrNil |
|
2016 | 5045 |
"change selection to an item or nil |
2715 | 5046 |
if the item has a submenu the first item might be selected (style-sheet)" |
5047 |
||
2249 | 5048 |
|openMenu openOnSelect submenu item| |
5049 |
||
5050 |
selection == anItemOrNil ifTrue:[^ self]. |
|
5051 |
||
5052 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
5053 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5054 |
^ self |
2249 | 5055 |
]. |
5056 |
||
5057 |
openMenu := self isPopUpView not. |
|
5058 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
5059 |
||
5060 |
openMenu ifFalse:[ |
|
5061 |
openMenu := openOnSelect. |
|
5062 |
]. |
|
5063 |
self selection:anItemOrNil openMenu:openMenu. |
|
5064 |
||
5065 |
openOnSelect ifFalse:[ |
|
5066 |
"/ select first item in submenu |
|
5067 |
||
5068 |
submenu := anItemOrNil currentSubmenu. |
|
5069 |
||
2374 | 5070 |
submenu notNil ifTrue:[ |
2249 | 5071 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
5072 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 5073 |
submenu selection:item openMenu:false |
5074 |
] |
|
5075 |
]. |
|
5076 |
]. |
|
5077 |
! |
|
5078 |
||
5079 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 5080 |
"change selection to an item or nil" |
5081 |
||
2251 | 5082 |
|helpListener oldSelect| |
2249 | 5083 |
|
5084 |
anItemOrNil == selection ifTrue:[ |
|
5085 |
^ self |
|
2016 | 5086 |
]. |
2199 | 5087 |
self openDelayed:nil. |
388 | 5088 |
|
2251 | 5089 |
oldSelect := selection. |
5090 |
selection := nil. |
|
2249 | 5091 |
|
2374 | 5092 |
anItemOrNil notNil ifTrue:[ |
2249 | 5093 |
self makeItemVisible:anItemOrNil. |
5094 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 5095 |
selection := anItemOrNil |
2249 | 5096 |
] ifFalse:[ |
2374 | 5097 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 5098 |
]. |
5099 |
]. |
|
2374 | 5100 |
oldSelect notNil ifTrue:[ |
2249 | 5101 |
"/ clear current selection |
2251 | 5102 |
oldSelect isSelected:false. |
5103 |
]. |
|
2374 | 5104 |
selection isNil ifTrue:[^ self]. |
2251 | 5105 |
|
5106 |
selection == enteredItem ifTrue:[ |
|
2249 | 5107 |
enteredItem := nil |
2016 | 5108 |
] ifFalse:[ |
2249 | 5109 |
self pointerEntersItem:nil |
2016 | 5110 |
]. |
5111 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 5112 |
helpListener := ActiveHelp currentHelpListener. |
5113 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 5114 |
]. |
5115 |
shown ifTrue:[ |
|
5116 |
self rearrangeItems. |
|
5117 |
||
5118 |
openMenu ifFalse:[ |
|
5119 |
selection invalidate. |
|
5120 |
] |
|
5121 |
]. |
|
5122 |
openMenu ifTrue:[ |
|
5123 |
selection isSelected:true. |
|
5124 |
]. |
|
388 | 5125 |
! |
5126 |
||
5127 |
selectionIndex |
|
2715 | 5128 |
"returns index of current selection or 0" |
5129 |
||
388 | 5130 |
|item| |
5131 |
||
5132 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 5133 |
^ self findFirst:[:el| el == item ] |
388 | 5134 |
]. |
5135 |
^ 0 |
|
5136 |
! |
|
5137 |
||
5138 |
selectionIndex:anIndex |
|
2715 | 5139 |
"set selection at an index" |
5140 |
||
388 | 5141 |
self selection:(self itemAt:anIndex) |
5142 |
! ! |
|
5143 |
||
1791 | 5144 |
!MenuPanel methodsFor:'translation'! |
5145 |
||
5146 |
translateGrabPoint:aGrabPoint |
|
2715 | 5147 |
"translate the grab point into self" |
5148 |
||
1791 | 5149 |
superMenu isNil ifTrue:[ |
2936 | 5150 |
"I am the grabView" |
2715 | 5151 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
5152 |
^ aGrabPoint |
|
1791 | 5153 |
]. |
5154 |
||
5155 |
relativeGrabOrigin isNil ifTrue:[ |
|
2936 | 5156 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
5157 |
relativeGrabOrigin isNil ifTrue:[ |
|
5158 |
"I am the grabView" |
|
5159 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
5160 |
^ aGrabPoint |
|
5161 |
]. |
|
1791 | 5162 |
]. |
5163 |
^ relativeGrabOrigin + aGrabPoint |
|
5164 |
! |
|
5165 |
||
5166 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 5167 |
"translate a point into another menu its point" |
5168 |
||
1791 | 5169 |
|grapPoint| |
5170 |
||
5171 |
aMenu == self ifTrue:[ |
|
2715 | 5172 |
^ aPoint |
1791 | 5173 |
]. |
5174 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
5175 |
||
2715 | 5176 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 5177 |
! |
5178 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5179 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 5180 |
"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
|
5181 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5182 |
^ device |
2715 | 5183 |
translatePoint:aPoint asPoint |
5184 |
fromView:self |
|
5185 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5186 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
5187 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 5188 |
! ! |
5189 |
||
388 | 5190 |
!MenuPanel::Item class methodsFor:'accessing'! |
5191 |
||
689 | 5192 |
horizontalInset |
5193 |
^ HorizontalInset |
|
5194 |
! |
|
5195 |
||
388 | 5196 |
labelRightOffset |
5197 |
^ LabelRightOffset |
|
5198 |
! |
|
5199 |
||
689 | 5200 |
verticalInset |
5201 |
^ VerticalInset |
|
1765 | 5202 |
! |
5203 |
||
5204 |
verticalPopUpInset |
|
5205 |
^ VerticalPopUpInset |
|
388 | 5206 |
! ! |
5207 |
||
616 | 5208 |
!MenuPanel::Item class methodsFor:'defaults'! |
5209 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5210 |
halfSeparatorSize |
2870 | 5211 |
"returns the size of a space-separator" |
5212 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5213 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5214 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5215 |
|
1699 | 5216 |
separatorSize |
2870 | 5217 |
"returns the size of a separator" |
5218 |
||
1699 | 5219 |
^ 10 |
616 | 5220 |
! |
5221 |
||
5222 |
updateStyleCache |
|
2777 | 5223 |
"extract values from the styleSheet and cache them in class variables" |
5224 |
||
1765 | 5225 |
<resource: #style (#'menuPanel.verticalInset')> |
5226 |
||
1699 | 5227 |
HorizontalInset := 2. |
1765 | 5228 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5229 |
VerticalPopUpInset := 2. |
|
727 | 5230 |
|
5231 |
HorizontalButtonInset := 3. |
|
5232 |
VerticalButtonInset := 3. |
|
5233 |
||
681 | 5234 |
LabelRightOffset := 15. |
1765 | 5235 |
|
2777 | 5236 |
" |
5237 |
self updateStyleCache |
|
5238 |
" |
|
1124 | 5239 |
! ! |
1078 | 5240 |
|
388 | 5241 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5242 |
||
5243 |
in:aSuperMenu |
|
5244 |
^ self in:aSuperMenu label:nil |
|
5245 |
! |
|
5246 |
||
5247 |
in:aSuperMenu label:aLabel |
|
5248 |
|item| |
|
5249 |
||
5250 |
item := self new in:aSuperMenu. |
|
5251 |
item label:aLabel. |
|
2870 | 5252 |
^ item |
388 | 5253 |
! |
5254 |
||
5255 |
in:aSuperMenu menuItem:aMenuItem |
|
5256 |
|item| |
|
5257 |
||
5258 |
item := self in:aSuperMenu. |
|
5259 |
item menuItem:aMenuItem. |
|
2870 | 5260 |
^ item. |
2359 | 5261 |
! |
5262 |
||
5263 |
new |
|
5264 |
^ self basicNew initialize |
|
388 | 5265 |
! ! |
5266 |
||
1808 | 5267 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5268 |
|
420 | 5269 |
canAccept |
2870 | 5270 |
"returns true if item is acceptable" |
5271 |
||
2199 | 5272 |
self enabled ifFalse:[ ^ false]. |
5273 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5274 |
||
5275 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
5276 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 5277 |
! |
5278 |
||
5279 |
toggleIndication |
|
2870 | 5280 |
"toggle indication or choice" |
5281 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5282 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5283 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5284 |
indication notNil ifTrue:[ |
2359 | 5285 |
arg := self indicationValue not. |
5286 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5287 |
] ifFalse:[ |
2359 | 5288 |
choice notNil ifTrue:[ |
5289 |
choice value:(menuItem choiceValue). |
|
5290 |
^ true |
|
5291 |
] |
|
524 | 5292 |
]. |
5293 |
^ arg |
|
389 | 5294 |
! ! |
5295 |
||
388 | 5296 |
!MenuPanel::Item methodsFor:'accessing'! |
5297 |
||
5298 |
accessCharacter |
|
2870 | 5299 |
"returns my accessCharacter or nil" |
5300 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5301 |
^ accessCharacter |
388 | 5302 |
! |
5303 |
||
5304 |
accessCharacterPosition |
|
2870 | 5305 |
"get the access character position or nil" |
5306 |
||
2359 | 5307 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5308 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5309 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5310 |
accessCharacterPosition:anIndex |
2870 | 5311 |
"set the access character position or nil" |
5312 |
||
2359 | 5313 |
menuItem accessCharacterPosition:anIndex. |
388 | 5314 |
! |
5315 |
||
5316 |
argument |
|
2870 | 5317 |
"gets the argument" |
5318 |
||
2359 | 5319 |
^ menuItem argument |
388 | 5320 |
! |
5321 |
||
5322 |
argument:anArgument |
|
2870 | 5323 |
"sets the argument" |
5324 |
||
2359 | 5325 |
menuItem argument:anArgument. |
389 | 5326 |
! |
5327 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5328 |
displayLabel |
2870 | 5329 |
"returns my printable Label" |
5330 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5331 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5332 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5333 |
|
2614 | 5334 |
displayLabelExtent |
2870 | 5335 |
"returns the labels extent" |
5336 |
||
2614 | 5337 |
|prevFont w h| |
5338 |
||
5339 |
displayLabelExtent notNil ifTrue:[ |
|
5340 |
^ displayLabelExtent |
|
5341 |
]. |
|
5342 |
||
5343 |
displayLabel isNil ifTrue:[ |
|
5344 |
displayLabelExtent := 0@0. |
|
5345 |
^ displayLabelExtent |
|
5346 |
]. |
|
5347 |
prevFont := menuPanel setFont:(self font). |
|
5348 |
||
5349 |
displayLabel isArray ifTrue:[ |
|
5350 |
w := h := 0. |
|
5351 |
||
5352 |
displayLabel do:[:aSubLabel| |
|
5353 |
aSubLabel notNil ifTrue:[ |
|
5354 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5355 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5356 |
] ifFalse:[ |
|
5357 |
h := h + (self spaceBetweenEmptyLines) |
|
5358 |
] |
|
5359 |
] |
|
5360 |
] ifFalse:[ |
|
5361 |
w := displayLabel widthOn:menuPanel. |
|
5362 |
h := displayLabel heightOn:menuPanel. |
|
5363 |
]. |
|
5364 |
"/ care for italic fonts - give a few more pixels at the end |
|
5365 |
menuPanel font italic ifTrue:[ |
|
5366 |
w := w + 2. |
|
5367 |
]. |
|
5368 |
displayLabelExtent := w@h. |
|
5369 |
||
5370 |
prevFont notNil ifTrue:[ |
|
5371 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5372 |
]. |
|
5373 |
^ displayLabelExtent |
|
5374 |
! |
|
5375 |
||
1727 | 5376 |
font |
2870 | 5377 |
"returns the user configured font or nil (default menu font)" |
5378 |
||
2373 | 5379 |
|font| |
5380 |
||
5381 |
menuPanel isNil ifTrue:[^ nil]. |
|
5382 |
||
5383 |
font := menuItem font. |
|
5384 |
||
5385 |
font notNil ifTrue:[ |
|
5386 |
font := font onDevice:(menuPanel device). |
|
5387 |
menuItem font:font. |
|
5388 |
]. |
|
1727 | 5389 |
^ font |
5390 |
! |
|
5391 |
||
5392 |
font:aFont |
|
2870 | 5393 |
"returns the user configured font or nil (default menu font)" |
5394 |
||
2373 | 5395 |
menuItem font:aFont. |
1727 | 5396 |
! |
5397 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5398 |
ignoreMnemonicKeys |
2870 | 5399 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5400 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5401 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5402 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5403 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5404 |
ignoreMnemonicKeys:aBoolean |
2870 | 5405 |
"if true, mnemonic (access character) in the submenus under the item are ignored" |
5406 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5407 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5408 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5409 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5410 |
ignoreShortcutKeys |
2870 | 5411 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5412 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5413 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5414 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5415 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5416 |
ignoreShortcutKeys:aBoolean |
2870 | 5417 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored" |
5418 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5419 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5420 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5421 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5422 |
itemValue |
2870 | 5423 |
"gets the items value" |
5424 |
||
2360 | 5425 |
^ menuItem itemValue |
5426 |
! |
|
5427 |
||
5428 |
itemValue:aValue |
|
2870 | 5429 |
"argument could be a value holder, an action or selector" |
5430 |
||
2360 | 5431 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5432 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5433 |
|
388 | 5434 |
label |
2870 | 5435 |
"returns the label" |
5436 |
||
388 | 5437 |
^ label |
5438 |
! |
|
5439 |
||
5440 |
label:aLabel |
|
399 | 5441 |
"set a new label; if the label changed, a redraw is performed; |
2870 | 5442 |
handle characters $& (ST-80 compatibility)" |
5443 |
||
2614 | 5444 |
|size char oldExtent| |
5445 |
||
5446 |
oldExtent := displayLabelExtent. |
|
5447 |
displayLabelExtent := nil. "/ force a recomputation |
|
5448 |
accessCharacter := disabledDisplayLabel := nil. |
|
5449 |
label := aLabel value. |
|
5450 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5451 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5452 |
displayLabel isString ifTrue:[ |
2359 | 5453 |
"CHECK FOR SEPARATOR" |
5454 |
||
5455 |
(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5456 |
size := displayLabel size. |
2359 | 5457 |
|
5458 |
size == 0 ifTrue:[ |
|
2614 | 5459 |
displayLabel := nil. "blank separator" |
2359 | 5460 |
^ self |
5461 |
]. |
|
5462 |
||
5463 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5464 |
char := displayLabel first. |
2359 | 5465 |
|
5466 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5467 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5468 |
displayLabel := nil. |
2359 | 5469 |
^ self |
5470 |
] |
|
5471 |
] |
|
5472 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5473 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5474 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5475 |
displayLabel := displayLabel asArray. |
2359 | 5476 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5477 |
]. |
2614 | 5478 |
displayLabel notNil ifTrue:[ |
5479 |
displayLabel isArray ifTrue:[ |
|
5480 |
displayLabel keysAndValuesDo:[:i :el| |
|
5481 |
el notNil ifTrue:[ |
|
5482 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
5483 |
]. |
|
5484 |
]. |
|
5485 |
] ifFalse:[ |
|
5486 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
5487 |
]. |
|
5488 |
]. |
|
5489 |
||
5490 |
menuPanel shown ifTrue:[ |
|
5491 |
self fetchImages. |
|
5492 |
||
5493 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5494 |
self invalidate |
|
5495 |
] ifFalse:[ |
|
5496 |
menuPanel mustRearrange |
|
2359 | 5497 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5498 |
]. |
388 | 5499 |
! |
5500 |
||
5501 |
menuPanel |
|
2870 | 5502 |
"returns my menuPanel" |
5503 |
||
399 | 5504 |
^ menuPanel |
388 | 5505 |
! |
5506 |
||
5507 |
nameKey |
|
2870 | 5508 |
"gets the nameKey" |
5509 |
||
2359 | 5510 |
^ menuItem nameKey |
388 | 5511 |
! |
5512 |
||
5513 |
nameKey:aNameKey |
|
2870 | 5514 |
"sets the nameKey" |
5515 |
||
2359 | 5516 |
menuItem nameKey:aNameKey. |
388 | 5517 |
! |
5518 |
||
5519 |
rawLabel |
|
2870 | 5520 |
"returns my raw, unprocessed label" |
5521 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5522 |
^ menuItem rawLabel |
388 | 5523 |
! |
5524 |
||
5525 |
shortcutKey |
|
5526 |
"get the key to press to select the submenu from the keyboard or if |
|
2870 | 5527 |
no submenu exists evaluate the action assigned to the item (accept)." |
5528 |
||
2359 | 5529 |
^ menuItem shortcutKey |
388 | 5530 |
! |
5531 |
||
5532 |
shortcutKey:aKey |
|
5533 |
"set the key to press to select the submenu from the keyboard or if |
|
2870 | 5534 |
no submenu exists evaluate the action assigned to the item (accept)." |
5535 |
||
2359 | 5536 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5537 |
menuItem shortcutKey:aKey. |
|
5538 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5539 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5540 |
! |
388 | 5541 |
|
710 | 5542 |
startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5543 |
"start group #left #right #conditionalRight ... or nil |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5544 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 5545 |
|
2359 | 5546 |
^ menuItem startGroup |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5547 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5548 |
"Modified: / 16-10-2006 / 13:06:25 / cg" |
710 | 5549 |
! |
5550 |
||
5551 |
startGroup:aSymbol |
|
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5552 |
"start group #left #right #conditionalRight ... |
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5553 |
at the moment only #right and #conditionalRight are implemented" |
2870 | 5554 |
|
2359 | 5555 |
menuItem startGroup:aSymbol. |
3127
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5556 |
|
9b522d37eca0
new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents:
3126
diff
changeset
|
5557 |
"Modified: / 16-10-2006 / 13:06:37 / cg" |
710 | 5558 |
! |
5559 |
||
388 | 5560 |
submenu |
3133 | 5561 |
"returns my submenu or creates it if its defined via a selector or channel. |
5562 |
May return nil, if there is really no menu" |
|
5563 |
||
5564 |
subMenu isNil ifTrue:[ |
|
5565 |
self setupSubmenu |
|
5566 |
]. |
|
5567 |
^ subMenu |
|
5568 |
||
5569 |
"Modified: / 07-11-2006 / 11:09:49 / cg" |
|
388 | 5570 |
! |
5571 |
||
5572 |
submenu:aSubMenu |
|
2870 | 5573 |
"set a new submenu; an existing submenu will be destroyed. |
5574 |
This might lead to a redraw if 'hasSubmenu' changed" |
|
5575 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5576 |
|widget| |
1767 | 5577 |
|
5578 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5579 |
subMenu notNil ifTrue:[ |
5580 |
subMenu destroy. |
|
5581 |
subMenu := nil. |
|
5582 |
]. |
|
5583 |
^ self |
|
1767 | 5584 |
]. |
5585 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5586 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5587 |
subMenu := MenuPanel new. |
5588 |
||
5589 |
menuPanel notNil ifTrue:[ |
|
5590 |
subMenu receiver:menuPanel receiver. |
|
5591 |
]. |
|
5592 |
subMenu superMenu:menuPanel. |
|
5593 |
||
5594 |
menuItem horizontalLayout == true ifTrue:[ |
|
5595 |
subMenu verticalLayout:false |
|
5596 |
]. |
|
5597 |
subMenu menu:aSubMenu. |
|
1767 | 5598 |
] ifFalse:[ |
2360 | 5599 |
aSubMenu isView ifFalse:[ |
5600 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5601 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5602 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5603 |
]. |
5604 |
widget := SimpleView new. |
|
5605 |
widget client:aSubMenu. |
|
5606 |
] ifTrue:[ |
|
2827 | 5607 |
widget := aSubMenu. |
5608 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
2360 | 5609 |
]. |
5610 |
||
5611 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5612 |
subMenu := widget. |
|
5613 |
||
5614 |
menuItem horizontalLayout == true ifTrue:[ |
|
5615 |
subMenu verticalLayout:false |
|
5616 |
]. |
|
5617 |
] ifFalse:[ |
|
5618 |
subMenu := MenuPanel new. |
|
5619 |
subMenu receiver:menuPanel receiver. |
|
5620 |
subMenu addSubView:widget. |
|
5621 |
subMenu extent:(widget preferredExtent). |
|
5622 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5623 |
]. |
|
5624 |
subMenu superMenu:menuPanel. |
|
5625 |
]. |
|
389 | 5626 |
! |
5627 |
||
3133 | 5628 |
submenuOrNil |
5629 |
"returns my submenu or nil if there is none or its defined via a channel or selector" |
|
5630 |
||
5631 |
^ subMenu |
|
5632 |
||
5633 |
"Created: / 07-11-2006 / 11:04:47 / cg" |
|
5634 |
! |
|
5635 |
||
390 | 5636 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5637 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5638 |
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
|
5639 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5640 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5641 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5642 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5643 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5644 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5645 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5646 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5647 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5648 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5649 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5650 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5651 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5652 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5653 |
^ nil |
390 | 5654 |
! |
5655 |
||
1841 | 5656 |
triggerOnDown |
2870 | 5657 |
"return true if triggering the action if pressed" |
5658 |
||
2359 | 5659 |
menuItem triggerOnDown ifTrue:[ |
5660 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5661 |
]. |
5662 |
^ false |
|
5663 |
! |
|
5664 |
||
5665 |
triggerOnDown:aBool |
|
2870 | 5666 |
"setup to trigger the action if pressed" |
5667 |
||
2359 | 5668 |
menuItem triggerOnDown:aBool. |
1841 | 5669 |
! |
5670 |
||
389 | 5671 |
value |
2870 | 5672 |
"gets the items value |
5673 |
Left here for ST80 compatibility - value is a bad name" |
|
5674 |
||
2360 | 5675 |
^ menuItem itemValue |
5676 |
! |
|
5677 |
||
5678 |
value:aValue |
|
389 | 5679 |
"could be a value holder, an action or selector |
2870 | 5680 |
Left here for ST80 compatibility - value: is a bad name" |
5681 |
||
2360 | 5682 |
menuItem itemValue:aValue. |
502 | 5683 |
! |
5684 |
||
5685 |
value:aValue argument:anArgument |
|
2870 | 5686 |
"set the value and an argument" |
5687 |
||
2360 | 5688 |
menuItem itemValue:aValue. |
5689 |
menuItem argument:anArgument. |
|
388 | 5690 |
! ! |
5691 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5692 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5693 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5694 |
choice |
2870 | 5695 |
"implements a radio group; the field" |
5696 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5697 |
^ choice |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5698 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5699 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5700 |
choice:something |
2870 | 5701 |
"set choice indication" |
5702 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5703 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5704 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5705 |
choice isValueModel ifTrue:[ |
2870 | 5706 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5707 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5708 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5709 |
(choice := something) notNil ifTrue:[ |
2870 | 5710 |
choice isSymbol ifTrue:[ |
5711 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5712 |
choice := something |
|
5713 |
] |
|
5714 |
]. |
|
5715 |
choice isValueModel ifTrue:[ |
|
5716 |
choice addDependent:self |
|
5717 |
] |
|
1699 | 5718 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5719 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5720 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5721 |
choiceValue |
2870 | 5722 |
"implements a radio group; the value writen to the choice if selected" |
5723 |
||
2359 | 5724 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5725 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5726 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5727 |
choiceValue:something |
2870 | 5728 |
"implements a radio group; the value writen to the choice if selected" |
5729 |
||
2359 | 5730 |
menuItem choiceValue ~= something ifTrue:[ |
5731 |
menuItem choiceValue:something. |
|
5732 |
choice notNil ifTrue:[ self invalidate ]. |
|
5733 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5734 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5735 |
|
388 | 5736 |
enabled |
2870 | 5737 |
"returns the enabled state" |
5738 |
||
524 | 5739 |
|state| |
5740 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5741 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5742 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5743 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5744 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5745 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5746 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5747 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5748 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5749 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5750 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5751 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5752 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5753 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5754 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5755 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5756 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5757 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5758 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5759 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5760 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5761 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5762 |
^ state ~~ false |
388 | 5763 |
! |
5764 |
||
389 | 5765 |
enabled:something |
2870 | 5766 |
"change the enabled state; if the state changed, a redraw is performed" |
5767 |
||
390 | 5768 |
|oldState newState| |
5769 |
||
5770 |
enableChannel isNil ifTrue:[ |
|
2870 | 5771 |
oldState := true |
390 | 5772 |
] ifFalse:[ |
2870 | 5773 |
oldState := enableChannel value. |
5774 |
enableChannel isValueModel ifTrue:[ |
|
5775 |
enableChannel removeDependent:self |
|
5776 |
] |
|
388 | 5777 |
]. |
390 | 5778 |
enableChannel := something. |
5779 |
||
5780 |
enableChannel isNil ifTrue:[ |
|
2870 | 5781 |
menuPanel shown ifFalse:[^ self]. |
5782 |
newState := true |
|
390 | 5783 |
] ifFalse:[ |
2870 | 5784 |
enableChannel isValueModel ifTrue:[ |
5785 |
enableChannel addDependent:self |
|
5786 |
] ifFalse:[ |
|
5787 |
enableChannel isSymbol ifTrue:[^ self] |
|
5788 |
]. |
|
5789 |
menuPanel shown ifFalse:[^ self]. |
|
5790 |
newState := enableChannel value. |
|
390 | 5791 |
]. |
5792 |
||
5793 |
newState ~~ oldState ifTrue:[ |
|
2870 | 5794 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5795 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5796 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5797 |
|
1670 | 5798 |
hideMenuOnActivated |
2870 | 5799 |
"hide the menu when the item was activated; the default is true" |
5800 |
||
2359 | 5801 |
^ menuItem hideMenuOnActivated |
1670 | 5802 |
! |
5803 |
||
5804 |
hideMenuOnActivated:aBool |
|
2870 | 5805 |
"hide the menu when the item was activated; the default is true" |
5806 |
||
2359 | 5807 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5808 |
! |
5809 |
||
2216 | 5810 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5811 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5812 |
||
5813 |
(menuPanel receiver isNil |
|
5814 |
and:[ menuPanel application notNil |
|
5815 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5816 |
ifTrue:[ |
|
3147 | 5817 |
^ self "/ suppressed |
2216 | 5818 |
]. |
5819 |
aMessage infoPrintCR |
|
5820 |
! |
|
5821 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5822 |
indication |
2870 | 5823 |
"get on/off indication" |
5824 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5825 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5826 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5827 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5828 |
indication:something |
2870 | 5829 |
"set on/off indication" |
5830 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5831 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5832 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5833 |
indication isValueModel ifTrue:[ |
2870 | 5834 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5835 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5836 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5837 |
(indication := something) notNil ifTrue:[ |
2870 | 5838 |
indication isValueModel ifTrue:[ |
5839 |
indication addDependent:self |
|
5840 |
] ifFalse:[ |
|
5841 |
"/ to force an update of the value |
|
5842 |
self indicationValue |
|
5843 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5844 |
]. |
464 | 5845 |
! |
5846 |
||
1767 | 5847 |
keepLinkedMenu |
2870 | 5848 |
"get the keepLinkedMenu flag" |
5849 |
||
2359 | 5850 |
^ menuItem keepLinkedMenu |
5851 |
! |
|
5852 |
||
5853 |
keepLinkedMenu:aBool |
|
2870 | 5854 |
"get the keepLinkedMenu flag" |
5855 |
||
2359 | 5856 |
menuItem keepLinkedMenu:aBool. |
1767 | 5857 |
! |
5858 |
||
2331 | 5859 |
sendToOriginator |
5860 |
"if true, the message is sent to the originating widget; |
|
5861 |
otherwise (the default), it it sent to the receiver/application." |
|
5862 |
||
2359 | 5863 |
^ menuItem sendToOriginator |
2331 | 5864 |
! |
5865 |
||
5866 |
sendToOriginator:aBoolean |
|
5867 |
"if true, the message is sent to the originating widget; |
|
5868 |
otherwise (the default), it it sent to the receiver/application." |
|
5869 |
||
2359 | 5870 |
menuItem sendToOriginator:aBoolean. |
2331 | 5871 |
! |
5872 |
||
464 | 5873 |
submenuChannel |
2870 | 5874 |
"get the submenu channel" |
5875 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5876 |
^ menuItem submenuChannel |
464 | 5877 |
! |
5878 |
||
5879 |
submenuChannel:aSelectorOrNil |
|
2870 | 5880 |
"returns the submenu channel" |
5881 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5882 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5883 |
! ! |
5884 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5885 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5886 |
|
2016 | 5887 |
moveBy:aPoint |
2870 | 5888 |
"move the layouts origin" |
5889 |
||
2016 | 5890 |
layout moveBy:aPoint. |
5891 |
! |
|
5892 |
||
1699 | 5893 |
preferredExtent |
2870 | 5894 |
"compute my preferred extent excluding the shortCutKey and the menu identifier" |
5895 |
||
2614 | 5896 |
|isVertical icon wIcon isButton labelExtent |
1699 | 5897 |
x "{ Class:SmallInteger }" |
5898 |
y "{ Class:SmallInteger }" |
|
5899 |
s "{ Class:SmallInteger }" |
|
5900 |
| |
|
5901 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5902 |
||
2359 | 5903 |
isButton := menuItem isButton. |
5904 |
||
1699 | 5905 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5906 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5907 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5908 |
y := s + VerticalButtonInset. |
1699 | 5909 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5910 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5911 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5912 |
]. |
5913 |
x := x * 2. |
|
5914 |
y := y * 2. |
|
5915 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5916 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5917 |
|
2362 | 5918 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5919 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5920 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5921 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5922 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5923 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5924 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5925 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5926 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5927 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5928 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5929 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5930 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5931 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5932 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5933 |
]. |
1699 | 5934 |
] ifFalse:[ |
2614 | 5935 |
labelExtent := self displayLabelExtent. |
5936 |
||
5937 |
x := x + labelExtent x. |
|
5938 |
y := y + labelExtent y. |
|
3131 | 5939 |
x := x + (menuPanel stringOffsetXfor:self). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5940 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5941 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5942 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5943 |
"width of separator is 2 plus right offset 1 := 3" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5944 |
isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5945 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5946 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5947 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5948 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5949 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5950 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5951 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5952 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5953 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5954 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5955 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5956 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5957 |
x := x + wIcon. |
1699 | 5958 |
]. |
5959 |
^ x@y |
|
388 | 5960 |
! ! |
5961 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5962 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5963 |
|
5964 |
activeHelpKey |
|
2870 | 5965 |
"get the active helpKey; the key to retrieve the helpText from the application" |
5966 |
||
2359 | 5967 |
^ menuItem activeHelpKey |
1613 | 5968 |
! |
5969 |
||
5970 |
activeHelpKey:aHelpKey |
|
2870 | 5971 |
"set the active helpKey; the key to retrieve the helpText from the application" |
5972 |
||
2359 | 5973 |
menuItem activeHelpKey:aHelpKey. |
5974 |
activeHelpText := nil. |
|
1613 | 5975 |
! |
5976 |
||
5977 |
activeHelpText |
|
2870 | 5978 |
"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
|
5979 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5980 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5981 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5982 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5983 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5984 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5985 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5986 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5987 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5988 |
^ nil |
1613 | 5989 |
! |
5990 |
||
5991 |
activeHelpText:aText |
|
2870 | 5992 |
"set the active helpText" |
5993 |
||
1613 | 5994 |
activeHelpText := aText. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5995 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5996 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5997 |
flyByHelpText |
2870 | 5998 |
"get the flyBy helpText or nil." |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5999 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6000 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6001 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6002 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6003 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6004 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
6005 |
|
2471 | 6006 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
6007 |
"/ (if you have an argument for that let us know..) |
|
6008 |
"/ self isButton ifFalse:[^ nil]. |
|
6009 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6010 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6011 |
"/ if an activeHelpKey was explicitely given, use that one |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6012 |
key := self activeHelpKey. |
2895 | 6013 |
app := menuPanel application. |
6014 |
||
6015 |
"/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher) |
|
6016 |
(key isAssociation) ifTrue:[ |
|
6017 |
app := key key. |
|
6018 |
key := key value. |
|
6019 |
]. |
|
6020 |
||
6021 |
(key notNil and:[app notNil]) ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6022 |
text := app flyByHelpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6023 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6024 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6025 |
"/ 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
|
6026 |
text isNil ifTrue:[ |
2676
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6027 |
self hasSubmenu ifTrue:[ |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6028 |
^ key |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
6029 |
]. |
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
6030 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6031 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6032 |
text isNil ifTrue:[ |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6033 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6034 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6035 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6036 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6037 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6038 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6039 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6040 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6041 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6042 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6043 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6044 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6045 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6046 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6047 |
text := (self updateAccessCharacterFor:text) string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6048 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6049 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6050 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6051 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6052 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6053 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6054 |
"for text menus: it does not make sense to show the labels string again |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6055 |
(i.e. in a pull down menu)" |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6056 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6057 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6058 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6059 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6060 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6061 |
flyByHelpText:aText |
2870 | 6062 |
"exlicitly set the flyBy helpText. For example, to dynamically change it." |
6063 |
||
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
6064 |
flyByHelpText := aText. |
1613 | 6065 |
! ! |
6066 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6067 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6068 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6069 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6070 |
"on default submenus has a vertical layout; |
2870 | 6071 |
true, the submenu has a horizontal layout." |
6072 |
||
2360 | 6073 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6074 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6075 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6076 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6077 |
"on default submenus has a vertical layout; |
2870 | 6078 |
true, the submenu has a horizontal layout." |
6079 |
||
2360 | 6080 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6081 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6082 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6083 |
isButton |
2870 | 6084 |
"returns whether the item looks like a Button" |
6085 |
||
2359 | 6086 |
^ menuItem isButton |
6087 |
! |
|
6088 |
||
6089 |
isButton:aBool |
|
2870 | 6090 |
"set/clear the item to look like a Button" |
6091 |
||
2359 | 6092 |
menuItem isButton ~~ aBool ifTrue:[ |
6093 |
menuItem isButton:aBool. |
|
6094 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6095 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6096 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6097 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6098 |
layout |
2870 | 6099 |
"returns my layout ( Rectangle )" |
6100 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6101 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6102 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6103 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6104 |
layout:aLayout |
2870 | 6105 |
"set a new layout ( Rectangle )" |
6106 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6107 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6108 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6109 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6110 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6111 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6112 |
"get the flag which controls if a busy cursor is to be shown |
2870 | 6113 |
while performing the menu action. Defaults to false." |
6114 |
||
2359 | 6115 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6116 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6117 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6118 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6119 |
"set/clear the flag which controls if a busy cursor is to be shown |
2870 | 6120 |
while performing the menu action. Defaults to false." |
6121 |
||
2359 | 6122 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6123 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
6124 |
|
2504 | 6125 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 6126 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6127 |
currentSubmenu |
2870 | 6128 |
"returns the current submenu or nil" |
6129 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6130 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6131 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6132 |
|
1705 | 6133 |
hideSubmenu |
2870 | 6134 |
"hide submenu" |
6135 |
||
2199 | 6136 |
self hideSubmenu:subMenu. |
6137 |
! |
|
6138 |
||
6139 |
hideSubmenu:aSubmenu |
|
2870 | 6140 |
"hide submenu" |
6141 |
||
2871 | 6142 |
|id wg| |
1705 | 6143 |
|
2374 | 6144 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 6145 |
aSubmenu removeDependencies. |
2199 | 6146 |
|
6147 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6148 |
id := aSubmenu id. |
2374 | 6149 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 6150 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6151 |
aSubmenu hide |
2199 | 6152 |
]. |
6153 |
||
2870 | 6154 |
aSubmenu windowGroup:nil. |
2871 | 6155 |
(wg := menuPanel windowGroup) notNil ifTrue:[ |
6156 |
wg removeView:aSubmenu. |
|
6157 |
]. |
|
2199 | 6158 |
|
6159 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6160 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6161 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6162 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6163 |
] |
2199 | 6164 |
]. |
6165 |
! |
|
6166 |
||
6167 |
openDelayedSubmenu |
|
2870 | 6168 |
"called to open now my delayed submenu" |
6169 |
||
3133 | 6170 |
|subMenuBeforeOpening| |
2199 | 6171 |
|
6172 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
6173 |
||
2374 | 6174 |
subMenu notNil ifTrue:[ |
6175 |
subMenu realized ifTrue:[ |
|
6176 |
"/ already open |
|
6177 |
^ self |
|
6178 |
]. |
|
2199 | 6179 |
]. |
3133 | 6180 |
self setupSubmenu. |
6181 |
subMenu isNil ifTrue:[^ self]. |
|
6182 |
subMenuBeforeOpening := subMenu. |
|
2199 | 6183 |
self openSubmenu. |
6184 |
||
3133 | 6185 |
(subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[ |
2374 | 6186 |
"/ closed during building or opening the submenu |
3133 | 6187 |
self hideSubmenu:subMenuBeforeOpening. |
6188 |
]. |
|
6189 |
||
6190 |
"Modified: / 07-11-2006 / 11:07:57 / cg" |
|
1705 | 6191 |
! |
1701 | 6192 |
|
6193 |
openSubmenu |
|
6194 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
6195 |
is fully visible by shifting it into the visible screen area if |
|
2870 | 6196 |
nescessary." |
6197 |
||
2249 | 6198 |
|p o device isVertical topMenu windGrp prefExtent |
1701 | 6199 |
devBot "{ Class:SmallInteger }" |
6200 |
devRight "{ Class:SmallInteger }" |
|
6201 |
width "{ Class:SmallInteger }" |
|
6202 |
height "{ Class:SmallInteger }" |
|
6203 |
top "{ Class:SmallInteger }" |
|
6204 |
left "{ Class:SmallInteger }" |
|
6205 |
| |
|
6206 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
6207 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 6208 |
^ self |
1701 | 6209 |
]. |
6210 |
||
6211 |
topMenu := menuPanel topMenu. |
|
1829 | 6212 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 6213 |
subMenu releaseDeviceResources. |
6214 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
6215 |
subMenu recreate. |
|
1829 | 6216 |
]. |
6217 |
||
1701 | 6218 |
windGrp := topMenu windowGroup. |
6219 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6220 |
subMenu superMenu:menuPanel. |
1701 | 6221 |
subMenu becomesActiveMenu. |
6222 |
subMenu cursor:Cursor hand. |
|
6223 |
||
6224 |
windGrp notNil ifTrue:[ |
|
2249 | 6225 |
subMenu windowGroup:windGrp. |
6226 |
windGrp addTopView:subMenu. |
|
1701 | 6227 |
]. |
6228 |
||
2111 | 6229 |
"Q&D kludge - test whether the layout is nil; |
2249 | 6230 |
if true recompute the layouts |
2111 | 6231 |
" |
2374 | 6232 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6233 |
|
1701 | 6234 |
" Q&D kludge - if any visibility attributes are blocks; |
6235 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 6236 |
(since I react correctly on valueHolder changes) |
1701 | 6237 |
" |
6238 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6239 |
subMenu fixSize. |
|
6240 |
||
6241 |
"compute origin of subMenu |
|
6242 |
" |
|
6243 |
isVertical := menuPanel verticalLayout. |
|
6244 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6245 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6246 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6247 |
width := prefExtent x. |
1701 | 6248 |
devBot := device usableHeight. |
6249 |
devRight := device usableWidth. |
|
6250 |
||
6251 |
p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6252 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6253 |
menuPanel isPopUpView ifTrue:[ |
2249 | 6254 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6255 |
] ifFalse:[ |
2249 | 6256 |
o := menuPanel translatePoint:p to:nil. "/ translate to root window |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6257 |
]. |
1701 | 6258 |
left := o x. |
6259 |
top := o y. |
|
6260 |
||
2016 | 6261 |
top + height > devBot ifTrue:[ |
2249 | 6262 |
top := isVertical ifTrue:[devBot - height] |
6263 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 6264 |
]. |
6265 |
top := top max:0. |
|
6266 |
||
6267 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6268 |
"/ top < menuPanel bottom ifTrue:[ |
|
6269 |
"/ left := left + layout width. |
|
6270 |
"/ ]. |
|
6271 |
"/ left + width > devRight ifTrue:[ |
|
6272 |
"/ left := o x - width - 2 |
|
6273 |
"/ ]. |
|
6274 |
"/ ]. |
|
6275 |
||
1701 | 6276 |
left + width > devRight ifTrue:[ |
2249 | 6277 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6278 |
ifFalse:[devRight - width] |
|
1701 | 6279 |
]. |
6280 |
left := left max:0. |
|
6281 |
||
6282 |
subMenu origin:(left@top). |
|
6283 |
||
6284 |
subMenu realized ifFalse:[ |
|
2249 | 6285 |
subMenu realize. |
1701 | 6286 |
] ifTrue:[ |
2249 | 6287 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6288 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6289 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6290 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6291 |
toggleSubmenuVisibility |
2870 | 6292 |
"toggle the visibility of the submenu" |
6293 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6294 |
subMenu notNil ifTrue:[ |
2870 | 6295 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6296 |
] ifFalse:[ |
3133 | 6297 |
self setupSubmenu. |
6298 |
subMenu isNil ifTrue:[ |
|
2870 | 6299 |
"/ cannot open a submenu |
6300 |
^ self |
|
6301 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6302 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6303 |
self openSubmenu. |
3133 | 6304 |
|
6305 |
"Modified: / 07-11-2006 / 11:06:42 / cg" |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6306 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6307 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6308 |
visibleSubmenu |
2870 | 6309 |
"returns the current visible submenu or nil" |
6310 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6311 |
subMenu notNil ifTrue:[ |
2870 | 6312 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6313 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6314 |
^ nil |
1701 | 6315 |
! ! |
6316 |
||
524 | 6317 |
!MenuPanel::Item methodsFor:'building'! |
6318 |
||
6319 |
aspectAt:aKey |
|
3092 | 6320 |
"returns the value assigned to key or nil" |
2870 | 6321 |
|
524 | 6322 |
|appl value| |
6323 |
||
6324 |
appl := menuPanel receiver. |
|
6325 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6326 |
(appl isValueModel) ifTrue:[ |
2359 | 6327 |
^ appl value:aKey |
524 | 6328 |
]. |
6329 |
||
2123 | 6330 |
appl isNil ifTrue:[ |
2359 | 6331 |
appl := menuPanel application. |
2123 | 6332 |
]. |
6333 |
appl isNil ifTrue:[ ^ nil]. |
|
6334 |
||
6335 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 6336 |
ex selector == aKey ifFalse:[ |
6337 |
ex reject |
|
6338 |
]. |
|
6339 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 6340 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' |
6341 |
bindWith:appl classNameWithArticle with:aKey). |
|
2123 | 6342 |
] do:[ |
2359 | 6343 |
aKey numArgs == 1 ifTrue:[ |
6344 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6345 |
] ifFalse:[ |
|
6346 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6347 |
value := appl aspectFor:aKey |
|
6348 |
] ifFalse:[ |
|
6349 |
value := appl perform:aKey |
|
6350 |
] |
|
6351 |
] |
|
524 | 6352 |
]. |
6353 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6354 |
|
3092 | 6355 |
"Modified: / 05-10-2006 / 03:10:20 / cg" |
524 | 6356 |
! ! |
6357 |
||
390 | 6358 |
!MenuPanel::Item methodsFor:'change & update'! |
6359 |
||
2614 | 6360 |
fontChanged |
2870 | 6361 |
"called whenever the font changed" |
6362 |
||
2614 | 6363 |
displayLabel notNil ifTrue:[ |
6364 |
displayLabelExtent := nil. |
|
6365 |
||
6366 |
subMenu notNil ifTrue:[ |
|
6367 |
subMenu font:(menuPanel font). |
|
6368 |
]. |
|
6369 |
]. |
|
6370 |
! |
|
6371 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6372 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6373 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6374 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6375 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6376 |
(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
|
6377 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6378 |
self isSeparator ifFalse:[ |
2359 | 6379 |
"/ NOT A SEPARATOR |
6380 |
||
6381 |
menuPanel shown ifTrue:[ |
|
6382 |
changedObject == enableChannel ifTrue:[ |
|
6383 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6384 |
^ menuPanel selection:nil. |
|
6385 |
]. |
|
6386 |
^ self invalidate |
|
6387 |
]. |
|
6388 |
||
6389 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6390 |
menuItem isButton ifTrue:[ |
|
6391 |
self invalidate |
|
6392 |
] ifFalse:[ |
|
6393 |
"/ invalidate the interactor only |
|
6394 |
"/ take any interactor; interactors has the same extent |
|
6395 |
form := menuPanel iconIndicationOff. |
|
6396 |
||
6397 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6398 |
top:(layout top) |
|
6399 |
width:(form width) |
|
6400 |
height:(layout height). |
|
6401 |
||
6402 |
menuPanel invalidate:rect repairNow:false |
|
6403 |
]. |
|
6404 |
^ self |
|
6405 |
]. |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6406 |
self invalidate. |
2359 | 6407 |
]. |
498 | 6408 |
]. |
712 | 6409 |
|
6410 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6411 |
menuPanel mustRearrange. |
6412 |
menuPanel rearrangeItems. |
|
6413 |
^ self. |
|
712 | 6414 |
]. |
6415 |
||
498 | 6416 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6417 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6418 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6419 |
updateIndicators |
2870 | 6420 |
"update indicators " |
6421 |
||
2934 | 6422 |
indication notNil ifTrue:[ |
6423 |
(indication isSymbol |
|
6424 |
or:[menuItem hideMenuOnActivated not]) |
|
6425 |
ifTrue:[ |
|
6426 |
"indication is a selector; |
|
6427 |
otherwise no need to redraw, because |
|
6428 |
a change notification is raised from the model !!!!" |
|
6429 |
self update:nil with:nil from:indication |
|
6430 |
] |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6431 |
] |
390 | 6432 |
! ! |
6433 |
||
388 | 6434 |
!MenuPanel::Item methodsFor:'converting'! |
6435 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6436 |
asMenuItem |
2870 | 6437 |
"convert to a MenuItem" |
6438 |
||
2359 | 6439 |
^ menuItem |
388 | 6440 |
! |
6441 |
||
2827 | 6442 |
menuItem |
6443 |
^ menuItem |
|
6444 |
! |
|
6445 |
||
388 | 6446 |
menuItem:aMenuItem |
2870 | 6447 |
"setup attributes from a MenuItem" |
6448 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6449 |
|lbl| |
389 | 6450 |
|
388 | 6451 |
menuPanel disabledRedrawDo:[ |
2359 | 6452 |
menuItem := aMenuItem. |
6453 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6454 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6455 |
label := displayLabel := activeHelpText := nil. |
2359 | 6456 |
|
6457 |
self enabled:(menuItem enabled). |
|
6458 |
self indication:(menuItem indication). |
|
6459 |
self choice:(menuItem choice). |
|
6460 |
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
|
6461 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6462 |
"/ 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
|
6463 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6464 |
|
2359 | 6465 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6466 |
lbl := menuItem rawLabel. "/ avoid translating &'s twice |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6467 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6468 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6469 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6470 |
self label:lbl. |
388 | 6471 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6472 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6473 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6474 |
! ! |
6475 |
||
2681 | 6476 |
!MenuPanel::Item methodsFor:'dependents access'! |
6477 |
||
6478 |
addDependencies |
|
2870 | 6479 |
"add all dependencies" |
6480 |
||
2681 | 6481 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
6482 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
6483 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
6484 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
6485 |
! |
|
6486 |
||
6487 |
removeDependencies |
|
2870 | 6488 |
"remove all dependencies" |
6489 |
||
2681 | 6490 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
6491 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
6492 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
6493 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
6494 |
! ! |
|
6495 |
||
388 | 6496 |
!MenuPanel::Item methodsFor:'drawing'! |
6497 |
||
2768 | 6498 |
choiceForm |
2870 | 6499 |
"returns choice form or nil" |
6500 |
||
2768 | 6501 |
|isOn| |
6502 |
||
6503 |
choice isNil ifTrue:[^ nil]. |
|
6504 |
||
6505 |
isOn := (choice value = menuItem choiceValue). |
|
6506 |
self enabled ifFalse:[ |
|
6507 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
|
6508 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
6509 |
]. |
|
6510 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
|
6511 |
ifFalse:[menuPanel iconRadioGroupOff] |
|
6512 |
! |
|
6513 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6514 |
draw |
2870 | 6515 |
"redraw this item" |
6516 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6517 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6518 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6519 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6520 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6521 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6522 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6523 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6524 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6525 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6526 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6527 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6528 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6529 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6530 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6531 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6532 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6533 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6534 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6535 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6536 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6537 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6538 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6539 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6540 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6541 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6542 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6543 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6544 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6545 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6546 |
]]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6547 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6548 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6549 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6550 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6551 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6552 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6553 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6554 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6555 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6556 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6557 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6558 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6559 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6560 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6561 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6562 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6563 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6564 |
ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6565 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6566 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6567 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6568 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6569 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6570 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6571 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6572 |
menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6573 |
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6574 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6575 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6576 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6577 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6578 |
drawButton |
2870 | 6579 |
"draw as button" |
6580 |
||
2362 | 6581 |
|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
|
6582 |
x "{ Class:SmallInteger }" |
2143 | 6583 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6584 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6585 |
drawObject := displayLabel. |
2362 | 6586 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6587 |
isSelected := self isSelected. |
2362 | 6588 |
|
6589 |
isSelected ifFalse:[ |
|
6590 |
"/ test whether button has pressed toggle behaviour |
|
6591 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6592 |
] ifTrue:[ |
|
6593 |
showSelected := isSelected |
|
6594 |
]. |
|
6595 |
||
6596 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6597 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6598 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6599 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6600 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6601 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6602 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6603 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6604 |
]. |
2059 | 6605 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6606 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6607 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6608 |
fg := menuPanel disabledForegroundColor. |
2059 | 6609 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6610 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6611 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6612 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6613 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6614 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6615 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6616 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6617 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6618 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6619 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6620 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6621 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6622 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6623 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6624 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6625 |
|
6626 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6627 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6628 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6629 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6630 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6631 |
"check whether button should be drawn selected; indicator or radio button" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6632 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6633 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6634 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6635 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6636 |
] ifFalse:[ |
2359 | 6637 |
isSelected := (choice notNil and:[choice value = menuItem choiceValue]). |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6638 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6639 |
]. |
2143 | 6640 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6641 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6642 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6643 |
level := menuPanel buttonActiveLevel. |
2142 | 6644 |
x := x + 1 "level abs". |
2143 | 6645 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6646 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6647 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6648 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6649 |
]. |
6650 |
||
2817 | 6651 |
drawObject notEmptyOrNil ifTrue:[ |
2362 | 6652 |
etchFg notNil ifTrue:[ |
6653 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6654 |
]. |
|
6655 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6656 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6657 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6658 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6659 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6660 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6661 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6662 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6663 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6664 |
drawLabel |
2870 | 6665 |
"draw a labeled entry; no button, no separator." |
6666 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6667 |
|scKey cLb cLa drawObject fg etchFg arrow |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6668 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6669 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6670 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6671 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6672 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6673 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6674 |
drawObject := displayLabel. |
2362 | 6675 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6676 |
isSelected := self isSelected. |
2362 | 6677 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6678 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6679 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6680 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6681 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6682 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6683 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6684 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6685 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6686 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6687 |
] ifFalse:[ |
2362 | 6688 |
fg := menuPanel disabledForegroundColor. |
6689 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6690 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6691 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6692 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6693 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6694 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6695 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6696 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6697 |
|
3131 | 6698 |
( (form := self indicatorForm) notNil |
6699 |
or:[(form := self choiceForm) notNil] |
|
6700 |
) ifTrue:[ |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6701 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6702 |
form displayOn:menuPanel x:x y:y. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6703 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6704 |
|
2817 | 6705 |
drawObject notEmptyOrNil ifTrue:[ |
3131 | 6706 |
x := x + (menuPanel stringOffsetXfor:self). |
6707 |
||
2362 | 6708 |
etchFg notNil ifTrue:[ |
6709 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6710 |
]. |
|
6711 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6712 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6713 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6714 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6715 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6716 |
|
2359 | 6717 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6718 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6719 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6720 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6721 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6722 |
y := t + ((h - (scKey heightOn:menuPanel)) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6723 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6724 |
scKey displayOn:menuPanel x:x y:y. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6725 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6726 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6727 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6728 |
|
2362 | 6729 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6730 |
^ self |
|
6731 |
]. |
|
6732 |
arrow := menuPanel rightArrow. |
|
6733 |
x := layout right - arrow width - HorizontalInset. |
|
3131 | 6734 |
y := t + ((h - arrow height) // 2). |
2362 | 6735 |
|
6736 |
(menuPanel styleSheet is3D not |
|
6737 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6738 |
^ menuPanel displayForm:arrow x:x y:y |
|
6739 |
]. |
|
6740 |
cLa := menuPanel shadowColor. |
|
6741 |
cLb := menuPanel lightColor. |
|
6742 |
||
6743 |
isSelected ifFalse:[ |
|
6744 |
fg := cLa. |
|
6745 |
cLa := cLb. |
|
6746 |
cLb := fg |
|
6747 |
]. |
|
6748 |
menuPanel paint:cLa. |
|
6749 |
menuPanel displayForm:arrow x:x y:y. |
|
6750 |
menuPanel paint:cLb. |
|
6751 |
menuPanel displayForm:drawObject x:x y:y. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6752 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6753 |
"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
|
6754 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6755 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6756 |
drawMenuIndicator |
2870 | 6757 |
"draw a menu indicator if the item has a menu or delayed menu." |
6758 |
||
2220 | 6759 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6760 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6761 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6762 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6763 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6764 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6765 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6766 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6767 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6768 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6769 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6770 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6771 |
x := layout right - icon width. |
2460 | 6772 |
false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[ |
2220 | 6773 |
y := layout height - icon height // 2 + layout top. |
6774 |
] ifFalse:[ |
|
6775 |
y := layout bottom - icon height - 2. |
|
6776 |
]. |
|
6777 |
||
6778 |
bAbsLevel := 0. |
|
2359 | 6779 |
menuItem isButton ifTrue:[ |
2220 | 6780 |
self isSelected ifTrue:[ |
6781 |
x := x + 1. |
|
6782 |
y := y + 1. |
|
6783 |
]. |
|
6784 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6785 |
x := x - bAbsLevel. |
|
6786 |
y := y - bAbsLevel. |
|
6787 |
]. |
|
6788 |
x := x - 1 "- HorizontalInset". |
|
6789 |
||
6790 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6791 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6792 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6793 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6794 |
|
2234 | 6795 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2761 | 6796 |
ifTrue:[ |
2220 | 6797 |
menuPanel paint:menuPanel buttonShadowColor. |
6798 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6799 |
menuPanel paint:menuPanel buttonLightColor. |
|
6800 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6801 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6802 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6803 |
|
2059 | 6804 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
2870 | 6805 |
"draw a labeled entry; no button, no separator." |
6806 |
||
2614 | 6807 |
|mfont labelExtent |
1727 | 6808 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6809 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6810 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6811 |
| |
2059 | 6812 |
|
2373 | 6813 |
mfont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6814 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6815 |
menuPanel paint:fg. |
2614 | 6816 |
labelExtent := self displayLabelExtent. |
6817 |
||
6818 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 6819 |
"/ menuPanel centerItems ifTrue:[self halt]. |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6820 |
aLabel isArray ifFalse:[ |printLabel| |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6821 |
aLabel isText ifTrue:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6822 |
"/background of label already drawn |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6823 |
printLabel := aLabel withoutEmphasis:#backgroundColor. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6824 |
] ifFalse:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6825 |
printLabel := aLabel. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6826 |
]. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6827 |
y := y + (printLabel ascentOn:menuPanel). |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6828 |
printLabel displayOn:menuPanel x:x y:y. |
1727 | 6829 |
] ifTrue:[ |
2337 | 6830 |
aLabel do:[:el| |
6831 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6832 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6833 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6834 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6835 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6836 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6837 |
"/ ]. |
2614 | 6838 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 6839 |
el displayOn:menuPanel x:x0 y:y0. |
6840 |
y := y + 1 + (el heightOn:menuPanel) |
|
6841 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6842 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 6843 |
] |
6844 |
]. |
|
1727 | 6845 |
]. |
6846 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6847 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6848 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6849 |
drawSeparatingLines |
2870 | 6850 |
"draw separating lines" |
6851 |
||
2059 | 6852 |
|myIndex lfSep rtSep items prevItem nextItem |
6853 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6854 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6855 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6856 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6857 |
b "{ Class:SmallInteger }" |
706 | 6858 |
| |
2059 | 6859 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6860 |
items := menuPanel items. |
2059 | 6861 |
myIndex := items identityIndexOf:self. |
6862 |
||
6863 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6864 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6865 |
||
6866 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6867 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6868 |
||
6869 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2870 | 6870 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6871 |
]. |
2059 | 6872 |
|
6873 |
lightColor := menuPanel lightColor. |
|
6874 |
shadowColor := menuPanel shadowColor. |
|
6875 |
||
6876 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6877 |
|
608 | 6878 |
l := layout left. |
6879 |
t := layout top. |
|
6880 |
r := layout right. |
|
6881 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6882 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6883 |
menuPanel verticalLayout ifTrue:[ |
2870 | 6884 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
6885 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
6886 |
||
6887 |
menuPanel paint:shadowColor. |
|
6888 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
6889 |
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
|
6890 |
] ifFalse:[ |
2870 | 6891 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
6892 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
6893 |
||
6894 |
menuPanel paint:shadowColor. |
|
6895 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
6896 |
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
|
6897 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6898 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6899 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6900 |
drawSeparator |
2870 | 6901 |
"draw as separator" |
6902 |
||
2059 | 6903 |
|type lightColor shadowColor isDouble |
6904 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6905 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6906 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6907 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6908 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6909 |
| |
2059 | 6910 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6911 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6912 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2870 | 6913 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6914 |
]. |
2059 | 6915 |
|
6916 |
isDouble := type == #doubleLine. |
|
6917 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6918 |
lightColor := menuPanel lightColor. |
2059 | 6919 |
shadowColor := menuPanel shadowColor. |
6920 |
menuPanel paint:shadowColor. |
|
6921 |
||
6922 |
left := layout left. |
|
6923 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6924 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6925 |
menuPanel verticalLayout ifTrue:[ |
2870 | 6926 |
x0 := left + HorizontalInset. |
6927 |
x1 := layout right - HorizontalInset. |
|
6928 |
y0 := top - 1 + (layout height // 2). |
|
6929 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
6930 |
||
6931 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
6932 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
6933 |
||
6934 |
menuPanel paint:lightColor. |
|
6935 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
6936 |
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
|
6937 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6938 |
] ifFalse:[ |
2870 | 6939 |
y1 := layout bottom. |
6940 |
x0 := left - 1 + (layout width // 2). |
|
6941 |
y0 := top. |
|
6942 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
6943 |
||
6944 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
6945 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
6946 |
||
6947 |
menuPanel paint:lightColor. |
|
6948 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
6949 |
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
|
6950 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6951 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6952 |
|
2768 | 6953 |
indicatorForm |
2870 | 6954 |
"returns indication form or nil" |
6955 |
||
2768 | 6956 |
|val| |
6957 |
||
6958 |
indication isNil ifTrue:[^ nil]. |
|
6959 |
||
6960 |
val := self indicationValue. |
|
6961 |
self enabled ifFalse:[ |
|
2870 | 6962 |
^ val == true |
6963 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
6964 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
2768 | 6965 |
]. |
6966 |
^ val == true |
|
2870 | 6967 |
ifTrue:[menuPanel iconIndicationOn] |
6968 |
ifFalse:[menuPanel iconIndicationOff] |
|
2768 | 6969 |
! |
6970 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6971 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6972 |
|
2362 | 6973 |
layout isNil ifTrue:[^ self]. |
6974 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6975 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 6976 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6977 |
] |
388 | 6978 |
! ! |
6979 |
||
6980 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6981 |
||
6982 |
destroy |
|
2870 | 6983 |
"destroy submenus, remove dependencies" |
6984 |
||
616 | 6985 |
self submenu:nil. |
2681 | 6986 |
self removeDependencies. |
616 | 6987 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6988 |
menuPanel := nil. |
616 | 6989 |
! |
6990 |
||
794 | 6991 |
in:aPanel |
2870 | 6992 |
"create item in a menuPanel" |
6993 |
||
794 | 6994 |
menuPanel := aPanel. |
2359 | 6995 |
|
6996 |
menuItem isNil ifTrue:[ |
|
6997 |
self halt. |
|
6998 |
menuItem := MenuItem new |
|
6999 |
]. |
|
7000 |
! |
|
7001 |
||
7002 |
initialize |
|
7003 |
menuItem := MenuItem new. |
|
1811 | 7004 |
! |
7005 |
||
7006 |
reinitStyle |
|
7007 |
||
7008 |
subMenu notNil ifTrue:[ |
|
3147 | 7009 |
subMenu reinitStyle |
1811 | 7010 |
]. |
7011 |
||
7012 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
7013 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 7014 |
! ! |
7015 |
||
7016 |
!MenuPanel::Item methodsFor:'label basics'! |
|
7017 |
||
7018 |
disabledRawLabel |
|
2870 | 7019 |
"returns the label used if the item is disabled" |
7020 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7021 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7022 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7023 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7024 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7025 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7026 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7027 |
disabledDisplayLabel isString ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7028 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7029 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7030 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7031 |
block := [:el| |rslt| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7032 |
(rslt := el) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7033 |
el isImageOrForm ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7034 |
el colorMap notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7035 |
rslt := menuPanel lightenedImageOnDevice:el |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7036 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7037 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7038 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7039 |
((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7040 |
form := menuPanel lightenedImageOnDevice:form |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7041 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7042 |
((image := el image) notNil and:[image colorMap notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7043 |
image := menuPanel lightenedImageOnDevice:image |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7044 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7045 |
rslt := LabelAndIcon form:form image:image string:(el string). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7046 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7047 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7048 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7049 |
rslt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7050 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7051 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7052 |
displayLabel isArray ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7053 |
disabledDisplayLabel := Array new:(displayLabel size). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7054 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7055 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7056 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7057 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7058 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7059 |
disabledDisplayLabel := block value:displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7060 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7061 |
^ disabledDisplayLabel |
794 | 7062 |
! |
7063 |
||
1829 | 7064 |
fetchDeviceResources |
2373 | 7065 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7066 |
disabledDisplayLabel := nil. |
1829 | 7067 |
self fetchImages. |
7068 |
! |
|
7069 |
||
616 | 7070 |
fetchImages |
2870 | 7071 |
"fetch my icon images" |
7072 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7073 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
7074 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7075 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7076 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7077 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7078 |
displayLabel isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7079 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7080 |
^ self. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7081 |
]. |
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 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7084 |
(icon := displayLabel image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7085 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7086 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7087 |
(icon := displayLabel icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7088 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7089 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7090 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7091 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7092 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7093 |
displayLabel isArray ifFalse:[^ self]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7094 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7095 |
displayLabel keysAndValuesDo:[:i :el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7096 |
(el notNil and:[el isString not]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7097 |
el isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7098 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7099 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7100 |
el class == LabelAndIcon ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7101 |
(icon := el image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7102 |
el image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7103 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7104 |
(icon := el icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
7105 |
el icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7106 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7107 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7108 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7109 |
] |
1078 | 7110 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7111 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7112 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7113 |
updateAccessCharacterFor:aLabel |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7114 |
"replace the & by the short-key attribute (i.e. underline it)" |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
7115 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7116 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7117 |
|
3192 | 7118 |
accessCharacter notNil ifTrue:[^ aLabel]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7119 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7120 |
aLabel isString ifFalse:[ |
2359 | 7121 |
aLabel class == LabelAndIcon ifTrue:[ |
7122 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
7123 |
]. |
|
7124 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7125 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7126 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7127 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7128 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7129 |
label := aLabel. |
2359 | 7130 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7131 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7132 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 7133 |
rest := label copyFrom:(i+1). |
7134 |
||
7135 |
i == 1 ifTrue:[label := rest] |
|
7136 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
7137 |
||
7138 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
7139 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7140 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7141 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7142 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 7143 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7144 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7145 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7146 |
label isText ifFalse:[ |
2359 | 7147 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7148 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7149 |
label emphasisAt:pos add:#underline. |
2359 | 7150 |
^ label |
388 | 7151 |
! ! |
7152 |
||
1573 | 7153 |
!MenuPanel::Item methodsFor:'printing & storing'! |
7154 |
||
7155 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7156 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
7157 |
|
1573 | 7158 |
! ! |
7159 |
||
388 | 7160 |
!MenuPanel::Item methodsFor:'private'! |
7161 |
||
650 | 7162 |
activeBackgroundColor |
2870 | 7163 |
"returns the active background color derived from menuPanel" |
7164 |
||
2359 | 7165 |
menuItem isButton ifTrue:[ |
7166 |
^ menuPanel buttonActiveBackgroundColor |
|
7167 |
]. |
|
7168 |
^ menuPanel activeBackgroundColor |
|
650 | 7169 |
! |
7170 |
||
7171 |
activeForegroundColor |
|
2870 | 7172 |
"returns the active foreground color derived from menuPanel" |
650 | 7173 |
|
7174 |
^menuPanel activeForegroundColor |
|
7175 |
! |
|
7176 |
||
727 | 7177 |
backgroundColor |
2870 | 7178 |
"returns the background color derived from menuPanel" |
7179 |
||
2359 | 7180 |
menuItem isButton ifTrue:[ |
7181 |
^ menuPanel buttonPassiveBackgroundColor |
|
7182 |
]. |
|
7183 |
^ menuPanel backgroundColor |
|
727 | 7184 |
! |
7185 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7186 |
backgroundColorFromLabel |
2870 | 7187 |
"returns the background color derived from label or nil" |
7188 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7189 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7190 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7191 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7192 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7193 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7194 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7195 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7196 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7197 |
run size == 0 ifTrue:[ |
2870 | 7198 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
7199 |
^ run value |
|
7200 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7201 |
] ifFalse:[ |
2870 | 7202 |
run do:[:r| |
7203 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
7204 |
^ r value |
|
7205 |
] |
|
7206 |
] |
|
388 | 7207 |
]. |
7208 |
^ nil |
|
7209 |
! |
|
7210 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7211 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7212 |
"returns the background color to use when thhe mouse has entered |
2870 | 7213 |
derived from menuPanel" |
7214 |
||
2359 | 7215 |
menuItem isButton ifTrue:[ |
7216 |
^ menuPanel buttonEnteredBackgroundColor |
|
7217 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7218 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7219 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7220 |
|
663 | 7221 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7222 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7223 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7224 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7225 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
7226 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7227 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7228 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7229 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7230 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7231 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7232 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7233 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7234 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7235 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7236 |
numArgs == 0 ifTrue:[ |
2359 | 7237 |
MessageNotUnderstood handle:[:ex | |
7238 |
|selector| |
|
7239 |
||
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7240 |
((selector := ex selector) == sel |
2359 | 7241 |
or:[selector == #aspectFor:]) ifFalse:[ |
7242 |
ex reject |
|
7243 |
]. |
|
7244 |
] do:[ |
|
7245 |
subm := aRecv aspectFor:sel. |
|
7246 |
]. |
|
7247 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7248 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7249 |
|
2043 | 7250 |
(Array with:(aRecv) with:(aRecv class)) |
7251 |
do:[:aPossibleReceiver | |
|
2359 | 7252 |
MessageNotUnderstood handle:[:ex| |
7253 |
ex message selector == sel ifFalse:[ ex reject ] |
|
7254 |
] do:[ |
|
7255 |
numArgs == 0 ifTrue:[ |
|
7256 |
subm := aPossibleReceiver perform:sel |
|
7257 |
] ifFalse:[ |
|
7258 |
numArgs == 1 ifTrue:[ |
|
7259 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
7260 |
] ifFalse:[ |
|
7261 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
7262 |
] |
|
7263 |
] |
|
7264 |
]. |
|
7265 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7266 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7267 |
|
663 | 7268 |
^ subm |
2043 | 7269 |
|
7270 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 7271 |
! |
7272 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7273 |
indicationValue |
2870 | 7274 |
"returns indication value or nil in case of no indication" |
7275 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7276 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7277 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7278 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7279 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7280 |
indication isSymbol ifFalse:[ |
2359 | 7281 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7282 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7283 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7284 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 7285 |
recv := menuPanel receiver. |
7286 |
||
7287 |
(recv isValueModel) ifFalse:[ |
|
7288 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
7289 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
7290 |
sel := sel asSymbol. |
|
7291 |
||
7292 |
MessageNotUnderstood handle:[:ex| |
|
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7293 |
ex selector == sel ifFalse:[ |
2359 | 7294 |
ex reject |
7295 |
]. |
|
7296 |
] do:[ |
|
7297 |
sel := recv perform:sel with:(menuItem argument) |
|
7298 |
] |
|
7299 |
]. |
|
7300 |
]. |
|
7301 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7302 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7303 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7304 |
numArgs ~~ 0 ifTrue:[ |
2359 | 7305 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7306 |
] ifFalse:[ |
2359 | 7307 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7308 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7309 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7310 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7311 |
sel isValueModel ifTrue:[ |
2359 | 7312 |
indication := sel. |
7313 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7314 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7315 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7316 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7317 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7318 |
indicationValue:aValue |
2870 | 7319 |
"set the indication value" |
7320 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7321 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7322 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7323 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7324 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7325 |
indication isSymbol ifFalse:[ |
2359 | 7326 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
7327 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7328 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7329 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7330 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 7331 |
^ self |
1218 | 7332 |
]. |
7333 |
||
524 | 7334 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7335 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7336 |
|
1218 | 7337 |
recv isNil ifTrue:[ |
2359 | 7338 |
recv := menuPanel application. |
7339 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7340 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7341 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7342 |
MessageNotUnderstood handle:[:ex| |
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7343 |
(ex selector ~~ indication) ifTrue:[ |
2359 | 7344 |
ex reject |
7345 |
]. |
|
7346 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 7347 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
7348 |
bindWith:recv classNameWithArticle with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7349 |
] do:[ |
2359 | 7350 |
numArgs == 1 ifTrue:[ |
7351 |
recv perform:indication with:aValue |
|
7352 |
] ifFalse:[ |
|
7353 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
7354 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7355 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7356 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7357 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7358 |
isEntered |
2870 | 7359 |
"returns true if the mouse pointer is over the item" |
7360 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7361 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7362 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7363 |
"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
|
7364 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7365 |
|
464 | 7366 |
separatorType |
2870 | 7367 |
"returns type of separator line or nil" |
7368 |
||
390 | 7369 |
|c lbl| |
388 | 7370 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7371 |
self isSeparator ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7372 |
^ nil |
388 | 7373 |
]. |
7374 |
||
390 | 7375 |
(lbl := label value) isNil ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7376 |
^ #singleLine |
388 | 7377 |
]. |
7378 |
||
390 | 7379 |
lbl size == 1 ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7380 |
c := lbl first. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7381 |
c == $- ifTrue:[^ #singleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7382 |
c == $= ifTrue:[^ #doubleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7383 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7384 |
^ #blankLine |
1130 | 7385 |
! |
7386 |
||
7387 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7388 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7389 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7390 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7391 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7392 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7393 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7394 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7395 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7396 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7397 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7398 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7399 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7400 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7401 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7402 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7403 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7404 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7405 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7406 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7407 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7408 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7409 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7410 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7411 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7412 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7413 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7414 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7415 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7416 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7417 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7418 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7419 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7420 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7421 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7422 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7423 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7424 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7425 |
submenuEncoding := submenu. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7426 |
submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7427 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7428 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7429 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7430 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7431 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7432 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7433 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7434 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7435 |
self submenu:submenu. |
1130 | 7436 |
^ subMenu |
7437 |
||
7438 |
"Modified: / 19.5.1998 / 19:36:56 / cg" |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7439 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7440 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7441 |
spaceBetweenEmptyLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7442 |
^ 3 |
388 | 7443 |
! ! |
7444 |
||
7445 |
!MenuPanel::Item methodsFor:'queries'! |
|
7446 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7447 |
canChangeVisibility |
1699 | 7448 |
"return true if I am not always visible; can only be changed by a selector |
2870 | 7449 |
otherwise there is a change notification raised if the model changed" |
7450 |
||
3122 | 7451 |
^ isVisible isSymbol or:[isVisible isValueModel] |
1699 | 7452 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
3112 | 7453 |
|
7454 |
"Modified: / 11-10-2006 / 21:43:31 / cg" |
|
3122 | 7455 |
"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
|
7456 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7457 |
|
388 | 7458 |
canSelect |
1699 | 7459 |
"returns true if item is selectable; no separator, visible and enabled. |
2870 | 7460 |
in case of a choice (RadioButton) i have to check for the choiceValue" |
7461 |
||
2362 | 7462 |
self isSeparator ifTrue:[^ false]. |
7463 |
||
7464 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 7465 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
7466 |
^ true |
|
7467 |
]. |
|
1078 | 7468 |
]. |
7469 |
^ false |
|
388 | 7470 |
! |
7471 |
||
2046 | 7472 |
containsPoint:aPoint |
2870 | 7473 |
"returns true if aPoint is contained in my layout" |
7474 |
||
2046 | 7475 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2870 | 7476 |
^ layout containsPoint:aPoint |
2046 | 7477 |
]. |
7478 |
^ false |
|
7479 |
||
7480 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
7481 |
! |
|
7482 |
||
388 | 7483 |
containsPointX:x y:y |
2870 | 7484 |
"returns true if point is contained in my layout" |
7485 |
||
712 | 7486 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2870 | 7487 |
^ layout containsPointX:x y:y |
505 | 7488 |
]. |
7489 |
^ false |
|
388 | 7490 |
! |
7491 |
||
2199 | 7492 |
hasDelayedMenu |
2870 | 7493 |
"returns true if a delayed menu exists" |
7494 |
||
2360 | 7495 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7496 |
^ false |
2199 | 7497 |
]. |
2360 | 7498 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7499 |
||
7500 |
(indication isNil and:[choice isNil]) ifTrue:[ |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7501 |
^ false |
2199 | 7502 |
]. |
7503 |
^ true |
|
7504 |
! |
|
7505 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7506 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7507 |
"returns true if the item has a delayed menu |
2870 | 7508 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
7509 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7510 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7511 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7512 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7513 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7514 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7515 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7516 |
hasIndication |
2870 | 7517 |
"returns true if on/off indication exists" |
7518 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7519 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7520 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7521 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7522 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7523 |
"returns true if the item has a delayed menu |
2870 | 7524 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)" |
7525 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7526 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7527 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7528 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7529 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7530 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7531 |
|
388 | 7532 |
hasSubmenu |
2870 | 7533 |
"returns true if the item is configured as an subMenu entry" |
7534 |
||
7535 |
^ subMenu notNil or:[ menuItem submenuChannel notNil ] |
|
388 | 7536 |
! |
7537 |
||
7538 |
isEnabled |
|
2870 | 7539 |
"returns the enabled state" |
7540 |
||
388 | 7541 |
^ self enabled |
7542 |
! |
|
7543 |
||
608 | 7544 |
isSeparator |
2870 | 7545 |
"returns true if item is a separator" |
7546 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7547 |
^ displayLabel isNil |
608 | 7548 |
! |
7549 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7550 |
isToggle |
2870 | 7551 |
"returns true if on/off indication exists" |
7552 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7553 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7554 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7555 |
|
712 | 7556 |
isVisible |
2870 | 7557 |
"returns the visibility state" |
7558 |
||
712 | 7559 |
|state| |
7560 |
||
7561 |
isVisible isSymbol ifTrue:[ |
|
2870 | 7562 |
state := self aspectAt:isVisible. |
7563 |
||
7564 |
state isValueModel ifTrue:[ |
|
7565 |
isVisible := state. |
|
7566 |
isVisible addDependent:self. |
|
7567 |
state := isVisible. |
|
7568 |
] |
|
712 | 7569 |
] ifFalse:[ |
2870 | 7570 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7571 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7572 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7573 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7574 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7575 |
! |
7576 |
||
7577 |
isVisible:something |
|
2870 | 7578 |
"change the visibility state; if the state changed, a redraw is performed" |
7579 |
||
712 | 7580 |
|oldState newState| |
7581 |
||
7582 |
isVisible isNil ifTrue:[ |
|
2870 | 7583 |
oldState := true |
712 | 7584 |
] ifFalse:[ |
2870 | 7585 |
oldState := isVisible value. |
7586 |
isVisible isValueModel ifTrue:[ |
|
7587 |
isVisible removeDependent:self |
|
7588 |
] |
|
712 | 7589 |
]. |
7590 |
isVisible := something. |
|
7591 |
||
7592 |
isVisible isNil ifTrue:[ |
|
2870 | 7593 |
newState := true |
712 | 7594 |
] ifFalse:[ |
2870 | 7595 |
isVisible isValueModel ifTrue:[ |
7596 |
isVisible addDependent:self |
|
7597 |
] ifFalse:[ |
|
7598 |
isVisible isSymbol ifTrue:[^ self] |
|
7599 |
]. |
|
7600 |
menuPanel shown ifFalse:[^ self]. |
|
7601 |
newState := isVisible value. |
|
712 | 7602 |
]. |
7603 |
||
7604 |
newState ~~ oldState ifTrue:[ |
|
2870 | 7605 |
menuPanel mustRearrange |
712 | 7606 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7607 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7608 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7609 |
! |
7610 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7611 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7612 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7613 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7614 |
|
388 | 7615 |
shortcutKeyAsString |
2870 | 7616 |
"converts shortcutKey to a text object" |
7617 |
||
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7618 |
|shortcutKey| |
2359 | 7619 |
|
7620 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7621 |
|
7622 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7623 |
^ nil |
1609 | 7624 |
]. |
7625 |
shortcutKey isCharacter ifTrue:[ |
|
2972
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7626 |
^ shortcutKey asString |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7627 |
]. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7628 |
^ menuPanel device shortKeyStringFor:shortcutKey. |
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7629 |
|
65841fbd0933
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
2936
diff
changeset
|
7630 |
"Modified: / 08-08-2006 / 15:46:24 / cg" |
388 | 7631 |
! ! |
7632 |
||
7633 |
!MenuPanel::Item methodsFor:'selection'! |
|
7634 |
||
7635 |
isSelected |
|
2870 | 7636 |
"returns true if item is selected" |
1998 | 7637 |
|
7638 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 7639 |
! |
7640 |
||
2249 | 7641 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7642 |
"change selection to a state. Dependant on the state open or hide an existing |
2870 | 7643 |
submenu and perform a redraw" |
7644 |
||
2249 | 7645 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
7646 |
self invalidate. |
|
7647 |
self hideSubmenu. |
|
2359 | 7648 |
^ self |
2249 | 7649 |
]. |
7650 |
||
2199 | 7651 |
menuPanel realized ifFalse:[ ^ self ]. |
7652 |
||
2359 | 7653 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 7654 |
self invalidate |
2199 | 7655 |
]. |
7656 |
self hasSubmenu ifFalse:[ ^ self]. |
|
7657 |
||
7658 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 7659 |
menuPanel openDelayed:self |
2199 | 7660 |
] ifFalse:[ |
3133 | 7661 |
self setupSubmenu. |
2374 | 7662 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
1701 | 7663 |
]. |
3133 | 7664 |
|
7665 |
"Modified: / 07-11-2006 / 11:08:03 / cg" |
|
388 | 7666 |
! ! |
7667 |
||
2692 | 7668 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
7669 |
||
7670 |
argument2 |
|
7671 |
||
7672 |
^ argument2 |
|
7673 |
! |
|
7674 |
||
7675 |
argument2:anArgumentOrNil |
|
7676 |
||
7677 |
argument2 := anArgumentOrNil |
|
7678 |
! ! |
|
7679 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7680 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7681 |
|
2018 | 7682 |
icon |
2016 | 7683 |
"This resource specification was automatically generated |
7684 |
by the ImageEditor of ST/X." |
|
7685 |
||
7686 |
"Do not manually edit this!! If it is corrupted, |
|
7687 |
the ImageEditor may not be able to read the specification." |
|
7688 |
||
7689 |
" |
|
2018 | 7690 |
self icon inspect |
7691 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7692 |
" |
7693 |
||
7694 |
<resource: #image> |
|
7695 |
||
7696 |
^Icon |
|
3147 | 7697 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7698 |
ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a') ; yourself); yourself] |
|
2016 | 7699 |
! ! |
7700 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7701 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7702 |
|
7703 |
new |
|
7704 |
^ self basicNew initialize |
|
7705 |
! ! |
|
7706 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7707 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7708 |
|
7709 |
activeMenu |
|
7710 |
"returns the active menu the scrolling is activated on; nil |
|
2870 | 7711 |
is returned if scrolling is deactivated" |
7712 |
||
2016 | 7713 |
^ activeMenu |
7714 |
! |
|
7715 |
||
7716 |
direction |
|
2870 | 7717 |
"returns the scroll-direction" |
7718 |
||
2016 | 7719 |
^ direction |
7720 |
! |
|
7721 |
||
7722 |
iconAt:aDirection on:aMenu |
|
2018 | 7723 |
|icon device index| |
2016 | 7724 |
|
7725 |
device := aMenu device. |
|
7726 |
||
7727 |
aDirection == #PREV ifTrue:[ |
|
3147 | 7728 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7729 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7730 |
] ifFalse:[ |
3147 | 7731 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7732 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7733 |
]. |
7734 |
||
7735 |
icon := icons at:index. |
|
7736 |
||
7737 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
3147 | 7738 |
icon := self class icon. |
7739 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7740 |
ifFalse:[ icon := icon copy ]. |
|
7741 |
||
7742 |
icon := icon onDevice:device. |
|
7743 |
icon clearMaskedPixels. |
|
7744 |
icons at:index put:icon |
|
2018 | 7745 |
]. |
7746 |
^ icon |
|
2016 | 7747 |
! ! |
7748 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7749 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7750 |
|
7751 |
initialize |
|
7752 |
||
7753 |
semaLock := RecursionLock new. |
|
2018 | 7754 |
icons := Array new:4. |
2016 | 7755 |
! ! |
7756 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7757 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7758 |
|
7759 |
isActive |
|
2870 | 7760 |
"returns true if scrolling is activated" |
7761 |
||
2016 | 7762 |
^ activeMenu notNil |
7763 |
! ! |
|
7764 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7765 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7766 |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7767 |
startIfRequiredAt:aDirection on:aMenu |
2870 | 7768 |
"start scrolling; returns true if scrolling is activated" |
7769 |
||
2860 | 7770 |
|bounds index isScrolledMenu| |
7771 |
||
7772 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 7773 |
|
7774 |
semaLock critical:[ |
|
2860 | 7775 |
self stop. |
7776 |
||
7777 |
isScrolledMenu ifTrue:[ |
|
7778 |
bounds := aMenu scrollerBoundsAt:aDirection. |
|
7779 |
activeMenu := aMenu. |
|
7780 |
direction := aDirection. |
|
7781 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7782 |
||
7783 |
index ~~ 0 ifTrue:[ |
|
7784 |
scrollTask := |
|
7785 |
[ |
|
7786 |
|item step| |
|
7787 |
||
7788 |
[ |
|
7789 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7790 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7791 |
aMenu makeItemVisible:item. |
|
7792 |
index := index + step. |
|
7793 |
]. |
|
7794 |
||
7795 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7796 |
||
7797 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
|
7798 |
aMenu makeItemVisible:item. |
|
7799 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7800 |
index := index + step. |
|
7801 |
]. |
|
7802 |
item := nil. |
|
7803 |
] ensure:[ |
|
7804 |
scrollTask := nil. |
|
7805 |
||
7806 |
item notNil ifTrue:[ |
|
7807 |
"/ process was killed |
|
7808 |
aMenu invalidate:bounds |
|
7809 |
] |
|
7810 |
] |
|
7811 |
] forkAt:8. |
|
7812 |
] |
|
7813 |
] |
|
2016 | 7814 |
]. |
7815 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7816 |
|
2048 | 7817 |
"Created: ca" |
7818 |
||
7819 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7820 |
! |
7821 |
||
7822 |
stop |
|
2870 | 7823 |
"stop scrolling; returns true if the scrolling was activated otherwise false" |
7824 |
||
2016 | 7825 |
|task resp| |
7826 |
||
7827 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7828 |
^ false |
2016 | 7829 |
]. |
7830 |
semaLock critical:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7831 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7832 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7833 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7834 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7835 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7836 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7837 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7838 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7839 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7840 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7841 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7842 |
activeMenu := direction := nil. |
2016 | 7843 |
]. |
7844 |
^ resp |
|
7845 |
! ! |
|
7846 |
||
388 | 7847 |
!MenuPanel class methodsFor:'documentation'! |
7848 |
||
7849 |
version |
|
3192 | 7850 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.445 2007-03-05 12:46:53 ca Exp $' |
388 | 7851 |
! ! |
2199 | 7852 |
|
388 | 7853 |
MenuPanel initialize! |