author | ca |
Fri, 28 Oct 2005 10:26:45 +0200 | |
changeset 2860 | 300aa94bb73e |
parent 2855 | c7f3481ff14a |
child 2869 | 3e24a0b78c17 |
permissions | -rw-r--r-- |
2005 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
2145 | 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 |
" |
|
12 |
||
13 |
||
1750 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
2182
59a770bbb95a
changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
16 |
View subclass:#MenuPanel |
2145 | 17 |
instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu |
2219 | 18 |
shortKeyInset selection items groupSizes receiver enabled |
19 |
lastActiveMenu enteredItem prevFocusView previousPointerGrab |
|
20 |
previousKeyboardGrab relativeGrabOrigin hasImplicitGrap |
|
2253 | 21 |
scrollActivity rightArrowShadow rightArrow fgColor verticalLayout |
22 |
showSeparatingLines showGroupDivider implicitGrabView |
|
2331 | 23 |
lastPointerView openDelayedMenuBlock preferredWidth application |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
24 |
originator centerItems hideOnRelease defaultHideOnRelease' |
2609 | 25 |
classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages |
2752 | 26 |
DefaultForegroundColor DefaultBackgroundColor IconIndicationOn |
2755 | 27 |
IconIndicationOff IconRadioOn IconRadioOff |
28 |
IconDisabledIndicationOn IconDisabledIndicationOff |
|
29 |
IconDisabledRadioOn IconDisabledRadioOff' |
|
2145 | 30 |
poolDictionaries:'' |
31 |
category:'Views-Menus' |
|
388 | 32 |
! |
33 |
||
34 |
Object subclass:#Item |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
35 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
36 |
disabledDisplayLabel enableChannel label activeHelpText |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
37 |
flyByHelpText isVisible indication choice accessCharacter' |
2145 | 38 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
39 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:MenuPanel |
|
388 | 42 |
! |
43 |
||
2692 | 44 |
Object subclass:#Adornment |
45 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
|
46 |
choice choiceValue' |
|
47 |
classVariableNames:'' |
|
48 |
poolDictionaries:'' |
|
49 |
privateIn:MenuPanel::Item |
|
50 |
! |
|
51 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
52 |
Object subclass:#ScrollActivity |
2145 | 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 |
|
2145 | 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 |
|
2219 | 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. |
2219 | 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. |
|
2219 | 174 |
[exEnd] |
388 | 175 |
|
176 |
||
177 |
start as PopUpMenu |
|
2219 | 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 |
2219 | 206 |
[exEnd] |
388 | 207 |
|
208 |
||
209 |
start from menu spec |
|
2219 | 210 |
[exBegin] |
388 | 211 |
|menu| |
212 |
||
436 | 213 |
menu := MenuPanel menu: |
2219 | 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). |
|
2219 | 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:[ |
|
2219 | 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:[ |
|
2219 | 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:[ |
|
2219 | 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' |
|
608 |
#'menu.buttonItemVerticalSpace' |
|
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. |
2609 | 645 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black. |
646 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
|
2219 | 647 |
|
648 |
var := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
|
2374 | 649 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 650 |
styleSheet at:#'menuPanel.buttonInsetX' put:(var abs). |
651 |
||
652 |
var := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
2374 | 653 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 654 |
styleSheet at:#'menuPanel.buttonInsetY' put:(var abs). |
655 |
||
656 |
var := styleSheet at:#'menu.itemHorizontalSpace'. |
|
2374 | 657 |
var isNil ifTrue:[ var := styleSheet at:#'menu.itemSpace' default:0 ]. |
2219 | 658 |
styleSheet at:#'menuPanel.itemSpace' put:var. |
659 |
||
660 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 661 |
var isNil ifTrue:[ |
2219 | 662 |
style == #motif ifTrue:[ var := backgroundColor ] |
663 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
664 |
]. |
|
665 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
666 |
||
667 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 668 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 669 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
670 |
||
671 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 672 |
var isNil ifTrue:[ |
2219 | 673 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 674 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 675 |
]. |
676 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
677 |
||
678 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 679 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 680 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
681 |
||
682 |
||
683 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 684 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 685 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
686 |
||
687 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 688 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 689 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
690 |
||
691 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
692 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
693 |
||
694 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
695 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
696 |
||
697 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 698 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 699 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
700 |
]. |
|
701 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
702 |
||
703 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 704 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 705 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
706 |
||
707 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 708 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 709 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
710 |
||
711 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 712 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 713 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
714 |
||
715 |
Item updateStyleCache. |
|
2607 | 716 |
|
2754 | 717 |
getBitmapOrFile := [:key :fileKey | |
718 |
|var| |
|
719 |
||
720 |
var := styleSheet at:key ifAbsent:nil. |
|
721 |
var isNil ifTrue:[ |
|
722 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
2752 | 723 |
var notNil ifTrue:[ |
2754 | 724 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
2752 | 725 |
]. |
726 |
]. |
|
2754 | 727 |
var |
728 |
]. |
|
729 |
||
730 |
var := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
|
2768 | 731 |
"/ var notNil ifTrue:[ |
2754 | 732 |
IconIndicationOn := var. |
2768 | 733 |
"/ ]. |
2754 | 734 |
var := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
2768 | 735 |
"/ var notNil ifTrue:[ |
2752 | 736 |
IconIndicationOff := var. |
2768 | 737 |
"/ ]. |
2755 | 738 |
var := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
2768 | 739 |
"/ var notNil ifTrue:[ |
2755 | 740 |
IconDisabledIndicationOn := var. |
2768 | 741 |
"/ ]. |
2755 | 742 |
var := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
2768 | 743 |
"/ var notNil ifTrue:[ |
2755 | 744 |
IconDisabledIndicationOff := var. |
2768 | 745 |
"/ ]. |
2755 | 746 |
|
2754 | 747 |
var := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
2768 | 748 |
"/ var notNil ifTrue:[ |
2754 | 749 |
IconRadioOn := var. |
2768 | 750 |
"/ ]. |
2754 | 751 |
var := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
2768 | 752 |
"/ var notNil ifTrue:[ |
2754 | 753 |
IconRadioOff := var. |
2768 | 754 |
"/ ]. |
2755 | 755 |
var := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
2768 | 756 |
"/ var notNil ifTrue:[ |
2755 | 757 |
IconDisabledRadioOn := var. |
2768 | 758 |
"/ ]. |
2755 | 759 |
var := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
2768 | 760 |
"/ var notNil ifTrue:[ |
2755 | 761 |
IconDisabledRadioOff := var. |
2768 | 762 |
"/ ]. |
2752 | 763 |
|
2607 | 764 |
" |
765 |
self updateStyleCache |
|
766 |
" |
|
388 | 767 |
! ! |
768 |
||
794 | 769 |
!MenuPanel class methodsFor:'image registration'! |
770 |
||
771 |
image:anImage onDevice:aDevice |
|
772 |
" |
|
773 |
Images := nil |
|
774 |
" |
|
2269 | 775 |
|deviceImages| |
794 | 776 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
777 |
anImage device == aDevice ifTrue:[ |
2269 | 778 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
779 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
780 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
781 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 782 |
|
1097 | 783 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 784 |
Images at:aDevice put:(deviceImages := Dictionary new) |
785 |
]. |
|
786 |
||
787 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
788 |
image := anImage copy onDevice:aDevice. |
|
789 |
image clearMaskedPixels. |
|
790 |
deviceImages at:anImage put:image. |
|
791 |
image |
|
792 |
]. |
|
794 | 793 |
! |
794 |
||
795 |
lightenedImage:anImage onDevice:aDevice |
|
796 |
" |
|
797 |
LigthenedImages := nil |
|
798 |
" |
|
2374 | 799 |
|deviceImages image colorMap| |
794 | 800 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
801 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 802 |
|
1097 | 803 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 804 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 805 |
]. |
806 |
||
807 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 808 |
^ image |
809 |
]. |
|
810 |
||
811 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
812 |
||
813 |
colorMap notNil ifTrue:[ |
|
814 |
image := anImage copy lightened onDevice:aDevice. |
|
815 |
image clearMaskedPixels. |
|
794 | 816 |
] ifFalse:[ |
2374 | 817 |
image := self image:anImage onDevice:aDevice |
794 | 818 |
]. |
1097 | 819 |
deviceImages at:anImage put:image. |
794 | 820 |
^ image |
821 |
! ! |
|
822 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
823 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
824 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
825 |
subMenu:aSubMenu |
2715 | 826 |
"create a submenu; can be redifined in derived classes" |
827 |
||
828 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
829 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
830 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
831 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
832 |
|
1808 | 833 |
!MenuPanel methodsFor:'accepting'! |
389 | 834 |
|
835 |
accept |
|
2715 | 836 |
"accept current selected item" |
837 |
||
1670 | 838 |
^ self acceptItem:(self selection) inMenu:self |
389 | 839 |
! |
840 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
841 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
842 |
"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
|
843 |
|
2826 | 844 |
|item tgState itemIdx recv panel masterGroup winGrp acceptAction| |
1630 | 845 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
846 |
self superMenu notNil ifTrue:[ |
2253 | 847 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
848 |
]. |
2199 | 849 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
850 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
851 |
self selection:nil. |
420 | 852 |
|
853 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 854 |
tgState := anItem toggleIndication. |
855 |
panel := anItem menuPanel. |
|
856 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
857 |
item := anItem. |
|
858 |
recv := panel receiver. |
|
389 | 859 |
]. |
1699 | 860 |
self doUngrab:true. |
389 | 861 |
|
510 | 862 |
self isPopUpView ifFalse:[ |
2253 | 863 |
self do:[:el| el updateIndicators]. |
864 |
self windowGroup processExposeEvents. |
|
524 | 865 |
] ifTrue:[ |
2253 | 866 |
self unmap. |
2712 | 867 |
self device sync. "/ round trip - all expose events are now received |
2253 | 868 |
(winGrp := self windowGroup) notNil ifTrue:[ |
869 |
"/ give expose event a chance to arrive |
|
870 |
[shown and:[realized]] whileTrue:[ |
|
871 |
winGrp processExposeEventsFor:self |
|
872 |
]. |
|
873 |
masterGroup := winGrp previousGroup. |
|
874 |
]. |
|
875 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
876 |
"/ self destroy. |
|
877 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 878 |
]. |
1710 | 879 |
|
2826 | 880 |
acceptAction := [ |
881 |
self accept:item index:itemIdx toggle:tgState receiver:recv. |
|
882 |
]. |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
883 |
|
1710 | 884 |
(item notNil |
885 |
and:[item showBusyCursorWhilePerforming |
|
886 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
887 |
ifTrue:[ |
|
2253 | 888 |
winGrp withWaitCursorDo:acceptAction |
2132 | 889 |
] ifFalse:[acceptAction value]. |
524 | 890 |
|
891 |
self isPopUpView ifTrue:[ |
|
2253 | 892 |
self menuAdornmentAt:#item put:item. |
524 | 893 |
]. |
1699 | 894 |
^ item. |
524 | 895 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
896 |
"Modified: / 15.11.2001 / 17:05:40 / cg" |
524 | 897 |
! |
898 |
||
899 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
2715 | 900 |
"accept an item" |
901 |
||
2253 | 902 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
903 |
app master fallBack| |
524 | 904 |
|
905 |
anItem isNil ifTrue:[ |
|
2253 | 906 |
self menuAdornmentAt:#hasPerformed put:true. |
907 |
^ nil |
|
908 |
]. |
|
909 |
||
910 |
isValueModel := aReceiver isValueModel. |
|
911 |
||
912 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 913 |
|
914 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 915 |
^ anIndex |
524 | 916 |
]. |
917 |
||
918 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 919 |
argument := aState ? anItem |
389 | 920 |
]. |
524 | 921 |
|
922 |
value isSymbol ifFalse:[ |
|
2253 | 923 |
"/ a valueHolder or block |
924 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
925 |
^ value |
|
926 |
]. |
|
927 |
||
928 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
929 |
||
930 |
numArgs == 0 ifTrue:[ |
|
931 |
args := nil |
|
932 |
] ifFalse:[ |
|
933 |
numArgs == 1 ifTrue:[ |
|
934 |
args := Array with:argument |
|
935 |
] ifFalse:[ |
|
936 |
args := Array with:argument with:self |
|
937 |
] |
|
938 |
]. |
|
939 |
||
940 |
value valueWithArguments:args. |
|
941 |
||
942 |
self menuAdornmentAt:#hasPerformed put:true. |
|
943 |
^ anIndex |
|
524 | 944 |
]. |
945 |
||
2331 | 946 |
anItem sendToOriginator ifTrue:[ |
2473 | 947 |
rec := self originator. |
948 |
rec isNil ifTrue:[ |
|
2844 | 949 |
self error:'no originating widget (no target for message)' mayProceed:true. |
2473 | 950 |
]. |
2331 | 951 |
] ifFalse:[ |
952 |
rec := aReceiver |
|
953 |
]. |
|
954 |
||
955 |
rec isNil ifTrue:[ |
|
2253 | 956 |
^ value |
957 |
]. |
|
958 |
||
959 |
isValueModel ifTrue:[ |
|
2331 | 960 |
rec value:value |
465 | 961 |
] ifFalse:[ |
2253 | 962 |
arg2 := self. |
963 |
||
964 |
"/ support for ST80 style applications |
|
965 |
"/ (expecting the message to go to the application |
|
966 |
"/ if not understood by the view) |
|
967 |
"/ These expect the controller to be passed as argument. |
|
968 |
"/ sigh. |
|
969 |
||
2331 | 970 |
(rec isView |
971 |
and:[(rec respondsTo:value) not |
|
972 |
and:[(app := rec application) ~~ rec |
|
2253 | 973 |
and:[app notNil]]]) ifTrue:[ |
2331 | 974 |
arg2 := rec controller. "/ the Views controller |
2253 | 975 |
rec := app. |
976 |
]. |
|
977 |
||
978 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
979 |
args := nil |
|
980 |
] ifFalse:[ |
|
981 |
numArgs == 1 ifTrue:[ |
|
982 |
args := Array with:argument |
|
983 |
] ifFalse:[ |
|
984 |
args := Array with:argument with:arg2 |
|
985 |
] |
|
986 |
]. |
|
987 |
||
988 |
fallBack := |
|
989 |
[ |
|
990 |
"/ mhmh - the receiver did not respond to that message; |
|
991 |
"/ if there is a master-application, try that one |
|
992 |
"/ (recursive) |
|
993 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
994 |
master notNil ifTrue:[ |
|
995 |
rec := master. |
|
996 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
997 |
] ifFalse:[ |
|
998 |
self |
|
999 |
error:'unimplemented (or error in) menu message: ' , value |
|
1000 |
mayProceed:true |
|
1001 |
]. |
|
1002 |
]. |
|
1003 |
||
1004 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 1005 |
]. |
524 | 1006 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
1007 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1008 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
1009 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 1010 |
! |
1011 |
||
1670 | 1012 |
acceptItem:anItem inMenu:aMenu |
2199 | 1013 |
|tgState topMenu| |
1014 |
||
1015 |
topMenu := self topMenu. |
|
1016 |
topMenu openDelayed:nil. |
|
1670 | 1017 |
|
1841 | 1018 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2219 | 1019 |
topMenu accept:anItem |
1670 | 1020 |
] ifFalse:[ |
2219 | 1021 |
anItem canAccept ifTrue:[ |
1022 |
tgState := anItem toggleIndication. |
|
1023 |
||
1024 |
self accept:anItem |
|
1025 |
index:(aMenu selectionIndex) |
|
1026 |
toggle:tgState |
|
1027 |
receiver:(aMenu receiver). |
|
1028 |
||
1029 |
aMenu do:[:el| el updateIndicators]. |
|
1030 |
] |
|
1670 | 1031 |
] |
1032 |
! |
|
1033 |
||
389 | 1034 |
lastItemAccepted |
2715 | 1035 |
"returns last item selected or nil" |
1036 |
||
390 | 1037 |
^ self topMenu menuAdornmentAt:#item |
389 | 1038 |
! |
1039 |
||
1040 |
lastValueAccepted |
|
2715 | 1041 |
"returns last value accepted or nil" |
1042 |
||
2253 | 1043 |
^ self lastItemAccepted value |
389 | 1044 |
! ! |
1045 |
||
388 | 1046 |
!MenuPanel methodsFor:'accessing'! |
1047 |
||
1048 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1049 |
"get the access character position for a textLabel" |
1050 |
||
2059 | 1051 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1052 |
! |
1053 |
||
1054 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1055 |
"get the access character position for a textLabel" |
1056 |
||
388 | 1057 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1058 |
! |
|
1059 |
||
1060 |
accessCharacterPositions |
|
2715 | 1061 |
"returns a collection of accessCharacterPositions or nil" |
1062 |
||
388 | 1063 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1064 |
! |
|
1065 |
||
1066 |
accessCharacterPositions:something |
|
2715 | 1067 |
"define accessCharacterPositions for each item" |
1068 |
||
388 | 1069 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1070 |
! |
|
1071 |
||
1072 |
args |
|
2715 | 1073 |
"returns a collection of arguments or nil" |
1074 |
||
388 | 1075 |
^ self collect:[:anItem| anItem argument ] |
1076 |
! |
|
1077 |
||
1078 |
args:something |
|
2715 | 1079 |
"define arguments for each item" |
1080 |
||
388 | 1081 |
self onEachPerform:#argument: withArgList:something |
1082 |
! |
|
1083 |
||
1084 |
argsAt:stringOrNumber |
|
2715 | 1085 |
"gets the argument of an item or nil" |
1086 |
||
2059 | 1087 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1088 |
! |
1089 |
||
1090 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1091 |
"sets the argument of an item" |
1092 |
||
388 | 1093 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1094 |
! |
|
1095 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1096 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1097 |
"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
|
1098 |
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
|
1099 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1100 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1101 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1102 |
"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
|
1103 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1104 |
|
388 | 1105 |
groupSizes |
2715 | 1106 |
"gets collection of group sizes" |
1107 |
||
388 | 1108 |
^ groupSizes |
1109 |
! |
|
1110 |
||
1111 |
groupSizes:aGroupSizes |
|
2715 | 1112 |
"sets collection of group sizes" |
1113 |
||
388 | 1114 |
aGroupSizes = groupSizes ifFalse:[ |
2715 | 1115 |
groupSizes := aGroupSizes copy. |
1116 |
self mustRearrange. |
|
388 | 1117 |
]. |
1118 |
! |
|
1119 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1120 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1121 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1122 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1123 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1124 |
hideOnRelease:something |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1125 |
hideOnRelease := something. |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1126 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1127 |
|
388 | 1128 |
labelAt:stringOrNumber |
2715 | 1129 |
"gets the label of an item or nil" |
1130 |
||
388 | 1131 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1132 |
! |
|
1133 |
||
1134 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1135 |
"sets the label of an item" |
1136 |
||
388 | 1137 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1138 |
! |
|
1139 |
||
1140 |
labels |
|
2715 | 1141 |
"returns a collection of labels's or nil" |
1142 |
||
388 | 1143 |
^ self collect:[:anItem| anItem label ] |
1144 |
! |
|
1145 |
||
1146 |
labels:labels |
|
2715 | 1147 |
"define labels for each item" |
1148 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1149 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1150 |
|
388 | 1151 |
self disabledRedrawDo:[ |
2715 | 1152 |
self removeAll. |
1153 |
size := labels size. |
|
1154 |
||
1155 |
size > 0 ifTrue:[ |
|
1156 |
items := OrderedCollection new:size. |
|
1157 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1158 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1159 |
]. |
388 | 1160 |
! |
1161 |
||
1999 | 1162 |
menuPerformer:anObject |
1163 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1164 |
from all submenus no specific receiver is defined )." |
1165 |
||
1999 | 1166 |
^ self receiver:anObject |
1167 |
! |
|
1168 |
||
388 | 1169 |
nameKeyAt:stringOrNumber |
2715 | 1170 |
"gets the nameKey of an item or nil" |
1171 |
||
1172 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1173 |
! |
1174 |
||
1175 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1176 |
"sets the nameKey of an item" |
1177 |
||
388 | 1178 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1179 |
! |
|
1180 |
||
1181 |
nameKeys |
|
2715 | 1182 |
"returns a collection of nameKeyss or nil" |
1183 |
||
388 | 1184 |
^ self collect:[:anItem| anItem nameKey ] |
1185 |
! |
|
1186 |
||
1187 |
nameKeys:something |
|
2715 | 1188 |
"define nameKeys for each item" |
1189 |
||
388 | 1190 |
self onEachPerform:#nameKey: withArgList:something |
1191 |
! |
|
1192 |
||
1193 |
numberOfItems |
|
2715 | 1194 |
"gets number of items" |
1195 |
||
388 | 1196 |
^ items size |
1197 |
! |
|
1198 |
||
2331 | 1199 |
originator |
1200 |
originator notNil ifTrue:[^ originator]. |
|
1201 |
superMenu notNil ifTrue:[ |
|
1202 |
^ superMenu originator |
|
1203 |
]. |
|
1204 |
^ nil |
|
1205 |
! |
|
1206 |
||
388 | 1207 |
receiver |
1208 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1209 |
from all submenus no specific receiver is defined )." |
1210 |
||
389 | 1211 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2715 | 1212 |
^ superMenu receiver |
388 | 1213 |
]. |
389 | 1214 |
^ receiver |
388 | 1215 |
! |
1216 |
||
1217 |
receiver:anObject |
|
1218 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1219 |
from all submenus no specific receiver is defined )." |
1220 |
||
389 | 1221 |
receiver := anObject |
388 | 1222 |
! |
1223 |
||
1224 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1225 |
"gets the shortCutKey of an item or nil" |
1226 |
||
1227 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1228 |
! |
1229 |
||
1230 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1231 |
"sets the shortCutKey of an item" |
1232 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1233 |
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
|
1234 |
! |
388 | 1235 |
|
1236 |
shortcutKeys |
|
2715 | 1237 |
"returns a collection of shortcutKeys or nil" |
1238 |
||
388 | 1239 |
^ self collect:[:anItem| anItem shortcutKey ] |
1240 |
! |
|
1241 |
||
1242 |
shortcutKeys:something |
|
2715 | 1243 |
"define shortcutKeys for each item" |
1244 |
||
388 | 1245 |
self onEachPerform:#shortcutKey: withArgList:something |
1246 |
! |
|
1247 |
||
1248 |
valueAt:stringOrNumber |
|
2715 | 1249 |
"gets value of an item; a block, valueHolder, ..." |
1250 |
||
1251 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1252 |
! |
1253 |
||
1254 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1255 |
"sets value of an item; a block, valueHolder, ..." |
1256 |
||
388 | 1257 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1258 |
! |
|
1259 |
||
1260 |
values:something |
|
2715 | 1261 |
"define values for each item" |
1262 |
||
388 | 1263 |
self onEachPerform:#value: withArgList:something |
1264 |
! ! |
|
1265 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1266 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1267 |
|
1268 |
disableAll |
|
2715 | 1269 |
"disable all items; not the menu in case of enabled" |
1270 |
||
498 | 1271 |
self do:[:anItem| anItem enabled:false] |
388 | 1272 |
! |
1273 |
||
1274 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1275 |
"disable an collection of items" |
1276 |
||
388 | 1277 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1278 |
! |
|
1279 |
||
1280 |
enableAll |
|
2715 | 1281 |
"enable all items; not the menu in case of disabled" |
1282 |
||
498 | 1283 |
self do:[:anItem| anItem enabled:true] |
388 | 1284 |
! |
1285 |
||
1286 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1287 |
"enable an collection of items" |
1288 |
||
388 | 1289 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1290 |
! |
|
1291 |
||
1292 |
enabled |
|
2715 | 1293 |
"returns enabled state" |
1294 |
||
498 | 1295 |
^ enabled |
388 | 1296 |
! |
1297 |
||
1298 |
enabled:aState |
|
2715 | 1299 |
"change enabled state of menu" |
1300 |
||
545 | 1301 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1302 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1303 |
state := aState ? true. |
388 | 1304 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1305 |
enabled ~~ state ifTrue:[ |
2715 | 1306 |
enabled := state. |
1307 |
self invalidate. |
|
498 | 1308 |
]. |
388 | 1309 |
! |
1310 |
||
1311 |
enabledAt:stringOrNumber |
|
2715 | 1312 |
"gets the enabled state of an item or false" |
1313 |
||
388 | 1314 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1315 |
! |
|
1316 |
||
1317 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1318 |
"sets the enabled state of an item" |
1319 |
||
388 | 1320 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1321 |
! |
|
1322 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1323 |
exclusivePointer:aBoolean |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1324 |
"Do nothing here. Compatibility with PopUpListController" |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1325 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1326 |
^ self |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1327 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1328 |
|
388 | 1329 |
isEnabled:stringOrNumber |
2715 | 1330 |
"gets the enabled state of an item or false" |
1331 |
||
388 | 1332 |
^ self enabledAt:stringOrNumber |
1333 |
! ! |
|
1334 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1335 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1336 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1337 |
enableChannel:aValueHolder |
2715 | 1338 |
"set my enableChannel" |
1339 |
||
498 | 1340 |
enableChannel notNil ifTrue:[ |
2715 | 1341 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1342 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1343 |
|
498 | 1344 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2715 | 1345 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1346 |
]. |
498 | 1347 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1348 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1349 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1350 |
menuHolder:aValueHolder |
2715 | 1351 |
"set my menuHolder" |
1352 |
||
498 | 1353 |
menuHolder notNil ifTrue:[ |
2715 | 1354 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1355 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1356 |
|
498 | 1357 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2715 | 1358 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1359 |
]. |
498 | 1360 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1361 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1362 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1363 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1364 |
|
616 | 1365 |
activeBackgroundColor |
2715 | 1366 |
"get the background drawing color used to highlight selection" |
1367 |
||
2219 | 1368 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1369 |
! |
1370 |
||
1371 |
activeForegroundColor |
|
2715 | 1372 |
"get the foreground color used to highlight selections" |
1373 |
||
2219 | 1374 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1375 |
! |
1376 |
||
390 | 1377 |
backgroundColor |
2715 | 1378 |
"return the background color" |
1379 |
||
502 | 1380 |
^ super viewBackground |
390 | 1381 |
! |
1382 |
||
1383 |
backgroundColor:aColor |
|
1384 |
"set the background drawing color. You should not use this method; |
|
2715 | 1385 |
instead, leave the value as defined in the styleSheet." |
1386 |
||
1387 |
self backgroundColor ~~ aColor ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1388 |
super viewBackground:aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1389 |
self invalidate "/ RepairNow:true |
616 | 1390 |
] |
1391 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1392 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1393 |
! |
1394 |
||
727 | 1395 |
buttonActiveBackgroundColor |
2715 | 1396 |
"get the background drawing color used to highlight button selection" |
1397 |
||
2219 | 1398 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1399 |
default:(self viewBackground) |
|
727 | 1400 |
! |
1401 |
||
730 | 1402 |
buttonEdgeStyle |
2715 | 1403 |
"get the button edge style" |
1404 |
||
2219 | 1405 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1406 |
! |
1407 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1408 |
buttonEnteredBackgroundColor |
2715 | 1409 |
"get the background drawing color used to highlight entered button items" |
1410 |
||
2219 | 1411 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1412 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1413 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1414 |
buttonEnteredLevel |
2715 | 1415 |
"get the 3D-level used to highlight entered button items" |
1416 |
||
2219 | 1417 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1418 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1419 |
|
730 | 1420 |
buttonHalfLightColor |
2715 | 1421 |
"get the background drawing color used to half light button frame" |
1422 |
||
2219 | 1423 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1424 |
! |
1425 |
||
1426 |
buttonHalfShadowColor |
|
2715 | 1427 |
"get the background drawing color used to half shadow button frame" |
1428 |
||
2219 | 1429 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1430 |
! |
1431 |
||
1432 |
buttonLightColor |
|
2715 | 1433 |
"get the background drawing color used to light button frame" |
1434 |
||
2219 | 1435 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1436 |
! |
1437 |
||
1438 |
buttonPassiveBackgroundColor |
|
2715 | 1439 |
"get the background drawing color used for button" |
1440 |
||
2219 | 1441 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1442 |
! |
1443 |
||
1444 |
buttonShadowColor |
|
2715 | 1445 |
"get the background drawing color used to shadow button frame" |
1446 |
||
2219 | 1447 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1448 |
! |
1449 |
||
1450 |
disabledEtchedForegroundColor |
|
1451 |
"return the color used for etching disabled items. |
|
2715 | 1452 |
If nil, no 3D effect is drawn." |
1453 |
||
2219 | 1454 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1455 |
! |
1456 |
||
390 | 1457 |
disabledForegroundColor |
2715 | 1458 |
"return the foreground color used by disabled items" |
1459 |
||
2219 | 1460 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1461 |
! |
1462 |
||
2170 | 1463 |
enteredBackgroundColor |
2715 | 1464 |
"return the background color for entered items" |
1465 |
||
2219 | 1466 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1467 |
default:(self backgroundColor) |
|
2170 | 1468 |
! |
1469 |
||
1470 |
enteredForegroundColor |
|
2715 | 1471 |
"return the foreground color for entered items" |
1472 |
||
2219 | 1473 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1474 |
! |
1475 |
||
390 | 1476 |
font:aFont |
2715 | 1477 |
"set the font" |
1478 |
||
2614 | 1479 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1480 |
||
1481 |
super font:aFont. |
|
1482 |
self do:[:anItem| anItem fontChanged ]. |
|
1483 |
||
1484 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1485 |
self extent:(self preferredExtent) |
|
1486 |
]. |
|
1487 |
self mustRearrange. |
|
390 | 1488 |
! |
1489 |
||
1490 |
foregroundColor |
|
2715 | 1491 |
"return the passive foreground color" |
1492 |
||
2059 | 1493 |
^ fgColor |
390 | 1494 |
! |
1495 |
||
1496 |
foregroundColor:aColor |
|
1497 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1498 |
instead leave the value as defined in the styleSheet." |
1499 |
||
2219 | 1500 |
aColor ~= fgColor ifTrue:[ |
1478 | 1501 |
fgColor := aColor onDevice:device. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1502 |
self invalidate |
2219 | 1503 |
]. |
580 | 1504 |
! |
1505 |
||
1699 | 1506 |
maxAbsoluteButtonLevel |
1507 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1508 |
extent of a button" |
1509 |
||
2219 | 1510 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1511 |
! |
1512 |
||
730 | 1513 |
selectionFrameBrightColor |
2715 | 1514 |
"get the selection frame bright color" |
1515 |
||
2219 | 1516 |
^ Color white |
730 | 1517 |
! |
1518 |
||
1519 |
selectionFrameDarkColor |
|
2715 | 1520 |
"get the selection frame dark color" |
1521 |
||
2219 | 1522 |
^ Color black |
730 | 1523 |
! |
1524 |
||
1727 | 1525 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1526 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1527 |
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
|
1528 |
|
1727 | 1529 |
|currentFont| |
1530 |
||
1531 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1532 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1533 |
super font:aFont. |
1727 | 1534 |
]. |
1535 |
^ currentFont |
|
2761 | 1536 |
! |
1537 |
||
1538 |
viewBackground:aColor |
|
1539 |
super viewBackground:aColor |
|
390 | 1540 |
! ! |
1541 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1542 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1543 |
|
1544 |
height |
|
2715 | 1545 |
"default height" |
1546 |
||
388 | 1547 |
(explicitExtent ~~ true) ifTrue:[ |
2715 | 1548 |
^ self preferredExtent y |
388 | 1549 |
]. |
1550 |
^ super height |
|
1551 |
! |
|
1552 |
||
2016 | 1553 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1554 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1555 |
device notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1556 |
^ device usableExtent - 2. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1557 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1558 |
superMenu notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1559 |
^ superMenu maxExtent |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1560 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1561 |
"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
|
1562 |
self error:'don''t know maxExtent'. |
2016 | 1563 |
! |
1564 |
||
388 | 1565 |
preferredExtent |
2715 | 1566 |
"compute and returns my preferred extent" |
1567 |
||
2253 | 1568 |
|maxExtent usedExtent| |
2024 | 1569 |
|
2016 | 1570 |
preferredExtent notNil ifTrue:[ |
2253 | 1571 |
^ preferredExtent |
2016 | 1572 |
]. |
2024 | 1573 |
usedExtent := self preferredExtentOfItems. |
1574 |
||
1575 |
superView isNil ifTrue:[ |
|
2253 | 1576 |
"/ is standalone |
2374 | 1577 |
preferredWidth notNil ifTrue:[ |
2253 | 1578 |
usedExtent x < preferredWidth ifTrue:[ |
1579 |
usedExtent := preferredWidth @ usedExtent y. |
|
1580 |
] |
|
1581 |
] |
|
2024 | 1582 |
]. |
1583 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1584 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1585 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1586 |
usedExtent := usedExtent min:maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1587 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1588 |
^ usedExtent |
2024 | 1589 |
|
1590 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1591 |
! |
1592 |
||
1593 |
preferredExtentOfItems |
|
1594 |
"compute and returns my preferred extent including all items |
|
2715 | 1595 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
1596 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1597 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1598 |
x "{ Class:SmallInteger }" |
1599 |
y "{ Class:SmallInteger }" |
|
1600 |
size "{ Class:SmallInteger }" |
|
2145 | 1601 |
buttonInsetX "{ Class:SmallInteger }" |
1602 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 1603 |
labelInsetX "{ Class:SmallInteger }" |
1604 |
labelInsetY "{ Class:SmallInteger }" |
|
1605 |
itemSpace "{ Class:SmallInteger }" |
|
1606 |
itemMargin "{ Class:SmallInteger }" |
|
1607 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1608 |
| |
388 | 1609 |
|
1699 | 1610 |
(size := items size) == 0 ifTrue:[ |
2219 | 1611 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1612 |
^ 32 @ 32 |
2219 | 1613 |
]. |
1614 |
buttonInsetX := 2 * self buttonInsetX. |
|
1615 |
buttonInsetY := 2 * self buttonInsetY. |
|
1699 | 1616 |
|
1617 |
self isPopUpView ifFalse:[ |
|
2219 | 1618 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1619 |
] ifTrue:[ |
2145 | 1620 |
labelInsetX := labelInsetY := 0. |
1699 | 1621 |
]. |
1622 |
||
1623 |
x := 0. |
|
1624 |
y := 0. |
|
2219 | 1625 |
groupDividerSize := self groupDividerSize. |
388 | 1626 |
|
1627 |
self verticalLayout ifFalse:[ |
|
2219 | 1628 |
itemSpace := self itemSpace. |
1629 |
||
1699 | 1630 |
items keysAndValuesDo:[:key :el| |eX eY| |
1631 |
extent := el preferredExtent. |
|
1632 |
||
1633 |
"/ check for visibility (extent x ~~ 0) |
|
1634 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1635 |
eY := extent y. |
|
1636 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1637 |
el isButton ifTrue:[ |
2145 | 1638 |
eX := eX + buttonInsetX. |
1639 |
eY := eY + buttonInsetY. |
|
1699 | 1640 |
] ifFalse:[ |
2145 | 1641 |
eX := eX + labelInsetX. |
1642 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1643 |
]. |
1699 | 1644 |
key ~~ size ifTrue:[ |
1645 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1646 |
x := x + groupDividerSize |
|
1647 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1648 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1649 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1650 |
] |
1699 | 1651 |
] |
1652 |
]. |
|
1653 |
x := eX + x. |
|
1654 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1655 |
] |
1699 | 1656 |
] |
388 | 1657 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1658 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1659 |
shCtKey := 0. |
1699 | 1660 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1661 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1662 |
x := 0. |
2219 | 1663 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1664 |
|
1699 | 1665 |
items keysAndValuesDo:[:key :el| |eX eY| |
1666 |
extent := el preferredExtent. |
|
1667 |
||
1668 |
"/ check for visibility (extent x ~~ 0) |
|
1669 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1670 |
eY := extent y. |
|
1671 |
||
1672 |
el isButton ifTrue:[ |
|
2145 | 1673 |
eX := eX + buttonInsetX. |
1674 |
eY := eY + buttonInsetY. |
|
1699 | 1675 |
] ifFalse:[ |
2145 | 1676 |
eX := eX + labelInsetX. |
1677 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1678 |
]. |
1699 | 1679 |
hasMenu ifFalse:[ |
1680 |
hasMenu := el hasSubmenu |
|
1681 |
]. |
|
1682 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1683 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1684 |
]. |
|
1685 |
key ~~ size ifTrue:[ |
|
1686 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1687 |
y := y + groupDividerSize |
|
1688 |
] |
|
1689 |
]. |
|
1690 |
y := eY + y. |
|
1691 |
x := eX max:x. |
|
1692 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1693 |
]. |
2219 | 1694 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1695 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1696 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1697 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1698 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1699 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1700 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1701 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1702 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1703 |
]. |
1699 | 1704 |
"/ to have a small inset |
1705 |
y := y + 1. |
|
1706 |
"/ x := x + 1. |
|
1707 |
]. |
|
1708 |
x := x + margin + margin. |
|
1709 |
y := y + margin + margin. |
|
1710 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1711 |
^ x @ y |
388 | 1712 |
! |
1713 |
||
2253 | 1714 |
preferredWidth:aWidthOrNil |
1715 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1716 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1717 |
If not nil, the width is the maximum from the contained items and the required width." |
1718 |
||
2253 | 1719 |
preferredWidth := aWidthOrNil. |
2024 | 1720 |
! |
1721 |
||
388 | 1722 |
shortKeyInset |
2715 | 1723 |
"left inset of shortcutKey" |
1724 |
||
1725 |
^ shortKeyInset |
|
616 | 1726 |
! |
1727 |
||
1728 |
subMenuIndicationWidth |
|
2219 | 1729 |
^ self rightArrow width |
388 | 1730 |
! ! |
1731 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1732 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1733 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1734 |
iconIndicationDisabledOff |
2219 | 1735 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1736 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1737 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1738 |
iconIndicationDisabledOn |
2219 | 1739 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1740 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1741 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1742 |
iconIndicationOff |
2219 | 1743 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1744 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1745 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1746 |
iconIndicationOn |
2219 | 1747 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1748 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1749 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1750 |
iconRadioGroupDisabledOff |
2219 | 1751 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1752 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1753 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1754 |
iconRadioGroupDisabledOn |
2219 | 1755 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1756 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1757 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1758 |
iconRadioGroupOff |
2219 | 1759 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1760 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1761 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1762 |
iconRadioGroupOn |
2219 | 1763 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1764 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1765 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1766 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1767 |
|
1768 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1769 |
"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
|
1770 |
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
|
1771 |
|
388 | 1772 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1773 |
! |
|
1774 |
||
1775 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1776 |
"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
|
1777 |
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
|
1778 |
|
388 | 1779 |
|item| |
1780 |
||
1781 |
item := self itemAt:stringOrNumber. |
|
1782 |
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
|
1783 |
^ exceptionBlock value |
706 | 1784 |
! |
1785 |
||
1786 |
itemAtIndex:anIndex |
|
2715 | 1787 |
"returns item at an index or nil" |
1788 |
||
706 | 1789 |
^ 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
|
1790 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1791 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1792 |
items |
2715 | 1793 |
"returns list of items or nil" |
1794 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1795 |
^ items |
388 | 1796 |
! ! |
1797 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1798 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1799 |
|
727 | 1800 |
buttonActiveLevel |
2715 | 1801 |
"get the buttons active level" |
1802 |
||
2219 | 1803 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1804 |
! |
1805 |
||
1806 |
buttonPassiveLevel |
|
2715 | 1807 |
"get the buttons passive level" |
1808 |
||
2219 | 1809 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
727 | 1810 |
! |
1811 |
||
2337 | 1812 |
centerItems |
1813 |
^ centerItems ? false |
|
1814 |
! |
|
1815 |
||
1816 |
centerItems:aBoolean |
|
1817 |
centerItems := aBoolean |
|
1818 |
! |
|
1819 |
||
390 | 1820 |
fitFirstPanel |
1821 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1822 |
to the extent of its superView |
|
1699 | 1823 |
|
2715 | 1824 |
NOT SUPPORTED" |
1825 |
||
2219 | 1826 |
^ false |
388 | 1827 |
! |
1828 |
||
390 | 1829 |
fitFirstPanel:aState |
1830 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1831 |
to the extent of its superView |
|
1699 | 1832 |
|
2715 | 1833 |
NOT SUPPORTED" |
616 | 1834 |
! |
1835 |
||
1093 | 1836 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1837 |
anInt ~~ level ifTrue:[ |
2219 | 1838 |
super level:anInt. |
1839 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1840 |
] |
2052 | 1841 |
|
1842 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1843 |
! |
1844 |
||
616 | 1845 |
rightArrow |
2374 | 1846 |
rightArrow isNil ifTrue:[ |
1847 |
device isNil ifTrue:[ |
|
2219 | 1848 |
^ SelectionInListView rightArrowFormOn:Display |
1849 |
]. |
|
1850 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1851 |
]. |
|
616 | 1852 |
^ rightArrow |
1853 |
! |
|
1854 |
||
1855 |
rightArrowShadow |
|
1856 |
^ rightArrowShadow |
|
388 | 1857 |
! |
1858 |
||
390 | 1859 |
showGroupDivider |
2715 | 1860 |
"get the enabled flag for showing groupDiveders" |
1861 |
||
2253 | 1862 |
^ showGroupDivider |
388 | 1863 |
! |
1864 |
||
390 | 1865 |
showGroupDivider:aState |
2715 | 1866 |
"set the enabled flag for showing groupDiveders" |
1867 |
||
2253 | 1868 |
showGroupDivider ~~ aState ifTrue:[ |
1869 |
showGroupDivider := aState. |
|
1870 |
self mustRearrange. |
|
653 | 1871 |
] |
388 | 1872 |
! |
1873 |
||
1874 |
showSeparatingLines |
|
2715 | 1875 |
"gets true if drawing of separating lines is enabled." |
1876 |
||
2253 | 1877 |
^ showSeparatingLines |
388 | 1878 |
! |
1879 |
||
390 | 1880 |
showSeparatingLines:aState |
2715 | 1881 |
"turn on/off drawing of separating lines." |
1882 |
||
2253 | 1883 |
aState ~~ showSeparatingLines ifTrue:[ |
1884 |
showSeparatingLines := aState. |
|
1885 |
self mustRearrange |
|
1886 |
]. |
|
388 | 1887 |
! |
1888 |
||
1889 |
verticalLayout |
|
2715 | 1890 |
"get the layout: vertical( true ) or horizontal( false )" |
1891 |
||
2374 | 1892 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 1893 |
|
1894 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1895 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
2374 | 1896 |
^ verticalLayout |
388 | 1897 |
! |
1898 |
||
1899 |
verticalLayout:aState |
|
2715 | 1900 |
"set the layout: vertical( true ) or horizontal( false )" |
1901 |
||
2253 | 1902 |
aState ~~ verticalLayout ifTrue:[ |
1903 |
verticalLayout isNil ifTrue:[ |
|
1904 |
verticalLayout := aState |
|
1905 |
] ifFalse:[ |
|
1906 |
verticalLayout := aState. |
|
1907 |
self mustRearrange. |
|
1908 |
]. |
|
1909 |
]. |
|
388 | 1910 |
! ! |
1911 |
||
2219 | 1912 |
!MenuPanel methodsFor:'accessing-style'! |
1913 |
||
1914 |
buttonInsetX |
|
2715 | 1915 |
"returns the verical button space" |
1916 |
||
2219 | 1917 |
^ styleSheet at:#'menuPanel.buttonInsetX' |
1918 |
! |
|
1919 |
||
1920 |
buttonInsetY |
|
2715 | 1921 |
"returns the verical button space" |
1922 |
||
2219 | 1923 |
^ styleSheet at:#'menuPanel.buttonInsetY' |
1924 |
! |
|
1925 |
||
1926 |
enteredLevel |
|
2715 | 1927 |
"returns the enter-level for an unselected item moved through" |
1928 |
||
2219 | 1929 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
1930 |
! |
|
1931 |
||
1932 |
groupDividerSize |
|
2715 | 1933 |
"returns the width of a group divider" |
1934 |
||
2219 | 1935 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
1936 |
! |
|
1937 |
||
1938 |
itemMargin |
|
2715 | 1939 |
"returns the margin of an item" |
1940 |
||
2219 | 1941 |
^ styleSheet at:#'menu.itemMargin' default:0 |
1942 |
! |
|
1943 |
||
1944 |
itemSpace |
|
2715 | 1945 |
"returns the additional space for an item in a (vertical) panel" |
1946 |
||
2219 | 1947 |
^ styleSheet at:#'menuPanel.itemSpace' |
1948 |
! |
|
1949 |
||
1950 |
selectionFollowsMouse |
|
2715 | 1951 |
"returns true if the selection follows the mouse" |
1952 |
||
2219 | 1953 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
1954 |
! |
|
1955 |
||
1956 |
shortcutKeyOffset |
|
2715 | 1957 |
"returns the offset for a shortcutKey" |
1958 |
||
2219 | 1959 |
^ 5 |
1960 |
! ! |
|
1961 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1962 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1963 |
|
1964 |
subMenuAt:stringOrNumber |
|
2715 | 1965 |
"gets the submenu of an item or nil" |
1966 |
||
1967 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
388 | 1968 |
! |
1969 |
||
1970 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 1971 |
"sets the submenu of an item" |
1972 |
||
388 | 1973 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
1974 |
! |
|
1975 |
||
1976 |
subMenuShown |
|
2715 | 1977 |
"return the currently visible submenu - or nil if there is none" |
1978 |
||
388 | 1979 |
|item| |
1980 |
||
1981 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 1982 |
^ item submenu |
1983 |
]. |
|
1984 |
^ nil |
|
388 | 1985 |
! ! |
1986 |
||
2504 | 1987 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 1988 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1989 |
closeMenus |
2715 | 1990 |
"close all menus without accepting" |
1991 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1992 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1993 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1994 |
|
388 | 1995 |
hide |
2715 | 1996 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1997 |
|
2407 | 1998 |
"/ TODO: replace with LeaveSignal raise. |
1999 |
||
388 | 2000 |
self selection:nil. |
2001 |
self unmap. |
|
2002 |
! |
|
2003 |
||
2004 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2005 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2006 |
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
|
2007 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2008 |
to some performer)" |
2009 |
||
2010 |
^ self showAt:(self origin) resizing:true |
|
388 | 2011 |
! |
2012 |
||
2013 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2014 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2015 |
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
|
2016 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2017 |
to some performer)" |
2018 |
||
388 | 2019 |
^ self showAt:aPoint resizing:true |
2020 |
! |
|
2021 |
||
2022 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2023 |
"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
|
2024 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2025 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2026 |
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
|
2027 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2028 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2029 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2030 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2031 |
|
2032 |
aBoolean ifTrue:[ |
|
2715 | 2033 |
self fixSize. |
388 | 2034 |
]. |
2035 |
self origin:aPoint. |
|
1459 | 2036 |
"/ self makeFullyVisible. -- done in realize |
388 | 2037 |
self openModal:[true]. "realize " |
2038 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2039 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2040 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2041 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2042 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2715 | 2043 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2044 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2045 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2046 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2047 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2048 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 2049 |
! |
2050 |
||
2051 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2052 |
"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
|
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 |
||
388 | 2057 |
^ self showAt:(device pointerPosition) resizing:true |
2058 |
! |
|
2059 |
||
2060 |
showCenteredIn:aView |
|
2061 |
"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
|
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 |
|top| |
2067 |
||
2068 |
top := aView topView. |
|
2069 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2070 |
^ 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
|
2071 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2072 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2073 |
! |
2074 |
||
2075 |
startUp |
|
2076 |
"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
|
2077 |
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
|
2078 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2079 |
to some performer)" |
2080 |
||
388 | 2081 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2082 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2083 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2084 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2085 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2086 |
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
|
2087 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2088 |
to some performer)" |
2089 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2090 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2091 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2092 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2093 |
! |
2094 |
||
2332 | 2095 |
startUpFor:originatingWidget |
2096 |
"realize the menu at the current pointer position |
|
2097 |
return the value of the selectedItem or nil, of none was selected |
|
2098 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2099 |
to some performer)" |
2100 |
||
2332 | 2101 |
originator := originatingWidget. |
2102 |
^ self startUp |
|
2103 |
! |
|
2104 |
||
1750 | 2105 |
startUpOrNil |
2106 |
"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
|
2107 |
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
|
2108 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2109 |
to some performer)" |
2110 |
||
1750 | 2111 |
^ self showAtPointer |
388 | 2112 |
! ! |
2113 |
||
2114 |
!MenuPanel methodsFor:'adding & removing'! |
|
2115 |
||
2116 |
createAtIndex:anIndexOrNil |
|
1800 | 2117 |
"create an item and add this item to the index. In case of nil, the item |
2118 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2119 |
otherwise the new created item is returned." |
2120 |
||
388 | 2121 |
|max item| |
2122 |
||
2123 |
max := (items size) + 1. |
|
2124 |
||
2125 |
anIndexOrNil notNil ifTrue:[ |
|
2715 | 2126 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2127 |
^ nil |
|
2128 |
] |
|
388 | 2129 |
]. |
2130 |
items isNil ifTrue:[ |
|
2715 | 2131 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2132 |
] ifFalse:[ |
2715 | 2133 |
items := items asOrderedCollection |
388 | 2134 |
]. |
2135 |
item := Item in:self. |
|
2136 |
||
2137 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2715 | 2138 |
items add:item |
388 | 2139 |
] ifFalse:[ |
2715 | 2140 |
items add:item beforeIndex:anIndexOrNil |
388 | 2141 |
]. |
2142 |
^ item |
|
2143 |
! |
|
2144 |
||
2145 |
remove:stringOrNumber |
|
2146 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2147 |
if found, remove and return it" |
2148 |
||
388 | 2149 |
|item| |
2150 |
||
2151 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2715 | 2152 |
items remove:item. |
2153 |
item destroy. |
|
2154 |
items isEmpty ifTrue:[items := nil]. |
|
2155 |
self mustRearrange. |
|
388 | 2156 |
]. |
2157 |
^ item |
|
2158 |
! |
|
2159 |
||
2160 |
removeAll |
|
2715 | 2161 |
"remove all items and submenus" |
2162 |
||
388 | 2163 |
self disabledRedrawDo:[ |
2715 | 2164 |
self selection:nil. |
2165 |
groupSizes := nil. |
|
2166 |
items notNil ifTrue:[ |
|
2167 |
items copy do:[:el| el destroy ]. |
|
2168 |
]. |
|
2169 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2170 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2171 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2172 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2173 |
! ! |
2174 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2175 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2176 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2177 |
update:something with:aParameter from:changedObject |
498 | 2178 |
|
2179 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2180 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2181 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2182 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2183 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2184 |
|
388 | 2185 |
!MenuPanel methodsFor:'converting'! |
2186 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2187 |
asMenu |
2715 | 2188 |
"convert contents to menu" |
2189 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2190 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2191 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2192 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2193 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2194 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2195 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2196 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2197 |
|
388 | 2198 |
fromSpec:aMenuSpec |
2715 | 2199 |
"build from spec" |
2200 |
||
388 | 2201 |
|menu| |
2202 |
||
2203 |
menu := Menu new. |
|
2204 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2205 |
self menu:menu |
|
2206 |
! |
|
2207 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2208 |
menu:aMenu |
2715 | 2209 |
"convert to Menu" |
2210 |
||
388 | 2211 |
self disabledRedrawDo:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2212 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2213 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2214 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2215 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2216 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2217 |
(aMenu isCollection) ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2218 |
menu := Menu new. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2219 |
menu fromLiteralArrayEncoding:aMenu. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2220 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2221 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2222 |
menuReceiver notNil ifTrue:[ |
2793 | 2223 |
self receiver:menuReceiver. |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2224 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2225 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2226 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2227 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2228 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2229 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2230 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2231 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2232 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2233 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2234 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2235 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2236 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2237 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2238 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2239 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2240 |
! ! |
2241 |
||
2681 | 2242 |
!MenuPanel methodsFor:'dependents access'! |
2243 |
||
2244 |
addDependencies |
|
2715 | 2245 |
"add all dependencies" |
2246 |
||
2681 | 2247 |
self do:[:anItem| anItem addDependencies ]. |
2248 |
||
2249 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2250 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2251 |
! |
|
2252 |
||
2253 |
removeDependencies |
|
2715 | 2254 |
"remove all dependencies" |
2255 |
||
2681 | 2256 |
self do:[:anItem| anItem removeDependencies ]. |
2257 |
||
2258 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2259 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2260 |
! ! |
|
2261 |
||
388 | 2262 |
!MenuPanel methodsFor:'drawing'! |
2263 |
||
2264 |
disabledRedrawDo:aBlock |
|
2265 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2266 |
of the block a redraw might be performed" |
2267 |
||
388 | 2268 |
|state| |
2269 |
||
2270 |
state := mustRearrange. |
|
2271 |
mustRearrange := true. |
|
2272 |
aBlock value. |
|
2273 |
mustRearrange := state. |
|
2274 |
self mustRearrange |
|
2275 |
! |
|
2276 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2277 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2278 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2279 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2280 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2281 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2282 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2283 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2284 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2285 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2286 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2287 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2288 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2289 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2290 |
level:aLevel |
2219 | 2291 |
shadow:(self buttonShadowColor) |
2292 |
light:(self buttonLightColor) |
|
2293 |
halfShadow:(self buttonHalfShadowColor) |
|
2294 |
halfLight:(self buttonHalfLightColor) |
|
2295 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2296 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2297 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2298 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2299 |
|
2016 | 2300 |
drawItemsX:x y:y width:w height:h |
2715 | 2301 |
"redraw items and groups in a damage" |
2302 |
||
2016 | 2303 |
|isVertical item layout prevClip |
2304 |
x1 "{ Class:SmallInteger }" |
|
2305 |
x2 "{ Class:SmallInteger }" |
|
2306 |
y1 "{ Class:SmallInteger }" |
|
2307 |
y2 "{ Class:SmallInteger }" |
|
2308 |
start "{ Class:SmallInteger }" |
|
2309 |
stop "{ Class:SmallInteger }" |
|
2310 |
size "{ Class:SmallInteger }" |
|
2311 |
groupDivInset "{ Class:SmallInteger }" |
|
2312 |
| |
|
2313 |
||
2314 |
size := items size. |
|
2315 |
isVertical := self verticalLayout. |
|
2316 |
||
2317 |
isVertical ifTrue:[ |
|
2064 | 2318 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2319 |
start == 0 ifTrue:[ ^ self ]. |
2320 |
y1 := y + h. |
|
2064 | 2321 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2322 |
startingAt:(start + 1). |
|
2016 | 2323 |
] ifFalse:[ |
2064 | 2324 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2325 |
start == 0 ifTrue:[ ^ self ]. |
2326 |
x1 := x + w. |
|
2064 | 2327 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2328 |
startingAt:(start + 1). |
|
2016 | 2329 |
]. |
2330 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2331 |
||
2253 | 2332 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2333 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2334 |
|
2335 |
groupDivInset ~~ 0 ifTrue:[ |
|
2336 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2337 |
start := start - 1 |
|
2338 |
] |
|
2339 |
]. |
|
2340 |
] ifFalse:[ |
|
2341 |
groupDivInset := 0 |
|
2342 |
]. |
|
2343 |
||
2344 |
prevClip := clipRect. |
|
2345 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2346 |
||
2347 |
start to:stop do:[:i| |
|
2348 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2349 |
item draw. |
2016 | 2350 |
|
2351 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2352 |
layout := item layout. |
|
2353 |
||
2354 |
isVertical ifTrue:[ |
|
2355 |
x1 := layout left. |
|
2356 |
x2 := layout right. |
|
2357 |
y1 := layout bottom + groupDivInset. |
|
2358 |
y2 := y1. |
|
2359 |
] ifFalse:[ |
|
2360 |
y1 := layout top. |
|
2361 |
y2 := layout bottom. |
|
2362 |
x1 := layout right + groupDivInset. |
|
2363 |
x2 := x1. |
|
2364 |
]. |
|
2365 |
self paint:shadowColor. |
|
2366 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2367 |
self paint:lightColor. |
|
2368 |
||
2369 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2370 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2371 |
||
2372 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2373 |
] |
|
2374 |
]. |
|
2375 |
self clippingRectangle:prevClip. |
|
2376 |
! |
|
2377 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2378 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2379 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2380 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2381 |
isSelected ifTrue:[ |
2219 | 2382 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2383 |
] ifFalse:[ |
2219 | 2384 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2385 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2386 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2387 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2388 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2389 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2390 |
|
1691 | 2391 |
self drawEdgesForX:(layout left) |
2392 |
y:(layout top) |
|
2393 |
width:(layout width) |
|
2394 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2395 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2396 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2397 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2398 |
|
2016 | 2399 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2400 |
"draw a scroller" |
2401 |
||
2016 | 2402 |
|scrolling icon level x y w h| |
2403 |
||
2404 |
x := bounds left. |
|
2405 |
y := bounds top. |
|
2406 |
w := bounds width. |
|
2407 |
h := bounds height. |
|
2408 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2409 |
scrolling := self scrollActivity. |
2016 | 2410 |
|
2411 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2715 | 2412 |
level := -2 |
2016 | 2413 |
] ifFalse:[ |
2715 | 2414 |
level := 1 |
2016 | 2415 |
]. |
2416 |
||
2417 |
level ~~ 0 ifTrue:[ |
|
2715 | 2418 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2419 |
]. |
2420 |
icon := scrolling iconAt:aDirection on:self. |
|
2421 |
||
2422 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2715 | 2423 |
y:(y + (h - icon height // 2)). |
2016 | 2424 |
! |
2425 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2426 |
invalidateItem:anItem repairNow:aBool |
2715 | 2427 |
"an item changed; invalidate the items layout" |
2428 |
||
2016 | 2429 |
|layout| |
2430 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2431 |
(mustRearrange not and:[shown]) ifTrue:[ |
2715 | 2432 |
layout := anItem layout. |
2433 |
||
2434 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2435 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2436 |
] |
|
1728 | 2437 |
]. |
2438 |
||
2439 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2440 |
! |
2441 |
||
388 | 2442 |
mustRearrange |
2715 | 2443 |
"force rearrange (i.e. set the rearrange flag)" |
2444 |
||
2080 | 2445 |
mustRearrange ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2446 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2447 |
self invalidate "/ RepairNow:true |
388 | 2448 |
] |
590 | 2449 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2450 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2451 |
! |
2452 |
||
710 | 2453 |
rearrangeGroups |
2715 | 2454 |
"implements the groupIdentifier #right in a horizontal menu" |
2455 |
||
1699 | 2456 |
|layout point |
710 | 2457 |
dltX "{ Class:SmallInteger }" |
2458 |
start "{ Class:SmallInteger }" |
|
2459 |
| |
|
2460 |
||
2461 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2715 | 2462 |
^ self |
710 | 2463 |
]. |
2464 |
||
2465 |
layout := items last layout. |
|
2466 |
||
1699 | 2467 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2715 | 2468 |
^ self "/ no free space |
710 | 2469 |
]. |
2470 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2471 |
||
2472 |
start == 0 ifTrue:[ |
|
2715 | 2473 |
^ self "/ no item detected |
1699 | 2474 |
]. |
2475 |
point := dltX @ 0. |
|
2476 |
||
2477 |
"/ move items layout to right |
|
710 | 2478 |
|
2479 |
items from:start do:[:anItem| |
|
2715 | 2480 |
anItem isVisible ifTrue:[ |
2481 |
anItem layout moveBy:point. |
|
2482 |
] |
|
710 | 2483 |
]. |
2484 |
! |
|
2485 |
||
388 | 2486 |
rearrangeItems |
1699 | 2487 |
"recompute the layout of each item |
2715 | 2488 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2489 |
||
1791 | 2490 |
|isVertical extent isPopUpMenu |
2219 | 2491 |
x "{ Class:SmallInteger }" |
2492 |
y "{ Class:SmallInteger }" |
|
2493 |
x0 "{ Class:SmallInteger }" |
|
2494 |
y0 "{ Class:SmallInteger }" |
|
2495 |
x1 "{ Class:SmallInteger }" |
|
2496 |
y1 "{ Class:SmallInteger }" |
|
2497 |
size "{ Class:SmallInteger }" |
|
2498 |
insetX "{ Class:SmallInteger }" |
|
2499 |
insetY "{ Class:SmallInteger }" |
|
2500 |
labelInsetX "{ Class:SmallInteger }" |
|
2501 |
labelInsetY "{ Class:SmallInteger }" |
|
2145 | 2502 |
buttonInsetX "{ Class:SmallInteger }" |
2503 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 2504 |
itemMargin "{ Class:SmallInteger }" |
2505 |
itemSpace "{ Class:SmallInteger }" |
|
2506 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2507 |
| |
1699 | 2508 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2509 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2510 |
^ self |
390 | 2511 |
]. |
2219 | 2512 |
|
2080 | 2513 |
"/ DON'T SET THIS!! |
2514 |
"/ item layout: below of first item -> item invalidate |
|
2515 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2516 |
"/ -> invalidate:rapairDamage: |
|
2517 |
"/ -> redrawX:y:width:height: |
|
2518 |
"/ tries to get uninitialized layout from second item. |
|
2519 |
"/ This happens in a modal debugger!! |
|
2520 |
"/ mustRearrange := false. |
|
2219 | 2521 |
isVertical := self verticalLayout. |
2522 |
itemSpace := self itemSpace. |
|
2523 |
groupDividerSize := self groupDividerSize. |
|
2524 |
buttonInsetX := self buttonInsetX. |
|
2525 |
buttonInsetY := self buttonInsetY. |
|
2526 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2527 |
|
2528 |
isPopUpMenu ifFalse:[ |
|
2219 | 2529 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2530 |
] ifTrue:[ |
2145 | 2531 |
labelInsetX := labelInsetY := 0 |
388 | 2532 |
]. |
390 | 2533 |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2534 |
(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
|
2535 |
extent := self preferredExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2536 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2537 |
isPopUpMenu ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2538 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2539 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2540 |
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
|
2541 |
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
|
2542 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2543 |
] ifFalse:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2544 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
1478 | 2545 |
]. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2546 |
self extent:extentToSet. |
390 | 2547 |
] ifFalse:[ |
1699 | 2548 |
extent := self computeExtent |
390 | 2549 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2550 |
|
1093 | 2551 |
x := y := margin. |
2552 |
||
1699 | 2553 |
isVertical ifFalse:[ |
2554 |
y0 := margin. |
|
2555 |
y1 := extent y - margin. |
|
2556 |
||
2557 |
items keysAndValuesDo:[:anIndex :el| |
|
2558 |
el isVisible ifFalse:[ |
|
2559 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2560 |
] ifTrue:[ |
|
1478 | 2561 |
el isButton ifTrue:[ |
2145 | 2562 |
insetX := buttonInsetX. |
2563 |
insetY := buttonInsetY. |
|
2062 | 2564 |
] ifFalse:[ |
2145 | 2565 |
insetX := labelInsetX. |
2566 |
insetY := labelInsetY. |
|
1478 | 2567 |
]. |
2145 | 2568 |
x0 := x + insetX. |
2171 | 2569 |
x1 := x0 + (el preferredExtent x). |
2145 | 2570 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2571 |
x := x1 + insetX. |
|
1699 | 2572 |
|
2573 |
size ~~ anIndex ifTrue:[ |
|
2574 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2575 |
x := x + groupDividerSize |
|
2576 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2577 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2578 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2579 |
] |
1699 | 2580 |
] |
2581 |
] |
|
1478 | 2582 |
]. |
1699 | 2583 |
]. |
2584 |
] ifTrue:[ |
|
2219 | 2585 |
itemMargin := self itemMargin. |
1699 | 2586 |
x0 := margin. |
2219 | 2587 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2588 |
|
2589 |
items keysAndValuesDo:[:anIndex :el| |
|
2590 |
el isVisible ifFalse:[ |
|
2591 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2592 |
] ifTrue:[ |
|
2593 |
el isButton ifTrue:[ |
|
2145 | 2594 |
insetX := buttonInsetX. |
2595 |
insetY := buttonInsetY. |
|
1699 | 2596 |
] ifFalse:[ |
2145 | 2597 |
insetX := labelInsetX. |
2598 |
insetY := labelInsetY. |
|
1699 | 2599 |
]. |
2145 | 2600 |
y0 := y + insetY. |
1699 | 2601 |
y1 := y0 + el preferredExtent y. |
2219 | 2602 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2603 |
y := y1 + insetY. |
1699 | 2604 |
|
2605 |
size ~~ anIndex ifTrue:[ |
|
2606 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2607 |
y := y + groupDividerSize |
|
2608 |
] |
|
2609 |
] |
|
1478 | 2610 |
] |
2611 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2612 |
]. |
710 | 2613 |
self rearrangeGroups. |
2048 | 2614 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2615 |
mustRearrange := false. |
2048 | 2616 |
|
2617 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2618 |
! |
2619 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2620 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2621 |
"check for items which can change its visibility; |
2715 | 2622 |
if at least one item exists, rearrange all items" |
2623 |
||
1464 | 2624 |
items isNil ifTrue:[^ self]. |
1699 | 2625 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2626 |
items do:[:item | |
2715 | 2627 |
item canChangeVisibility ifTrue:[ |
2628 |
mustRearrange := true. |
|
2629 |
self rearrangeItems. |
|
2630 |
^ self |
|
2631 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2632 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2633 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2634 |
|
388 | 2635 |
redrawX:x y:y width:w height:h |
2715 | 2636 |
"redraw a damage" |
2637 |
||
2860 | 2638 |
|y0 y1 x0 x1| |
388 | 2639 |
|
710 | 2640 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2641 |
|
1699 | 2642 |
mustRearrange ifTrue:[ |
2569 | 2643 |
self isPopUpView ifFalse:[explicitExtent := true]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2644 |
self rearrangeItems. |
2569 | 2645 |
self invalidate. |
2646 |
^ self |
|
1699 | 2647 |
]. |
2219 | 2648 |
self paint:(self viewBackground). |
1699 | 2649 |
self clearRectangleX:x y:y width:w height:h. |
2650 |
||
2016 | 2651 |
items size == 0 ifTrue:[ |
1699 | 2652 |
^ self |
2653 |
]. |
|
2016 | 2654 |
y0 := y. |
2655 |
y1 := y + h. |
|
2018 | 2656 |
x0 := x. |
2657 |
x1 := x + w. |
|
2016 | 2658 |
|
2860 | 2659 |
self isPopUpView ifFalse:[ |mustDraw prvBound nxtBound| |
2660 |
self hasScrollers ifTrue:[ |
|
2661 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2662 |
prvBound := self scrollerBoundsAt:#PREV. |
|
2663 |
||
2664 |
self verticalLayout ifTrue:[ |
|
2665 |
(mustDraw := (prvBound bottom > y)) ifTrue:[ |
|
2666 |
y0 := prvBound bottom. |
|
2667 |
]. |
|
2668 |
] ifFalse:[ |
|
2669 |
(mustDraw := (prvBound right > x)) ifTrue:[ |
|
2670 |
x0 := prvBound right. |
|
2671 |
]. |
|
2018 | 2672 |
]. |
2860 | 2673 |
mustDraw ifTrue:[ |
2674 |
self drawScrollerAt:#PREV bounds:prvBound. |
|
2018 | 2675 |
]. |
2052 | 2676 |
]. |
2860 | 2677 |
|
2678 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2679 |
nxtBound := self scrollerBoundsAt:#NEXT. |
|
2680 |
||
2681 |
self verticalLayout ifTrue:[ |
|
2682 |
(mustDraw := (nxtBound top < y1)) ifTrue:[ |
|
2683 |
y1 := nxtBound top. |
|
2684 |
] |
|
2685 |
] ifFalse:[ |
|
2686 |
(mustDraw := (nxtBound left < x1)) ifTrue:[ |
|
2687 |
x1 := nxtBound left. |
|
2688 |
] |
|
2689 |
]. |
|
2690 |
mustDraw ifTrue:[ |
|
2691 |
self drawScrollerAt:#NEXT bounds:nxtBound. |
|
2692 |
]. |
|
2052 | 2693 |
]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2694 |
]. |
2860 | 2695 |
self menuAdornmentAt:#lastDrawnScrollerNextBounds put:nxtBound. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2696 |
]. |
2018 | 2697 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2698 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2699 |
]. |
2052 | 2700 |
|
2701 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2702 |
! ! |
2703 |
||
2704 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2705 |
||
2706 |
collect:aOneArgBlock |
|
2707 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 2708 |
and return a collection of the results" |
2709 |
||
388 | 2710 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 2711 |
^ nil |
388 | 2712 |
! |
2713 |
||
2714 |
do:aOneArgBlock |
|
2715 | 2715 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
2716 |
||
388 | 2717 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
2718 |
! |
|
2719 |
||
2720 |
findFirst:aOneArgBlock |
|
2721 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2722 |
returns true; return its index or 0 if none detected." |
2723 |
||
388 | 2724 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 2725 |
^ 0 |
388 | 2726 |
! |
2727 |
||
2728 |
findLast:aOneArgBlock |
|
2729 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2730 |
returns true; return its index or 0 if none detected." |
2731 |
||
388 | 2732 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 2733 |
^ 0 |
388 | 2734 |
! |
2735 |
||
390 | 2736 |
indexOf:something |
2737 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 2738 |
If no item match 0 is returned. No range checks are performed on a number argument" |
2739 |
||
390 | 2740 |
|i v| |
2741 |
||
2742 |
something isNumber ifTrue:[ ^ something ]. |
|
2743 |
something isNil ifTrue:[ ^ 0 ]. |
|
2744 |
||
1218 | 2745 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2746 |
|
2747 |
i ~~ 0 ifTrue:[ |
|
2715 | 2748 |
^ i |
388 | 2749 |
]. |
390 | 2750 |
|
2751 |
something isSymbol ifTrue:[ |
|
2715 | 2752 |
i := self findFirst:[:el| |
2753 |
v := el value. |
|
2754 |
v isSymbol and:[v == something] |
|
2755 |
]. |
|
2756 |
i ~~ 0 ifTrue:[ |
|
2757 |
^ i |
|
2758 |
] |
|
390 | 2759 |
]. |
2760 |
||
2761 |
(something respondsTo:#string) ifTrue:[ |
|
2715 | 2762 |
v := something string. |
1218 | 2763 |
^ self findFirst:[:el | el textLabel = v]. |
2764 |
]. |
|
2765 |
^ 0 |
|
388 | 2766 |
! |
2767 |
||
706 | 2768 |
indexOfItem:anItem |
2715 | 2769 |
"returns the index of the item or 0" |
2770 |
||
706 | 2771 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
2772 |
! |
|
2773 |
||
388 | 2774 |
keysAndValuesDo:aTwoArgBlock |
2715 | 2775 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
2776 |
||
388 | 2777 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
2778 |
! ! |
|
2779 |
||
2780 |
!MenuPanel methodsFor:'event handling'! |
|
2781 |
||
2782 |
buttonMotion:state x:x y:y |
|
2715 | 2783 |
"open or close the corresponding submenu" |
2784 |
||
2046 | 2785 |
|menue motionPoint translatedPoint sensor| |
1699 | 2786 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2787 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2788 |
^ self |
2016 | 2789 |
]. |
2790 |
||
1699 | 2791 |
sensor := self sensor. |
2792 |
||
2793 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2794 |
^ self |
1699 | 2795 |
]. |
2796 |
menue := self detectGrabMenu. |
|
1841 | 2797 |
|
2046 | 2798 |
motionPoint := x@y. |
2799 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2800 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2801 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2802 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2803 |
|
1699 | 2804 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2805 |
^ self |
1699 | 2806 |
]. |
2807 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2808 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2809 |
"/ 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
|
2810 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2811 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2812 |
] |
1699 | 2813 |
]. |
2814 |
||
2048 | 2815 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2816 |
! |
2817 |
||
2818 |
buttonPress:button x:x y:y |
|
2715 | 2819 |
"any button pressed; open or close the corresponding submenus" |
2820 |
||
2016 | 2821 |
|menu point| |
2822 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2823 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2824 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2825 |
self scrollActivity stop. |
2016 | 2826 |
point := x@y. |
2827 |
menu := self detectMenuAtGrabPoint:point. |
|
2828 |
||
2829 |
menu isNil ifTrue:[ |
|
2133
293dadf237ad
hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
2830 |
"/ self accept:nil |
2016 | 2831 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2832 |
point := menu translateGrabPoint:point. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2833 |
menu handleButtonPressAtPoint:point. |
2016 | 2834 |
] |
2046 | 2835 |
|
2836 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2837 |
! |
2838 |
||
2839 |
buttonRelease:button x:x y:y |
|
2715 | 2840 |
"button release action; accept selection and close all views" |
2841 |
||
2679 | 2842 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
2715 | 2843 |
buttonReleaseTime menuOpenTime| |
2199 | 2844 |
|
2845 |
topMenu := self topMenu. |
|
2846 |
topMenu openDelayed:nil. |
|
1699 | 2847 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2848 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2849 |
^ self |
2016 | 2850 |
]. |
2851 |
||
1699 | 2852 |
dstMenu := topMenu activeMenu. |
2853 |
||
2679 | 2854 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
2855 |
||
2856 |
hideMenuAndPerformAction ifFalse:[ |
|
2857 |
hideOnRelease ifTrue:[ |
|
2858 |
buttonReleaseTime := Time millisecondClockValue. |
|
2859 |
menuOpenTime := dstMenu mapTime. |
|
2860 |
"/ t := windowGroup lastEvent timeStamp. |
|
2861 |
hideMenuAndPerformAction := (OperatingSystem millisecondTimeDeltaBetween:buttonReleaseTime and:menuOpenTime) |
|
2862 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
2863 |
]. |
|
2864 |
]. |
|
2865 |
||
2866 |
hideMenuAndPerformAction ifTrue:[ |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2867 |
srcPoint := x@y. |
1699 | 2868 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2869 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2870 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2871 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2872 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2873 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2874 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2875 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2876 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2877 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2878 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2879 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2880 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2881 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2882 |
|
2374 | 2883 |
subm notNil ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2884 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2885 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2886 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2887 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2888 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2889 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2890 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2891 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2892 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2893 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2894 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2895 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2896 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2897 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2898 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2899 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2900 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2901 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2902 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2903 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2904 |
self accept:nil. |
1699 | 2905 |
]. |
2906 |
! |
|
2907 |
||
2860 | 2908 |
handleSizeChanged:how |
2909 |
"used to handle the scrollers and groups in a none popUpView |
|
2910 |
" |
|
2911 |
|layouts damage isVertical scrollBound| |
|
2912 |
||
2913 |
(mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[ |
|
2914 |
^ self |
|
2915 |
]. |
|
2916 |
mustRearrange := true. |
|
2917 |
||
2918 |
shown ifFalse:[ |
|
2919 |
^ self |
|
2920 |
]. |
|
2921 |
layouts := OrderedCollection new. |
|
2922 |
||
2923 |
items do:[:el| |layout| |
|
2924 |
(layout := el layout) isNil ifTrue:[ |
|
2925 |
self invalidate. |
|
2926 |
^ self. |
|
2927 |
]. |
|
2928 |
layouts add:layout. |
|
2929 |
]. |
|
2930 |
isVertical := self verticalLayout. |
|
2931 |
scrollBound := self scrollerBoundsAt:#NEXT. |
|
2932 |
||
2933 |
self rearrangeItems. |
|
2934 |
||
2935 |
items keysAndValuesDo:[:i :el| |newLyt oldLyt| |
|
2936 |
damage isNil ifTrue:[ |
|
2937 |
newLyt := el layout. |
|
2938 |
oldLyt := layouts at:i ifAbsent:newLyt. |
|
2939 |
||
2940 |
newLyt ~= oldLyt ifTrue:[ |x y start| |
|
2941 |
start := 0. |
|
2942 |
||
2943 |
i > 1 ifTrue:[ |
|
2944 |
isVertical ifTrue:[ |
|
2945 |
x := 0. |
|
2946 |
y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height). |
|
2947 |
] ifFalse:[ |
|
2948 |
y := 0. |
|
2949 |
x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width). |
|
2950 |
]. |
|
2951 |
]. |
|
2952 |
start <= 20 ifTrue:[ |
|
2953 |
self invalidate. |
|
2954 |
^ self |
|
2955 |
]. |
|
2956 |
damage := Rectangle left:x top:y extent:(self extent). |
|
2957 |
]. |
|
2958 |
]. |
|
2959 |
]. |
|
2960 |
damage isNil ifTrue:[ |
|
2961 |
damage := scrollBound. |
|
2962 |
]. |
|
2963 |
scrollBound := self menuAdornmentAt:#lastDrawnScrollerNextBounds. |
|
2964 |
||
2965 |
scrollBound notNil ifTrue:[ |
|
2966 |
damage := damage merge:scrollBound |
|
2967 |
]. |
|
2968 |
self invalidate:damage. |
|
2969 |
! |
|
2970 |
||
1699 | 2971 |
keyPress:key x:x y:y |
2715 | 2972 |
"any key is pressed" |
2973 |
||
2251 | 2974 |
|menu superMenu sensor| |
2975 |
||
2976 |
sensor := self sensor. |
|
2374 | 2977 |
sensor isNil ifTrue:[^ self]. |
2251 | 2978 |
|
2979 |
sensor anyButtonPressed ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2980 |
^ self "/ ignored while any button is pressed |
2251 | 2981 |
]. |
1699 | 2982 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2983 |
self scrollActivity isActive ifTrue:[ |
2016 | 2984 |
key ~~ #Escape ifTrue:[ |
2985 |
^ self |
|
2986 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2987 |
self scrollActivity stop |
2016 | 2988 |
]. |
2989 |
||
1699 | 2990 |
(key == #Tab |
2991 |
or:[key == #FocusNext |
|
2992 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2993 |
self accept:nil. |
|
2374 | 2994 |
^ super keyPress:key x:x y:y |
1699 | 2995 |
]. |
2996 |
||
2997 |
menu := self detectGrabMenu. |
|
2251 | 2998 |
superMenu := menu superMenu. |
1699 | 2999 |
|
3000 |
key == #Escape ifTrue:[ |
|
3001 |
"/ must hide the active menu |
|
2251 | 3002 |
(superMenu notNil and:[superMenu ~~ self]) ifTrue:[ |
1703 | 3003 |
"/ hide active menu but keep the grab |
2251 | 3004 |
superMenu selection:nil |
1699 | 3005 |
] ifFalse:[ |
1703 | 3006 |
"/ hide active menu and ungrab |
1699 | 3007 |
self accept:nil |
2251 | 3008 |
]. |
3009 |
^ self |
|
3010 |
]. |
|
3011 |
||
3012 |
menu isViewWrapper ifFalse:[ |
|
3013 |
sensor compressKeyPressEventsWithKey:key. |
|
3014 |
menu handleKeyPress:key. |
|
2374 | 3015 |
^ self |
2251 | 3016 |
]. |
3017 |
superMenu == self ifFalse:[^ self]. |
|
3018 |
||
3019 |
"/ allow cursor movement |
|
3020 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
3021 |
(self containsPoint:x@y) ifTrue:[ |
|
3022 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3023 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3024 |
]. |
1699 | 3025 |
! |
3026 |
||
3027 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3028 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3029 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3030 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 3031 |
|
1699 | 3032 |
self detectGrabMenu handlePointerLeave:state. |
3033 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3034 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 3035 |
^ self |
3036 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3037 |
|
2374 | 3038 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3039 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3040 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3041 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3042 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3043 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3044 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3045 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3046 |
sensor isNil ifTrue:[ |
2251 | 3047 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3048 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3049 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3050 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3051 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3052 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
3053 |
]. |
2251 | 3054 |
] |
1699 | 3055 |
]. |
3056 |
! |
|
3057 |
||
3058 |
sizeChanged:how |
|
2715 | 3059 |
"redraw #right groups" |
3060 |
||
2860 | 3061 |
"/ self isPopUpView ifFalse:[ |
3062 |
"/ mustRearrange := true. |
|
3063 |
"/ self invalidate |
|
3064 |
"/ ]. |
|
3065 |
"/ ^ super sizeChanged:how. |
|
3066 |
||
3067 |
self handleSizeChanged:how. |
|
3068 |
super sizeChanged:how. |
|
1699 | 3069 |
! ! |
3070 |
||
2503 | 3071 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3072 |
|
1767 | 3073 |
clearImplicitGrab |
2253 | 3074 |
implicitGrabView := lastPointerView := nil. |
1767 | 3075 |
! |
3076 |
||
3077 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3078 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3079 |
|
2253 | 3080 |
|view x y p syntheticEvent menu| |
1767 | 3081 |
|
2658 | 3082 |
ev isDamage ifTrue:[ |
3083 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3084 |
]. |
|
3085 |
||
1767 | 3086 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3087 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3088 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3089 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3090 |
self sensor leftButtonPressed ifFalse:[ |
3091 |
self clearImplicitGrab. |
|
3092 |
]. |
|
1767 | 3093 |
]. |
3094 |
||
3095 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 3096 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3097 |
]. |
3098 |
||
3099 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3100 |
ev isButtonEvent ifTrue:[ |
3101 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3102 |
ev view:implicitGrabView. |
|
3103 |
ev arguments at:2 put:p x. |
|
3104 |
ev arguments at:3 put:p y. |
|
3105 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3106 |
||
3107 |
ev isButtonReleaseEvent ifTrue:[ |
|
3108 |
self clearImplicitGrab. |
|
3109 |
]. |
|
3110 |
^ self |
|
3111 |
] |
|
1767 | 3112 |
]. |
3113 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3114 |
||
2016 | 3115 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 3116 |
self clearImplicitGrab. |
1767 | 3117 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
3118 |
]. |
|
3119 |
||
3120 |
p := menu translateGrabPoint:(x@y). |
|
3121 |
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
|
3122 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3123 |
|
3124 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 3125 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3126 |
view requestFocus. |
|
3127 |
]. |
|
3128 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3129 |
implicitGrabView := view. |
|
3130 |
] |
|
3131 |
]. |
|
1767 | 3132 |
|
3133 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 3134 |
lastPointerView ~~ view ifTrue:[ |
3135 |
"/ must generate enter/leave ... (sigh) |
|
3136 |
lastPointerView notNil ifTrue:[ |
|
3137 |
"/ XXX: should be fixed |
|
3138 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3139 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3140 |
]. |
|
3141 |
view notNil ifTrue:[ |
|
3142 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3143 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3144 |
]. |
|
3145 |
lastPointerView := view. |
|
3146 |
]. |
|
1767 | 3147 |
]. |
3148 |
||
3149 |
ev view:view. |
|
3150 |
ev x:p x. |
|
3151 |
ev y:p y. |
|
3152 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3153 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3154 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3155 |
! |
3156 |
||
2048 | 3157 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3158 |
"open or close the corresponding submenus" |
3159 |
||
2251 | 3160 |
|menu item translatedPoint containsPoint| |
3161 |
||
3162 |
containsPoint := self containsPoint:motionPoint. |
|
3163 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ] |
|
3164 |
ifFalse:[ item := nil ]. |
|
3165 |
||
3166 |
self pointerEntersItem:item. |
|
1699 | 3167 |
|
1910 | 3168 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
2251 | 3169 |
"/ only update pointerEnter |
2048 | 3170 |
^ self |
3171 |
]. |
|
3172 |
||
2251 | 3173 |
containsPoint ifTrue:[ |
3174 |
self selection:item openMenu:true. |
|
2374 | 3175 |
^ self |
2251 | 3176 |
]. |
3177 |
||
3178 |
menu := self superMenuAtPoint:motionPoint. |
|
3179 |
||
2374 | 3180 |
menu notNil ifTrue:[ |
2046 | 3181 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3182 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3183 |
^ self |
2251 | 3184 |
]. |
3185 |
self isPopUpView ifTrue:[ |
|
3186 |
self selection:nil |
|
3187 |
]. |
|
2046 | 3188 |
! |
3189 |
||
3190 |
handleButtonPressAtPoint:aPoint |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3191 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3192 |
|
2251 | 3193 |
| item sensor direction wasSelected| |
2016 | 3194 |
|
2046 | 3195 |
item := self itemAtPoint:aPoint. |
2374 | 3196 |
item isNil ifTrue:[ |
2251 | 3197 |
self selection:nil openMenu:false. |
2374 | 3198 |
^ self |
2251 | 3199 |
]. |
3200 |
||
3201 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3202 |
direction notNil ifTrue:[ |
|
3203 |
(self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[ |
|
3204 |
self pointerEntersItem:nil. |
|
3205 |
^ self |
|
2238 | 3206 |
] |
2016 | 3207 |
]. |
2251 | 3208 |
|
3209 |
wasSelected := (selection == item). |
|
3210 |
wasSelected ifFalse:[ |
|
3211 |
self selection:item openMenu:true |
|
3212 |
]. |
|
2199 | 3213 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3214 |
|
2238 | 3215 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3216 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3217 |
item toggleSubmenuVisibility |
|
3218 |
]. |
|
2238 | 3219 |
^ self |
3220 |
]. |
|
3221 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3222 |
^ self |
|
3223 |
]. |
|
3224 |
self invalidateItem:item repairNow:true. |
|
3225 |
self acceptItem:item inMenu:self. |
|
3226 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3227 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3228 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3229 |
sensor flushUserEvents. |
2238 | 3230 |
self selection:nil. |
2046 | 3231 |
|
3232 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3233 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3234 |
! |
3235 |
||
1699 | 3236 |
handleCursorKey:aKey |
2715 | 3237 |
"handle a cursor key" |
3238 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3239 |
|next menu item isVrt backKey p1 p2 |
2354 | 3240 |
idx0 "{ Class:SmallInteger }" |
687 | 3241 |
idx "{ Class:SmallInteger }" |
1705 | 3242 |
size "{ Class:SmallInteger }" |
687 | 3243 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3244 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3245 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3246 |
^ self |
388 | 3247 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3248 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3249 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3250 |
|
2016 | 3251 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3252 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3253 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3254 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3255 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3256 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3257 |
^ superMenu handleCursorKey:aKey |
1699 | 3258 |
]. |
2016 | 3259 |
idx := 0. |
3260 |
||
3261 |
isVrt ifTrue:[ |
|
3262 |
"/ used because of vertical scrolling |
|
3263 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3264 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3265 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3266 |
] ifFalse:[ |
2016 | 3267 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3268 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3269 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3270 |
|
2354 | 3271 |
idx0 := idx. |
3272 |
size timesRepeat:[ |
|
3273 |
|el| |
|
3274 |
||
3275 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3276 |
||
3277 |
idx > size ifTrue:[ |
|
3278 |
idx := 0 "1" |
|
3279 |
] ifFalse:[ |
|
3280 |
idx < 0 ifTrue:[ |
|
3281 |
idx := size |
|
3282 |
] |
|
3283 |
]. |
|
3284 |
||
3285 |
idx == 0 ifTrue:[ |
|
3286 |
self selection:nil. |
|
3287 |
^ self |
|
3288 |
] ifFalse:[ |
|
3289 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3290 |
el canSelect ifTrue:[ |
|
3291 |
el hasDelayedMenu ifTrue:[ |
|
3292 |
"/ do not open menu |
|
3293 |
self selection:el openMenu:false |
|
3294 |
] ifFalse:[ |
|
3295 |
"/ open comes from style-sheet |
|
3296 |
self selection:el. |
|
3297 |
]. |
|
3298 |
^ self |
|
2249 | 3299 |
]. |
2354 | 3300 |
] |
3301 |
]. |
|
3302 |
idx == idx0 ifTrue:[ |
|
3303 |
^ self |
|
3304 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3305 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3306 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3307 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3308 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3309 |
superMenu notNil ifTrue:[ |
1791 | 3310 |
p1 := self translateGrabPoint:0. |
3311 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3312 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3313 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3314 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3315 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3316 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3317 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3318 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3319 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3320 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3321 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3322 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3323 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3324 |
backKey := #CursorUp. |
1699 | 3325 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3326 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3327 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3328 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3329 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3330 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3331 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3332 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3333 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3334 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3335 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3336 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3337 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3338 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3339 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3340 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3341 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3342 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3343 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3344 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3345 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3346 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3347 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3348 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3349 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3350 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3351 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3352 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3353 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3354 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3355 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3356 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3357 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3358 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3359 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3360 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3361 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3362 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3363 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3364 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3365 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3366 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3367 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3368 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3369 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3370 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3371 |
handleKeyPress:key |
2715 | 3372 |
"any key is pressed" |
3373 |
||
2219 | 3374 |
|item inMenu| |
1699 | 3375 |
|
3376 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3377 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3378 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3379 |
key isCharacter ifTrue:[ |
1862 | 3380 |
"/ selection notNil ifTrue:[ |
3381 |
"/ inMenu := self |
|
3382 |
"/ ] ifFalse:[ |
|
3383 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3384 |
"/ ]. |
|
3385 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3386 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3387 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3388 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3389 |
] |
1699 | 3390 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3391 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3392 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3393 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3394 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3395 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3396 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3397 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3398 |
! |
1699 | 3399 |
|
3400 |
handlePointerLeave:state |
|
3401 |
self pointerEntersItem:nil. |
|
3402 |
super pointerLeave:state |
|
3403 |
! |
|
3404 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3405 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3406 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3407 |
|
2238 | 3408 |
|sensor subm item| |
3409 |
||
3410 |
(item := selection) isNil ifTrue:[ |
|
3411 |
superMenu notNil ifTrue:[ |
|
2249 | 3412 |
item := superMenu selection. |
3413 |
||
3414 |
item value notNil ifTrue:[ |
|
3415 |
"/ is a delayed menu |
|
3416 |
self accept:item |
|
3417 |
] ifFalse:[ |
|
3418 |
item toggleSubmenuVisibility |
|
3419 |
] |
|
2238 | 3420 |
] ifFalse:[ |
3421 |
self accept |
|
3422 |
]. |
|
3423 |
^ self |
|
1841 | 3424 |
]. |
3425 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3426 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3427 |
selection toggleSubmenuVisibility. |
3428 |
^ self |
|
2238 | 3429 |
]. |
3430 |
subm := selection currentSubmenu. |
|
3431 |
||
3432 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3433 |
selection toggleSubmenuVisibility. |
3434 |
^ self |
|
2238 | 3435 |
]. |
3436 |
self openDelayed:nil |
|
1841 | 3437 |
]. |
3438 |
self accept. |
|
3439 |
||
2238 | 3440 |
" test for toggle " |
3441 |
item isToggle ifTrue:[ |
|
3442 |
self selection:item. |
|
3443 |
] ifFalse:[ |
|
3444 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3445 |
^ self |
|
3446 |
] |
|
3447 |
]. |
|
1841 | 3448 |
|
3449 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3450 |
^ self |
1841 | 3451 |
]. |
3452 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3453 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3454 |
sensor flushKeyboardFor:nil. |
2238 | 3455 |
Delay waitForSeconds:0.1. |
3456 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3457 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3458 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3459 |
|
1699 | 3460 |
pointerEntersItem:anItemOrNil |
3461 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3462 |
redraw the new item highlighted." |
3463 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3464 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3465 |
|
1699 | 3466 |
( anItemOrNil notNil |
3467 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3468 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3469 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3470 |
anItemOrNil isButton ifTrue:[ |
2219 | 3471 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3472 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3473 |
) ifTrue:[ |
1699 | 3474 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3475 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3476 |
] ifFalse:[ |
2219 | 3477 |
(self enteredLevel ~~ 0 |
3478 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3479 |
) ifTrue:[ |
|
1699 | 3480 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3481 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3482 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3483 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3484 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3485 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3486 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3487 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3488 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3489 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3490 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3491 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3492 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3493 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3494 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3495 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3496 |
]. |
388 | 3497 |
! ! |
3498 |
||
2251 | 3499 |
!MenuPanel methodsFor:'focus handling'! |
3500 |
||
3501 |
hasKeyboardFocus:aBoolean |
|
2715 | 3502 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3503 |
||
2251 | 3504 |
|focusView| |
3505 |
||
3506 |
self isPopUpView ifTrue:[ |
|
3507 |
"/ not visible for popup menus |
|
3508 |
^ super hasKeyboardFocus:aBoolean |
|
3509 |
]. |
|
3510 |
||
3511 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3512 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3513 |
focusView := windowGroup focusView. |
|
3514 |
||
3515 |
focusView == self ifFalse:[ |
|
3516 |
self selection:nil. |
|
3517 |
] |
|
3518 |
] |
|
3519 |
]. |
|
3520 |
super hasKeyboardFocus:aBoolean. |
|
3521 |
! ! |
|
3522 |
||
388 | 3523 |
!MenuPanel methodsFor:'grabbing'! |
3524 |
||
1699 | 3525 |
doGrab |
3526 |
relativeGrabOrigin := nil. |
|
3527 |
||
3528 |
superMenu notNil ifTrue:[ |
|
2219 | 3529 |
superMenu doGrab |
1699 | 3530 |
] ifFalse:[ |
2219 | 3531 |
hasImplicitGrap ~~ true ifTrue:[ |
3532 |
self grabMouseAndKeyboard. |
|
3533 |
hasImplicitGrap := true |
|
3534 |
] |
|
1699 | 3535 |
] |
3536 |
! |
|
3537 |
||
3538 |
doUngrab:forceDo |
|
3539 |
||
3540 |
relativeGrabOrigin := nil. |
|
1767 | 3541 |
self clearImplicitGrab. |
1699 | 3542 |
|
3543 |
superMenu notNil ifTrue:[ |
|
2219 | 3544 |
forceDo ifTrue:[ |
3545 |
superMenu doUngrab:true |
|
3546 |
]. |
|
3547 |
^ self |
|
1699 | 3548 |
]. |
3549 |
||
3550 |
hasImplicitGrap ~~ true ifTrue:[ |
|
2219 | 3551 |
^ self |
1699 | 3552 |
]. |
3553 |
||
3554 |
forceDo ifFalse:[ |
|
2219 | 3555 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3556 |
^ self |
|
3557 |
]. |
|
1699 | 3558 |
]. |
3559 |
self ungrabMouseAndKeyboard. |
|
3560 |
self selection:nil. |
|
3561 |
hasImplicitGrap := nil. |
|
1703 | 3562 |
prevFocusView := nil. |
3563 |
||
1699 | 3564 |
! |
3565 |
||
1630 | 3566 |
grabKeyboard |
2715 | 3567 |
"grap the keyboard; keep previous grab" |
3568 |
||
1630 | 3569 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 3570 |
^ super grabKeyboard |
1630 | 3571 |
! |
3572 |
||
388 | 3573 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3574 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3575 |
|
2833
e50bdda555b9
oops - windowGroup is nil sometimes.
Claus Gittinger <cg@exept.de>
parents:
2827
diff
changeset
|
3576 |
|windowGroup sensor| |
e50bdda555b9
oops - windowGroup is nil sometimes.
Claus Gittinger <cg@exept.de>
parents:
2827
diff
changeset
|
3577 |
|
e50bdda555b9
oops - windowGroup is nil sometimes.
Claus Gittinger <cg@exept.de>
parents:
2827
diff
changeset
|
3578 |
windowGroup := self windowGroup. |
e50bdda555b9
oops - windowGroup is nil sometimes.
Claus Gittinger <cg@exept.de>
parents:
2827
diff
changeset
|
3579 |
(realized and:[windowGroup notNil]) ifTrue:[ |
e50bdda555b9
oops - windowGroup is nil sometimes.
Claus Gittinger <cg@exept.de>
parents:
2827
diff
changeset
|
3580 |
prevFocusView := windowGroup focusView. |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3581 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3582 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3583 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3584 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3585 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3586 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3587 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3588 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3589 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3590 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3591 |
self unmap |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3592 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3593 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3594 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3595 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3596 |
device activeKeyboardGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3597 |
device sync. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3598 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3599 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3600 |
] |
388 | 3601 |
] |
3602 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3603 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3604 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3605 |
! |
3606 |
||
1630 | 3607 |
grabPointerWithCursor:aCursorOrNil |
2715 | 3608 |
"grap the pointer; keep previous grab" |
3609 |
||
1630 | 3610 |
previousPointerGrab := device activePointerGrab. |
1699 | 3611 |
hasImplicitGrap := true. |
2715 | 3612 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3613 |
! |
3614 |
||
3615 |
ungrabKeyboard |
|
2715 | 3616 |
"ungrap the keyboard; restore previous grab" |
3617 |
||
1630 | 3618 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3619 |
|
2579 | 3620 |
(previousKeyboardGrab notNil |
3621 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3622 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3623 |
]. |
|
1630 | 3624 |
! |
3625 |
||
388 | 3626 |
ungrabMouseAndKeyboard |
2715 | 3627 |
"ungrab resources (mouse and keyboard)" |
3628 |
||
1630 | 3629 |
self ungrabPointer. |
3630 |
self ungrabKeyboard. |
|
3631 |
! |
|
3632 |
||
3633 |
ungrabPointer |
|
2715 | 3634 |
"ungrap the pointer; restore previous grab" |
3635 |
||
1630 | 3636 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3637 |
|
2579 | 3638 |
(previousPointerGrab notNil |
3639 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3640 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3641 |
]. |
388 | 3642 |
! ! |
3643 |
||
1251 | 3644 |
!MenuPanel methodsFor:'help'! |
3645 |
||
2058 | 3646 |
flyByHelpTextAt:srcPoint |
3647 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2715 | 3648 |
If there is a selection, that items helpText is used (ignoring the given point)." |
3649 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3650 |
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
|
3651 |
^ nil |
2058 | 3652 |
! |
3653 |
||
3654 |
flyByHelpTextForItem:anItem |
|
2715 | 3655 |
"returns the helpText for an item (empty if none)" |
3656 |
||
2063 | 3657 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3658 |
^ anItem flyByHelpText. |
2058 | 3659 |
! |
3660 |
||
1251 | 3661 |
helpText |
2715 | 3662 |
"return the helpText for the currently selected item (empty if none)" |
3663 |
||
1613 | 3664 |
^ self helpTextForItem:selection |
1251 | 3665 |
! |
3666 |
||
1699 | 3667 |
helpTextAt:srcPoint |
1252 | 3668 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 3669 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
3670 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3671 |
self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu helpTextForItem:item]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3672 |
^ '' |
1613 | 3673 |
! |
3674 |
||
3675 |
helpTextForItem:anItem |
|
2715 | 3676 |
"returns the helpText for an item (empty if none)" |
3677 |
||
1613 | 3678 |
anItem isNil ifTrue:[^ '']. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3679 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3680 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3681 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3682 |
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
|
3683 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3684 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3685 |
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
|
3686 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3687 |
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
|
3688 |
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
|
3689 |
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
|
3690 |
] |
1251 | 3691 |
! ! |
3692 |
||
794 | 3693 |
!MenuPanel methodsFor:'image registration'! |
3694 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
3695 |
imageOnMyDevice:anImage |
2715 | 3696 |
"returns image registered on device" |
3697 |
||
2770 | 3698 |
^ self class image:anImage value onDevice:device |
794 | 3699 |
! |
3700 |
||
3701 |
lightenedImageOnDevice:anImage |
|
2715 | 3702 |
"returns lightened image registered on device" |
3703 |
||
794 | 3704 |
^ self class lightenedImage:anImage onDevice:device |
3705 |
! ! |
|
3706 |
||
1688 | 3707 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3708 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3709 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3710 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3711 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3712 |
|
388 | 3713 |
create |
2715 | 3714 |
"create the shadow view for a none contained submenu" |
3715 |
||
388 | 3716 |
super create. |
3717 |
||
3718 |
self isPopUpView ifTrue:[ |
|
2715 | 3719 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3720 |
shadowView isNil ifTrue:[ |
|
3721 |
shadowView := (ShadowView onDevice:device) for:self |
|
3722 |
] ifFalse:[ |
|
3723 |
self saveUnder:true. |
|
3724 |
]. |
|
3725 |
] |
|
388 | 3726 |
] ifFalse:[ |
2715 | 3727 |
explicitExtent == true ifTrue:[ |
3728 |
(self width) == (superView width) ifTrue:[ |
|
3729 |
self verticalLayout:false |
|
3730 |
] |
|
3731 |
] |
|
388 | 3732 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3733 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3734 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3735 |
! |
3736 |
||
3737 |
destroy |
|
2715 | 3738 |
"destroy items and shadowView; remove dependencies" |
3739 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3740 |
self clearLastActiveMenu. |
2051 | 3741 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 3742 |
items := nil. |
3743 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3744 |
|
388 | 3745 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3746 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3747 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3748 |
|
2051 | 3749 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3750 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3751 |
|
616 | 3752 |
fetchDeviceResources |
2715 | 3753 |
"fetch device colors, to avoid reallocation at redraw time" |
3754 |
||
2219 | 3755 |
|style| |
3756 |
||
2374 | 3757 |
superMenu notNil ifTrue:[ |
2219 | 3758 |
styleSheet := superMenu styleSheet |
3759 |
]. |
|
616 | 3760 |
|
3761 |
super fetchDeviceResources. |
|
3762 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3763 |
"/ 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
|
3764 |
"/ (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
|
3765 |
|
616 | 3766 |
superMenu isNil ifTrue:[ |
2374 | 3767 |
rightArrow isNil ifTrue:[ |
2219 | 3768 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 3769 |
]. |
2219 | 3770 |
fgColor := fgColor onDevice:device. |
3771 |
style := styleSheet name. |
|
3772 |
||
2761 | 3773 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
2219 | 3774 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
3775 |
] ifFalse:[ |
|
3776 |
rightArrowShadow := nil |
|
3777 |
]. |
|
616 | 3778 |
] ifFalse:[ |
2219 | 3779 |
rightArrow := superMenu rightArrow. |
3780 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3781 |
||
3782 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 3783 |
self font:(superMenu font). |
2761 | 3784 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3785 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3786 |
|
1829 | 3787 |
items notNil ifTrue:[ |
2219 | 3788 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 3789 |
]. |
3790 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3791 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3792 |
! |
3793 |
||
580 | 3794 |
initStyle |
3795 |
"initialize style specific stuff" |
|
3796 |
||
2609 | 3797 |
|fn| |
3798 |
||
580 | 3799 |
super initStyle. |
616 | 3800 |
|
2609 | 3801 |
fgColor := DefaultForegroundColor ? Color black. |
3802 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
3803 |
fn := self class defaultFont. |
|
2610 | 3804 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 3805 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3806 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3807 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3808 |
self updateLevelAndBorder. |
580 | 3809 |
! |
3810 |
||
388 | 3811 |
initialize |
2715 | 3812 |
"set default configuration" |
3813 |
||
388 | 3814 |
super initialize. |
616 | 3815 |
|
1730
4936edfc2eee
must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
3816 |
self enableMotionEvents. |
498 | 3817 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3818 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3819 |
self originChangedFlag:false. |
2253 | 3820 |
explicitExtent := nil. |
3821 |
shortKeyInset := 0. |
|
3822 |
mustRearrange := false. |
|
3823 |
showSeparatingLines := false. |
|
3824 |
showGroupDivider := true. |
|
388 | 3825 |
! |
3826 |
||
1573 | 3827 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3828 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 3829 |
If the grab fails, try again and unmap myself if that fails too." |
3830 |
||
1791 | 3831 |
|loIndices loItems| |
388 | 3832 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3833 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3834 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3835 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3836 |
self becomesActiveMenu. |
1573 | 3837 |
super map. |
2681 | 3838 |
self addDependencies. |
388 | 3839 |
|
1785 | 3840 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 3841 |
loItems := items ? #[]. |
3842 |
||
3843 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 3844 |
|
388 | 3845 |
self isPopUpView ifTrue:[ |
2681 | 3846 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3847 |
] ifFalse:[ |
2681 | 3848 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3849 |
]. |
1791 | 3850 |
loItems do:[:el| el updateIndicators ]. |
388 | 3851 |
|
1785 | 3852 |
loIndices size > 0 ifTrue:[ |
2681 | 3853 |
self redrawX:0 y:0 width:width height:height. |
3854 |
self openMenusFromItemIndices:loIndices. |
|
388 | 3855 |
]. |
3856 |
||
1177 | 3857 |
"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
|
3858 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 3859 |
! |
3860 |
||
3861 |
realize |
|
2715 | 3862 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3863 |
|
2761 | 3864 |
|bgColor| |
3865 |
||
388 | 3866 |
self isPopUpView ifTrue:[ |
2761 | 3867 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
3868 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
3869 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3870 |
"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
|
3871 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3872 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3873 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3874 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3875 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3876 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3877 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3878 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3879 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3880 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3881 |
self map. |
736 | 3882 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3883 |
super realize. |
1767 | 3884 |
]. |
3885 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3886 |
hideOnRelease := defaultHideOnRelease. |
388 | 3887 |
! |
3888 |
||
3889 |
recreate |
|
1832 | 3890 |
"this is called after a snapin or a migration. |
2715 | 3891 |
If the image was saved with an active menu, hide the menu" |
3892 |
||
1455 | 3893 |
selection := nil. |
388 | 3894 |
super recreate. |
3895 |
! |
|
3896 |
||
1130 | 3897 |
reinitStyle |
3898 |
"handle style change while being open (win32 only - for now)" |
|
3899 |
||
3900 |
super reinitStyle. |
|
3901 |
||
3902 |
self fetchDeviceResources. |
|
1811 | 3903 |
self mustRearrange. "/ care for changed font sizes etc. |
3904 |
||
3905 |
self do:[:anItem | |
|
3906 |
anItem reinitStyle |
|
3907 |
]. |
|
1130 | 3908 |
|
3909 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 3910 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 3911 |
! |
3912 |
||
388 | 3913 |
unmap |
1330 | 3914 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
3915 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 3916 |
|
2681 | 3917 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3918 |
self clearLastActiveMenu. |
1699 | 3919 |
self doUngrab:(superMenu isNil). |
3920 |
"/ self isPopUpView ifTrue:[ |
|
3921 |
"/ self doUngrab:(superMenu isNil) |
|
3922 |
"/ ]. |
|
3923 |
||
388 | 3924 |
super unmap. |
3925 |
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
|
3926 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3927 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3928 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3929 |
"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
|
3930 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3931 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3932 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3933 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3934 |
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
|
3935 |
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
|
3936 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3937 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 3938 |
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
|
3939 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3940 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3941 |
self level:lvl. |
388 | 3942 |
! ! |
3943 |
||
1878 | 3944 |
!MenuPanel methodsFor:'keyboard control'! |
3945 |
||
3946 |
mnemonicViewNext:aKeyEvent |
|
3947 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
3948 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 3949 |
return the topMenu otherwise nil." |
3950 |
||
2112 | 3951 |
|menu uKey lKey list index| |
3952 |
||
3953 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 3954 |
shown ifFalse:[^ nil]. |
3955 |
||
3956 |
uKey := aKeyEvent rawKey last asUppercase. |
|
3957 |
lKey := uKey asLowercase. |
|
2112 | 3958 |
|
3959 |
selection notNil ifTrue:[ |
|
2374 | 3960 |
"first lookup the current grapMenu before starting in the topMenu |
3961 |
" |
|
3962 |
menu := self detectGrabMenu. |
|
3963 |
||
3964 |
[ menu ~~ self ] whileTrue:[ |
|
3965 |
index := menu selectionIndex. |
|
3966 |
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
|
3967 |
maxDepth:10 from:(index + 1) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3968 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 3969 |
|
2374 | 3970 |
list size ~~ 0 ifTrue:[ |
3971 |
"/ has item which responds to the mnemonic |
|
3972 |
menu processCollectedIndices:list. |
|
3973 |
^ self |
|
3974 |
]. |
|
3975 |
menu := menu superMenu. |
|
3976 |
]. |
|
3977 |
index := self selectionIndex. |
|
3978 |
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
|
3979 |
maxDepth:10 from:(1 + index) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3980 |
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
|
3981 |
|
2112 | 3982 |
] ifFalse:[ |
2374 | 3983 |
index := 99999. |
3984 |
list := nil. |
|
2112 | 3985 |
]. |
3986 |
||
2374 | 3987 |
list isNil ifTrue:[ |
3988 |
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
|
3989 |
maxDepth:1 from:1 to:index |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3990 |
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
|
3991 |
|
2374 | 3992 |
|
3993 |
list isNil ifTrue:[ |
|
3994 |
"/ must clear existing selection |
|
3995 |
self selection:nil. |
|
3996 |
^ nil |
|
3997 |
] |
|
2112 | 3998 |
]. |
3999 |
||
4000 |
"/ has item which responds to the mnemonic |
|
4001 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4002 |
! |
1878 | 4003 |
|
4004 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 4005 |
"open all menus derived from sequence of item indices" |
4006 |
||
1878 | 4007 |
|item| |
4008 |
||
4009 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 4010 |
^ self |
1878 | 4011 |
]. |
4012 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
4013 |
||
4014 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 4015 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
4016 |
self selection:item openMenu:true. |
|
4017 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4018 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4019 |
! |
1878 | 4020 |
|
4021 |
processCollectedIndices:indices |
|
4022 |
|menu item| |
|
4023 |
||
4024 |
indices size == 0 ifTrue:[ |
|
2219 | 4025 |
^ self |
1878 | 4026 |
]. |
4027 |
menu := self. |
|
4028 |
||
4029 |
[menu selectionIndex == indices first] whileTrue:[ |
|
2219 | 4030 |
( (item := menu selection) isNil "/ shouldn't happen |
4031 |
or:[(menu := item submenu) isNil] "/ no more indices; done |
|
4032 |
) ifTrue:[ |
|
4033 |
^ true |
|
4034 |
]. |
|
4035 |
indices removeFirst. |
|
4036 |
||
4037 |
indices isEmpty ifTrue:[ |
|
4038 |
menu selection:nil. |
|
4039 |
^ self |
|
4040 |
] |
|
1878 | 4041 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4042 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4043 |
! |
1878 | 4044 |
|
4045 |
processShortcut:aKeyEvent |
|
4046 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
2715 | 4047 |
shortcut-key defined process the shortcut and return true otherwise false." |
4048 |
||
2219 | 4049 |
|menu rKey lKey list item| |
1878 | 4050 |
|
4051 |
superMenu notNil ifTrue:[ |
|
4052 |
^ superMenu processShortcut:aKeyEvent |
|
4053 |
]. |
|
4054 |
shown ifFalse:[^ false]. |
|
4055 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4056 |
lKey := aKeyEvent key. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4057 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4058 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4059 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4060 |
( #( CursorDown CursorUp CursorRight CursorLeft |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4061 |
) includes:lKey |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4062 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4063 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4064 |
]. |
1878 | 4065 |
rKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4066 |
item := nil. |
1878 | 4067 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
4068 |
||
4069 |
[true] whileTrue:[ |
|
4070 |
list := menu selectItemIndicesFor:[:el||skey| |
|
4071 |
item := el. |
|
4072 |
skey := el shortcutKey. |
|
4073 |
skey == rKey or:[skey == lKey] |
|
4074 |
] |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4075 |
maxDepth:10 from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4076 |
ignoreSubmenuBlock:[:anItem| anItem ignoreShortcutKeys ]. |
1878 | 4077 |
|
4078 |
list size ~~ 0 ifTrue:[ |
|
4079 |
"/ has item which responds to the shortcut |
|
4080 |
item hasSubmenu ifFalse:[ |
|
4081 |
menu accept:item |
|
4082 |
] ifTrue:[ |
|
4083 |
menu processCollectedIndices:list. |
|
4084 |
self windowGroup focusView:self. |
|
4085 |
]. |
|
4086 |
^ true |
|
4087 |
]. |
|
4088 |
||
4089 |
menu == self ifTrue:[ ^ false ]. |
|
4090 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4091 |
]. |
2219 | 4092 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4093 |
! |
1878 | 4094 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4095 |
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
|
4096 |
"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
|
4097 |
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
|
4098 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4099 |
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
|
4100 |
is created and passed through if the block returns false. |
2715 | 4101 |
Otherwise the item is not asked for its submenu." |
4102 |
||
2112 | 4103 |
|start stop| |
4104 |
||
4105 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4106 |
||
4107 |
start := aStart max:1. |
|
4108 |
stop := aStop min:(items size). |
|
4109 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4110 |
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
|
4111 |
item := items at:i. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4112 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4113 |
(aOneArgBlock value:item) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4114 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4115 |
^ 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
|
4116 |
] |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4117 |
] ifFalse:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4118 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4119 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4120 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4121 |
menu := item submenu. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4122 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4123 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4124 |
result := menu selectItemIndicesFor:aOneArgBlock |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4125 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4126 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4127 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4128 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4129 |
result addFirst:i. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4130 |
^ result |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4131 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4132 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4133 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4134 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4135 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4136 |
]. |
1878 | 4137 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4138 |
^ nil |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4139 |
! ! |
1878 | 4140 |
|
388 | 4141 |
!MenuPanel methodsFor:'misc'! |
4142 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4143 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4144 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4145 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4146 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4147 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4148 |
|
388 | 4149 |
superMenu |
2715 | 4150 |
"returns supermenu or nil" |
4151 |
||
388 | 4152 |
^ superMenu |
4153 |
! |
|
4154 |
||
4155 |
topMenu |
|
2715 | 4156 |
"returns the topMenu; the one having no superMenu" |
4157 |
||
1791 | 4158 |
|menu smenu| |
4159 |
||
4160 |
menu := self. |
|
4161 |
||
4162 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2715 | 4163 |
menu := smenu |
1791 | 4164 |
]. |
4165 |
^ menu |
|
388 | 4166 |
! ! |
4167 |
||
1825 | 4168 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4169 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4170 |
printString |
2715 | 4171 |
"return a printed representation of the menu" |
4172 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4173 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4174 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4175 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4176 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4177 |
self do:[:anItem| |
2715 | 4178 |
label := anItem label ? ''. |
4179 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4180 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4181 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4182 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4183 |
"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
|
4184 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4185 |
|
388 | 4186 |
!MenuPanel methodsFor:'private'! |
4187 |
||
434 | 4188 |
application |
2715 | 4189 |
"optimize access to retrive the application" |
4190 |
||
2374 | 4191 |
application notNil ifTrue:[^ application ]. |
434 | 4192 |
|
4193 |
superMenu notNil ifTrue:[ |
|
2253 | 4194 |
application := superMenu application. |
2374 | 4195 |
^ application |
2253 | 4196 |
]. |
4197 |
application := super application. |
|
2374 | 4198 |
^ application |
1872 | 4199 |
! |
434 | 4200 |
|
1572 | 4201 |
detectItemForKey:aKey |
4202 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4203 |
if no item is detected nil is returned." |
4204 |
||
1572 | 4205 |
|cIdx uKey lKey item| |
4206 |
||
1699 | 4207 |
items isNil ifTrue:[^ nil]. |
4208 |
||
1572 | 4209 |
cIdx := self selectionIndex. |
4210 |
uKey := aKey asUppercase. |
|
4211 |
lKey := aKey asLowercase. |
|
4212 |
||
1699 | 4213 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2715 | 4214 |
( anIndex ~~ cIdx |
4215 |
and:[anItem canSelect |
|
4216 |
and:[(label := anItem textLabel) notNil |
|
4217 |
and:[label size ~~ 0]]] |
|
4218 |
) ifTrue:[ |
|
4219 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4220 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4221 |
^ anItem |
|
4222 |
] |
|
4223 |
] ifFalse:[ |
|
4224 |
char := label at:1. |
|
4225 |
||
4226 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4227 |
anIndex > cIdx ifTrue:[ |
|
4228 |
^ anItem |
|
4229 |
]. |
|
4230 |
item isNil ifTrue:[item := anItem] |
|
4231 |
] |
|
4232 |
] |
|
4233 |
] |
|
1572 | 4234 |
]. |
4235 |
^ item |
|
4236 |
! |
|
4237 |
||
390 | 4238 |
menuAdornmentAt:aSymbol |
2715 | 4239 |
"returns a value derived from adornment" |
4240 |
||
2374 | 4241 |
adornment isNil ifTrue:[^ nil]. |
4242 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4243 |
! |
4244 |
||
390 | 4245 |
menuAdornmentAt:aSymbol put:something |
2715 | 4246 |
"sets a value for the specific menu" |
4247 |
||
2253 | 4248 |
|oldValue| |
4249 |
||
653 | 4250 |
adornment isNil ifTrue:[ |
2374 | 4251 |
something isNil ifTrue:[^ self]. |
2253 | 4252 |
adornment := IdentityDictionary new. |
4253 |
] ifFalse:[ |
|
4254 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4255 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4256 |
]. |
4257 |
adornment at:aSymbol put:something. |
|
388 | 4258 |
! |
4259 |
||
4260 |
onEachPerform:aSelector withArgList:aList |
|
2715 | 4261 |
"on each item perform selector with an argument derived from aList" |
4262 |
||
388 | 4263 |
aList isCollection ifTrue:[ |
2715 | 4264 |
items size >= aList size ifTrue:[ |
4265 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4266 |
(items at:anIndex) perform:aSelector with:anArg |
|
4267 |
] |
|
4268 |
] |
|
388 | 4269 |
] ifFalse:[ |
2715 | 4270 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4271 |
] |
4272 |
! |
|
4273 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4274 |
registerImageOnDevice:anImage |
2269 | 4275 |
|
4276 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4277 |
^ self class image:anImage onDevice:device |
|
4278 |
||
4279 |
"/ |image| |
|
4280 |
"/ |
|
4281 |
"/ (image := anImage) notNil ifTrue:[ |
|
4282 |
"/ image device ~~ device ifTrue:[ |
|
4283 |
"/ image := image copy. |
|
4284 |
"/ ]. |
|
4285 |
"/ image := image onDevice:device. |
|
4286 |
"/ image := image clearMaskedPixels. |
|
4287 |
"/ ]. |
|
4288 |
"/ ^ image |
|
2355 | 4289 |
! |
4290 |
||
4291 |
superMenu:aSuperMenu |
|
2715 | 4292 |
"set my supermenu from which i'am activated" |
4293 |
||
2355 | 4294 |
superMenu := aSuperMenu. |
4295 |
||
2374 | 4296 |
superMenu notNil ifTrue:[ |
2355 | 4297 |
styleSheet := superMenu styleSheet. |
4298 |
rightArrow := superMenu rightArrow. |
|
4299 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4300 |
]. |
|
388 | 4301 |
! ! |
4302 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4303 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4304 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4305 |
activeMenu |
2715 | 4306 |
"returns the current active menu or self (the top menu)" |
4307 |
||
687 | 4308 |
^ lastActiveMenu ? self |
4309 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4310 |
"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
|
4311 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4312 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4313 |
activeMenu:aMenu |
2715 | 4314 |
"set the current active menu" |
4315 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4316 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4317 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4318 |
"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
|
4319 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4320 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4321 |
becomesActiveMenu |
2715 | 4322 |
"submenu becomes the active menu" |
4323 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4324 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4325 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4326 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4327 |
"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
|
4328 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4329 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4330 |
clearLastActiveMenu |
2715 | 4331 |
"reset the current active menu" |
4332 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4333 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4334 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4335 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4336 |
|
2251 | 4337 |
"/ prevFocusView notNil ifTrue:[ |
4338 |
"/ self windowGroup focusView:prevFocusView. |
|
4339 |
"/ prevFocusView := nil. |
|
4340 |
"/ ]. |
|
4341 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4342 |
top activeMenu == self ifTrue:[ |
2251 | 4343 |
top activeMenu:nil |
687 | 4344 |
] |
4345 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4346 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4347 |
! |
4348 |
||
4349 |
mapTime |
|
2715 | 4350 |
"returns the time when the menu becomes active" |
4351 |
||
687 | 4352 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4353 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4354 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4355 |
! ! |
4356 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4357 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4358 |
|
4359 |
hasScrollerAt:aDirection |
|
2715 | 4360 |
"returns true if a visible scroller at a direction exists" |
4361 |
||
2016 | 4362 |
|layout| |
4363 |
||
4364 |
self hasScrollers ifFalse:[ |
|
2715 | 4365 |
^ false |
2016 | 4366 |
]. |
4367 |
||
4368 |
aDirection == #PREV ifTrue:[ |
|
2715 | 4369 |
layout := items first layout. |
2016 | 4370 |
|
4371 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2715 | 4372 |
ifFalse:[ layout left < margin] |
2016 | 4373 |
]. |
4374 |
layout := items last layout. |
|
4375 |
||
4376 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2715 | 4377 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4378 |
! |
4379 |
||
4380 |
hasScrollers |
|
2715 | 4381 |
"returns true if scrollers are needed" |
4382 |
||
2018 | 4383 |
|maxExtent first last isVert| |
4384 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4385 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 4386 |
|
4387 |
isVert := self verticalLayout. |
|
4388 |
||
4389 |
superView notNil ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4390 |
((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
|
4391 |
or:[(last := items last layout) isNil] |
2715 | 4392 |
) ifTrue:[ |
4393 |
^ false |
|
4394 |
]. |
|
4395 |
isVert ifTrue:[ |
|
4396 |
^ first top < 0 or:[last bottom > height] |
|
4397 |
]. |
|
4398 |
^ first left < 0 or:[last right > width] |
|
2018 | 4399 |
]. |
4400 |
maxExtent := self maxExtent. |
|
4401 |
isVert ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4402 |
^ (height >= maxExtent y) |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4403 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4404 |
^ (width >= maxExtent x) |
2016 | 4405 |
! |
4406 |
||
4407 |
indexOfItemAtScroller:aDirection |
|
2715 | 4408 |
"returns the index of the item under the scroller or 0" |
4409 |
||
2016 | 4410 |
|bounds min max layout| |
4411 |
||
2860 | 4412 |
self hasScrollers ifFalse:[ ^ 0 ]. |
2016 | 4413 |
bounds := self scrollerBoundsAt:aDirection. |
4414 |
||
4415 |
self verticalLayout ifTrue:[ |
|
2715 | 4416 |
min := bounds top. |
4417 |
max := bounds bottom. |
|
4418 |
||
4419 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4420 |
anItem isVisible ifTrue:[ |
|
4421 |
layout := anItem layout. |
|
4422 |
||
4423 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4424 |
^ anIndex |
|
4425 |
]. |
|
4426 |
]. |
|
4427 |
]. |
|
2016 | 4428 |
] ifFalse:[ |
2715 | 4429 |
min := bounds left. |
4430 |
max := bounds right. |
|
4431 |
||
4432 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4433 |
anItem isVisible ifTrue:[ |
|
4434 |
layout := anItem layout. |
|
4435 |
||
4436 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4437 |
^ anIndex |
|
4438 |
]. |
|
4439 |
]. |
|
4440 |
] |
|
2016 | 4441 |
]. |
4442 |
^ 0 |
|
4443 |
! |
|
4444 |
||
4445 |
makeItemVisible:anItem |
|
2715 | 4446 |
"make an item visible" |
4447 |
||
2018 | 4448 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4449 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4450 |
inv1 inv2| |
2018 | 4451 |
|
4452 |
( anItem notNil |
|
4453 |
and:[self hasScrollers |
|
4454 |
and:[(layout := anItem layout) notNil]] |
|
4455 |
) ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4456 |
^ self |
2016 | 4457 |
]. |
2018 | 4458 |
index := self indexOfItem:anItem. |
2016 | 4459 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4460 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4461 |
||
2018 | 4462 |
isVertical := self verticalLayout. |
4463 |
||
4464 |
isVertical ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4465 |
boundsMin := boundsPREV bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4466 |
boundsMax := boundsNEXT top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4467 |
layoutMin := layout top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4468 |
layoutMax := layout bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4469 |
windowSz := height. |
2018 | 4470 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4471 |
boundsMin := boundsPREV right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4472 |
boundsMax := boundsNEXT left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4473 |
layoutMin := layout left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4474 |
layoutMax := layout right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4475 |
windowSz := width. |
2018 | 4476 |
]. |
4477 |
||
4478 |
||
4479 |
layoutMin < boundsMin ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4480 |
layoutMin >= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4481 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4482 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4483 |
"/ test whether is first visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4484 |
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
|
4485 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4486 |
index == 0 ifTrue:[ scr0 := margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4487 |
ifFalse:[ scr0 := boundsMin ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4488 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4489 |
delta := layoutMin negated + scr0. |
2016 | 4490 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4491 |
layoutMax > boundsMax ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4492 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4493 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4494 |
"/ test whether is last visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4495 |
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
|
4496 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4497 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4498 |
ifFalse:[ scr0 := boundsMax ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4499 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4500 |
delta := scr0 - layoutMax. |
2018 | 4501 |
]. |
4502 |
delta == 0 ifTrue:[ ^ self ]. |
|
4503 |
||
2016 | 4504 |
doScroll := false. |
4505 |
||
4506 |
shown ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4507 |
delta abs < (windowSz / 2) ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4508 |
doScroll := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4509 |
self repairDamage |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4510 |
] |
2016 | 4511 |
]. |
2018 | 4512 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4513 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4514 |
|
4515 |
doScroll ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4516 |
self invalidate. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4517 |
^ self |
2016 | 4518 |
]. |
4519 |
||
2018 | 4520 |
windowSz := windowSz - margin - margin. |
4521 |
||
4522 |
scr0 := boundsMin. |
|
4523 |
scr1 := scr0 + delta abs. |
|
4524 |
scrSz := boundsMax - scr1. |
|
4525 |
||
4526 |
delta < 0 ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4527 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4528 |
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
|
4529 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4530 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4531 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4532 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4533 |
"/ 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
|
4534 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4535 |
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
|
4536 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4537 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4538 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4539 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4540 |
"/ 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
|
4541 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4542 |
inv1 := boundsPREV. |
2016 | 4543 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4544 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4545 |
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
|
4546 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4547 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4548 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4549 |
"/ 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
|
4550 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4551 |
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
|
4552 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4553 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4554 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4555 |
"/ 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
|
4556 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4557 |
inv1 := boundsNEXT. |
2042 | 4558 |
]. |
4559 |
self invalidate:inv1. |
|
4560 |
self invalidate:inv2. |
|
2048 | 4561 |
|
4562 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4563 |
! |
4564 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4565 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4566 |
"returns the one and only scrollActivity - data holder |
2715 | 4567 |
for a menu and all contained submenus" |
4568 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4569 |
superMenu notNil ifTrue:[ |
2715 | 4570 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4571 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4572 |
scrollActivity isNil ifTrue:[ |
2715 | 4573 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4574 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4575 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4576 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4577 |
|
2016 | 4578 |
scrollerBoundsAt:aDirection |
2860 | 4579 |
"returns the bounds of the scroller at a direction" |
2715 | 4580 |
|
2016 | 4581 |
|y x w h inset| |
4582 |
||
4583 |
inset := 0. |
|
4584 |
x := y := inset. |
|
4585 |
w := h := 15. |
|
4586 |
||
4587 |
self verticalLayout ifTrue:[ |
|
2715 | 4588 |
aDirection == #NEXT ifTrue:[ |
4589 |
y := height - h - inset. |
|
4590 |
]. |
|
4591 |
w := width - inset - inset. |
|
2016 | 4592 |
] ifFalse:[ |
2715 | 4593 |
aDirection == #NEXT ifTrue:[ |
4594 |
x := width - w - inset. |
|
4595 |
]. |
|
4596 |
h := height - inset - inset. |
|
2016 | 4597 |
]. |
4598 |
^ Rectangle left:x top:y width:w height:h |
|
4599 |
! |
|
4600 |
||
2046 | 4601 |
scrollerDirectionAtPoint:aPoint |
2715 | 4602 |
"returns the scroller-direction at aPoint, or nil" |
4603 |
||
2046 | 4604 |
self hasScrollers ifTrue:[ |
2715 | 4605 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
2860 | 4606 |
bounds := self scrollerBoundsAt:aDirection. |
4607 |
||
4608 |
(bounds containsPoint:aPoint) ifTrue:[ |
|
2715 | 4609 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
4610 |
] |
|
4611 |
] |
|
2046 | 4612 |
]. |
4613 |
^ nil |
|
4614 |
||
4615 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4616 |
! ! |
4617 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4618 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4619 |
|
1699 | 4620 |
detectGrabMenu |
2715 | 4621 |
"returns the menu which is responsible for the grap; the last opened menu" |
4622 |
||
1699 | 4623 |
|subMenu| |
4624 |
||
4625 |
selection notNil ifTrue:[ |
|
2715 | 4626 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4627 |
^ subMenu detectGrabMenu |
|
4628 |
] |
|
1699 | 4629 |
]. |
4630 |
^ self |
|
4631 |
! |
|
4632 |
||
4633 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 4634 |
"returns the menu which contains the grab-point" |
4635 |
||
1699 | 4636 |
|dstMenu dstPoint firstMenu| |
4637 |
||
4638 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4639 |
||
4640 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2715 | 4641 |
firstMenu := self. |
1699 | 4642 |
]. |
4643 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4644 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2715 | 4645 |
^ firstMenu |
1699 | 4646 |
]. |
4647 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4648 |
^ dstMenu ? firstMenu |
1699 | 4649 |
! |
4650 |
||
1767 | 4651 |
detectViewAtX:x y:y in:aTopView |
2715 | 4652 |
"detect view at x@y" |
4653 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4654 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4655 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4656 |
"/ 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
|
4657 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4658 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4659 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4660 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4661 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4662 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4663 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4664 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4665 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4666 |
"/ 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
|
4667 |
"/ ^ 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
|
4668 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4669 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4670 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4671 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4672 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4673 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4674 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4675 |
! |
4676 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4677 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4678 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 4679 |
If no item match nil is returned." |
4680 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4681 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4682 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4683 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4684 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4685 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4686 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4687 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4688 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4689 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4690 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4691 |
itemAtPoint:aPoint |
2715 | 4692 |
"returns the item at aPoint or nil if none detected" |
4693 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4694 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4695 |
|
1699 | 4696 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4697 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4698 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4699 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 4700 |
]. |
4701 |
^ nil |
|
388 | 4702 |
! |
4703 |
||
2048 | 4704 |
superMenuAtPoint:aPoint |
2715 | 4705 |
"returns the superMenu which contains aPoint, or nil if none detected" |
4706 |
||
1699 | 4707 |
|grabPoint superMenu| |
4708 |
||
2048 | 4709 |
(self containsPoint:aPoint) ifTrue:[ |
2715 | 4710 |
^ self |
1699 | 4711 |
]. |
4712 |
||
2048 | 4713 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4714 |
superMenu := self. |
4715 |
||
4716 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2715 | 4717 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
4718 |
^ superMenu |
|
4719 |
] |
|
4720 |
]. |
|
4721 |
^ nil |
|
1699 | 4722 |
|
2048 | 4723 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4724 |
! ! |
4725 |
||
4726 |
!MenuPanel methodsFor:'queries'! |
|
4727 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4728 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4729 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4730 |
aView notNil ifTrue:[ |
2219 | 4731 |
"/ I am no longer a popUpView |
4732 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4733 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4734 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4735 |
|
388 | 4736 |
containsPoint:aPoint |
2715 | 4737 |
"returns true if the argument, aPoint is contained by the view" |
4738 |
||
388 | 4739 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
4740 |
! |
|
4741 |
||
4742 |
containsPointX:x y:y |
|
2715 | 4743 |
"returns true if point is contained by the view" |
4744 |
||
708 | 4745 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 4746 |
! |
4747 |
||
390 | 4748 |
hasGroupDividerAt:anIndex |
2715 | 4749 |
"returns true if a divider is defined at an index" |
4750 |
||
388 | 4751 |
|i| |
4752 |
||
4753 |
groupSizes size ~~ 0 ifTrue:[ |
|
2715 | 4754 |
i := 0. |
4755 |
||
4756 |
groupSizes do:[:t| |
|
4757 |
(i := i + t) == anIndex ifTrue:[ |
|
4758 |
^ true |
|
4759 |
] |
|
4760 |
] |
|
4761 |
]. |
|
4762 |
^ false |
|
388 | 4763 |
! |
4764 |
||
390 | 4765 |
hasGroupDividers |
2715 | 4766 |
"returns true if any group divider exists" |
4767 |
||
4768 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 4769 |
! |
4770 |
||
390 | 4771 |
isFitPanel |
4772 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4773 |
be fit to the extent of its superView; |
2715 | 4774 |
NOT SUPPORTED" |
4775 |
||
1699 | 4776 |
^ false |
390 | 4777 |
! |
4778 |
||
388 | 4779 |
isPopUpView |
4780 |
"return true if view is a popup view; without decoration |
|
2715 | 4781 |
and popUp to top immediately" |
4782 |
||
388 | 4783 |
^ superView isNil |
4784 |
! |
|
4785 |
||
4786 |
isVerticalLayout |
|
2715 | 4787 |
"returns true if vertical layout otherwise false( horizontal layout )" |
4788 |
||
1699 | 4789 |
^ self verticalLayout |
416 | 4790 |
! |
4791 |
||
1793 | 4792 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
4793 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 4794 |
! |
4795 |
||
416 | 4796 |
type |
428 | 4797 |
^ nil. |
416 | 4798 |
|
388 | 4799 |
! ! |
4800 |
||
4801 |
!MenuPanel methodsFor:'selection'! |
|
4802 |
||
4803 |
hasSelection |
|
2715 | 4804 |
"returns true if a selection exists" |
4805 |
||
388 | 4806 |
^ self selection notNil |
4807 |
! |
|
4808 |
||
2199 | 4809 |
openDelayed:anItem |
4810 |
||
2374 | 4811 |
superMenu notNil ifTrue:[ |
2219 | 4812 |
superMenu openDelayed:anItem. |
2374 | 4813 |
^ self |
4814 |
]. |
|
4815 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 4816 |
Processor removeTimedBlock:openDelayedMenuBlock. |
4817 |
openDelayedMenuBlock := nil. |
|
4818 |
]. |
|
2374 | 4819 |
anItem isNil ifTrue:[ |
2253 | 4820 |
openDelayedMenuBlock := nil. |
2374 | 4821 |
^ self |
2253 | 4822 |
]. |
4823 |
openDelayedMenuBlock := [ |
|
4824 |
openDelayedMenuBlock := nil. |
|
4825 |
anItem openDelayedSubmenu |
|
4826 |
]. |
|
4827 |
||
4828 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5. |
|
2199 | 4829 |
! |
4830 |
||
388 | 4831 |
selection |
2715 | 4832 |
"returns current selected item or nil" |
4833 |
||
388 | 4834 |
^ selection |
4835 |
! |
|
4836 |
||
4837 |
selection:anItemOrNil |
|
2016 | 4838 |
"change selection to an item or nil |
2715 | 4839 |
if the item has a submenu the first item might be selected (style-sheet)" |
4840 |
||
2249 | 4841 |
|openMenu openOnSelect submenu item| |
4842 |
||
4843 |
selection == anItemOrNil ifTrue:[^ self]. |
|
4844 |
||
4845 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
4846 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4847 |
^ self |
2249 | 4848 |
]. |
4849 |
||
4850 |
openMenu := self isPopUpView not. |
|
4851 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
4852 |
||
4853 |
openMenu ifFalse:[ |
|
4854 |
openMenu := openOnSelect. |
|
4855 |
]. |
|
4856 |
self selection:anItemOrNil openMenu:openMenu. |
|
4857 |
||
4858 |
openOnSelect ifFalse:[ |
|
4859 |
"/ select first item in submenu |
|
4860 |
||
4861 |
submenu := anItemOrNil currentSubmenu. |
|
4862 |
||
2374 | 4863 |
submenu notNil ifTrue:[ |
2249 | 4864 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4865 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 4866 |
submenu selection:item openMenu:false |
4867 |
] |
|
4868 |
]. |
|
4869 |
]. |
|
4870 |
! |
|
4871 |
||
4872 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 4873 |
"change selection to an item or nil" |
4874 |
||
2251 | 4875 |
|helpListener oldSelect| |
2249 | 4876 |
|
4877 |
anItemOrNil == selection ifTrue:[ |
|
4878 |
^ self |
|
2016 | 4879 |
]. |
2199 | 4880 |
self openDelayed:nil. |
388 | 4881 |
|
2251 | 4882 |
oldSelect := selection. |
4883 |
selection := nil. |
|
2249 | 4884 |
|
2374 | 4885 |
anItemOrNil notNil ifTrue:[ |
2249 | 4886 |
self makeItemVisible:anItemOrNil. |
4887 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 4888 |
selection := anItemOrNil |
2249 | 4889 |
] ifFalse:[ |
2374 | 4890 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 4891 |
]. |
4892 |
]. |
|
2374 | 4893 |
oldSelect notNil ifTrue:[ |
2249 | 4894 |
"/ clear current selection |
2251 | 4895 |
oldSelect isSelected:false. |
4896 |
]. |
|
2374 | 4897 |
selection isNil ifTrue:[^ self]. |
2251 | 4898 |
|
4899 |
selection == enteredItem ifTrue:[ |
|
2249 | 4900 |
enteredItem := nil |
2016 | 4901 |
] ifFalse:[ |
2249 | 4902 |
self pointerEntersItem:nil |
2016 | 4903 |
]. |
4904 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 4905 |
helpListener := ActiveHelp currentHelpListener. |
4906 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 4907 |
]. |
4908 |
shown ifTrue:[ |
|
4909 |
self rearrangeItems. |
|
4910 |
||
4911 |
openMenu ifFalse:[ |
|
4912 |
selection invalidate. |
|
4913 |
] |
|
4914 |
]. |
|
4915 |
openMenu ifTrue:[ |
|
4916 |
selection isSelected:true. |
|
4917 |
]. |
|
388 | 4918 |
! |
4919 |
||
4920 |
selectionIndex |
|
2715 | 4921 |
"returns index of current selection or 0" |
4922 |
||
388 | 4923 |
|item| |
4924 |
||
4925 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 4926 |
^ self findFirst:[:el| el == item ] |
388 | 4927 |
]. |
4928 |
^ 0 |
|
4929 |
! |
|
4930 |
||
4931 |
selectionIndex:anIndex |
|
2715 | 4932 |
"set selection at an index" |
4933 |
||
388 | 4934 |
self selection:(self itemAt:anIndex) |
4935 |
! ! |
|
4936 |
||
1791 | 4937 |
!MenuPanel methodsFor:'translation'! |
4938 |
||
4939 |
translateGrabPoint:aGrabPoint |
|
2715 | 4940 |
"translate the grab point into self" |
4941 |
||
1791 | 4942 |
superMenu isNil ifTrue:[ |
2715 | 4943 |
"I am the grapView" |
4944 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
4945 |
^ aGrabPoint |
|
1791 | 4946 |
]. |
4947 |
||
4948 |
relativeGrabOrigin isNil ifTrue:[ |
|
2715 | 4949 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
1791 | 4950 |
]. |
4951 |
^ relativeGrabOrigin + aGrabPoint |
|
4952 |
! |
|
4953 |
||
4954 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 4955 |
"translate a point into another menu its point" |
4956 |
||
1791 | 4957 |
|grapPoint| |
4958 |
||
4959 |
aMenu == self ifTrue:[ |
|
2715 | 4960 |
^ aPoint |
1791 | 4961 |
]. |
4962 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
4963 |
||
2715 | 4964 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 4965 |
! |
4966 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4967 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 4968 |
"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
|
4969 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4970 |
^ device |
2715 | 4971 |
translatePoint:aPoint asPoint |
4972 |
fromView:self |
|
4973 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4974 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4975 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 4976 |
! ! |
4977 |
||
388 | 4978 |
!MenuPanel::Item class methodsFor:'accessing'! |
4979 |
||
689 | 4980 |
horizontalInset |
4981 |
^ HorizontalInset |
|
4982 |
! |
|
4983 |
||
388 | 4984 |
labelRightOffset |
4985 |
^ LabelRightOffset |
|
4986 |
! |
|
4987 |
||
689 | 4988 |
verticalInset |
4989 |
^ VerticalInset |
|
1765 | 4990 |
! |
4991 |
||
4992 |
verticalPopUpInset |
|
4993 |
^ VerticalPopUpInset |
|
388 | 4994 |
! ! |
4995 |
||
616 | 4996 |
!MenuPanel::Item class methodsFor:'defaults'! |
4997 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4998 |
halfSeparatorSize |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4999 |
"returns size of a space-separator |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5000 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5001 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5002 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5003 |
|
1699 | 5004 |
separatorSize |
616 | 5005 |
"returns size of a separator |
5006 |
" |
|
1699 | 5007 |
^ 10 |
616 | 5008 |
! |
5009 |
||
5010 |
updateStyleCache |
|
2777 | 5011 |
"extract values from the styleSheet and cache them in class variables" |
5012 |
||
1765 | 5013 |
<resource: #style (#'menuPanel.verticalInset')> |
5014 |
||
1699 | 5015 |
HorizontalInset := 2. |
1765 | 5016 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
5017 |
VerticalPopUpInset := 2. |
|
727 | 5018 |
|
5019 |
HorizontalButtonInset := 3. |
|
5020 |
VerticalButtonInset := 3. |
|
5021 |
||
681 | 5022 |
LabelRightOffset := 15. |
1765 | 5023 |
|
2777 | 5024 |
" |
5025 |
self updateStyleCache |
|
5026 |
" |
|
1124 | 5027 |
! ! |
1078 | 5028 |
|
388 | 5029 |
!MenuPanel::Item class methodsFor:'instance creation'! |
5030 |
||
5031 |
in:aSuperMenu |
|
5032 |
^ self in:aSuperMenu label:nil |
|
5033 |
! |
|
5034 |
||
5035 |
in:aSuperMenu label:aLabel |
|
5036 |
|item| |
|
5037 |
||
5038 |
item := self new in:aSuperMenu. |
|
5039 |
item label:aLabel. |
|
5040 |
^ item |
|
5041 |
! |
|
5042 |
||
5043 |
in:aSuperMenu menuItem:aMenuItem |
|
5044 |
|item| |
|
5045 |
||
5046 |
item := self in:aSuperMenu. |
|
5047 |
item menuItem:aMenuItem. |
|
5048 |
^ item. |
|
2359 | 5049 |
! |
5050 |
||
5051 |
new |
|
5052 |
^ self basicNew initialize |
|
388 | 5053 |
! ! |
5054 |
||
1808 | 5055 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 5056 |
|
420 | 5057 |
canAccept |
5058 |
"returns true if item is acceptable |
|
5059 |
" |
|
2199 | 5060 |
self enabled ifFalse:[ ^ false]. |
5061 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5062 |
||
5063 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
5064 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 5065 |
! |
5066 |
||
5067 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5068 |
"toggle indication or choice |
524 | 5069 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5070 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5071 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5072 |
indication notNil ifTrue:[ |
2359 | 5073 |
arg := self indicationValue not. |
5074 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5075 |
] ifFalse:[ |
2359 | 5076 |
choice notNil ifTrue:[ |
5077 |
choice value:(menuItem choiceValue). |
|
5078 |
^ true |
|
5079 |
] |
|
524 | 5080 |
]. |
5081 |
^ arg |
|
389 | 5082 |
! ! |
5083 |
||
388 | 5084 |
!MenuPanel::Item methodsFor:'accessing'! |
5085 |
||
5086 |
accessCharacter |
|
389 | 5087 |
"returns my accessCharacter or nil |
388 | 5088 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5089 |
^ accessCharacter |
388 | 5090 |
! |
5091 |
||
5092 |
accessCharacterPosition |
|
390 | 5093 |
"get the access character position or nil |
388 | 5094 |
" |
2359 | 5095 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5096 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5097 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5098 |
accessCharacterPosition:anIndex |
390 | 5099 |
"set the access character position or nil |
388 | 5100 |
" |
2359 | 5101 |
menuItem accessCharacterPosition:anIndex. |
388 | 5102 |
! |
5103 |
||
5104 |
argument |
|
5105 |
"gets the argument |
|
5106 |
" |
|
2359 | 5107 |
^ menuItem argument |
388 | 5108 |
! |
5109 |
||
5110 |
argument:anArgument |
|
5111 |
"sets the argument |
|
5112 |
" |
|
2359 | 5113 |
menuItem argument:anArgument. |
389 | 5114 |
! |
5115 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5116 |
displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5117 |
"returns my printable Label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5118 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5119 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5120 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5121 |
|
2614 | 5122 |
displayLabelExtent |
5123 |
"returns the labelExtent |
|
5124 |
" |
|
5125 |
|prevFont w h| |
|
5126 |
||
5127 |
displayLabelExtent notNil ifTrue:[ |
|
5128 |
^ displayLabelExtent |
|
5129 |
]. |
|
5130 |
||
5131 |
displayLabel isNil ifTrue:[ |
|
5132 |
displayLabelExtent := 0@0. |
|
5133 |
^ displayLabelExtent |
|
5134 |
]. |
|
5135 |
prevFont := menuPanel setFont:(self font). |
|
5136 |
||
5137 |
displayLabel isArray ifTrue:[ |
|
5138 |
w := h := 0. |
|
5139 |
||
5140 |
displayLabel do:[:aSubLabel| |
|
5141 |
aSubLabel notNil ifTrue:[ |
|
5142 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5143 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5144 |
] ifFalse:[ |
|
5145 |
h := h + (self spaceBetweenEmptyLines) |
|
5146 |
] |
|
5147 |
] |
|
5148 |
] ifFalse:[ |
|
5149 |
w := displayLabel widthOn:menuPanel. |
|
5150 |
h := displayLabel heightOn:menuPanel. |
|
5151 |
]. |
|
5152 |
"/ care for italic fonts - give a few more pixels at the end |
|
5153 |
menuPanel font italic ifTrue:[ |
|
5154 |
w := w + 2. |
|
5155 |
]. |
|
5156 |
displayLabelExtent := w@h. |
|
5157 |
||
5158 |
prevFont notNil ifTrue:[ |
|
5159 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5160 |
]. |
|
5161 |
^ displayLabelExtent |
|
5162 |
! |
|
5163 |
||
1727 | 5164 |
font |
5165 |
"returns the user configured font or nil (default menu font) |
|
5166 |
" |
|
2373 | 5167 |
|font| |
5168 |
||
5169 |
menuPanel isNil ifTrue:[^ nil]. |
|
5170 |
||
5171 |
font := menuItem font. |
|
5172 |
||
5173 |
font notNil ifTrue:[ |
|
5174 |
font := font onDevice:(menuPanel device). |
|
5175 |
menuItem font:font. |
|
5176 |
]. |
|
1727 | 5177 |
^ font |
5178 |
! |
|
5179 |
||
5180 |
font:aFont |
|
5181 |
"returns the user configured font or nil (default menu font) |
|
5182 |
" |
|
2373 | 5183 |
menuItem font:aFont. |
1727 | 5184 |
! |
5185 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5186 |
ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5187 |
"if true, mnemonic (access character) in the submenus under the item are ignored |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5188 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5189 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5190 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5191 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5192 |
ignoreMnemonicKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5193 |
"if true, mnemonic (access character) in the submenus under the item are ignored |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5194 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5195 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5196 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5197 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5198 |
ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5199 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5200 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5201 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5202 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5203 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5204 |
ignoreShortcutKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5205 |
"if true, shortcutKeys (accelerators) in the submenus under the item are ignored |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5206 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5207 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5208 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5209 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5210 |
itemValue |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5211 |
"gets value |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5212 |
" |
2360 | 5213 |
^ menuItem itemValue |
5214 |
! |
|
5215 |
||
5216 |
itemValue:aValue |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5217 |
"argument could be a value holder, an action or selector |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5218 |
" |
2360 | 5219 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5220 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5221 |
|
388 | 5222 |
label |
5223 |
"returns the label |
|
5224 |
" |
|
5225 |
^ label |
|
5226 |
! |
|
5227 |
||
5228 |
label:aLabel |
|
399 | 5229 |
"set a new label; if the label changed, a redraw is performed; |
5230 |
handle characters $& (ST-80 compatibility) |
|
388 | 5231 |
" |
2614 | 5232 |
|size char oldExtent| |
5233 |
||
5234 |
oldExtent := displayLabelExtent. |
|
5235 |
displayLabelExtent := nil. "/ force a recomputation |
|
5236 |
accessCharacter := disabledDisplayLabel := nil. |
|
5237 |
label := aLabel value. |
|
5238 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5239 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5240 |
displayLabel isString ifTrue:[ |
2359 | 5241 |
"CHECK FOR SEPARATOR" |
5242 |
||
5243 |
(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
|
5244 |
size := displayLabel size. |
2359 | 5245 |
|
5246 |
size == 0 ifTrue:[ |
|
2614 | 5247 |
displayLabel := nil. "blank separator" |
2359 | 5248 |
^ self |
5249 |
]. |
|
5250 |
||
5251 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5252 |
char := displayLabel first. |
2359 | 5253 |
|
5254 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5255 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5256 |
displayLabel := nil. |
2359 | 5257 |
^ self |
5258 |
] |
|
5259 |
] |
|
5260 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5261 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5262 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5263 |
displayLabel := displayLabel asArray. |
2359 | 5264 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5265 |
]. |
2614 | 5266 |
displayLabel notNil ifTrue:[ |
5267 |
displayLabel isArray ifTrue:[ |
|
5268 |
displayLabel keysAndValuesDo:[:i :el| |
|
5269 |
el notNil ifTrue:[ |
|
5270 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
5271 |
]. |
|
5272 |
]. |
|
5273 |
] ifFalse:[ |
|
5274 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
5275 |
]. |
|
5276 |
]. |
|
5277 |
||
5278 |
menuPanel shown ifTrue:[ |
|
5279 |
self fetchImages. |
|
5280 |
||
5281 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5282 |
self invalidate |
|
5283 |
] ifFalse:[ |
|
5284 |
menuPanel mustRearrange |
|
2359 | 5285 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5286 |
]. |
388 | 5287 |
! |
5288 |
||
5289 |
menuPanel |
|
5290 |
"returns my menuPanel |
|
5291 |
" |
|
399 | 5292 |
^ menuPanel |
388 | 5293 |
! |
5294 |
||
5295 |
nameKey |
|
5296 |
"gets the nameKey |
|
5297 |
" |
|
2359 | 5298 |
^ menuItem nameKey |
388 | 5299 |
! |
5300 |
||
5301 |
nameKey:aNameKey |
|
5302 |
"sets the nameKey |
|
5303 |
" |
|
2359 | 5304 |
menuItem nameKey:aNameKey. |
388 | 5305 |
! |
5306 |
||
5307 |
rawLabel |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5308 |
"returns my raw, unprocessed label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5309 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5310 |
^ menuItem rawLabel |
388 | 5311 |
! |
5312 |
||
5313 |
shortcutKey |
|
5314 |
"get the key to press to select the submenu from the keyboard or if |
|
5315 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5316 |
" |
|
2359 | 5317 |
^ menuItem shortcutKey |
388 | 5318 |
! |
5319 |
||
5320 |
shortcutKey:aKey |
|
5321 |
"set the key to press to select the submenu from the keyboard or if |
|
5322 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5323 |
" |
|
2359 | 5324 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5325 |
menuItem shortcutKey:aKey. |
|
5326 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5327 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5328 |
! |
388 | 5329 |
|
710 | 5330 |
startGroup |
5331 |
"start group #left #right #center ... or nil |
|
5332 |
at the moment only #right is implemented |
|
5333 |
" |
|
2359 | 5334 |
^ menuItem startGroup |
710 | 5335 |
! |
5336 |
||
5337 |
startGroup:aSymbol |
|
5338 |
"start group #left #right #center ... |
|
5339 |
at the moment only #right is implemented |
|
5340 |
" |
|
2359 | 5341 |
menuItem startGroup:aSymbol. |
710 | 5342 |
! |
5343 |
||
388 | 5344 |
submenu |
5345 |
"returns my submenu or nil |
|
5346 |
" |
|
464 | 5347 |
subMenu notNil ifTrue:[^ subMenu]. |
5348 |
^ self setupSubmenu |
|
388 | 5349 |
! |
5350 |
||
5351 |
submenu:aSubMenu |
|
5352 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
5353 |
to a redraw if 'hasSubmenu' changed |
|
5354 |
" |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5355 |
|widget| |
1767 | 5356 |
|
5357 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5358 |
subMenu notNil ifTrue:[ |
5359 |
subMenu destroy. |
|
5360 |
subMenu := nil. |
|
5361 |
]. |
|
5362 |
^ self |
|
1767 | 5363 |
]. |
5364 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5365 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5366 |
subMenu := MenuPanel new. |
5367 |
||
5368 |
menuPanel notNil ifTrue:[ |
|
5369 |
subMenu receiver:menuPanel receiver. |
|
5370 |
]. |
|
5371 |
subMenu superMenu:menuPanel. |
|
5372 |
||
5373 |
menuItem horizontalLayout == true ifTrue:[ |
|
5374 |
subMenu verticalLayout:false |
|
5375 |
]. |
|
5376 |
subMenu menu:aSubMenu. |
|
1767 | 5377 |
] ifFalse:[ |
2360 | 5378 |
aSubMenu isView ifFalse:[ |
5379 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5380 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5381 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5382 |
]. |
5383 |
widget := SimpleView new. |
|
5384 |
widget client:aSubMenu. |
|
5385 |
] ifTrue:[ |
|
2827 | 5386 |
widget := aSubMenu. |
5387 |
subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[]. |
|
2360 | 5388 |
]. |
5389 |
||
5390 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5391 |
subMenu := widget. |
|
5392 |
||
5393 |
menuItem horizontalLayout == true ifTrue:[ |
|
5394 |
subMenu verticalLayout:false |
|
5395 |
]. |
|
5396 |
] ifFalse:[ |
|
5397 |
subMenu := MenuPanel new. |
|
5398 |
subMenu receiver:menuPanel receiver. |
|
5399 |
subMenu addSubView:widget. |
|
5400 |
subMenu extent:(widget preferredExtent). |
|
5401 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5402 |
]. |
|
5403 |
subMenu superMenu:menuPanel. |
|
5404 |
]. |
|
389 | 5405 |
! |
5406 |
||
390 | 5407 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5408 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5409 |
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
|
5410 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5411 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5412 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5413 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5414 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5415 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5416 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5417 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5418 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5419 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5420 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5421 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5422 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5423 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5424 |
^ nil |
390 | 5425 |
! |
5426 |
||
1841 | 5427 |
triggerOnDown |
5428 |
"trigger the action if pressed |
|
5429 |
" |
|
2359 | 5430 |
menuItem triggerOnDown ifTrue:[ |
5431 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5432 |
]. |
5433 |
^ false |
|
5434 |
! |
|
5435 |
||
5436 |
triggerOnDown:aBool |
|
5437 |
"trigger the action if pressed |
|
5438 |
" |
|
2359 | 5439 |
menuItem triggerOnDown:aBool. |
1841 | 5440 |
! |
5441 |
||
389 | 5442 |
value |
5443 |
"gets value |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5444 |
Left here for ST80 compatibility - value is a bad name |
389 | 5445 |
" |
2360 | 5446 |
^ menuItem itemValue |
5447 |
! |
|
5448 |
||
5449 |
value:aValue |
|
389 | 5450 |
"could be a value holder, an action or selector |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5451 |
Left here for ST80 compatibility - value: is a bad name |
389 | 5452 |
" |
2360 | 5453 |
menuItem itemValue:aValue. |
502 | 5454 |
! |
5455 |
||
5456 |
value:aValue argument:anArgument |
|
5457 |
"set the value and an argument |
|
5458 |
" |
|
2360 | 5459 |
menuItem itemValue:aValue. |
5460 |
menuItem argument:anArgument. |
|
388 | 5461 |
! ! |
5462 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5463 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5464 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5465 |
choice |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5466 |
"implements a radio group; the field |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5467 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5468 |
^ choice |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5469 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5470 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5471 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5472 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5473 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5474 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5475 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5476 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5477 |
choice isValueModel ifTrue:[ |
2219 | 5478 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5479 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5480 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5481 |
(choice := something) notNil ifTrue:[ |
2219 | 5482 |
choice isSymbol ifTrue:[ |
5483 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5484 |
choice := something |
|
5485 |
] |
|
5486 |
]. |
|
5487 |
choice isValueModel ifTrue:[ |
|
5488 |
choice addDependent:self |
|
5489 |
] |
|
1699 | 5490 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5491 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5492 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5493 |
choiceValue |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5494 |
"implements a radio group; the value writen to the choice if selected |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5495 |
" |
2359 | 5496 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5497 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5498 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5499 |
choiceValue:something |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5500 |
"implements a radio group; the value writen to the choice if selected |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5501 |
" |
2359 | 5502 |
menuItem choiceValue ~= something ifTrue:[ |
5503 |
menuItem choiceValue:something. |
|
5504 |
choice notNil ifTrue:[ self invalidate ]. |
|
5505 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5506 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5507 |
|
388 | 5508 |
enabled |
5509 |
"returns the enabled state |
|
5510 |
" |
|
524 | 5511 |
|state| |
5512 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5513 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5514 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5515 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5516 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5517 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5518 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5519 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5520 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5521 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5522 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5523 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5524 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5525 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5526 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5527 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5528 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5529 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5530 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5531 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5532 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5533 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5534 |
^ state ~~ false |
388 | 5535 |
! |
5536 |
||
389 | 5537 |
enabled:something |
388 | 5538 |
"change the enabled state; if the state changed, a redraw is performed |
5539 |
" |
|
390 | 5540 |
|oldState newState| |
5541 |
||
5542 |
enableChannel isNil ifTrue:[ |
|
2219 | 5543 |
oldState := true |
390 | 5544 |
] ifFalse:[ |
2219 | 5545 |
oldState := enableChannel value. |
5546 |
enableChannel isValueModel ifTrue:[ |
|
5547 |
enableChannel removeDependent:self |
|
5548 |
] |
|
388 | 5549 |
]. |
390 | 5550 |
enableChannel := something. |
5551 |
||
5552 |
enableChannel isNil ifTrue:[ |
|
2219 | 5553 |
menuPanel shown ifFalse:[^ self]. |
5554 |
newState := true |
|
390 | 5555 |
] ifFalse:[ |
2219 | 5556 |
enableChannel isValueModel ifTrue:[ |
5557 |
enableChannel addDependent:self |
|
5558 |
] ifFalse:[ |
|
5559 |
enableChannel isSymbol ifTrue:[^ self] |
|
5560 |
]. |
|
5561 |
menuPanel shown ifFalse:[^ self]. |
|
5562 |
newState := enableChannel value. |
|
390 | 5563 |
]. |
5564 |
||
5565 |
newState ~~ oldState ifTrue:[ |
|
2219 | 5566 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5567 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5568 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5569 |
|
1670 | 5570 |
hideMenuOnActivated |
5571 |
"hide the menu when the item was activated; the default is true |
|
5572 |
" |
|
2359 | 5573 |
^ menuItem hideMenuOnActivated |
1670 | 5574 |
! |
5575 |
||
5576 |
hideMenuOnActivated:aBool |
|
5577 |
"hide the menu when the item was activated; the default is true |
|
5578 |
" |
|
2359 | 5579 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5580 |
! |
5581 |
||
2216 | 5582 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5583 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5584 |
||
5585 |
(menuPanel receiver isNil |
|
5586 |
and:[ menuPanel application notNil |
|
5587 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5588 |
ifTrue:[ |
|
2219 | 5589 |
^ self "/ suppressed |
2216 | 5590 |
]. |
5591 |
aMessage infoPrintCR |
|
5592 |
! |
|
5593 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5594 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5595 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5596 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5597 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5598 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5599 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5600 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5601 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5602 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5603 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5604 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5605 |
indication isValueModel ifTrue:[ |
2219 | 5606 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5607 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5608 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5609 |
(indication := something) notNil ifTrue:[ |
2219 | 5610 |
indication isValueModel ifTrue:[ |
5611 |
indication addDependent:self |
|
5612 |
] ifFalse:[ |
|
5613 |
"/ to force an update of the value |
|
5614 |
self indicationValue |
|
5615 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5616 |
]. |
464 | 5617 |
! |
5618 |
||
1767 | 5619 |
keepLinkedMenu |
5620 |
"get the keepLinkedMenu flag |
|
5621 |
" |
|
2359 | 5622 |
^ menuItem keepLinkedMenu |
5623 |
! |
|
5624 |
||
5625 |
keepLinkedMenu:aBool |
|
1767 | 5626 |
"get the keepLinkedMenu flag |
5627 |
" |
|
2359 | 5628 |
menuItem keepLinkedMenu:aBool. |
1767 | 5629 |
! |
5630 |
||
2331 | 5631 |
sendToOriginator |
5632 |
"if true, the message is sent to the originating widget; |
|
5633 |
otherwise (the default), it it sent to the receiver/application." |
|
5634 |
||
2359 | 5635 |
^ menuItem sendToOriginator |
2331 | 5636 |
! |
5637 |
||
5638 |
sendToOriginator:aBoolean |
|
5639 |
"if true, the message is sent to the originating widget; |
|
5640 |
otherwise (the default), it it sent to the receiver/application." |
|
5641 |
||
2359 | 5642 |
menuItem sendToOriginator:aBoolean. |
2331 | 5643 |
! |
5644 |
||
464 | 5645 |
submenuChannel |
5646 |
"get the submenu channel |
|
5647 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5648 |
^ menuItem submenuChannel |
464 | 5649 |
! |
5650 |
||
5651 |
submenuChannel:aSelectorOrNil |
|
5652 |
"returns the submenu channel |
|
5653 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5654 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5655 |
! ! |
5656 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5657 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5658 |
|
2016 | 5659 |
moveBy:aPoint |
5660 |
"move layout origin |
|
5661 |
" |
|
5662 |
layout moveBy:aPoint. |
|
5663 |
! |
|
5664 |
||
1699 | 5665 |
preferredExtent |
5666 |
"compute my preferred extent excluding the shortCutKey and the menu identifier |
|
5667 |
" |
|
2614 | 5668 |
|isVertical icon wIcon isButton labelExtent |
1699 | 5669 |
x "{ Class:SmallInteger }" |
5670 |
y "{ Class:SmallInteger }" |
|
5671 |
s "{ Class:SmallInteger }" |
|
5672 |
| |
|
5673 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5674 |
||
2359 | 5675 |
isButton := menuItem isButton. |
5676 |
||
1699 | 5677 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5678 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5679 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5680 |
y := s + VerticalButtonInset. |
1699 | 5681 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5682 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5683 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5684 |
]. |
5685 |
x := x * 2. |
|
5686 |
y := y * 2. |
|
5687 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5688 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5689 |
|
2362 | 5690 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5691 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5692 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5693 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5694 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5695 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5696 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5697 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5698 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5699 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5700 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5701 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5702 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5703 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5704 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5705 |
]. |
1699 | 5706 |
] ifFalse:[ |
2614 | 5707 |
labelExtent := self displayLabelExtent. |
5708 |
||
5709 |
x := x + labelExtent x. |
|
5710 |
y := y + labelExtent y. |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5711 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5712 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5713 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5714 |
"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
|
5715 |
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
|
5716 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5717 |
(indication notNil or:[choice notNil]) ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5718 |
x := x + 2 + menuPanel iconIndicationOff width. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5719 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5720 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5721 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5722 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5723 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5724 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5725 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5726 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5727 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5728 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5729 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5730 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5731 |
x := x + wIcon. |
1699 | 5732 |
]. |
5733 |
^ x@y |
|
388 | 5734 |
! ! |
5735 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5736 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5737 |
|
5738 |
activeHelpKey |
|
5739 |
"get the active helpKey; the key to retrieve the helpText from the application |
|
5740 |
" |
|
2359 | 5741 |
^ menuItem activeHelpKey |
1613 | 5742 |
! |
5743 |
||
5744 |
activeHelpKey:aHelpKey |
|
5745 |
"set the active helpKey; the key to retrieve the helpText from the application |
|
5746 |
" |
|
2359 | 5747 |
menuItem activeHelpKey:aHelpKey. |
5748 |
activeHelpText := nil. |
|
1613 | 5749 |
! |
5750 |
||
5751 |
activeHelpText |
|
5752 |
"get the active helpText or nil if not yet resolved |
|
5753 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5754 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5755 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5756 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5757 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5758 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5759 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5760 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5761 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5762 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5763 |
^ nil |
1613 | 5764 |
! |
5765 |
||
5766 |
activeHelpText:aText |
|
5767 |
"set the active helpText |
|
5768 |
" |
|
5769 |
activeHelpText := aText. |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5770 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5771 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5772 |
flyByHelpText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5773 |
"get the flyBy helpText or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5774 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5775 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5776 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5777 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5778 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5779 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5780 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5781 |
|
2471 | 5782 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
5783 |
"/ (if you have an argument for that let us know..) |
|
5784 |
"/ self isButton ifFalse:[^ nil]. |
|
5785 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5786 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5787 |
"/ 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
|
5788 |
key := self activeHelpKey. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5789 |
(key notNil and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5790 |
text := app flyByHelpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5791 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5792 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5793 |
"/ 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
|
5794 |
text isNil ifTrue:[ |
2676
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5795 |
self hasSubmenu ifTrue:[ |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5796 |
^ key |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5797 |
]. |
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5798 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5799 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5800 |
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
|
5801 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5802 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5803 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5804 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5805 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5806 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5807 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5808 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5809 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5810 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5811 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5812 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5813 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5814 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5815 |
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
|
5816 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5817 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5818 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5819 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5820 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5821 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5822 |
"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
|
5823 |
(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
|
5824 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5825 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5826 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5827 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5828 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5829 |
flyByHelpText:aText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5830 |
"exlicitly set the flyBy helpText. For example, to dynamically change it. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5831 |
" |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5832 |
flyByHelpText := aText. |
1613 | 5833 |
! ! |
5834 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5835 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5836 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5837 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5838 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5839 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5840 |
" |
2360 | 5841 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5842 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5843 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5844 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5845 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5846 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5847 |
" |
2360 | 5848 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5849 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5850 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5851 |
isButton |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5852 |
"returns whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5853 |
" |
2359 | 5854 |
^ menuItem isButton |
5855 |
! |
|
5856 |
||
5857 |
isButton:aBool |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5858 |
"sets whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5859 |
" |
2359 | 5860 |
menuItem isButton ~~ aBool ifTrue:[ |
5861 |
menuItem isButton:aBool. |
|
5862 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5863 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5864 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5865 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5866 |
layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5867 |
"returns my layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5868 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5869 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5870 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5871 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5872 |
layout:aLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5873 |
"set a new layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5874 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5875 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5876 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5877 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5878 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5879 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5880 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5881 |
"get the flag which controls if a busy cursor is to be shown |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5882 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5883 |
" |
2359 | 5884 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5885 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5886 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5887 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5888 |
"set/clear the flag which controls if a busy cursor is to be shown |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5889 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5890 |
" |
2359 | 5891 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5892 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5893 |
|
2504 | 5894 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 5895 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5896 |
currentSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5897 |
"returns the current submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5898 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5899 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5900 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5901 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5902 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5903 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5904 |
|
1705 | 5905 |
hideSubmenu |
5906 |
"hide submenu |
|
5907 |
" |
|
2199 | 5908 |
self hideSubmenu:subMenu. |
5909 |
! |
|
5910 |
||
5911 |
hideSubmenu:aSubmenu |
|
5912 |
"hide submenu |
|
5913 |
" |
|
1705 | 5914 |
|id| |
5915 |
||
2374 | 5916 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 5917 |
aSubmenu removeDependencies. |
2199 | 5918 |
|
5919 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5920 |
id := aSubmenu id. |
2374 | 5921 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 5922 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5923 |
aSubmenu hide |
2199 | 5924 |
]. |
5925 |
||
5926 |
aSubmenu windowGroup:nil. |
|
5927 |
menuPanel windowGroup removeView:aSubmenu. |
|
5928 |
||
5929 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5930 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5931 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5932 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5933 |
] |
2199 | 5934 |
]. |
5935 |
! |
|
5936 |
||
5937 |
openDelayedSubmenu |
|
5938 |
"called to open now my delayed submenu |
|
5939 |
" |
|
5940 |
|subm| |
|
5941 |
||
5942 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
5943 |
||
2374 | 5944 |
subMenu notNil ifTrue:[ |
5945 |
subMenu realized ifTrue:[ |
|
5946 |
"/ already open |
|
5947 |
^ self |
|
5948 |
]. |
|
2199 | 5949 |
]. |
5950 |
subm := self setupSubmenu. |
|
2374 | 5951 |
subm isNil ifTrue:[^ self]. |
2199 | 5952 |
|
5953 |
self openSubmenu. |
|
5954 |
||
5955 |
(subm == subMenu and:[self isSelected]) ifFalse:[ |
|
2374 | 5956 |
"/ closed during building or opening the submenu |
5957 |
self hideSubmenu:subm. |
|
2199 | 5958 |
]. |
1705 | 5959 |
! |
1701 | 5960 |
|
5961 |
openSubmenu |
|
5962 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
5963 |
is fully visible by shifting it into the visible screen area if |
|
5964 |
nescessary. |
|
5965 |
" |
|
2249 | 5966 |
|p o device isVertical topMenu windGrp prefExtent |
1701 | 5967 |
devBot "{ Class:SmallInteger }" |
5968 |
devRight "{ Class:SmallInteger }" |
|
5969 |
width "{ Class:SmallInteger }" |
|
5970 |
height "{ Class:SmallInteger }" |
|
5971 |
top "{ Class:SmallInteger }" |
|
5972 |
left "{ Class:SmallInteger }" |
|
5973 |
| |
|
5974 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
5975 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 5976 |
^ self |
1701 | 5977 |
]. |
5978 |
||
5979 |
topMenu := menuPanel topMenu. |
|
1829 | 5980 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 5981 |
subMenu releaseDeviceResources. |
5982 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
5983 |
subMenu recreate. |
|
1829 | 5984 |
]. |
5985 |
||
1701 | 5986 |
windGrp := topMenu windowGroup. |
5987 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5988 |
subMenu superMenu:menuPanel. |
1701 | 5989 |
subMenu becomesActiveMenu. |
5990 |
subMenu cursor:Cursor hand. |
|
5991 |
||
5992 |
windGrp notNil ifTrue:[ |
|
2249 | 5993 |
subMenu windowGroup:windGrp. |
5994 |
windGrp addTopView:subMenu. |
|
1701 | 5995 |
]. |
5996 |
||
2111 | 5997 |
"Q&D kludge - test whether the layout is nil; |
2249 | 5998 |
if true recompute the layouts |
2111 | 5999 |
" |
2374 | 6000 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 6001 |
|
1701 | 6002 |
" Q&D kludge - if any visibility attributes are blocks; |
6003 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 6004 |
(since I react correctly on valueHolder changes) |
1701 | 6005 |
" |
6006 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
6007 |
subMenu fixSize. |
|
6008 |
||
6009 |
"compute origin of subMenu |
|
6010 |
" |
|
6011 |
isVertical := menuPanel verticalLayout. |
|
6012 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6013 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6014 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
6015 |
width := prefExtent x. |
1701 | 6016 |
devBot := device usableHeight. |
6017 |
devRight := device usableWidth. |
|
6018 |
||
6019 |
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
|
6020 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6021 |
menuPanel isPopUpView ifTrue:[ |
2249 | 6022 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6023 |
] ifFalse:[ |
2249 | 6024 |
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
|
6025 |
]. |
1701 | 6026 |
left := o x. |
6027 |
top := o y. |
|
6028 |
||
2016 | 6029 |
top + height > devBot ifTrue:[ |
2249 | 6030 |
top := isVertical ifTrue:[devBot - height] |
6031 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 6032 |
]. |
6033 |
top := top max:0. |
|
6034 |
||
6035 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
6036 |
"/ top < menuPanel bottom ifTrue:[ |
|
6037 |
"/ left := left + layout width. |
|
6038 |
"/ ]. |
|
6039 |
"/ left + width > devRight ifTrue:[ |
|
6040 |
"/ left := o x - width - 2 |
|
6041 |
"/ ]. |
|
6042 |
"/ ]. |
|
6043 |
||
1701 | 6044 |
left + width > devRight ifTrue:[ |
2249 | 6045 |
left := isVertical ifTrue:[left - layout width - width + 2] |
6046 |
ifFalse:[devRight - width] |
|
1701 | 6047 |
]. |
6048 |
left := left max:0. |
|
6049 |
||
6050 |
subMenu origin:(left@top). |
|
6051 |
||
6052 |
subMenu realized ifFalse:[ |
|
2249 | 6053 |
subMenu realize. |
1701 | 6054 |
] ifTrue:[ |
2249 | 6055 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6056 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6057 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6058 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6059 |
toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6060 |
"toggle the visibility of the submenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6061 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6062 |
subMenu notNil ifTrue:[ |
2219 | 6063 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6064 |
] ifFalse:[ |
2219 | 6065 |
(subMenu := self setupSubmenu) isNil ifTrue:[ |
6066 |
"/ cannot open a submenu |
|
6067 |
^ self |
|
6068 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6069 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6070 |
self openSubmenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6071 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6072 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6073 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6074 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6075 |
visibleSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6076 |
"returns the current visible submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6077 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6078 |
subMenu notNil ifTrue:[ |
2219 | 6079 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6080 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6081 |
^ nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6082 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6083 |
|
1701 | 6084 |
|
6085 |
! ! |
|
6086 |
||
524 | 6087 |
!MenuPanel::Item methodsFor:'building'! |
6088 |
||
6089 |
aspectAt:aKey |
|
6090 |
"retursns value assigned to key or nil |
|
6091 |
" |
|
6092 |
|appl value| |
|
6093 |
||
6094 |
appl := menuPanel receiver. |
|
6095 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6096 |
(appl isValueModel) ifTrue:[ |
2359 | 6097 |
^ appl value:aKey |
524 | 6098 |
]. |
6099 |
||
2123 | 6100 |
appl isNil ifTrue:[ |
2359 | 6101 |
appl := menuPanel application. |
2123 | 6102 |
]. |
6103 |
appl isNil ifTrue:[ ^ nil]. |
|
6104 |
||
6105 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 6106 |
ex selector == aKey ifFalse:[ |
6107 |
ex reject |
|
6108 |
]. |
|
6109 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 6110 |
('MenuPanel::Item [info]: application (%1) does not provide aspect: %2' |
6111 |
bindWith:appl classNameWithArticle with:aKey). |
|
2123 | 6112 |
] do:[ |
2359 | 6113 |
aKey numArgs == 1 ifTrue:[ |
6114 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6115 |
] ifFalse:[ |
|
6116 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6117 |
value := appl aspectFor:aKey |
|
6118 |
] ifFalse:[ |
|
6119 |
value := appl perform:aKey |
|
6120 |
] |
|
6121 |
] |
|
524 | 6122 |
]. |
6123 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6124 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6125 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 6126 |
! ! |
6127 |
||
390 | 6128 |
!MenuPanel::Item methodsFor:'change & update'! |
6129 |
||
2614 | 6130 |
fontChanged |
6131 |
"called whenever the font changed |
|
6132 |
" |
|
6133 |
displayLabel notNil ifTrue:[ |
|
6134 |
displayLabelExtent := nil. |
|
6135 |
||
6136 |
subMenu notNil ifTrue:[ |
|
6137 |
subMenu font:(menuPanel font). |
|
6138 |
]. |
|
6139 |
]. |
|
6140 |
! |
|
6141 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6142 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6143 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6144 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6145 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6146 |
(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
|
6147 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6148 |
self isSeparator ifFalse:[ |
2359 | 6149 |
"/ NOT A SEPARATOR |
6150 |
||
6151 |
menuPanel shown ifTrue:[ |
|
6152 |
changedObject == enableChannel ifTrue:[ |
|
6153 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6154 |
^ menuPanel selection:nil. |
|
6155 |
]. |
|
6156 |
^ self invalidate |
|
6157 |
]. |
|
6158 |
||
6159 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6160 |
menuItem isButton ifTrue:[ |
|
6161 |
self invalidate |
|
6162 |
] ifFalse:[ |
|
6163 |
"/ invalidate the interactor only |
|
6164 |
"/ take any interactor; interactors has the same extent |
|
6165 |
form := menuPanel iconIndicationOff. |
|
6166 |
||
6167 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6168 |
top:(layout top) |
|
6169 |
width:(form width) |
|
6170 |
height:(layout height). |
|
6171 |
||
6172 |
menuPanel invalidate:rect repairNow:false |
|
6173 |
]. |
|
6174 |
^ self |
|
6175 |
]. |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6176 |
self invalidate. |
2359 | 6177 |
]. |
498 | 6178 |
]. |
712 | 6179 |
|
6180 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6181 |
menuPanel mustRearrange. |
6182 |
menuPanel rearrangeItems. |
|
6183 |
^ self. |
|
712 | 6184 |
]. |
6185 |
||
498 | 6186 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6187 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6188 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6189 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6190 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6191 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6192 |
(indication notNil and:[indication isSymbol]) ifTrue:[ |
2219 | 6193 |
" indication is a selector otherwise a change notification |
6194 |
is raised from the model !!!! |
|
6195 |
" |
|
6196 |
self update:nil with:nil from:indication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6197 |
] |
390 | 6198 |
! ! |
6199 |
||
388 | 6200 |
!MenuPanel::Item methodsFor:'converting'! |
6201 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6202 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6203 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6204 |
" |
2359 | 6205 |
^ menuItem |
388 | 6206 |
! |
6207 |
||
2827 | 6208 |
menuItem |
6209 |
^ menuItem |
|
6210 |
! |
|
6211 |
||
388 | 6212 |
menuItem:aMenuItem |
6213 |
"setup attributes from a MenuItem |
|
6214 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6215 |
|lbl| |
389 | 6216 |
|
388 | 6217 |
menuPanel disabledRedrawDo:[ |
2359 | 6218 |
menuItem := aMenuItem. |
6219 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6220 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6221 |
label := displayLabel := activeHelpText := nil. |
2359 | 6222 |
|
6223 |
self enabled:(menuItem enabled). |
|
6224 |
self indication:(menuItem indication). |
|
6225 |
self choice:(menuItem choice). |
|
6226 |
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
|
6227 |
|
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6228 |
"/ 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
|
6229 |
"/ but ... ?? |
2855
c7f3481ff14a
redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents:
2844
diff
changeset
|
6230 |
|
2359 | 6231 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6232 |
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
|
6233 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6234 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6235 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6236 |
self label:lbl. |
388 | 6237 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6238 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6239 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6240 |
! ! |
6241 |
||
2681 | 6242 |
!MenuPanel::Item methodsFor:'dependents access'! |
6243 |
||
6244 |
addDependencies |
|
6245 |
"add all dependencies |
|
6246 |
" |
|
6247 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
|
6248 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
6249 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
6250 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
6251 |
! |
|
6252 |
||
6253 |
removeDependencies |
|
6254 |
"remove all dependencies |
|
6255 |
" |
|
6256 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
|
6257 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
6258 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
6259 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
6260 |
! ! |
|
6261 |
||
388 | 6262 |
!MenuPanel::Item methodsFor:'drawing'! |
6263 |
||
2768 | 6264 |
choiceForm |
6265 |
"returns choice form or nil |
|
6266 |
" |
|
6267 |
|isOn| |
|
6268 |
||
6269 |
choice isNil ifTrue:[^ nil]. |
|
6270 |
||
6271 |
isOn := (choice value = menuItem choiceValue). |
|
6272 |
self enabled ifFalse:[ |
|
6273 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
|
6274 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
6275 |
]. |
|
6276 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
|
6277 |
ifFalse:[menuPanel iconRadioGroupOff] |
|
6278 |
! |
|
6279 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6280 |
draw |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6281 |
"redraw item |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6282 |
" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6283 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6284 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6285 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6286 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6287 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6288 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6289 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6290 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6291 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6292 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6293 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6294 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6295 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6296 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6297 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6298 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6299 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6300 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6301 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6302 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6303 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6304 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6305 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6306 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6307 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6308 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6309 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6310 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6311 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6312 |
]]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6313 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6314 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6315 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6316 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6317 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6318 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6319 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6320 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6321 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6322 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6323 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6324 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6325 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6326 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6327 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6328 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6329 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6330 |
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
|
6331 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6332 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6333 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6334 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6335 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6336 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6337 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6338 |
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
|
6339 |
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
|
6340 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6341 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6342 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6343 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6344 |
drawButton |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6345 |
"draw as button |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6346 |
" |
2362 | 6347 |
|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
|
6348 |
x "{ Class:SmallInteger }" |
2143 | 6349 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6350 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6351 |
drawObject := displayLabel. |
2362 | 6352 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6353 |
isSelected := self isSelected. |
2362 | 6354 |
|
6355 |
isSelected ifFalse:[ |
|
6356 |
"/ test whether button has pressed toggle behaviour |
|
6357 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6358 |
] ifTrue:[ |
|
6359 |
showSelected := isSelected |
|
6360 |
]. |
|
6361 |
||
6362 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6363 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6364 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6365 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6366 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6367 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6368 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6369 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6370 |
]. |
2059 | 6371 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6372 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6373 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6374 |
fg := menuPanel disabledForegroundColor. |
2059 | 6375 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6376 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6377 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6378 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6379 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6380 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6381 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6382 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6383 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6384 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6385 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6386 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6387 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6388 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6389 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6390 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6391 |
|
6392 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6393 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6394 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6395 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6396 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6397 |
"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
|
6398 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6399 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6400 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6401 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6402 |
] ifFalse:[ |
2359 | 6403 |
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
|
6404 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6405 |
]. |
2143 | 6406 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6407 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6408 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6409 |
level := menuPanel buttonActiveLevel. |
2142 | 6410 |
x := x + 1 "level abs". |
2143 | 6411 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6412 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6413 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6414 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6415 |
]. |
6416 |
||
2817 | 6417 |
drawObject notEmptyOrNil ifTrue:[ |
2362 | 6418 |
etchFg notNil ifTrue:[ |
6419 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6420 |
]. |
|
6421 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6422 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6423 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6424 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6425 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6426 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6427 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6428 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6429 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6430 |
drawLabel |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6431 |
"draw a labeled entry; no button, no separator. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6432 |
" |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6433 |
|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
|
6434 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6435 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6436 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6437 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6438 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6439 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6440 |
drawObject := displayLabel. |
2362 | 6441 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6442 |
isSelected := self isSelected. |
2362 | 6443 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6444 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6445 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6446 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6447 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6448 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6449 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6450 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6451 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6452 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6453 |
] ifFalse:[ |
2362 | 6454 |
fg := menuPanel disabledForegroundColor. |
6455 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6456 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6457 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6458 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6459 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6460 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6461 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6462 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6463 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6464 |
((form := self indicatorForm) notNil or:[(form := self choiceForm) notNil]) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6465 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6466 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6467 |
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
|
6468 |
x := x + 2 + form width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6469 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6470 |
|
2817 | 6471 |
drawObject notEmptyOrNil ifTrue:[ |
2362 | 6472 |
etchFg notNil ifTrue:[ |
6473 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6474 |
]. |
|
6475 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6476 |
]. |
|
6477 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6478 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6479 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6480 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6481 |
|
2359 | 6482 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6483 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6484 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6485 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6486 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6487 |
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
|
6488 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6489 |
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
|
6490 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6491 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6492 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6493 |
|
2362 | 6494 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6495 |
^ self |
|
6496 |
]. |
|
6497 |
arrow := menuPanel rightArrow. |
|
6498 |
x := layout right - arrow width - HorizontalInset. |
|
6499 |
y := t + (h - arrow height // 2). |
|
6500 |
||
6501 |
(menuPanel styleSheet is3D not |
|
6502 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6503 |
^ menuPanel displayForm:arrow x:x y:y |
|
6504 |
]. |
|
6505 |
cLa := menuPanel shadowColor. |
|
6506 |
cLb := menuPanel lightColor. |
|
6507 |
||
6508 |
isSelected ifFalse:[ |
|
6509 |
fg := cLa. |
|
6510 |
cLa := cLb. |
|
6511 |
cLb := fg |
|
6512 |
]. |
|
6513 |
menuPanel paint:cLa. |
|
6514 |
menuPanel displayForm:arrow x:x y:y. |
|
6515 |
menuPanel paint:cLb. |
|
6516 |
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
|
6517 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6518 |
"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
|
6519 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6520 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6521 |
drawMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6522 |
"draw a menu indicator if the item has a menu or delayed menu. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6523 |
" |
2220 | 6524 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6525 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6526 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6527 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6528 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6529 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6530 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6531 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6532 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6533 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6534 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6535 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6536 |
x := layout right - icon width. |
2460 | 6537 |
false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[ |
2220 | 6538 |
y := layout height - icon height // 2 + layout top. |
6539 |
] ifFalse:[ |
|
6540 |
y := layout bottom - icon height - 2. |
|
6541 |
]. |
|
6542 |
||
6543 |
bAbsLevel := 0. |
|
2359 | 6544 |
menuItem isButton ifTrue:[ |
2220 | 6545 |
self isSelected ifTrue:[ |
6546 |
x := x + 1. |
|
6547 |
y := y + 1. |
|
6548 |
]. |
|
6549 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6550 |
x := x - bAbsLevel. |
|
6551 |
y := y - bAbsLevel. |
|
6552 |
]. |
|
6553 |
x := x - 1 "- HorizontalInset". |
|
6554 |
||
6555 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6556 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6557 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6558 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6559 |
|
2234 | 6560 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2761 | 6561 |
ifTrue:[ |
2220 | 6562 |
menuPanel paint:menuPanel buttonShadowColor. |
6563 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6564 |
menuPanel paint:menuPanel buttonLightColor. |
|
6565 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6566 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6567 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6568 |
|
2059 | 6569 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6570 |
"draw a labeled entry; no button, no separator. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6571 |
" |
2614 | 6572 |
|mfont labelExtent |
1727 | 6573 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6574 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6575 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6576 |
| |
2059 | 6577 |
|
2373 | 6578 |
mfont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6579 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6580 |
menuPanel paint:fg. |
2614 | 6581 |
labelExtent := self displayLabelExtent. |
6582 |
||
6583 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 6584 |
"/ menuPanel centerItems ifTrue:[self halt]. |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6585 |
aLabel isArray ifFalse:[ |printLabel| |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6586 |
aLabel isText ifTrue:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6587 |
"/background of label already drawn |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6588 |
printLabel := aLabel withoutEmphasis:#backgroundColor. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6589 |
] ifFalse:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6590 |
printLabel := aLabel. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6591 |
]. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6592 |
y := y + (printLabel ascentOn:menuPanel). |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6593 |
printLabel displayOn:menuPanel x:x y:y. |
1727 | 6594 |
] ifTrue:[ |
2337 | 6595 |
aLabel do:[:el| |
6596 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6597 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6598 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6599 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6600 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6601 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6602 |
"/ ]. |
2614 | 6603 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 6604 |
el displayOn:menuPanel x:x0 y:y0. |
6605 |
y := y + 1 + (el heightOn:menuPanel) |
|
6606 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6607 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 6608 |
] |
6609 |
]. |
|
1727 | 6610 |
]. |
6611 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6612 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6613 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6614 |
drawSeparatingLines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6615 |
"draw separating lines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6616 |
" |
2059 | 6617 |
|myIndex lfSep rtSep items prevItem nextItem |
6618 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6619 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6620 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6621 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6622 |
b "{ Class:SmallInteger }" |
706 | 6623 |
| |
2059 | 6624 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6625 |
items := menuPanel items. |
2059 | 6626 |
myIndex := items identityIndexOf:self. |
6627 |
||
6628 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6629 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6630 |
||
6631 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6632 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6633 |
||
6634 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2219 | 6635 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6636 |
]. |
2059 | 6637 |
|
6638 |
lightColor := menuPanel lightColor. |
|
6639 |
shadowColor := menuPanel shadowColor. |
|
6640 |
||
6641 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6642 |
|
608 | 6643 |
l := layout left. |
6644 |
t := layout top. |
|
6645 |
r := layout right. |
|
6646 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6647 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6648 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6649 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
6650 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
6651 |
||
6652 |
menuPanel paint:shadowColor. |
|
6653 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
6654 |
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
|
6655 |
] ifFalse:[ |
2219 | 6656 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
6657 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
6658 |
||
6659 |
menuPanel paint:shadowColor. |
|
6660 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
6661 |
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
|
6662 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6663 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6664 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6665 |
drawSeparator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6666 |
"draw as separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6667 |
" |
2059 | 6668 |
|type lightColor shadowColor isDouble |
6669 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6670 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6671 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6672 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6673 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6674 |
| |
2059 | 6675 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6676 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6677 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2219 | 6678 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6679 |
]. |
2059 | 6680 |
|
6681 |
isDouble := type == #doubleLine. |
|
6682 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6683 |
lightColor := menuPanel lightColor. |
2059 | 6684 |
shadowColor := menuPanel shadowColor. |
6685 |
menuPanel paint:shadowColor. |
|
6686 |
||
6687 |
left := layout left. |
|
6688 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6689 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6690 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6691 |
x0 := left + HorizontalInset. |
6692 |
x1 := layout right - HorizontalInset. |
|
6693 |
y0 := top - 1 + (layout height // 2). |
|
6694 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
6695 |
||
6696 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
6697 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
6698 |
||
6699 |
menuPanel paint:lightColor. |
|
6700 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
6701 |
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
|
6702 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6703 |
] ifFalse:[ |
2219 | 6704 |
y1 := layout bottom. |
6705 |
x0 := left - 1 + (layout width // 2). |
|
6706 |
y0 := top. |
|
6707 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
6708 |
||
6709 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
6710 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
6711 |
||
6712 |
menuPanel paint:lightColor. |
|
6713 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
6714 |
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
|
6715 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6716 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6717 |
|
2768 | 6718 |
indicatorForm |
6719 |
"returns indication form or nil |
|
6720 |
" |
|
6721 |
|val| |
|
6722 |
||
6723 |
indication isNil ifTrue:[^ nil]. |
|
6724 |
||
6725 |
val := self indicationValue. |
|
6726 |
self enabled ifFalse:[ |
|
6727 |
^ val == true |
|
6728 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
6729 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
6730 |
]. |
|
6731 |
^ val == true |
|
6732 |
ifTrue:[menuPanel iconIndicationOn] |
|
6733 |
ifFalse:[menuPanel iconIndicationOff] |
|
6734 |
! |
|
6735 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6736 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6737 |
|
2362 | 6738 |
layout isNil ifTrue:[^ self]. |
6739 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6740 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 6741 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6742 |
] |
388 | 6743 |
! ! |
6744 |
||
6745 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6746 |
||
6747 |
destroy |
|
616 | 6748 |
"destroy submenus, remove dependencies |
388 | 6749 |
" |
616 | 6750 |
self submenu:nil. |
2681 | 6751 |
self removeDependencies. |
616 | 6752 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6753 |
menuPanel := nil. |
616 | 6754 |
! |
6755 |
||
794 | 6756 |
in:aPanel |
6757 |
"create item in a menuPanel |
|
6758 |
" |
|
6759 |
menuPanel := aPanel. |
|
2359 | 6760 |
|
6761 |
menuItem isNil ifTrue:[ |
|
6762 |
self halt. |
|
6763 |
menuItem := MenuItem new |
|
6764 |
]. |
|
6765 |
! |
|
6766 |
||
6767 |
initialize |
|
6768 |
menuItem := MenuItem new. |
|
1811 | 6769 |
! |
6770 |
||
6771 |
reinitStyle |
|
6772 |
||
6773 |
subMenu notNil ifTrue:[ |
|
2219 | 6774 |
subMenu reinitStyle |
1811 | 6775 |
]. |
6776 |
||
6777 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
6778 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 6779 |
! ! |
6780 |
||
6781 |
!MenuPanel::Item methodsFor:'label basics'! |
|
6782 |
||
6783 |
disabledRawLabel |
|
6784 |
"returns the label used if the item is disabled |
|
6785 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6786 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6787 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6788 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6789 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6790 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6791 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6792 |
disabledDisplayLabel isString ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6793 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6794 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6795 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6796 |
block := [:el| |rslt| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6797 |
(rslt := el) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6798 |
el isImageOrForm ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6799 |
el colorMap notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6800 |
rslt := menuPanel lightenedImageOnDevice:el |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6801 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6802 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6803 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6804 |
((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
|
6805 |
form := menuPanel lightenedImageOnDevice:form |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6806 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6807 |
((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
|
6808 |
image := menuPanel lightenedImageOnDevice:image |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6809 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6810 |
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
|
6811 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6812 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6813 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6814 |
rslt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6815 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6816 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6817 |
displayLabel isArray ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6818 |
disabledDisplayLabel := Array new:(displayLabel size). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6819 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6820 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6821 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6822 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6823 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6824 |
disabledDisplayLabel := block value:displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6825 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6826 |
^ disabledDisplayLabel |
794 | 6827 |
! |
6828 |
||
1829 | 6829 |
fetchDeviceResources |
2373 | 6830 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6831 |
disabledDisplayLabel := nil. |
1829 | 6832 |
self fetchImages. |
6833 |
! |
|
6834 |
||
616 | 6835 |
fetchImages |
6836 |
"fetch images |
|
6837 |
" |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6838 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6839 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6840 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6841 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6842 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6843 |
displayLabel isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6844 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6845 |
^ self. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6846 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6847 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6848 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6849 |
(icon := displayLabel image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6850 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6851 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6852 |
(icon := displayLabel icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6853 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6854 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6855 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6856 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6857 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6858 |
displayLabel isArray ifFalse:[^ self]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6859 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6860 |
displayLabel keysAndValuesDo:[:i :el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6861 |
(el notNil and:[el isString not]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6862 |
el isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6863 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6864 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6865 |
el class == LabelAndIcon ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6866 |
(icon := el image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6867 |
el image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6868 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6869 |
(icon := el icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6870 |
el icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6871 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6872 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6873 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6874 |
] |
1078 | 6875 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6876 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6877 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6878 |
updateAccessCharacterFor:aLabel |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6879 |
"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
|
6880 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6881 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6882 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6883 |
(accessCharacter notNil or:[aLabel isNil]) ifTrue:[ |
2359 | 6884 |
^ aLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6885 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6886 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6887 |
aLabel isString ifFalse:[ |
2359 | 6888 |
aLabel class == LabelAndIcon ifTrue:[ |
6889 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
6890 |
]. |
|
6891 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6892 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6893 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6894 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6895 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6896 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6897 |
label := aLabel. |
2359 | 6898 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6899 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6900 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 6901 |
rest := label copyFrom:(i+1). |
6902 |
||
6903 |
i == 1 ifTrue:[label := rest] |
|
6904 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
6905 |
||
6906 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
6907 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6908 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6909 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6910 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 6911 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6912 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6913 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6914 |
label isText ifFalse:[ |
2359 | 6915 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6916 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6917 |
label emphasisAt:pos add:#underline. |
2359 | 6918 |
^ label |
388 | 6919 |
! ! |
6920 |
||
1573 | 6921 |
!MenuPanel::Item methodsFor:'printing & storing'! |
6922 |
||
6923 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6924 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6925 |
|
1573 | 6926 |
! ! |
6927 |
||
388 | 6928 |
!MenuPanel::Item methodsFor:'private'! |
6929 |
||
650 | 6930 |
activeBackgroundColor |
6931 |
"returns the active background color derived from menuPanel |
|
6932 |
" |
|
2359 | 6933 |
menuItem isButton ifTrue:[ |
6934 |
^ menuPanel buttonActiveBackgroundColor |
|
6935 |
]. |
|
6936 |
^ menuPanel activeBackgroundColor |
|
650 | 6937 |
! |
6938 |
||
6939 |
activeForegroundColor |
|
6940 |
"returns the active foreground color derived from menuPanel |
|
6941 |
" |
|
6942 |
||
6943 |
^menuPanel activeForegroundColor |
|
6944 |
! |
|
6945 |
||
727 | 6946 |
backgroundColor |
6947 |
"returns the background color derived from menuPanel |
|
6948 |
" |
|
2359 | 6949 |
menuItem isButton ifTrue:[ |
6950 |
^ menuPanel buttonPassiveBackgroundColor |
|
6951 |
]. |
|
6952 |
^ menuPanel backgroundColor |
|
727 | 6953 |
! |
6954 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6955 |
backgroundColorFromLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6956 |
"returns the background color derived from label or nil |
388 | 6957 |
" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6958 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6959 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6960 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6961 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6962 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6963 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6964 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6965 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6966 |
run size == 0 ifTrue:[ |
2145 | 6967 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
6968 |
^ run value |
|
6969 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6970 |
] ifFalse:[ |
2145 | 6971 |
run do:[:r| |
6972 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
6973 |
^ r value |
|
6974 |
] |
|
6975 |
] |
|
388 | 6976 |
]. |
6977 |
^ nil |
|
6978 |
! |
|
6979 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6980 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6981 |
"returns the background color to use when thhe mouse has entered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6982 |
derived from menuPanel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6983 |
" |
2359 | 6984 |
menuItem isButton ifTrue:[ |
6985 |
^ menuPanel buttonEnteredBackgroundColor |
|
6986 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6987 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6988 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6989 |
|
663 | 6990 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6991 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6992 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6993 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6994 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6995 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6996 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6997 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6998 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6999 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7000 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7001 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7002 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7003 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7004 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7005 |
numArgs == 0 ifTrue:[ |
2359 | 7006 |
MessageNotUnderstood handle:[:ex | |
7007 |
|selector| |
|
7008 |
||
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7009 |
((selector := ex selector) == sel |
2359 | 7010 |
or:[selector == #aspectFor:]) ifFalse:[ |
7011 |
ex reject |
|
7012 |
]. |
|
7013 |
] do:[ |
|
7014 |
subm := aRecv aspectFor:sel. |
|
7015 |
]. |
|
7016 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7017 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7018 |
|
2043 | 7019 |
(Array with:(aRecv) with:(aRecv class)) |
7020 |
do:[:aPossibleReceiver | |
|
2359 | 7021 |
MessageNotUnderstood handle:[:ex| |
7022 |
ex message selector == sel ifFalse:[ ex reject ] |
|
7023 |
] do:[ |
|
7024 |
numArgs == 0 ifTrue:[ |
|
7025 |
subm := aPossibleReceiver perform:sel |
|
7026 |
] ifFalse:[ |
|
7027 |
numArgs == 1 ifTrue:[ |
|
7028 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
7029 |
] ifFalse:[ |
|
7030 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
7031 |
] |
|
7032 |
] |
|
7033 |
]. |
|
7034 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7035 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
7036 |
|
663 | 7037 |
^ subm |
2043 | 7038 |
|
7039 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 7040 |
! |
7041 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7042 |
indicationValue |
524 | 7043 |
"returns indication value or nil in case of no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7044 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7045 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7046 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7047 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7048 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7049 |
indication isSymbol ifFalse:[ |
2359 | 7050 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7051 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7052 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7053 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 7054 |
recv := menuPanel receiver. |
7055 |
||
7056 |
(recv isValueModel) ifFalse:[ |
|
7057 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
7058 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
7059 |
sel := sel asSymbol. |
|
7060 |
||
7061 |
MessageNotUnderstood handle:[:ex| |
|
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7062 |
ex selector == sel ifFalse:[ |
2359 | 7063 |
ex reject |
7064 |
]. |
|
7065 |
] do:[ |
|
7066 |
sel := recv perform:sel with:(menuItem argument) |
|
7067 |
] |
|
7068 |
]. |
|
7069 |
]. |
|
7070 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7071 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7072 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7073 |
numArgs ~~ 0 ifTrue:[ |
2359 | 7074 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7075 |
] ifFalse:[ |
2359 | 7076 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7077 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7078 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7079 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7080 |
sel isValueModel ifTrue:[ |
2359 | 7081 |
indication := sel. |
7082 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7083 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7084 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7085 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7086 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7087 |
indicationValue:aValue |
1218 | 7088 |
"set the indication value |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7089 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7090 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7091 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7092 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7093 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7094 |
indication isSymbol ifFalse:[ |
2359 | 7095 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
7096 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7097 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7098 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7099 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 7100 |
^ self |
1218 | 7101 |
]. |
7102 |
||
524 | 7103 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7104 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7105 |
|
1218 | 7106 |
recv isNil ifTrue:[ |
2359 | 7107 |
recv := menuPanel application. |
7108 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7109 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7110 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7111 |
MessageNotUnderstood handle:[:ex| |
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7112 |
(ex selector ~~ indication) ifTrue:[ |
2359 | 7113 |
ex reject |
7114 |
]. |
|
7115 |
self ifNotInUIBuilderInfoPrintCR: |
|
2771 | 7116 |
('MenuPanel::Item [info]: application (%1) does not respond to: %2' |
7117 |
bindWith:recv classNameWithArticle with:indication). |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7118 |
] do:[ |
2359 | 7119 |
numArgs == 1 ifTrue:[ |
7120 |
recv perform:indication with:aValue |
|
7121 |
] ifFalse:[ |
|
7122 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
7123 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7124 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7125 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7126 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7127 |
isEntered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7128 |
"returns true if the mouse pointer is over the item |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7129 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7130 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7131 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7132 |
"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
|
7133 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7134 |
|
464 | 7135 |
separatorType |
7136 |
"returns type of separator line or nil |
|
388 | 7137 |
" |
390 | 7138 |
|c lbl| |
388 | 7139 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7140 |
self isSeparator ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7141 |
^ nil |
388 | 7142 |
]. |
7143 |
||
390 | 7144 |
(lbl := label value) isNil ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7145 |
^ #singleLine |
388 | 7146 |
]. |
7147 |
||
390 | 7148 |
lbl size == 1 ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7149 |
c := lbl first. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7150 |
c == $- ifTrue:[^ #singleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7151 |
c == $= ifTrue:[^ #doubleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7152 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7153 |
^ #blankLine |
1130 | 7154 |
! |
7155 |
||
7156 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7157 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7158 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7159 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7160 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7161 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7162 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7163 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7164 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7165 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7166 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7167 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7168 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7169 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7170 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7171 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7172 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7173 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7174 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7175 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7176 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7177 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7178 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7179 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7180 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7181 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7182 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7183 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7184 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7185 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7186 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7187 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7188 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7189 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7190 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7191 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7192 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7193 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7194 |
submenuEncoding := submenu. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7195 |
submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7196 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7197 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7198 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7199 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7200 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7201 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7202 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7203 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7204 |
self submenu:submenu. |
1130 | 7205 |
^ subMenu |
7206 |
||
7207 |
"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
|
7208 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7209 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7210 |
spaceBetweenEmptyLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7211 |
^ 3 |
388 | 7212 |
! ! |
7213 |
||
7214 |
!MenuPanel::Item methodsFor:'queries'! |
|
7215 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7216 |
canChangeVisibility |
1699 | 7217 |
"return true if I am not always visible; can only be changed by a selector |
7218 |
otherwise there is a change notification raised if the model changed |
|
7219 |
" |
|
7220 |
^ isVisible isSymbol |
|
7221 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7222 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7223 |
|
388 | 7224 |
canSelect |
1699 | 7225 |
"returns true if item is selectable; no separator, visible and enabled. |
7226 |
in case of a choice (RadioButton) i have to check for the choiceValue |
|
388 | 7227 |
" |
2362 | 7228 |
self isSeparator ifTrue:[^ false]. |
7229 |
||
7230 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 7231 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
7232 |
^ true |
|
7233 |
]. |
|
1078 | 7234 |
]. |
7235 |
^ false |
|
388 | 7236 |
! |
7237 |
||
2046 | 7238 |
containsPoint:aPoint |
7239 |
"returns true if aPoint is contained in my layout |
|
7240 |
" |
|
7241 |
(self isVisible and:[layout notNil]) ifTrue:[ |
|
2219 | 7242 |
^ layout containsPoint:aPoint |
2046 | 7243 |
]. |
7244 |
^ false |
|
7245 |
||
7246 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
7247 |
! |
|
7248 |
||
388 | 7249 |
containsPointX:x y:y |
7250 |
"returns true if point is contained in my layout |
|
7251 |
" |
|
712 | 7252 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2219 | 7253 |
^ layout containsPointX:x y:y |
505 | 7254 |
]. |
7255 |
^ false |
|
388 | 7256 |
! |
7257 |
||
2199 | 7258 |
hasDelayedMenu |
7259 |
"returns true if a delayed menu exists |
|
7260 |
" |
|
2360 | 7261 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7262 |
^ false |
2199 | 7263 |
]. |
2360 | 7264 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7265 |
||
7266 |
(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
|
7267 |
^ false |
2199 | 7268 |
]. |
7269 |
^ true |
|
7270 |
! |
|
7271 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7272 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7273 |
"returns true if the item has a delayed menu |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7274 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews) |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7275 |
" |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7276 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7277 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7278 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7279 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7280 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7281 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7282 |
hasIndication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7283 |
"returns true if on/off indication exists |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7284 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7285 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7286 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7287 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7288 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7289 |
"returns true if the item has a delayed menu |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7290 |
and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews) |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7291 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7292 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7293 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7294 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7295 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7296 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7297 |
|
388 | 7298 |
hasSubmenu |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7299 |
"returns true if the item is configured as an subMenu entry |
388 | 7300 |
" |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7301 |
^ subMenu notNil or:[menuItem submenuChannel notNil] |
388 | 7302 |
! |
7303 |
||
7304 |
isEnabled |
|
7305 |
"returns enabled state |
|
7306 |
" |
|
7307 |
^ self enabled |
|
7308 |
! |
|
7309 |
||
608 | 7310 |
isSeparator |
7311 |
"returns true if item is a separator |
|
7312 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7313 |
^ displayLabel isNil |
608 | 7314 |
! |
7315 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7316 |
isToggle |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7317 |
"returns true if on/off indication exists |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7318 |
" |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7319 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7320 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7321 |
|
712 | 7322 |
isVisible |
7323 |
"returns the visibility state |
|
7324 |
" |
|
7325 |
|state| |
|
7326 |
||
7327 |
isVisible isSymbol ifTrue:[ |
|
2219 | 7328 |
state := self aspectAt:isVisible. |
7329 |
||
7330 |
state isValueModel ifTrue:[ |
|
7331 |
isVisible := state. |
|
7332 |
isVisible addDependent:self. |
|
7333 |
state := isVisible. |
|
7334 |
] |
|
712 | 7335 |
] ifFalse:[ |
2219 | 7336 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7337 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7338 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7339 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7340 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7341 |
! |
7342 |
||
7343 |
isVisible:something |
|
7344 |
"change the state; if the state changed, a redraw is performed |
|
7345 |
" |
|
7346 |
|oldState newState| |
|
7347 |
||
7348 |
isVisible isNil ifTrue:[ |
|
2219 | 7349 |
oldState := true |
712 | 7350 |
] ifFalse:[ |
2219 | 7351 |
oldState := isVisible value. |
7352 |
isVisible isValueModel ifTrue:[ |
|
7353 |
isVisible removeDependent:self |
|
7354 |
] |
|
712 | 7355 |
]. |
7356 |
isVisible := something. |
|
7357 |
||
7358 |
isVisible isNil ifTrue:[ |
|
2219 | 7359 |
newState := true |
712 | 7360 |
] ifFalse:[ |
2219 | 7361 |
isVisible isValueModel ifTrue:[ |
7362 |
isVisible addDependent:self |
|
7363 |
] ifFalse:[ |
|
7364 |
isVisible isSymbol ifTrue:[^ self] |
|
7365 |
]. |
|
7366 |
menuPanel shown ifFalse:[^ self]. |
|
7367 |
newState := isVisible value. |
|
712 | 7368 |
]. |
7369 |
||
7370 |
newState ~~ oldState ifTrue:[ |
|
2219 | 7371 |
menuPanel mustRearrange |
712 | 7372 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7373 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7374 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7375 |
! |
7376 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7377 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7378 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7379 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7380 |
|
388 | 7381 |
shortcutKeyAsString |
7382 |
"converts shortcutKey to a text object |
|
7383 |
" |
|
2359 | 7384 |
|nm prefix shortcutKey| |
7385 |
||
7386 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7387 |
|
7388 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7389 |
^ nil |
1609 | 7390 |
]. |
7391 |
||
7392 |
shortcutKey isCharacter ifTrue:[ |
|
2359 | 7393 |
nm := shortcutKey asString |
388 | 7394 |
] ifFalse:[ |
2359 | 7395 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
7396 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
|
7397 |
"/ Ask the devices keyboardMap for the backtranslation. |
|
7398 |
||
7399 |
nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey. |
|
7400 |
"/ |
|
7401 |
"/ some modifier-key combination ? |
|
7402 |
"/ |
|
7403 |
(nm startsWith:#Cmd) ifTrue:[ |
|
7404 |
prefix := #Cmd. |
|
7405 |
] ifFalse:[(nm startsWith:#Alt) ifTrue:[ |
|
7406 |
prefix := #Alt. |
|
7407 |
] ifFalse:[(nm startsWith:#Meta) ifTrue:[ |
|
7408 |
prefix := #Meta. |
|
7409 |
] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[ |
|
7410 |
prefix := #Ctrl. |
|
7411 |
]]]]. |
|
7412 |
prefix notNil ifTrue:[ |
|
7413 |
nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1)) |
|
7414 |
] ifFalse:[ |
|
7415 |
nm := nm asString |
|
7416 |
] |
|
388 | 7417 |
]. |
608 | 7418 |
^ nm |
388 | 7419 |
|
987 | 7420 |
"Modified: / 17.7.1998 / 11:56:40 / cg" |
388 | 7421 |
! |
7422 |
||
7423 |
shortcutKeyPrefixFor:aModifier |
|
7424 |
"returns prefix assigned to a modifier |
|
7425 |
" |
|
7426 |
|m| |
|
7427 |
||
7428 |
m := menuPanel device modifierKeyTopFor:aModifier. |
|
7429 |
m notNil ifTrue:[ |
|
2145 | 7430 |
^ m , '-' |
388 | 7431 |
]. |
987 | 7432 |
^ aModifier , '-'. |
7433 |
||
7434 |
"Modified: / 17.7.1998 / 11:56:46 / cg" |
|
388 | 7435 |
! ! |
7436 |
||
7437 |
!MenuPanel::Item methodsFor:'selection'! |
|
7438 |
||
7439 |
isSelected |
|
7440 |
"returns true if item is selected |
|
7441 |
" |
|
1998 | 7442 |
|
7443 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 7444 |
! |
7445 |
||
2249 | 7446 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7447 |
"change selection to a state. Dependant on the state open or hide an existing |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7448 |
submenu and perform a redraw |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7449 |
" |
2249 | 7450 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
7451 |
self invalidate. |
|
7452 |
self hideSubmenu. |
|
2359 | 7453 |
^ self |
2249 | 7454 |
]. |
7455 |
||
2199 | 7456 |
menuPanel realized ifFalse:[ ^ self ]. |
7457 |
||
2359 | 7458 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 7459 |
self invalidate |
2199 | 7460 |
]. |
7461 |
self hasSubmenu ifFalse:[ ^ self]. |
|
7462 |
||
7463 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 7464 |
menuPanel openDelayed:self |
2199 | 7465 |
] ifFalse:[ |
2249 | 7466 |
subMenu := self setupSubmenu. |
2374 | 7467 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
1701 | 7468 |
]. |
388 | 7469 |
! ! |
7470 |
||
2692 | 7471 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
7472 |
||
7473 |
argument2 |
|
7474 |
||
7475 |
^ argument2 |
|
7476 |
! |
|
7477 |
||
7478 |
argument2:anArgumentOrNil |
|
7479 |
||
7480 |
argument2 := anArgumentOrNil |
|
7481 |
! ! |
|
7482 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7483 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7484 |
|
2018 | 7485 |
icon |
2016 | 7486 |
"This resource specification was automatically generated |
7487 |
by the ImageEditor of ST/X." |
|
7488 |
||
7489 |
"Do not manually edit this!! If it is corrupted, |
|
7490 |
the ImageEditor may not be able to read the specification." |
|
7491 |
||
7492 |
" |
|
2018 | 7493 |
self icon inspect |
7494 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7495 |
" |
7496 |
||
7497 |
<resource: #image> |
|
7498 |
||
7499 |
^Icon |
|
2219 | 7500 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7501 |
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 | 7502 |
! ! |
7503 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7504 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7505 |
|
7506 |
new |
|
7507 |
^ self basicNew initialize |
|
7508 |
! ! |
|
7509 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7510 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7511 |
|
7512 |
activeMenu |
|
7513 |
"returns the active menu the scrolling is activated on; nil |
|
7514 |
is returned if scrolling is deactivated |
|
7515 |
" |
|
7516 |
^ activeMenu |
|
7517 |
! |
|
7518 |
||
7519 |
direction |
|
7520 |
"returns the scroll-direction |
|
7521 |
" |
|
7522 |
^ direction |
|
7523 |
! |
|
7524 |
||
7525 |
iconAt:aDirection on:aMenu |
|
2018 | 7526 |
|icon device index| |
2016 | 7527 |
|
7528 |
device := aMenu device. |
|
7529 |
||
7530 |
aDirection == #PREV ifTrue:[ |
|
2219 | 7531 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7532 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7533 |
] ifFalse:[ |
2219 | 7534 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7535 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7536 |
]. |
7537 |
||
7538 |
icon := icons at:index. |
|
7539 |
||
7540 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
2219 | 7541 |
icon := self class icon. |
7542 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7543 |
ifFalse:[ icon := icon copy ]. |
|
7544 |
||
7545 |
icon := icon onDevice:device. |
|
7546 |
icon clearMaskedPixels. |
|
7547 |
icons at:index put:icon |
|
2018 | 7548 |
]. |
7549 |
^ icon |
|
2016 | 7550 |
! ! |
7551 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7552 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7553 |
|
7554 |
initialize |
|
7555 |
||
7556 |
semaLock := RecursionLock new. |
|
2018 | 7557 |
icons := Array new:4. |
2016 | 7558 |
! ! |
7559 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7560 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7561 |
|
7562 |
isActive |
|
7563 |
"returns true if scrolling is activated |
|
7564 |
" |
|
7565 |
^ activeMenu notNil |
|
7566 |
! ! |
|
7567 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7568 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7569 |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7570 |
startIfRequiredAt:aDirection on:aMenu |
2016 | 7571 |
"start scrolling; returns true if scrolling is activated |
7572 |
" |
|
2860 | 7573 |
|bounds index isScrolledMenu| |
7574 |
||
7575 |
isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]). |
|
2016 | 7576 |
|
7577 |
semaLock critical:[ |
|
2860 | 7578 |
self stop. |
7579 |
||
7580 |
isScrolledMenu ifTrue:[ |
|
7581 |
bounds := aMenu scrollerBoundsAt:aDirection. |
|
7582 |
activeMenu := aMenu. |
|
7583 |
direction := aDirection. |
|
7584 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7585 |
||
7586 |
index ~~ 0 ifTrue:[ |
|
7587 |
scrollTask := |
|
7588 |
[ |
|
7589 |
|item step| |
|
7590 |
||
7591 |
[ |
|
7592 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7593 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7594 |
aMenu makeItemVisible:item. |
|
7595 |
index := index + step. |
|
7596 |
]. |
|
7597 |
||
7598 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7599 |
||
7600 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
|
7601 |
aMenu makeItemVisible:item. |
|
7602 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7603 |
index := index + step. |
|
7604 |
]. |
|
7605 |
item := nil. |
|
7606 |
] ensure:[ |
|
7607 |
scrollTask := nil. |
|
7608 |
||
7609 |
item notNil ifTrue:[ |
|
7610 |
"/ process was killed |
|
7611 |
aMenu invalidate:bounds |
|
7612 |
] |
|
7613 |
] |
|
7614 |
] forkAt:8. |
|
7615 |
] |
|
7616 |
] |
|
2016 | 7617 |
]. |
7618 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7619 |
|
2048 | 7620 |
"Created: ca" |
7621 |
||
7622 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7623 |
! |
7624 |
||
7625 |
stop |
|
7626 |
"stop scrolling; returns true if the scrolling was activated otherwise false |
|
7627 |
" |
|
7628 |
|task resp| |
|
7629 |
||
7630 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7631 |
^ false |
2016 | 7632 |
]. |
7633 |
semaLock critical:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7634 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7635 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7636 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7637 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7638 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7639 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7640 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7641 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7642 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7643 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7644 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7645 |
activeMenu := direction := nil. |
2016 | 7646 |
]. |
7647 |
^ resp |
|
7648 |
! ! |
|
7649 |
||
388 | 7650 |
!MenuPanel class methodsFor:'documentation'! |
7651 |
||
7652 |
version |
|
2860 | 7653 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.414 2005-10-28 08:26:45 ca Exp $' |
388 | 7654 |
! ! |
2199 | 7655 |
|
388 | 7656 |
MenuPanel initialize! |