author | Claus Gittinger <cg@exept.de> |
Fri, 15 Oct 2004 15:14:13 +0200 | |
changeset 2761 | 611ecd331c14 |
parent 2755 | f8035120da51 |
child 2768 | 9c79a348a443 |
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 |
657 | 601 |
|
2219 | 602 |
<resource: #style ( |
603 |
#'popup.borderWidth' #'popup.level' |
|
604 |
#'selection.disabledForegroundColor' |
|
605 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
606 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
607 |
#'menu.buttonItemVerticalSpace' |
|
608 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
|
609 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
610 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
611 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
612 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
613 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
614 |
#'menu.selectionFollowsMouse' |
|
615 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
616 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
617 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
618 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
2752 | 619 |
#'menu.iconIndicationOn' #'menu.iconIndicationOff' |
2754 | 620 |
#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile' |
621 |
#'menu.iconRadioOn' #'menu.iconRadioOff' |
|
622 |
#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile' |
|
2755 | 623 |
#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff' |
624 |
#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile' |
|
625 |
#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff' |
|
626 |
#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile' |
|
2219 | 627 |
)> |
628 |
||
629 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
2754 | 630 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile| |
2607 | 631 |
|
2611 | 632 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
633 |
which returns the default cashed DefaultBackgroundColor |
|
634 |
" |
|
635 |
DefaultBackgroundColor := nil. |
|
636 |
||
2219 | 637 |
MenuView updateStyleCache. |
638 |
SelectionInListView updateStyleCache. |
|
1699 | 639 |
|
2372 | 640 |
styleSheet := StyleSheet. |
641 |
style := styleSheet name. |
|
642 |
||
2607 | 643 |
DefaultFont := MenuView defaultFont. |
2609 | 644 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black. |
645 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
|
2219 | 646 |
|
647 |
var := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
|
2374 | 648 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 649 |
styleSheet at:#'menuPanel.buttonInsetX' put:(var abs). |
650 |
||
651 |
var := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
2374 | 652 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 653 |
styleSheet at:#'menuPanel.buttonInsetY' put:(var abs). |
654 |
||
655 |
var := styleSheet at:#'menu.itemHorizontalSpace'. |
|
2374 | 656 |
var isNil ifTrue:[ var := styleSheet at:#'menu.itemSpace' default:0 ]. |
2219 | 657 |
styleSheet at:#'menuPanel.itemSpace' put:var. |
658 |
||
659 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 660 |
var isNil ifTrue:[ |
2219 | 661 |
style == #motif ifTrue:[ var := backgroundColor ] |
662 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
663 |
]. |
|
664 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
665 |
||
666 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 667 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 668 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
669 |
||
670 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 671 |
var isNil ifTrue:[ |
2219 | 672 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 673 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 674 |
]. |
675 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
676 |
||
677 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 678 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 679 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
680 |
||
681 |
||
682 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 683 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 684 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
685 |
||
686 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 687 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 688 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
689 |
||
690 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
691 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
692 |
||
693 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
694 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
695 |
||
696 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 697 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 698 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
699 |
]. |
|
700 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
701 |
||
702 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 703 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 704 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
705 |
||
706 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 707 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 708 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
709 |
||
710 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 711 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 712 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
713 |
||
714 |
Item updateStyleCache. |
|
2607 | 715 |
|
2754 | 716 |
getBitmapOrFile := [:key :fileKey | |
717 |
|var| |
|
718 |
||
719 |
var := styleSheet at:key ifAbsent:nil. |
|
720 |
var isNil ifTrue:[ |
|
721 |
var := styleSheet at:fileKey ifAbsent:nil. |
|
2752 | 722 |
var notNil ifTrue:[ |
2754 | 723 |
var := Smalltalk imageFromFileNamed:var forClass:self. |
2752 | 724 |
]. |
725 |
]. |
|
2754 | 726 |
var |
727 |
]. |
|
728 |
||
729 |
var := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'. |
|
730 |
var notNil ifTrue:[ |
|
731 |
IconIndicationOn := var. |
|
732 |
]. |
|
733 |
var := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'. |
|
2752 | 734 |
var notNil ifTrue:[ |
735 |
IconIndicationOff := var. |
|
2754 | 736 |
]. |
2755 | 737 |
var := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'. |
738 |
var notNil ifTrue:[ |
|
739 |
IconDisabledIndicationOn := var. |
|
740 |
]. |
|
741 |
var := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'. |
|
742 |
var notNil ifTrue:[ |
|
743 |
IconDisabledIndicationOff := var. |
|
744 |
]. |
|
745 |
||
2754 | 746 |
var := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'. |
747 |
var notNil ifTrue:[ |
|
748 |
IconRadioOn := var. |
|
749 |
]. |
|
750 |
var := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'. |
|
751 |
var notNil ifTrue:[ |
|
752 |
IconRadioOff := var. |
|
2752 | 753 |
]. |
2755 | 754 |
var := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'. |
755 |
var notNil ifTrue:[ |
|
756 |
IconDisabledRadioOn := var. |
|
757 |
]. |
|
758 |
var := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'. |
|
759 |
var notNil ifTrue:[ |
|
760 |
IconDisabledRadioOff := var. |
|
761 |
]. |
|
2752 | 762 |
|
2607 | 763 |
" |
764 |
self updateStyleCache |
|
765 |
" |
|
388 | 766 |
! ! |
767 |
||
794 | 768 |
!MenuPanel class methodsFor:'image registration'! |
769 |
||
770 |
image:anImage onDevice:aDevice |
|
771 |
" |
|
772 |
Images := nil |
|
773 |
" |
|
2269 | 774 |
|deviceImages| |
794 | 775 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
776 |
anImage device == aDevice ifTrue:[ |
2269 | 777 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
778 |
]. |
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 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 781 |
|
1097 | 782 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 783 |
Images at:aDevice put:(deviceImages := Dictionary new) |
784 |
]. |
|
785 |
||
786 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
787 |
image := anImage copy onDevice:aDevice. |
|
788 |
image clearMaskedPixels. |
|
789 |
deviceImages at:anImage put:image. |
|
790 |
image |
|
791 |
]. |
|
794 | 792 |
! |
793 |
||
794 |
lightenedImage:anImage onDevice:aDevice |
|
795 |
" |
|
796 |
LigthenedImages := nil |
|
797 |
" |
|
2374 | 798 |
|deviceImages image colorMap| |
794 | 799 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
800 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 801 |
|
1097 | 802 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 803 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 804 |
]. |
805 |
||
806 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 807 |
^ image |
808 |
]. |
|
809 |
||
810 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
811 |
||
812 |
colorMap notNil ifTrue:[ |
|
813 |
image := anImage copy lightened onDevice:aDevice. |
|
814 |
image clearMaskedPixels. |
|
794 | 815 |
] ifFalse:[ |
2374 | 816 |
image := self image:anImage onDevice:aDevice |
794 | 817 |
]. |
1097 | 818 |
deviceImages at:anImage put:image. |
794 | 819 |
^ image |
820 |
! ! |
|
821 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
822 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
823 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
824 |
subMenu:aSubMenu |
2715 | 825 |
"create a submenu; can be redifined in derived classes" |
826 |
||
827 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
828 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
829 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
830 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
831 |
|
1808 | 832 |
!MenuPanel methodsFor:'accepting'! |
389 | 833 |
|
834 |
accept |
|
2715 | 835 |
"accept current selected item" |
836 |
||
1670 | 837 |
^ self acceptItem:(self selection) inMenu:self |
389 | 838 |
! |
839 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
840 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
841 |
"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
|
842 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
843 |
|value item tgState itemIdx recv panel masterGroup winGrp acceptAction| |
1630 | 844 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
845 |
self superMenu notNil ifTrue:[ |
2253 | 846 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
847 |
]. |
2199 | 848 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
849 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
850 |
self selection:nil. |
420 | 851 |
|
852 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 853 |
tgState := anItem toggleIndication. |
854 |
panel := anItem menuPanel. |
|
855 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
856 |
item := anItem. |
|
857 |
recv := panel receiver. |
|
389 | 858 |
]. |
1699 | 859 |
self doUngrab:true. |
389 | 860 |
|
510 | 861 |
self isPopUpView ifFalse:[ |
2253 | 862 |
self do:[:el| el updateIndicators]. |
863 |
self windowGroup processExposeEvents. |
|
524 | 864 |
] ifTrue:[ |
2253 | 865 |
self unmap. |
2712 | 866 |
self device sync. "/ round trip - all expose events are now received |
2253 | 867 |
(winGrp := self windowGroup) notNil ifTrue:[ |
868 |
"/ give expose event a chance to arrive |
|
869 |
[shown and:[realized]] whileTrue:[ |
|
870 |
winGrp processExposeEventsFor:self |
|
871 |
]. |
|
872 |
masterGroup := winGrp previousGroup. |
|
873 |
]. |
|
874 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
875 |
"/ self destroy. |
|
876 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 877 |
]. |
1710 | 878 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
879 |
acceptAction := [ value := self accept:item index:itemIdx toggle:tgState receiver:recv ]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
880 |
|
1710 | 881 |
(item notNil |
882 |
and:[item showBusyCursorWhilePerforming |
|
883 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
884 |
ifTrue:[ |
|
2253 | 885 |
winGrp withWaitCursorDo:acceptAction |
2132 | 886 |
] ifFalse:[acceptAction value]. |
524 | 887 |
|
888 |
self isPopUpView ifTrue:[ |
|
2253 | 889 |
self menuAdornmentAt:#item put:item. |
524 | 890 |
]. |
1699 | 891 |
^ item. |
524 | 892 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
893 |
"Modified: / 15.11.2001 / 17:05:40 / cg" |
524 | 894 |
! |
895 |
||
896 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
2715 | 897 |
"accept an item" |
898 |
||
2253 | 899 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
900 |
app master fallBack| |
524 | 901 |
|
902 |
anItem isNil ifTrue:[ |
|
2253 | 903 |
self menuAdornmentAt:#hasPerformed put:true. |
904 |
^ nil |
|
905 |
]. |
|
906 |
||
907 |
isValueModel := aReceiver isValueModel. |
|
908 |
||
909 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 910 |
|
911 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 912 |
^ anIndex |
524 | 913 |
]. |
914 |
||
915 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 916 |
argument := aState ? anItem |
389 | 917 |
]. |
524 | 918 |
|
919 |
value isSymbol ifFalse:[ |
|
2253 | 920 |
"/ a valueHolder or block |
921 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
922 |
^ value |
|
923 |
]. |
|
924 |
||
925 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
926 |
||
927 |
numArgs == 0 ifTrue:[ |
|
928 |
args := nil |
|
929 |
] ifFalse:[ |
|
930 |
numArgs == 1 ifTrue:[ |
|
931 |
args := Array with:argument |
|
932 |
] ifFalse:[ |
|
933 |
args := Array with:argument with:self |
|
934 |
] |
|
935 |
]. |
|
936 |
||
937 |
value valueWithArguments:args. |
|
938 |
||
939 |
self menuAdornmentAt:#hasPerformed put:true. |
|
940 |
^ anIndex |
|
524 | 941 |
]. |
942 |
||
2331 | 943 |
anItem sendToOriginator ifTrue:[ |
2473 | 944 |
rec := self originator. |
945 |
rec isNil ifTrue:[ |
|
946 |
self error:'no originating widget (no target for message)'. |
|
947 |
]. |
|
2331 | 948 |
] ifFalse:[ |
949 |
rec := aReceiver |
|
950 |
]. |
|
951 |
||
952 |
rec isNil ifTrue:[ |
|
2253 | 953 |
^ value |
954 |
]. |
|
955 |
||
956 |
isValueModel ifTrue:[ |
|
2331 | 957 |
rec value:value |
465 | 958 |
] ifFalse:[ |
2253 | 959 |
arg2 := self. |
960 |
||
961 |
"/ support for ST80 style applications |
|
962 |
"/ (expecting the message to go to the application |
|
963 |
"/ if not understood by the view) |
|
964 |
"/ These expect the controller to be passed as argument. |
|
965 |
"/ sigh. |
|
966 |
||
2331 | 967 |
(rec isView |
968 |
and:[(rec respondsTo:value) not |
|
969 |
and:[(app := rec application) ~~ rec |
|
2253 | 970 |
and:[app notNil]]]) ifTrue:[ |
2331 | 971 |
arg2 := rec controller. "/ the Views controller |
2253 | 972 |
rec := app. |
973 |
]. |
|
974 |
||
975 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
976 |
args := nil |
|
977 |
] ifFalse:[ |
|
978 |
numArgs == 1 ifTrue:[ |
|
979 |
args := Array with:argument |
|
980 |
] ifFalse:[ |
|
981 |
args := Array with:argument with:arg2 |
|
982 |
] |
|
983 |
]. |
|
984 |
||
985 |
fallBack := |
|
986 |
[ |
|
987 |
"/ mhmh - the receiver did not respond to that message; |
|
988 |
"/ if there is a master-application, try that one |
|
989 |
"/ (recursive) |
|
990 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
991 |
master notNil ifTrue:[ |
|
992 |
rec := master. |
|
993 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
994 |
] ifFalse:[ |
|
995 |
self |
|
996 |
error:'unimplemented (or error in) menu message: ' , value |
|
997 |
mayProceed:true |
|
998 |
]. |
|
999 |
]. |
|
1000 |
||
1001 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 1002 |
]. |
524 | 1003 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
1004 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1005 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
1006 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 1007 |
! |
1008 |
||
1670 | 1009 |
acceptItem:anItem inMenu:aMenu |
2199 | 1010 |
|tgState topMenu| |
1011 |
||
1012 |
topMenu := self topMenu. |
|
1013 |
topMenu openDelayed:nil. |
|
1670 | 1014 |
|
1841 | 1015 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2219 | 1016 |
topMenu accept:anItem |
1670 | 1017 |
] ifFalse:[ |
2219 | 1018 |
anItem canAccept ifTrue:[ |
1019 |
tgState := anItem toggleIndication. |
|
1020 |
||
1021 |
self accept:anItem |
|
1022 |
index:(aMenu selectionIndex) |
|
1023 |
toggle:tgState |
|
1024 |
receiver:(aMenu receiver). |
|
1025 |
||
1026 |
aMenu do:[:el| el updateIndicators]. |
|
1027 |
] |
|
1670 | 1028 |
] |
1029 |
! |
|
1030 |
||
389 | 1031 |
lastItemAccepted |
2715 | 1032 |
"returns last item selected or nil" |
1033 |
||
390 | 1034 |
^ self topMenu menuAdornmentAt:#item |
389 | 1035 |
! |
1036 |
||
1037 |
lastValueAccepted |
|
2715 | 1038 |
"returns last value accepted or nil" |
1039 |
||
2253 | 1040 |
^ self lastItemAccepted value |
389 | 1041 |
! ! |
1042 |
||
388 | 1043 |
!MenuPanel methodsFor:'accessing'! |
1044 |
||
1045 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 1046 |
"get the access character position for a textLabel" |
1047 |
||
2059 | 1048 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 1049 |
! |
1050 |
||
1051 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 1052 |
"get the access character position for a textLabel" |
1053 |
||
388 | 1054 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
1055 |
! |
|
1056 |
||
1057 |
accessCharacterPositions |
|
2715 | 1058 |
"returns a collection of accessCharacterPositions or nil" |
1059 |
||
388 | 1060 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
1061 |
! |
|
1062 |
||
1063 |
accessCharacterPositions:something |
|
2715 | 1064 |
"define accessCharacterPositions for each item" |
1065 |
||
388 | 1066 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
1067 |
! |
|
1068 |
||
1069 |
args |
|
2715 | 1070 |
"returns a collection of arguments or nil" |
1071 |
||
388 | 1072 |
^ self collect:[:anItem| anItem argument ] |
1073 |
! |
|
1074 |
||
1075 |
args:something |
|
2715 | 1076 |
"define arguments for each item" |
1077 |
||
388 | 1078 |
self onEachPerform:#argument: withArgList:something |
1079 |
! |
|
1080 |
||
1081 |
argsAt:stringOrNumber |
|
2715 | 1082 |
"gets the argument of an item or nil" |
1083 |
||
2059 | 1084 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1085 |
! |
1086 |
||
1087 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1088 |
"sets the argument of an item" |
1089 |
||
388 | 1090 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1091 |
! |
|
1092 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1093 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1094 |
"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
|
1095 |
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
|
1096 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1097 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1098 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1099 |
"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
|
1100 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1101 |
|
388 | 1102 |
groupSizes |
2715 | 1103 |
"gets collection of group sizes" |
1104 |
||
388 | 1105 |
^ groupSizes |
1106 |
! |
|
1107 |
||
1108 |
groupSizes:aGroupSizes |
|
2715 | 1109 |
"sets collection of group sizes" |
1110 |
||
388 | 1111 |
aGroupSizes = groupSizes ifFalse:[ |
2715 | 1112 |
groupSizes := aGroupSizes copy. |
1113 |
self mustRearrange. |
|
388 | 1114 |
]. |
1115 |
! |
|
1116 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1117 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1118 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1119 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1120 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1121 |
hideOnRelease:something |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1122 |
hideOnRelease := something. |
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 |
|
388 | 1125 |
labelAt:stringOrNumber |
2715 | 1126 |
"gets the label of an item or nil" |
1127 |
||
388 | 1128 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1129 |
! |
|
1130 |
||
1131 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1132 |
"sets the label of an item" |
1133 |
||
388 | 1134 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1135 |
! |
|
1136 |
||
1137 |
labels |
|
2715 | 1138 |
"returns a collection of labels's or nil" |
1139 |
||
388 | 1140 |
^ self collect:[:anItem| anItem label ] |
1141 |
! |
|
1142 |
||
1143 |
labels:labels |
|
2715 | 1144 |
"define labels for each item" |
1145 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1146 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1147 |
|
388 | 1148 |
self disabledRedrawDo:[ |
2715 | 1149 |
self removeAll. |
1150 |
size := labels size. |
|
1151 |
||
1152 |
size > 0 ifTrue:[ |
|
1153 |
items := OrderedCollection new:size. |
|
1154 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1155 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1156 |
]. |
388 | 1157 |
! |
1158 |
||
1999 | 1159 |
menuPerformer:anObject |
1160 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1161 |
from all submenus no specific receiver is defined )." |
1162 |
||
1999 | 1163 |
^ self receiver:anObject |
1164 |
! |
|
1165 |
||
388 | 1166 |
nameKeyAt:stringOrNumber |
2715 | 1167 |
"gets the nameKey of an item or nil" |
1168 |
||
1169 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1170 |
! |
1171 |
||
1172 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1173 |
"sets the nameKey of an item" |
1174 |
||
388 | 1175 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1176 |
! |
|
1177 |
||
1178 |
nameKeys |
|
2715 | 1179 |
"returns a collection of nameKeyss or nil" |
1180 |
||
388 | 1181 |
^ self collect:[:anItem| anItem nameKey ] |
1182 |
! |
|
1183 |
||
1184 |
nameKeys:something |
|
2715 | 1185 |
"define nameKeys for each item" |
1186 |
||
388 | 1187 |
self onEachPerform:#nameKey: withArgList:something |
1188 |
! |
|
1189 |
||
1190 |
numberOfItems |
|
2715 | 1191 |
"gets number of items" |
1192 |
||
388 | 1193 |
^ items size |
1194 |
! |
|
1195 |
||
2331 | 1196 |
originator |
1197 |
originator notNil ifTrue:[^ originator]. |
|
1198 |
superMenu notNil ifTrue:[ |
|
1199 |
^ superMenu originator |
|
1200 |
]. |
|
1201 |
^ nil |
|
1202 |
! |
|
1203 |
||
388 | 1204 |
receiver |
1205 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1206 |
from all submenus no specific receiver is defined )." |
1207 |
||
389 | 1208 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2715 | 1209 |
^ superMenu receiver |
388 | 1210 |
]. |
389 | 1211 |
^ receiver |
388 | 1212 |
! |
1213 |
||
1214 |
receiver:anObject |
|
1215 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1216 |
from all submenus no specific receiver is defined )." |
1217 |
||
389 | 1218 |
receiver := anObject |
388 | 1219 |
! |
1220 |
||
1221 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1222 |
"gets the shortCutKey of an item or nil" |
1223 |
||
1224 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1225 |
! |
1226 |
||
1227 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1228 |
"sets the shortCutKey of an item" |
1229 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1230 |
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
|
1231 |
! |
388 | 1232 |
|
1233 |
shortcutKeys |
|
2715 | 1234 |
"returns a collection of shortcutKeys or nil" |
1235 |
||
388 | 1236 |
^ self collect:[:anItem| anItem shortcutKey ] |
1237 |
! |
|
1238 |
||
1239 |
shortcutKeys:something |
|
2715 | 1240 |
"define shortcutKeys for each item" |
1241 |
||
388 | 1242 |
self onEachPerform:#shortcutKey: withArgList:something |
1243 |
! |
|
1244 |
||
1245 |
valueAt:stringOrNumber |
|
2715 | 1246 |
"gets value of an item; a block, valueHolder, ..." |
1247 |
||
1248 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1249 |
! |
1250 |
||
1251 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1252 |
"sets value of an item; a block, valueHolder, ..." |
1253 |
||
388 | 1254 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1255 |
! |
|
1256 |
||
1257 |
values:something |
|
2715 | 1258 |
"define values for each item" |
1259 |
||
388 | 1260 |
self onEachPerform:#value: withArgList:something |
1261 |
! ! |
|
1262 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1263 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1264 |
|
1265 |
disableAll |
|
2715 | 1266 |
"disable all items; not the menu in case of enabled" |
1267 |
||
498 | 1268 |
self do:[:anItem| anItem enabled:false] |
388 | 1269 |
! |
1270 |
||
1271 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1272 |
"disable an collection of items" |
1273 |
||
388 | 1274 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1275 |
! |
|
1276 |
||
1277 |
enableAll |
|
2715 | 1278 |
"enable all items; not the menu in case of disabled" |
1279 |
||
498 | 1280 |
self do:[:anItem| anItem enabled:true] |
388 | 1281 |
! |
1282 |
||
1283 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1284 |
"enable an collection of items" |
1285 |
||
388 | 1286 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1287 |
! |
|
1288 |
||
1289 |
enabled |
|
2715 | 1290 |
"returns enabled state" |
1291 |
||
498 | 1292 |
^ enabled |
388 | 1293 |
! |
1294 |
||
1295 |
enabled:aState |
|
2715 | 1296 |
"change enabled state of menu" |
1297 |
||
545 | 1298 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1299 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1300 |
state := aState ? true. |
388 | 1301 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1302 |
enabled ~~ state ifTrue:[ |
2715 | 1303 |
enabled := state. |
1304 |
self invalidate. |
|
498 | 1305 |
]. |
388 | 1306 |
! |
1307 |
||
1308 |
enabledAt:stringOrNumber |
|
2715 | 1309 |
"gets the enabled state of an item or false" |
1310 |
||
388 | 1311 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1312 |
! |
|
1313 |
||
1314 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1315 |
"sets the enabled state of an item" |
1316 |
||
388 | 1317 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1318 |
! |
|
1319 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1320 |
exclusivePointer:aBoolean |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1321 |
"Do nothing here. Compatibility with PopUpListController" |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1322 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1323 |
^ self |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1324 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1325 |
|
388 | 1326 |
isEnabled:stringOrNumber |
2715 | 1327 |
"gets the enabled state of an item or false" |
1328 |
||
388 | 1329 |
^ self enabledAt:stringOrNumber |
1330 |
! ! |
|
1331 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1332 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1333 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1334 |
enableChannel:aValueHolder |
2715 | 1335 |
"set my enableChannel" |
1336 |
||
498 | 1337 |
enableChannel notNil ifTrue:[ |
2715 | 1338 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1339 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1340 |
|
498 | 1341 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2715 | 1342 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1343 |
]. |
498 | 1344 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1345 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1346 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1347 |
menuHolder:aValueHolder |
2715 | 1348 |
"set my menuHolder" |
1349 |
||
498 | 1350 |
menuHolder notNil ifTrue:[ |
2715 | 1351 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1352 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1353 |
|
498 | 1354 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2715 | 1355 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1356 |
]. |
498 | 1357 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1358 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1359 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1360 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1361 |
|
616 | 1362 |
activeBackgroundColor |
2715 | 1363 |
"get the background drawing color used to highlight selection" |
1364 |
||
2219 | 1365 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1366 |
! |
1367 |
||
1368 |
activeForegroundColor |
|
2715 | 1369 |
"get the foreground color used to highlight selections" |
1370 |
||
2219 | 1371 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1372 |
! |
1373 |
||
390 | 1374 |
backgroundColor |
2715 | 1375 |
"return the background color" |
1376 |
||
502 | 1377 |
^ super viewBackground |
390 | 1378 |
! |
1379 |
||
1380 |
backgroundColor:aColor |
|
1381 |
"set the background drawing color. You should not use this method; |
|
2715 | 1382 |
instead, leave the value as defined in the styleSheet." |
1383 |
||
1384 |
self backgroundColor ~~ aColor ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1385 |
super viewBackground:aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1386 |
self invalidate "/ RepairNow:true |
616 | 1387 |
] |
1388 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1389 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1390 |
! |
1391 |
||
727 | 1392 |
buttonActiveBackgroundColor |
2715 | 1393 |
"get the background drawing color used to highlight button selection" |
1394 |
||
2219 | 1395 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1396 |
default:(self viewBackground) |
|
727 | 1397 |
! |
1398 |
||
730 | 1399 |
buttonEdgeStyle |
2715 | 1400 |
"get the button edge style" |
1401 |
||
2219 | 1402 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1403 |
! |
1404 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1405 |
buttonEnteredBackgroundColor |
2715 | 1406 |
"get the background drawing color used to highlight entered button items" |
1407 |
||
2219 | 1408 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1409 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1410 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1411 |
buttonEnteredLevel |
2715 | 1412 |
"get the 3D-level used to highlight entered button items" |
1413 |
||
2219 | 1414 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1415 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1416 |
|
730 | 1417 |
buttonHalfLightColor |
2715 | 1418 |
"get the background drawing color used to half light button frame" |
1419 |
||
2219 | 1420 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1421 |
! |
1422 |
||
1423 |
buttonHalfShadowColor |
|
2715 | 1424 |
"get the background drawing color used to half shadow button frame" |
1425 |
||
2219 | 1426 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1427 |
! |
1428 |
||
1429 |
buttonLightColor |
|
2715 | 1430 |
"get the background drawing color used to light button frame" |
1431 |
||
2219 | 1432 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1433 |
! |
1434 |
||
1435 |
buttonPassiveBackgroundColor |
|
2715 | 1436 |
"get the background drawing color used for button" |
1437 |
||
2219 | 1438 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1439 |
! |
1440 |
||
1441 |
buttonShadowColor |
|
2715 | 1442 |
"get the background drawing color used to shadow button frame" |
1443 |
||
2219 | 1444 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1445 |
! |
1446 |
||
1447 |
disabledEtchedForegroundColor |
|
1448 |
"return the color used for etching disabled items. |
|
2715 | 1449 |
If nil, no 3D effect is drawn." |
1450 |
||
2219 | 1451 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1452 |
! |
1453 |
||
390 | 1454 |
disabledForegroundColor |
2715 | 1455 |
"return the foreground color used by disabled items" |
1456 |
||
2219 | 1457 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1458 |
! |
1459 |
||
2170 | 1460 |
enteredBackgroundColor |
2715 | 1461 |
"return the background color for entered items" |
1462 |
||
2219 | 1463 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1464 |
default:(self backgroundColor) |
|
2170 | 1465 |
! |
1466 |
||
1467 |
enteredForegroundColor |
|
2715 | 1468 |
"return the foreground color for entered items" |
1469 |
||
2219 | 1470 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1471 |
! |
1472 |
||
390 | 1473 |
font:aFont |
2715 | 1474 |
"set the font" |
1475 |
||
2614 | 1476 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1477 |
||
1478 |
super font:aFont. |
|
1479 |
self do:[:anItem| anItem fontChanged ]. |
|
1480 |
||
1481 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1482 |
self extent:(self preferredExtent) |
|
1483 |
]. |
|
1484 |
self mustRearrange. |
|
390 | 1485 |
! |
1486 |
||
1487 |
foregroundColor |
|
2715 | 1488 |
"return the passive foreground color" |
1489 |
||
2059 | 1490 |
^ fgColor |
390 | 1491 |
! |
1492 |
||
1493 |
foregroundColor:aColor |
|
1494 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1495 |
instead leave the value as defined in the styleSheet." |
1496 |
||
2219 | 1497 |
aColor ~= fgColor ifTrue:[ |
1478 | 1498 |
fgColor := aColor onDevice:device. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1499 |
self invalidate |
2219 | 1500 |
]. |
580 | 1501 |
! |
1502 |
||
1699 | 1503 |
maxAbsoluteButtonLevel |
1504 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1505 |
extent of a button" |
1506 |
||
2219 | 1507 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1508 |
! |
1509 |
||
730 | 1510 |
selectionFrameBrightColor |
2715 | 1511 |
"get the selection frame bright color" |
1512 |
||
2219 | 1513 |
^ Color white |
730 | 1514 |
! |
1515 |
||
1516 |
selectionFrameDarkColor |
|
2715 | 1517 |
"get the selection frame dark color" |
1518 |
||
2219 | 1519 |
^ Color black |
730 | 1520 |
! |
1521 |
||
1727 | 1522 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1523 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1524 |
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
|
1525 |
|
1727 | 1526 |
|currentFont| |
1527 |
||
1528 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1529 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1530 |
super font:aFont. |
1727 | 1531 |
]. |
1532 |
^ currentFont |
|
2761 | 1533 |
! |
1534 |
||
1535 |
viewBackground:aColor |
|
1536 |
super viewBackground:aColor |
|
390 | 1537 |
! ! |
1538 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1539 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1540 |
|
1541 |
height |
|
2715 | 1542 |
"default height" |
1543 |
||
388 | 1544 |
(explicitExtent ~~ true) ifTrue:[ |
2715 | 1545 |
^ self preferredExtent y |
388 | 1546 |
]. |
1547 |
^ super height |
|
1548 |
! |
|
1549 |
||
2016 | 1550 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1551 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1552 |
device notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1553 |
^ device usableExtent - 2. |
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 |
superMenu notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1556 |
^ superMenu maxExtent |
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 |
"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
|
1559 |
self error:'don''t know maxExtent'. |
2016 | 1560 |
! |
1561 |
||
388 | 1562 |
preferredExtent |
2715 | 1563 |
"compute and returns my preferred extent" |
1564 |
||
2253 | 1565 |
|maxExtent usedExtent| |
2024 | 1566 |
|
2016 | 1567 |
preferredExtent notNil ifTrue:[ |
2253 | 1568 |
^ preferredExtent |
2016 | 1569 |
]. |
2024 | 1570 |
usedExtent := self preferredExtentOfItems. |
1571 |
||
1572 |
superView isNil ifTrue:[ |
|
2253 | 1573 |
"/ is standalone |
2374 | 1574 |
preferredWidth notNil ifTrue:[ |
2253 | 1575 |
usedExtent x < preferredWidth ifTrue:[ |
1576 |
usedExtent := preferredWidth @ usedExtent y. |
|
1577 |
] |
|
1578 |
] |
|
2024 | 1579 |
]. |
1580 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1581 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1582 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1583 |
usedExtent := usedExtent min:maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1584 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1585 |
^ usedExtent |
2024 | 1586 |
|
1587 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1588 |
! |
1589 |
||
1590 |
preferredExtentOfItems |
|
1591 |
"compute and returns my preferred extent including all items |
|
2715 | 1592 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
1593 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1594 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1595 |
x "{ Class:SmallInteger }" |
1596 |
y "{ Class:SmallInteger }" |
|
1597 |
size "{ Class:SmallInteger }" |
|
2145 | 1598 |
buttonInsetX "{ Class:SmallInteger }" |
1599 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 1600 |
labelInsetX "{ Class:SmallInteger }" |
1601 |
labelInsetY "{ Class:SmallInteger }" |
|
1602 |
itemSpace "{ Class:SmallInteger }" |
|
1603 |
itemMargin "{ Class:SmallInteger }" |
|
1604 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1605 |
| |
388 | 1606 |
|
1699 | 1607 |
(size := items size) == 0 ifTrue:[ |
2219 | 1608 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1609 |
^ 32 @ 32 |
2219 | 1610 |
]. |
1611 |
buttonInsetX := 2 * self buttonInsetX. |
|
1612 |
buttonInsetY := 2 * self buttonInsetY. |
|
1699 | 1613 |
|
1614 |
self isPopUpView ifFalse:[ |
|
2219 | 1615 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1616 |
] ifTrue:[ |
2145 | 1617 |
labelInsetX := labelInsetY := 0. |
1699 | 1618 |
]. |
1619 |
||
1620 |
x := 0. |
|
1621 |
y := 0. |
|
2219 | 1622 |
groupDividerSize := self groupDividerSize. |
388 | 1623 |
|
1624 |
self verticalLayout ifFalse:[ |
|
2219 | 1625 |
itemSpace := self itemSpace. |
1626 |
||
1699 | 1627 |
items keysAndValuesDo:[:key :el| |eX eY| |
1628 |
extent := el preferredExtent. |
|
1629 |
||
1630 |
"/ check for visibility (extent x ~~ 0) |
|
1631 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1632 |
eY := extent y. |
|
1633 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1634 |
el isButton ifTrue:[ |
2145 | 1635 |
eX := eX + buttonInsetX. |
1636 |
eY := eY + buttonInsetY. |
|
1699 | 1637 |
] ifFalse:[ |
2145 | 1638 |
eX := eX + labelInsetX. |
1639 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1640 |
]. |
1699 | 1641 |
key ~~ size ifTrue:[ |
1642 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1643 |
x := x + groupDividerSize |
|
1644 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1645 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1646 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1647 |
] |
1699 | 1648 |
] |
1649 |
]. |
|
1650 |
x := eX + x. |
|
1651 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1652 |
] |
1699 | 1653 |
] |
388 | 1654 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1655 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1656 |
shCtKey := 0. |
1699 | 1657 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1658 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1659 |
x := 0. |
2219 | 1660 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1661 |
|
1699 | 1662 |
items keysAndValuesDo:[:key :el| |eX eY| |
1663 |
extent := el preferredExtent. |
|
1664 |
||
1665 |
"/ check for visibility (extent x ~~ 0) |
|
1666 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1667 |
eY := extent y. |
|
1668 |
||
1669 |
el isButton ifTrue:[ |
|
2145 | 1670 |
eX := eX + buttonInsetX. |
1671 |
eY := eY + buttonInsetY. |
|
1699 | 1672 |
] ifFalse:[ |
2145 | 1673 |
eX := eX + labelInsetX. |
1674 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1675 |
]. |
1699 | 1676 |
hasMenu ifFalse:[ |
1677 |
hasMenu := el hasSubmenu |
|
1678 |
]. |
|
1679 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1680 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1681 |
]. |
|
1682 |
key ~~ size ifTrue:[ |
|
1683 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1684 |
y := y + groupDividerSize |
|
1685 |
] |
|
1686 |
]. |
|
1687 |
y := eY + y. |
|
1688 |
x := eX max:x. |
|
1689 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1690 |
]. |
2219 | 1691 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1692 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1693 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1694 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1695 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1696 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1697 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1698 |
x := x + self shortcutKeyOffset. |
1472
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 |
]. |
1699 | 1701 |
"/ to have a small inset |
1702 |
y := y + 1. |
|
1703 |
"/ x := x + 1. |
|
1704 |
]. |
|
1705 |
x := x + margin + margin. |
|
1706 |
y := y + margin + margin. |
|
1707 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1708 |
^ x @ y |
388 | 1709 |
! |
1710 |
||
2253 | 1711 |
preferredWidth:aWidthOrNil |
1712 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1713 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1714 |
If not nil, the width is the maximum from the contained items and the required width." |
1715 |
||
2253 | 1716 |
preferredWidth := aWidthOrNil. |
2024 | 1717 |
! |
1718 |
||
388 | 1719 |
shortKeyInset |
2715 | 1720 |
"left inset of shortcutKey" |
1721 |
||
1722 |
^ shortKeyInset |
|
616 | 1723 |
! |
1724 |
||
1725 |
subMenuIndicationWidth |
|
2219 | 1726 |
^ self rightArrow width |
388 | 1727 |
! ! |
1728 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1729 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1730 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1731 |
iconIndicationDisabledOff |
2219 | 1732 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1733 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1734 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1735 |
iconIndicationDisabledOn |
2219 | 1736 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
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 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1739 |
iconIndicationOff |
2219 | 1740 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1741 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1742 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1743 |
iconIndicationOn |
2219 | 1744 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
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 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1747 |
iconRadioGroupDisabledOff |
2219 | 1748 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1749 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1750 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1751 |
iconRadioGroupDisabledOn |
2219 | 1752 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
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 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1755 |
iconRadioGroupOff |
2219 | 1756 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1757 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1758 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1759 |
iconRadioGroupOn |
2219 | 1760 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
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 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1763 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1764 |
|
1765 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1766 |
"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
|
1767 |
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
|
1768 |
|
388 | 1769 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1770 |
! |
|
1771 |
||
1772 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1773 |
"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
|
1774 |
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
|
1775 |
|
388 | 1776 |
|item| |
1777 |
||
1778 |
item := self itemAt:stringOrNumber. |
|
1779 |
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
|
1780 |
^ exceptionBlock value |
706 | 1781 |
! |
1782 |
||
1783 |
itemAtIndex:anIndex |
|
2715 | 1784 |
"returns item at an index or nil" |
1785 |
||
706 | 1786 |
^ 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
|
1787 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1788 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1789 |
items |
2715 | 1790 |
"returns list of items or nil" |
1791 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1792 |
^ items |
388 | 1793 |
! ! |
1794 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1795 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1796 |
|
727 | 1797 |
buttonActiveLevel |
2715 | 1798 |
"get the buttons active level" |
1799 |
||
2219 | 1800 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1801 |
! |
1802 |
||
1803 |
buttonPassiveLevel |
|
2715 | 1804 |
"get the buttons passive level" |
1805 |
||
2219 | 1806 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
727 | 1807 |
! |
1808 |
||
2337 | 1809 |
centerItems |
1810 |
^ centerItems ? false |
|
1811 |
! |
|
1812 |
||
1813 |
centerItems:aBoolean |
|
1814 |
centerItems := aBoolean |
|
1815 |
! |
|
1816 |
||
390 | 1817 |
fitFirstPanel |
1818 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1819 |
to the extent of its superView |
|
1699 | 1820 |
|
2715 | 1821 |
NOT SUPPORTED" |
1822 |
||
2219 | 1823 |
^ false |
388 | 1824 |
! |
1825 |
||
390 | 1826 |
fitFirstPanel:aState |
1827 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1828 |
to the extent of its superView |
|
1699 | 1829 |
|
2715 | 1830 |
NOT SUPPORTED" |
616 | 1831 |
! |
1832 |
||
1093 | 1833 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1834 |
anInt ~~ level ifTrue:[ |
2219 | 1835 |
super level:anInt. |
1836 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1837 |
] |
2052 | 1838 |
|
1839 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1840 |
! |
1841 |
||
616 | 1842 |
rightArrow |
2374 | 1843 |
rightArrow isNil ifTrue:[ |
1844 |
device isNil ifTrue:[ |
|
2219 | 1845 |
^ SelectionInListView rightArrowFormOn:Display |
1846 |
]. |
|
1847 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1848 |
]. |
|
616 | 1849 |
^ rightArrow |
1850 |
! |
|
1851 |
||
1852 |
rightArrowShadow |
|
1853 |
^ rightArrowShadow |
|
388 | 1854 |
! |
1855 |
||
390 | 1856 |
showGroupDivider |
2715 | 1857 |
"get the enabled flag for showing groupDiveders" |
1858 |
||
2253 | 1859 |
^ showGroupDivider |
388 | 1860 |
! |
1861 |
||
390 | 1862 |
showGroupDivider:aState |
2715 | 1863 |
"set the enabled flag for showing groupDiveders" |
1864 |
||
2253 | 1865 |
showGroupDivider ~~ aState ifTrue:[ |
1866 |
showGroupDivider := aState. |
|
1867 |
self mustRearrange. |
|
653 | 1868 |
] |
388 | 1869 |
! |
1870 |
||
1871 |
showSeparatingLines |
|
2715 | 1872 |
"gets true if drawing of separating lines is enabled." |
1873 |
||
2253 | 1874 |
^ showSeparatingLines |
388 | 1875 |
! |
1876 |
||
390 | 1877 |
showSeparatingLines:aState |
2715 | 1878 |
"turn on/off drawing of separating lines." |
1879 |
||
2253 | 1880 |
aState ~~ showSeparatingLines ifTrue:[ |
1881 |
showSeparatingLines := aState. |
|
1882 |
self mustRearrange |
|
1883 |
]. |
|
388 | 1884 |
! |
1885 |
||
1886 |
verticalLayout |
|
2715 | 1887 |
"get the layout: vertical( true ) or horizontal( false )" |
1888 |
||
2374 | 1889 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 1890 |
|
1891 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1892 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
2374 | 1893 |
^ verticalLayout |
388 | 1894 |
! |
1895 |
||
1896 |
verticalLayout:aState |
|
2715 | 1897 |
"set the layout: vertical( true ) or horizontal( false )" |
1898 |
||
2253 | 1899 |
aState ~~ verticalLayout ifTrue:[ |
1900 |
verticalLayout isNil ifTrue:[ |
|
1901 |
verticalLayout := aState |
|
1902 |
] ifFalse:[ |
|
1903 |
verticalLayout := aState. |
|
1904 |
self mustRearrange. |
|
1905 |
]. |
|
1906 |
]. |
|
388 | 1907 |
! ! |
1908 |
||
2219 | 1909 |
!MenuPanel methodsFor:'accessing-style'! |
1910 |
||
1911 |
buttonInsetX |
|
2715 | 1912 |
"returns the verical button space" |
1913 |
||
2219 | 1914 |
^ styleSheet at:#'menuPanel.buttonInsetX' |
1915 |
! |
|
1916 |
||
1917 |
buttonInsetY |
|
2715 | 1918 |
"returns the verical button space" |
1919 |
||
2219 | 1920 |
^ styleSheet at:#'menuPanel.buttonInsetY' |
1921 |
! |
|
1922 |
||
1923 |
enteredLevel |
|
2715 | 1924 |
"returns the enter-level for an unselected item moved through" |
1925 |
||
2219 | 1926 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
1927 |
! |
|
1928 |
||
1929 |
groupDividerSize |
|
2715 | 1930 |
"returns the width of a group divider" |
1931 |
||
2219 | 1932 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
1933 |
! |
|
1934 |
||
1935 |
itemMargin |
|
2715 | 1936 |
"returns the margin of an item" |
1937 |
||
2219 | 1938 |
^ styleSheet at:#'menu.itemMargin' default:0 |
1939 |
! |
|
1940 |
||
1941 |
itemSpace |
|
2715 | 1942 |
"returns the additional space for an item in a (vertical) panel" |
1943 |
||
2219 | 1944 |
^ styleSheet at:#'menuPanel.itemSpace' |
1945 |
! |
|
1946 |
||
1947 |
selectionFollowsMouse |
|
2715 | 1948 |
"returns true if the selection follows the mouse" |
1949 |
||
2219 | 1950 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
1951 |
! |
|
1952 |
||
1953 |
shortcutKeyOffset |
|
2715 | 1954 |
"returns the offset for a shortcutKey" |
1955 |
||
2219 | 1956 |
^ 5 |
1957 |
! ! |
|
1958 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1959 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1960 |
|
1961 |
subMenuAt:stringOrNumber |
|
2715 | 1962 |
"gets the submenu of an item or nil" |
1963 |
||
1964 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
388 | 1965 |
! |
1966 |
||
1967 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 1968 |
"sets the submenu of an item" |
1969 |
||
388 | 1970 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
1971 |
! |
|
1972 |
||
1973 |
subMenuShown |
|
2715 | 1974 |
"return the currently visible submenu - or nil if there is none" |
1975 |
||
388 | 1976 |
|item| |
1977 |
||
1978 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 1979 |
^ item submenu |
1980 |
]. |
|
1981 |
^ nil |
|
388 | 1982 |
! ! |
1983 |
||
2504 | 1984 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 1985 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1986 |
closeMenus |
2715 | 1987 |
"close all menus without accepting" |
1988 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1989 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1990 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1991 |
|
388 | 1992 |
hide |
2715 | 1993 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1994 |
|
2407 | 1995 |
"/ TODO: replace with LeaveSignal raise. |
1996 |
||
388 | 1997 |
self selection:nil. |
1998 |
self unmap. |
|
1999 |
! |
|
2000 |
||
2001 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2002 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2003 |
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
|
2004 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2005 |
to some performer)" |
2006 |
||
2007 |
^ self showAt:(self origin) resizing:true |
|
388 | 2008 |
! |
2009 |
||
2010 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2011 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2012 |
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
|
2013 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2014 |
to some performer)" |
2015 |
||
388 | 2016 |
^ self showAt:aPoint resizing:true |
2017 |
! |
|
2018 |
||
2019 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2020 |
"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
|
2021 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2022 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2023 |
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
|
2024 |
menu (i.e. the view or controller), which will perform the action |
2715 | 2025 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2026 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
2027 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 2028 |
|
2029 |
aBoolean ifTrue:[ |
|
2715 | 2030 |
self fixSize. |
388 | 2031 |
]. |
2032 |
self origin:aPoint. |
|
1459 | 2033 |
"/ self makeFullyVisible. -- done in realize |
388 | 2034 |
self openModal:[true]. "realize " |
2035 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2036 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2037 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2038 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2039 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2715 | 2040 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2041 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2042 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2043 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
2044 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2045 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 2046 |
! |
2047 |
||
2048 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2049 |
"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
|
2050 |
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
|
2051 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2052 |
to some performer)" |
2053 |
||
388 | 2054 |
^ self showAt:(device pointerPosition) resizing:true |
2055 |
! |
|
2056 |
||
2057 |
showCenteredIn:aView |
|
2058 |
"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
|
2059 |
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
|
2060 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2061 |
to some performer)" |
2062 |
||
388 | 2063 |
|top| |
2064 |
||
2065 |
top := aView topView. |
|
2066 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2067 |
^ 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
|
2068 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
2069 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 2070 |
! |
2071 |
||
2072 |
startUp |
|
2073 |
"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
|
2074 |
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
|
2075 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2076 |
to some performer)" |
2077 |
||
388 | 2078 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2079 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2080 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2081 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2082 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
2083 |
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
|
2084 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2085 |
to some performer)" |
2086 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2087 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2088 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2089 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2090 |
! |
2091 |
||
2332 | 2092 |
startUpFor:originatingWidget |
2093 |
"realize the menu at the current pointer position |
|
2094 |
return the value of the selectedItem or nil, of none was selected |
|
2095 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2096 |
to some performer)" |
2097 |
||
2332 | 2098 |
originator := originatingWidget. |
2099 |
^ self startUp |
|
2100 |
! |
|
2101 |
||
1750 | 2102 |
startUpOrNil |
2103 |
"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
|
2104 |
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
|
2105 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2106 |
to some performer)" |
2107 |
||
1750 | 2108 |
^ self showAtPointer |
388 | 2109 |
! ! |
2110 |
||
2111 |
!MenuPanel methodsFor:'adding & removing'! |
|
2112 |
||
2113 |
createAtIndex:anIndexOrNil |
|
1800 | 2114 |
"create an item and add this item to the index. In case of nil, the item |
2115 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2116 |
otherwise the new created item is returned." |
2117 |
||
388 | 2118 |
|max item| |
2119 |
||
2120 |
max := (items size) + 1. |
|
2121 |
||
2122 |
anIndexOrNil notNil ifTrue:[ |
|
2715 | 2123 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2124 |
^ nil |
|
2125 |
] |
|
388 | 2126 |
]. |
2127 |
items isNil ifTrue:[ |
|
2715 | 2128 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2129 |
] ifFalse:[ |
2715 | 2130 |
items := items asOrderedCollection |
388 | 2131 |
]. |
2132 |
item := Item in:self. |
|
2133 |
||
2134 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2715 | 2135 |
items add:item |
388 | 2136 |
] ifFalse:[ |
2715 | 2137 |
items add:item beforeIndex:anIndexOrNil |
388 | 2138 |
]. |
2139 |
^ item |
|
2140 |
! |
|
2141 |
||
2142 |
remove:stringOrNumber |
|
2143 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2144 |
if found, remove and return it" |
2145 |
||
388 | 2146 |
|item| |
2147 |
||
2148 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2715 | 2149 |
items remove:item. |
2150 |
item destroy. |
|
2151 |
items isEmpty ifTrue:[items := nil]. |
|
2152 |
self mustRearrange. |
|
388 | 2153 |
]. |
2154 |
^ item |
|
2155 |
! |
|
2156 |
||
2157 |
removeAll |
|
2715 | 2158 |
"remove all items and submenus" |
2159 |
||
388 | 2160 |
self disabledRedrawDo:[ |
2715 | 2161 |
self selection:nil. |
2162 |
groupSizes := nil. |
|
2163 |
items notNil ifTrue:[ |
|
2164 |
items copy do:[:el| el destroy ]. |
|
2165 |
]. |
|
2166 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2167 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2168 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2169 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2170 |
! ! |
2171 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2172 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2173 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2174 |
update:something with:aParameter from:changedObject |
498 | 2175 |
|
2176 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2177 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2178 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2179 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2180 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2181 |
|
388 | 2182 |
!MenuPanel methodsFor:'converting'! |
2183 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2184 |
asMenu |
2715 | 2185 |
"convert contents to menu" |
2186 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2187 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2188 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2189 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2190 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2191 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2192 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2193 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2194 |
|
388 | 2195 |
fromSpec:aMenuSpec |
2715 | 2196 |
"build from spec" |
2197 |
||
388 | 2198 |
|menu| |
2199 |
||
2200 |
menu := Menu new. |
|
2201 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2202 |
self menu:menu |
|
2203 |
! |
|
2204 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2205 |
menu:aMenu |
2715 | 2206 |
"convert to Menu" |
2207 |
||
388 | 2208 |
self disabledRedrawDo:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2209 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2210 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2211 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2212 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2213 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2214 |
(aMenu isCollection) ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2215 |
menu := Menu new. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2216 |
menu fromLiteralArrayEncoding:aMenu. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2217 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2218 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2219 |
menuReceiver notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2220 |
receiver := menuReceiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2221 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2222 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2223 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2224 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2225 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2226 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2227 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2228 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2229 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2230 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2231 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2232 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2233 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2234 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2235 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2236 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2237 |
! ! |
2238 |
||
2681 | 2239 |
!MenuPanel methodsFor:'dependents access'! |
2240 |
||
2241 |
addDependencies |
|
2715 | 2242 |
"add all dependencies" |
2243 |
||
2681 | 2244 |
self do:[:anItem| anItem addDependencies ]. |
2245 |
||
2246 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2247 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2248 |
! |
|
2249 |
||
2250 |
removeDependencies |
|
2715 | 2251 |
"remove all dependencies" |
2252 |
||
2681 | 2253 |
self do:[:anItem| anItem removeDependencies ]. |
2254 |
||
2255 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2256 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2257 |
! ! |
|
2258 |
||
388 | 2259 |
!MenuPanel methodsFor:'drawing'! |
2260 |
||
2261 |
disabledRedrawDo:aBlock |
|
2262 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2263 |
of the block a redraw might be performed" |
2264 |
||
388 | 2265 |
|state| |
2266 |
||
2267 |
state := mustRearrange. |
|
2268 |
mustRearrange := true. |
|
2269 |
aBlock value. |
|
2270 |
mustRearrange := state. |
|
2271 |
self mustRearrange |
|
2272 |
! |
|
2273 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2274 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2275 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2276 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2277 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2278 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2279 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2280 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2281 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2282 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2283 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2284 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2285 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2286 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2287 |
level:aLevel |
2219 | 2288 |
shadow:(self buttonShadowColor) |
2289 |
light:(self buttonLightColor) |
|
2290 |
halfShadow:(self buttonHalfShadowColor) |
|
2291 |
halfLight:(self buttonHalfLightColor) |
|
2292 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2293 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2294 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2295 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2296 |
|
2016 | 2297 |
drawItemsX:x y:y width:w height:h |
2715 | 2298 |
"redraw items and groups in a damage" |
2299 |
||
2016 | 2300 |
|isVertical item layout prevClip |
2301 |
x1 "{ Class:SmallInteger }" |
|
2302 |
x2 "{ Class:SmallInteger }" |
|
2303 |
y1 "{ Class:SmallInteger }" |
|
2304 |
y2 "{ Class:SmallInteger }" |
|
2305 |
start "{ Class:SmallInteger }" |
|
2306 |
stop "{ Class:SmallInteger }" |
|
2307 |
size "{ Class:SmallInteger }" |
|
2308 |
groupDivInset "{ Class:SmallInteger }" |
|
2309 |
| |
|
2310 |
||
2311 |
size := items size. |
|
2312 |
isVertical := self verticalLayout. |
|
2313 |
||
2314 |
isVertical ifTrue:[ |
|
2064 | 2315 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2316 |
start == 0 ifTrue:[ ^ self ]. |
2317 |
y1 := y + h. |
|
2064 | 2318 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2319 |
startingAt:(start + 1). |
|
2016 | 2320 |
] ifFalse:[ |
2064 | 2321 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2322 |
start == 0 ifTrue:[ ^ self ]. |
2323 |
x1 := x + w. |
|
2064 | 2324 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2325 |
startingAt:(start + 1). |
|
2016 | 2326 |
]. |
2327 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2328 |
||
2253 | 2329 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2330 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2331 |
|
2332 |
groupDivInset ~~ 0 ifTrue:[ |
|
2333 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2334 |
start := start - 1 |
|
2335 |
] |
|
2336 |
]. |
|
2337 |
] ifFalse:[ |
|
2338 |
groupDivInset := 0 |
|
2339 |
]. |
|
2340 |
||
2341 |
prevClip := clipRect. |
|
2342 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2343 |
||
2344 |
start to:stop do:[:i| |
|
2345 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2346 |
item draw. |
2016 | 2347 |
|
2348 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2349 |
layout := item layout. |
|
2350 |
||
2351 |
isVertical ifTrue:[ |
|
2352 |
x1 := layout left. |
|
2353 |
x2 := layout right. |
|
2354 |
y1 := layout bottom + groupDivInset. |
|
2355 |
y2 := y1. |
|
2356 |
] ifFalse:[ |
|
2357 |
y1 := layout top. |
|
2358 |
y2 := layout bottom. |
|
2359 |
x1 := layout right + groupDivInset. |
|
2360 |
x2 := x1. |
|
2361 |
]. |
|
2362 |
self paint:shadowColor. |
|
2363 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2364 |
self paint:lightColor. |
|
2365 |
||
2366 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2367 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2368 |
||
2369 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2370 |
] |
|
2371 |
]. |
|
2372 |
self clippingRectangle:prevClip. |
|
2373 |
! |
|
2374 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2375 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2376 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2377 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2378 |
isSelected ifTrue:[ |
2219 | 2379 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2380 |
] ifFalse:[ |
2219 | 2381 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2382 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2383 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2384 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2385 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2386 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2387 |
|
1691 | 2388 |
self drawEdgesForX:(layout left) |
2389 |
y:(layout top) |
|
2390 |
width:(layout width) |
|
2391 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2392 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2393 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2394 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2395 |
|
2016 | 2396 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2397 |
"draw a scroller" |
2398 |
||
2016 | 2399 |
|scrolling icon level x y w h| |
2400 |
||
2401 |
x := bounds left. |
|
2402 |
y := bounds top. |
|
2403 |
w := bounds width. |
|
2404 |
h := bounds height. |
|
2405 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2406 |
scrolling := self scrollActivity. |
2016 | 2407 |
|
2408 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2715 | 2409 |
level := -2 |
2016 | 2410 |
] ifFalse:[ |
2715 | 2411 |
level := 1 |
2016 | 2412 |
]. |
2413 |
||
2414 |
level ~~ 0 ifTrue:[ |
|
2715 | 2415 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2416 |
]. |
2417 |
icon := scrolling iconAt:aDirection on:self. |
|
2418 |
||
2419 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2715 | 2420 |
y:(y + (h - icon height // 2)). |
2016 | 2421 |
! |
2422 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2423 |
invalidateItem:anItem repairNow:aBool |
2715 | 2424 |
"an item changed; invalidate the items layout" |
2425 |
||
2016 | 2426 |
|layout| |
2427 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2428 |
(mustRearrange not and:[shown]) ifTrue:[ |
2715 | 2429 |
layout := anItem layout. |
2430 |
||
2431 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2432 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2433 |
] |
|
1728 | 2434 |
]. |
2435 |
||
2436 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2437 |
! |
2438 |
||
388 | 2439 |
mustRearrange |
2715 | 2440 |
"force rearrange (i.e. set the rearrange flag)" |
2441 |
||
2080 | 2442 |
mustRearrange ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2443 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2444 |
self invalidate "/ RepairNow:true |
388 | 2445 |
] |
590 | 2446 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2447 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2448 |
! |
2449 |
||
710 | 2450 |
rearrangeGroups |
2715 | 2451 |
"implements the groupIdentifier #right in a horizontal menu" |
2452 |
||
1699 | 2453 |
|layout point |
710 | 2454 |
dltX "{ Class:SmallInteger }" |
2455 |
start "{ Class:SmallInteger }" |
|
2456 |
| |
|
2457 |
||
2458 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2715 | 2459 |
^ self |
710 | 2460 |
]. |
2461 |
||
2462 |
layout := items last layout. |
|
2463 |
||
1699 | 2464 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2715 | 2465 |
^ self "/ no free space |
710 | 2466 |
]. |
2467 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2468 |
||
2469 |
start == 0 ifTrue:[ |
|
2715 | 2470 |
^ self "/ no item detected |
1699 | 2471 |
]. |
2472 |
point := dltX @ 0. |
|
2473 |
||
2474 |
"/ move items layout to right |
|
710 | 2475 |
|
2476 |
items from:start do:[:anItem| |
|
2715 | 2477 |
anItem isVisible ifTrue:[ |
2478 |
anItem layout moveBy:point. |
|
2479 |
] |
|
710 | 2480 |
]. |
2481 |
! |
|
2482 |
||
388 | 2483 |
rearrangeItems |
1699 | 2484 |
"recompute the layout of each item |
2715 | 2485 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2486 |
||
1791 | 2487 |
|isVertical extent isPopUpMenu |
2219 | 2488 |
x "{ Class:SmallInteger }" |
2489 |
y "{ Class:SmallInteger }" |
|
2490 |
x0 "{ Class:SmallInteger }" |
|
2491 |
y0 "{ Class:SmallInteger }" |
|
2492 |
x1 "{ Class:SmallInteger }" |
|
2493 |
y1 "{ Class:SmallInteger }" |
|
2494 |
size "{ Class:SmallInteger }" |
|
2495 |
insetX "{ Class:SmallInteger }" |
|
2496 |
insetY "{ Class:SmallInteger }" |
|
2497 |
labelInsetX "{ Class:SmallInteger }" |
|
2498 |
labelInsetY "{ Class:SmallInteger }" |
|
2145 | 2499 |
buttonInsetX "{ Class:SmallInteger }" |
2500 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 2501 |
itemMargin "{ Class:SmallInteger }" |
2502 |
itemSpace "{ Class:SmallInteger }" |
|
2503 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2504 |
| |
1699 | 2505 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2506 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2507 |
^ self |
390 | 2508 |
]. |
2219 | 2509 |
|
2080 | 2510 |
"/ DON'T SET THIS!! |
2511 |
"/ item layout: below of first item -> item invalidate |
|
2512 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2513 |
"/ -> invalidate:rapairDamage: |
|
2514 |
"/ -> redrawX:y:width:height: |
|
2515 |
"/ tries to get uninitialized layout from second item. |
|
2516 |
"/ This happens in a modal debugger!! |
|
2517 |
"/ mustRearrange := false. |
|
2219 | 2518 |
isVertical := self verticalLayout. |
2519 |
itemSpace := self itemSpace. |
|
2520 |
groupDividerSize := self groupDividerSize. |
|
2521 |
buttonInsetX := self buttonInsetX. |
|
2522 |
buttonInsetY := self buttonInsetY. |
|
2523 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2524 |
|
2525 |
isPopUpMenu ifFalse:[ |
|
2219 | 2526 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2527 |
] ifTrue:[ |
2145 | 2528 |
labelInsetX := labelInsetY := 0 |
388 | 2529 |
]. |
390 | 2530 |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2531 |
(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
|
2532 |
extent := self preferredExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2533 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2534 |
isPopUpMenu ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2535 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2536 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2537 |
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
|
2538 |
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
|
2539 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2540 |
] ifFalse:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2541 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
1478 | 2542 |
]. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2543 |
self extent:extentToSet. |
390 | 2544 |
] ifFalse:[ |
1699 | 2545 |
extent := self computeExtent |
390 | 2546 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2547 |
|
1093 | 2548 |
x := y := margin. |
2549 |
||
1699 | 2550 |
isVertical ifFalse:[ |
2551 |
y0 := margin. |
|
2552 |
y1 := extent y - margin. |
|
2553 |
||
2554 |
items keysAndValuesDo:[:anIndex :el| |
|
2555 |
el isVisible ifFalse:[ |
|
2556 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2557 |
] ifTrue:[ |
|
1478 | 2558 |
el isButton ifTrue:[ |
2145 | 2559 |
insetX := buttonInsetX. |
2560 |
insetY := buttonInsetY. |
|
2062 | 2561 |
] ifFalse:[ |
2145 | 2562 |
insetX := labelInsetX. |
2563 |
insetY := labelInsetY. |
|
1478 | 2564 |
]. |
2145 | 2565 |
x0 := x + insetX. |
2171 | 2566 |
x1 := x0 + (el preferredExtent x). |
2145 | 2567 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2568 |
x := x1 + insetX. |
|
1699 | 2569 |
|
2570 |
size ~~ anIndex ifTrue:[ |
|
2571 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2572 |
x := x + groupDividerSize |
|
2573 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2574 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2575 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2576 |
] |
1699 | 2577 |
] |
2578 |
] |
|
1478 | 2579 |
]. |
1699 | 2580 |
]. |
2581 |
] ifTrue:[ |
|
2219 | 2582 |
itemMargin := self itemMargin. |
1699 | 2583 |
x0 := margin. |
2219 | 2584 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2585 |
|
2586 |
items keysAndValuesDo:[:anIndex :el| |
|
2587 |
el isVisible ifFalse:[ |
|
2588 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2589 |
] ifTrue:[ |
|
2590 |
el isButton ifTrue:[ |
|
2145 | 2591 |
insetX := buttonInsetX. |
2592 |
insetY := buttonInsetY. |
|
1699 | 2593 |
] ifFalse:[ |
2145 | 2594 |
insetX := labelInsetX. |
2595 |
insetY := labelInsetY. |
|
1699 | 2596 |
]. |
2145 | 2597 |
y0 := y + insetY. |
1699 | 2598 |
y1 := y0 + el preferredExtent y. |
2219 | 2599 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2600 |
y := y1 + insetY. |
1699 | 2601 |
|
2602 |
size ~~ anIndex ifTrue:[ |
|
2603 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2604 |
y := y + groupDividerSize |
|
2605 |
] |
|
2606 |
] |
|
1478 | 2607 |
] |
2608 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2609 |
]. |
710 | 2610 |
self rearrangeGroups. |
2048 | 2611 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2612 |
mustRearrange := false. |
2048 | 2613 |
|
2614 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2615 |
! |
2616 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2617 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2618 |
"check for items which can change its visibility; |
2715 | 2619 |
if at least one item exists, rearrange all items" |
2620 |
||
1464 | 2621 |
items isNil ifTrue:[^ self]. |
1699 | 2622 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2623 |
items do:[:item | |
2715 | 2624 |
item canChangeVisibility ifTrue:[ |
2625 |
mustRearrange := true. |
|
2626 |
self rearrangeItems. |
|
2627 |
^ self |
|
2628 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2629 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2630 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2631 |
|
388 | 2632 |
redrawX:x y:y width:w height:h |
2715 | 2633 |
"redraw a damage" |
2634 |
||
2052 | 2635 |
|y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller| |
388 | 2636 |
|
710 | 2637 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2638 |
|
1699 | 2639 |
mustRearrange ifTrue:[ |
2569 | 2640 |
self isPopUpView ifFalse:[explicitExtent := true]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2641 |
self rearrangeItems. |
2569 | 2642 |
self invalidate. |
2643 |
^ self |
|
1699 | 2644 |
]. |
2219 | 2645 |
self paint:(self viewBackground). |
1699 | 2646 |
self clearRectangleX:x y:y width:w height:h. |
2647 |
||
2016 | 2648 |
items size == 0 ifTrue:[ |
1699 | 2649 |
^ self |
2650 |
]. |
|
2016 | 2651 |
y0 := y. |
2652 |
y1 := y + h. |
|
2018 | 2653 |
x0 := x. |
2654 |
x1 := x + w. |
|
2016 | 2655 |
|
2656 |
self hasScrollers ifTrue:[ |
|
2657 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2658 |
bounds := self scrollerBoundsAt:#PREV. |
|
2052 | 2659 |
mustDrawPrevScroller := false. |
2016 | 2660 |
|
2018 | 2661 |
self verticalLayout ifTrue:[ |
2662 |
bounds bottom > y ifTrue:[ |
|
2663 |
y0 := bounds bottom. |
|
2052 | 2664 |
mustDrawPrevScroller := true. |
2018 | 2665 |
]. |
2666 |
] ifFalse:[ |
|
2667 |
bounds right > x ifTrue:[ |
|
2668 |
x0 := bounds right. |
|
2052 | 2669 |
mustDrawPrevScroller := true. |
2018 | 2670 |
]. |
2052 | 2671 |
]. |
2672 |
mustDrawPrevScroller ifTrue:[ |
|
2673 |
self drawScrollerAt:#PREV bounds:bounds. |
|
2674 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2675 |
]. |
2016 | 2676 |
|
2677 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2678 |
bounds := self scrollerBoundsAt:#NEXT. |
|
2052 | 2679 |
mustDrawNextScroller := false. |
2016 | 2680 |
|
2018 | 2681 |
self verticalLayout ifTrue:[ |
2682 |
bounds top < y1 ifTrue:[ |
|
2683 |
y1 := bounds top. |
|
2052 | 2684 |
mustDrawNextScroller := true. |
2018 | 2685 |
] |
2686 |
] ifFalse:[ |
|
2687 |
bounds left < x1 ifTrue:[ |
|
2688 |
x1 := bounds left. |
|
2052 | 2689 |
mustDrawNextScroller := true. |
2018 | 2690 |
] |
2052 | 2691 |
]. |
2692 |
mustDrawNextScroller ifTrue:[ |
|
2693 |
self drawScrollerAt:#NEXT bounds:bounds. |
|
2694 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2695 |
] |
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 |
||
2908 |
keyPress:key x:x y:y |
|
2715 | 2909 |
"any key is pressed" |
2910 |
||
2251 | 2911 |
|menu superMenu sensor| |
2912 |
||
2913 |
sensor := self sensor. |
|
2374 | 2914 |
sensor isNil ifTrue:[^ self]. |
2251 | 2915 |
|
2916 |
sensor anyButtonPressed ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2917 |
^ self "/ ignored while any button is pressed |
2251 | 2918 |
]. |
1699 | 2919 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2920 |
self scrollActivity isActive ifTrue:[ |
2016 | 2921 |
key ~~ #Escape ifTrue:[ |
2922 |
^ self |
|
2923 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2924 |
self scrollActivity stop |
2016 | 2925 |
]. |
2926 |
||
1699 | 2927 |
(key == #Tab |
2928 |
or:[key == #FocusNext |
|
2929 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2930 |
self accept:nil. |
|
2374 | 2931 |
^ super keyPress:key x:x y:y |
1699 | 2932 |
]. |
2933 |
||
2934 |
menu := self detectGrabMenu. |
|
2251 | 2935 |
superMenu := menu superMenu. |
1699 | 2936 |
|
2937 |
key == #Escape ifTrue:[ |
|
2938 |
"/ must hide the active menu |
|
2251 | 2939 |
(superMenu notNil and:[superMenu ~~ self]) ifTrue:[ |
1703 | 2940 |
"/ hide active menu but keep the grab |
2251 | 2941 |
superMenu selection:nil |
1699 | 2942 |
] ifFalse:[ |
1703 | 2943 |
"/ hide active menu and ungrab |
1699 | 2944 |
self accept:nil |
2251 | 2945 |
]. |
2946 |
^ self |
|
2947 |
]. |
|
2948 |
||
2949 |
menu isViewWrapper ifFalse:[ |
|
2950 |
sensor compressKeyPressEventsWithKey:key. |
|
2951 |
menu handleKeyPress:key. |
|
2374 | 2952 |
^ self |
2251 | 2953 |
]. |
2954 |
superMenu == self ifFalse:[^ self]. |
|
2955 |
||
2956 |
"/ allow cursor movement |
|
2957 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
2958 |
(self containsPoint:x@y) ifTrue:[ |
|
2959 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2960 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2961 |
]. |
1699 | 2962 |
! |
2963 |
||
2964 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2965 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2966 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2967 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 2968 |
|
1699 | 2969 |
self detectGrabMenu handlePointerLeave:state. |
2970 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2971 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 2972 |
^ self |
2973 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2974 |
|
2374 | 2975 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2976 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2977 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2978 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2979 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2980 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2981 |
sensor := self sensor. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2982 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2983 |
sensor isNil ifTrue:[ |
2251 | 2984 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2985 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2986 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2987 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2988 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2989 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2990 |
]. |
2251 | 2991 |
] |
1699 | 2992 |
]. |
2993 |
! |
|
2994 |
||
2995 |
sizeChanged:how |
|
2715 | 2996 |
"redraw #right groups" |
2997 |
||
2018 | 2998 |
self isPopUpView ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2999 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
3000 |
self invalidate |
1699 | 3001 |
]. |
3002 |
super sizeChanged:how |
|
3003 |
! ! |
|
3004 |
||
2503 | 3005 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 3006 |
|
1767 | 3007 |
clearImplicitGrab |
2253 | 3008 |
implicitGrabView := lastPointerView := nil. |
1767 | 3009 |
! |
3010 |
||
3011 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3012 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3013 |
|
2253 | 3014 |
|view x y p syntheticEvent menu| |
1767 | 3015 |
|
2658 | 3016 |
ev isDamage ifTrue:[ |
3017 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3018 |
]. |
|
3019 |
||
1767 | 3020 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
3021 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
3022 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
3023 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3024 |
self sensor leftButtonPressed ifFalse:[ |
3025 |
self clearImplicitGrab. |
|
3026 |
]. |
|
1767 | 3027 |
]. |
3028 |
||
3029 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 3030 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 3031 |
]. |
3032 |
||
3033 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 3034 |
ev isButtonEvent ifTrue:[ |
3035 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
3036 |
ev view:implicitGrabView. |
|
3037 |
ev arguments at:2 put:p x. |
|
3038 |
ev arguments at:3 put:p y. |
|
3039 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
3040 |
||
3041 |
ev isButtonReleaseEvent ifTrue:[ |
|
3042 |
self clearImplicitGrab. |
|
3043 |
]. |
|
3044 |
^ self |
|
3045 |
] |
|
1767 | 3046 |
]. |
3047 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
3048 |
||
2016 | 3049 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 3050 |
self clearImplicitGrab. |
1767 | 3051 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
3052 |
]. |
|
3053 |
||
3054 |
p := menu translateGrabPoint:(x@y). |
|
3055 |
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
|
3056 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 3057 |
|
3058 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 3059 |
(view wantsFocusWithButtonPress) ifTrue:[ |
3060 |
view requestFocus. |
|
3061 |
]. |
|
3062 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
3063 |
implicitGrabView := view. |
|
3064 |
] |
|
3065 |
]. |
|
1767 | 3066 |
|
3067 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 3068 |
lastPointerView ~~ view ifTrue:[ |
3069 |
"/ must generate enter/leave ... (sigh) |
|
3070 |
lastPointerView notNil ifTrue:[ |
|
3071 |
"/ XXX: should be fixed |
|
3072 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
3073 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3074 |
]. |
|
3075 |
view notNil ifTrue:[ |
|
3076 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
3077 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
3078 |
]. |
|
3079 |
lastPointerView := view. |
|
3080 |
]. |
|
1767 | 3081 |
]. |
3082 |
||
3083 |
ev view:view. |
|
3084 |
ev x:p x. |
|
3085 |
ev y:p y. |
|
3086 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3087 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3088 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3089 |
! |
3090 |
||
2048 | 3091 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3092 |
"open or close the corresponding submenus" |
3093 |
||
2251 | 3094 |
|menu item translatedPoint containsPoint| |
3095 |
||
3096 |
containsPoint := self containsPoint:motionPoint. |
|
3097 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ] |
|
3098 |
ifFalse:[ item := nil ]. |
|
3099 |
||
3100 |
self pointerEntersItem:item. |
|
1699 | 3101 |
|
1910 | 3102 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
2251 | 3103 |
"/ only update pointerEnter |
2048 | 3104 |
^ self |
3105 |
]. |
|
3106 |
||
2251 | 3107 |
containsPoint ifTrue:[ |
3108 |
self selection:item openMenu:true. |
|
2374 | 3109 |
^ self |
2251 | 3110 |
]. |
3111 |
||
3112 |
menu := self superMenuAtPoint:motionPoint. |
|
3113 |
||
2374 | 3114 |
menu notNil ifTrue:[ |
2046 | 3115 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3116 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3117 |
^ self |
2251 | 3118 |
]. |
3119 |
self isPopUpView ifTrue:[ |
|
3120 |
self selection:nil |
|
3121 |
]. |
|
2046 | 3122 |
! |
3123 |
||
3124 |
handleButtonPressAtPoint:aPoint |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3125 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3126 |
|
2251 | 3127 |
| item sensor direction wasSelected| |
2016 | 3128 |
|
2046 | 3129 |
item := self itemAtPoint:aPoint. |
2374 | 3130 |
item isNil ifTrue:[ |
2251 | 3131 |
self selection:nil openMenu:false. |
2374 | 3132 |
^ self |
2251 | 3133 |
]. |
3134 |
||
3135 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3136 |
direction notNil ifTrue:[ |
|
3137 |
(self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[ |
|
3138 |
self pointerEntersItem:nil. |
|
3139 |
^ self |
|
2238 | 3140 |
] |
2016 | 3141 |
]. |
2251 | 3142 |
|
3143 |
wasSelected := (selection == item). |
|
3144 |
wasSelected ifFalse:[ |
|
3145 |
self selection:item openMenu:true |
|
3146 |
]. |
|
2199 | 3147 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3148 |
|
2238 | 3149 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3150 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3151 |
item toggleSubmenuVisibility |
|
3152 |
]. |
|
2238 | 3153 |
^ self |
3154 |
]. |
|
3155 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3156 |
^ self |
|
3157 |
]. |
|
3158 |
self invalidateItem:item repairNow:true. |
|
3159 |
self acceptItem:item inMenu:self. |
|
3160 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3161 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3162 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3163 |
sensor flushUserEvents. |
2238 | 3164 |
self selection:nil. |
2046 | 3165 |
|
3166 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3167 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3168 |
! |
3169 |
||
1699 | 3170 |
handleCursorKey:aKey |
2715 | 3171 |
"handle a cursor key" |
3172 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3173 |
|next menu item isVrt backKey p1 p2 |
2354 | 3174 |
idx0 "{ Class:SmallInteger }" |
687 | 3175 |
idx "{ Class:SmallInteger }" |
1705 | 3176 |
size "{ Class:SmallInteger }" |
687 | 3177 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3178 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3179 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3180 |
^ self |
388 | 3181 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3182 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3183 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3184 |
|
2016 | 3185 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3186 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3187 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3188 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3189 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3190 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3191 |
^ superMenu handleCursorKey:aKey |
1699 | 3192 |
]. |
2016 | 3193 |
idx := 0. |
3194 |
||
3195 |
isVrt ifTrue:[ |
|
3196 |
"/ used because of vertical scrolling |
|
3197 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3198 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3199 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3200 |
] ifFalse:[ |
2016 | 3201 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3202 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3203 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3204 |
|
2354 | 3205 |
idx0 := idx. |
3206 |
size timesRepeat:[ |
|
3207 |
|el| |
|
3208 |
||
3209 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3210 |
||
3211 |
idx > size ifTrue:[ |
|
3212 |
idx := 0 "1" |
|
3213 |
] ifFalse:[ |
|
3214 |
idx < 0 ifTrue:[ |
|
3215 |
idx := size |
|
3216 |
] |
|
3217 |
]. |
|
3218 |
||
3219 |
idx == 0 ifTrue:[ |
|
3220 |
self selection:nil. |
|
3221 |
^ self |
|
3222 |
] ifFalse:[ |
|
3223 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3224 |
el canSelect ifTrue:[ |
|
3225 |
el hasDelayedMenu ifTrue:[ |
|
3226 |
"/ do not open menu |
|
3227 |
self selection:el openMenu:false |
|
3228 |
] ifFalse:[ |
|
3229 |
"/ open comes from style-sheet |
|
3230 |
self selection:el. |
|
3231 |
]. |
|
3232 |
^ self |
|
2249 | 3233 |
]. |
2354 | 3234 |
] |
3235 |
]. |
|
3236 |
idx == idx0 ifTrue:[ |
|
3237 |
^ self |
|
3238 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3239 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3240 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3241 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3242 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3243 |
superMenu notNil ifTrue:[ |
1791 | 3244 |
p1 := self translateGrabPoint:0. |
3245 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3246 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3247 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3248 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3249 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3250 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3251 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3252 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3253 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3254 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3255 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3256 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3257 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3258 |
backKey := #CursorUp. |
1699 | 3259 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3260 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3261 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3262 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3263 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3264 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3265 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3266 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3267 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3268 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3269 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3270 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3271 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3272 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3273 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3274 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3275 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3276 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3277 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3278 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3279 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3280 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3281 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3282 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3283 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3284 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3285 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3286 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3287 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3288 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3289 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3290 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3291 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3292 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3293 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3294 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3295 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3296 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3297 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3298 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3299 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3300 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3301 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3302 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3303 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3304 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3305 |
handleKeyPress:key |
2715 | 3306 |
"any key is pressed" |
3307 |
||
2219 | 3308 |
|item inMenu| |
1699 | 3309 |
|
3310 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3311 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3312 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3313 |
key isCharacter ifTrue:[ |
1862 | 3314 |
"/ selection notNil ifTrue:[ |
3315 |
"/ inMenu := self |
|
3316 |
"/ ] ifFalse:[ |
|
3317 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3318 |
"/ ]. |
|
3319 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3320 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3321 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3322 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3323 |
] |
1699 | 3324 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3325 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3326 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3327 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3328 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3329 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3330 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3331 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3332 |
! |
1699 | 3333 |
|
3334 |
handlePointerLeave:state |
|
3335 |
self pointerEntersItem:nil. |
|
3336 |
super pointerLeave:state |
|
3337 |
! |
|
3338 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3339 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3340 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3341 |
|
2238 | 3342 |
|sensor subm item| |
3343 |
||
3344 |
(item := selection) isNil ifTrue:[ |
|
3345 |
superMenu notNil ifTrue:[ |
|
2249 | 3346 |
item := superMenu selection. |
3347 |
||
3348 |
item value notNil ifTrue:[ |
|
3349 |
"/ is a delayed menu |
|
3350 |
self accept:item |
|
3351 |
] ifFalse:[ |
|
3352 |
item toggleSubmenuVisibility |
|
3353 |
] |
|
2238 | 3354 |
] ifFalse:[ |
3355 |
self accept |
|
3356 |
]. |
|
3357 |
^ self |
|
1841 | 3358 |
]. |
3359 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3360 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3361 |
selection toggleSubmenuVisibility. |
3362 |
^ self |
|
2238 | 3363 |
]. |
3364 |
subm := selection currentSubmenu. |
|
3365 |
||
3366 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3367 |
selection toggleSubmenuVisibility. |
3368 |
^ self |
|
2238 | 3369 |
]. |
3370 |
self openDelayed:nil |
|
1841 | 3371 |
]. |
3372 |
self accept. |
|
3373 |
||
2238 | 3374 |
" test for toggle " |
3375 |
item isToggle ifTrue:[ |
|
3376 |
self selection:item. |
|
3377 |
] ifFalse:[ |
|
3378 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3379 |
^ self |
|
3380 |
] |
|
3381 |
]. |
|
1841 | 3382 |
|
3383 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3384 |
^ self |
1841 | 3385 |
]. |
3386 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3387 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3388 |
sensor flushKeyboardFor:nil. |
2238 | 3389 |
Delay waitForSeconds:0.1. |
3390 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3391 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3392 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3393 |
|
1699 | 3394 |
pointerEntersItem:anItemOrNil |
3395 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3396 |
redraw the new item highlighted." |
3397 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3398 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3399 |
|
1699 | 3400 |
( anItemOrNil notNil |
3401 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3402 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3403 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3404 |
anItemOrNil isButton ifTrue:[ |
2219 | 3405 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3406 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3407 |
) ifTrue:[ |
1699 | 3408 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3409 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3410 |
] ifFalse:[ |
2219 | 3411 |
(self enteredLevel ~~ 0 |
3412 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3413 |
) ifTrue:[ |
|
1699 | 3414 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3415 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3416 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3417 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3418 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3419 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3420 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3421 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3422 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3423 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3424 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3425 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3426 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3427 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3428 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3429 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3430 |
]. |
388 | 3431 |
! ! |
3432 |
||
2251 | 3433 |
!MenuPanel methodsFor:'focus handling'! |
3434 |
||
3435 |
hasKeyboardFocus:aBoolean |
|
2715 | 3436 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3437 |
||
2251 | 3438 |
|focusView| |
3439 |
||
3440 |
self isPopUpView ifTrue:[ |
|
3441 |
"/ not visible for popup menus |
|
3442 |
^ super hasKeyboardFocus:aBoolean |
|
3443 |
]. |
|
3444 |
||
3445 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3446 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3447 |
focusView := windowGroup focusView. |
|
3448 |
||
3449 |
focusView == self ifFalse:[ |
|
3450 |
self selection:nil. |
|
3451 |
] |
|
3452 |
] |
|
3453 |
]. |
|
3454 |
super hasKeyboardFocus:aBoolean. |
|
3455 |
! ! |
|
3456 |
||
388 | 3457 |
!MenuPanel methodsFor:'grabbing'! |
3458 |
||
1699 | 3459 |
doGrab |
3460 |
relativeGrabOrigin := nil. |
|
3461 |
||
3462 |
superMenu notNil ifTrue:[ |
|
2219 | 3463 |
superMenu doGrab |
1699 | 3464 |
] ifFalse:[ |
2219 | 3465 |
hasImplicitGrap ~~ true ifTrue:[ |
3466 |
self grabMouseAndKeyboard. |
|
3467 |
hasImplicitGrap := true |
|
3468 |
] |
|
1699 | 3469 |
] |
3470 |
! |
|
3471 |
||
3472 |
doUngrab:forceDo |
|
3473 |
||
3474 |
relativeGrabOrigin := nil. |
|
1767 | 3475 |
self clearImplicitGrab. |
1699 | 3476 |
|
3477 |
superMenu notNil ifTrue:[ |
|
2219 | 3478 |
forceDo ifTrue:[ |
3479 |
superMenu doUngrab:true |
|
3480 |
]. |
|
3481 |
^ self |
|
1699 | 3482 |
]. |
3483 |
||
3484 |
hasImplicitGrap ~~ true ifTrue:[ |
|
2219 | 3485 |
^ self |
1699 | 3486 |
]. |
3487 |
||
3488 |
forceDo ifFalse:[ |
|
2219 | 3489 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3490 |
^ self |
|
3491 |
]. |
|
1699 | 3492 |
]. |
3493 |
self ungrabMouseAndKeyboard. |
|
3494 |
self selection:nil. |
|
3495 |
hasImplicitGrap := nil. |
|
1703 | 3496 |
prevFocusView := nil. |
3497 |
||
1699 | 3498 |
! |
3499 |
||
1630 | 3500 |
grabKeyboard |
2715 | 3501 |
"grap the keyboard; keep previous grab" |
3502 |
||
1630 | 3503 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 3504 |
^ super grabKeyboard |
1630 | 3505 |
! |
3506 |
||
388 | 3507 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3508 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3509 |
|
388 | 3510 |
|sensor| |
3511 |
||
3512 |
realized ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3513 |
prevFocusView := self windowGroup focusView. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3514 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3515 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3516 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3517 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3518 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3519 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3520 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3521 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3522 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3523 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3524 |
self unmap |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3525 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3526 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3527 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3528 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3529 |
device activeKeyboardGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3530 |
device sync. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3531 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3532 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3533 |
] |
388 | 3534 |
] |
3535 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3536 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3537 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3538 |
! |
3539 |
||
1630 | 3540 |
grabPointerWithCursor:aCursorOrNil |
2715 | 3541 |
"grap the pointer; keep previous grab" |
3542 |
||
1630 | 3543 |
previousPointerGrab := device activePointerGrab. |
1699 | 3544 |
hasImplicitGrap := true. |
2715 | 3545 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3546 |
! |
3547 |
||
3548 |
ungrabKeyboard |
|
2715 | 3549 |
"ungrap the keyboard; restore previous grab" |
3550 |
||
1630 | 3551 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3552 |
|
2579 | 3553 |
(previousKeyboardGrab notNil |
3554 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3555 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3556 |
]. |
|
1630 | 3557 |
! |
3558 |
||
388 | 3559 |
ungrabMouseAndKeyboard |
2715 | 3560 |
"ungrab resources (mouse and keyboard)" |
3561 |
||
1630 | 3562 |
self ungrabPointer. |
3563 |
self ungrabKeyboard. |
|
3564 |
! |
|
3565 |
||
3566 |
ungrabPointer |
|
2715 | 3567 |
"ungrap the pointer; restore previous grab" |
3568 |
||
1630 | 3569 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3570 |
|
2579 | 3571 |
(previousPointerGrab notNil |
3572 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3573 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3574 |
]. |
388 | 3575 |
! ! |
3576 |
||
1251 | 3577 |
!MenuPanel methodsFor:'help'! |
3578 |
||
2058 | 3579 |
flyByHelpTextAt:srcPoint |
3580 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2715 | 3581 |
If there is a selection, that items helpText is used (ignoring the given point)." |
3582 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3583 |
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
|
3584 |
^ nil |
2058 | 3585 |
! |
3586 |
||
3587 |
flyByHelpTextForItem:anItem |
|
2715 | 3588 |
"returns the helpText for an item (empty if none)" |
3589 |
||
2063 | 3590 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3591 |
^ anItem flyByHelpText. |
2058 | 3592 |
! |
3593 |
||
1251 | 3594 |
helpText |
2715 | 3595 |
"return the helpText for the currently selected item (empty if none)" |
3596 |
||
1613 | 3597 |
^ self helpTextForItem:selection |
1251 | 3598 |
! |
3599 |
||
1699 | 3600 |
helpTextAt:srcPoint |
1252 | 3601 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 3602 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
3603 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3604 |
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
|
3605 |
^ '' |
1613 | 3606 |
! |
3607 |
||
3608 |
helpTextForItem:anItem |
|
2715 | 3609 |
"returns the helpText for an item (empty if none)" |
3610 |
||
1613 | 3611 |
anItem isNil ifTrue:[^ '']. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3612 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3613 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3614 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3615 |
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
|
3616 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3617 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3618 |
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
|
3619 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3620 |
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
|
3621 |
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
|
3622 |
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
|
3623 |
] |
1251 | 3624 |
! ! |
3625 |
||
794 | 3626 |
!MenuPanel methodsFor:'image registration'! |
3627 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
3628 |
imageOnMyDevice:anImage |
2715 | 3629 |
"returns image registered on device" |
3630 |
||
794 | 3631 |
^ self class image:anImage onDevice:device |
3632 |
! |
|
3633 |
||
3634 |
lightenedImageOnDevice:anImage |
|
2715 | 3635 |
"returns lightened image registered on device" |
3636 |
||
794 | 3637 |
^ self class lightenedImage:anImage onDevice:device |
3638 |
! ! |
|
3639 |
||
1688 | 3640 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3641 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3642 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3643 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3644 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3645 |
|
388 | 3646 |
create |
2715 | 3647 |
"create the shadow view for a none contained submenu" |
3648 |
||
388 | 3649 |
super create. |
3650 |
||
3651 |
self isPopUpView ifTrue:[ |
|
2715 | 3652 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3653 |
shadowView isNil ifTrue:[ |
|
3654 |
shadowView := (ShadowView onDevice:device) for:self |
|
3655 |
] ifFalse:[ |
|
3656 |
self saveUnder:true. |
|
3657 |
]. |
|
3658 |
] |
|
388 | 3659 |
] ifFalse:[ |
2715 | 3660 |
explicitExtent == true ifTrue:[ |
3661 |
(self width) == (superView width) ifTrue:[ |
|
3662 |
self verticalLayout:false |
|
3663 |
] |
|
3664 |
] |
|
388 | 3665 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3666 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3667 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3668 |
! |
3669 |
||
3670 |
destroy |
|
2715 | 3671 |
"destroy items and shadowView; remove dependencies" |
3672 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3673 |
self clearLastActiveMenu. |
2051 | 3674 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 3675 |
items := nil. |
3676 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3677 |
|
388 | 3678 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3679 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3680 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3681 |
|
2051 | 3682 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3683 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3684 |
|
616 | 3685 |
fetchDeviceResources |
2715 | 3686 |
"fetch device colors, to avoid reallocation at redraw time" |
3687 |
||
2219 | 3688 |
|style| |
3689 |
||
2374 | 3690 |
superMenu notNil ifTrue:[ |
2219 | 3691 |
styleSheet := superMenu styleSheet |
3692 |
]. |
|
616 | 3693 |
|
3694 |
super fetchDeviceResources. |
|
3695 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3696 |
"/ 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
|
3697 |
"/ (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
|
3698 |
|
616 | 3699 |
superMenu isNil ifTrue:[ |
2374 | 3700 |
rightArrow isNil ifTrue:[ |
2219 | 3701 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 3702 |
]. |
2219 | 3703 |
fgColor := fgColor onDevice:device. |
3704 |
style := styleSheet name. |
|
3705 |
||
2761 | 3706 |
(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[ |
2219 | 3707 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
3708 |
] ifFalse:[ |
|
3709 |
rightArrowShadow := nil |
|
3710 |
]. |
|
616 | 3711 |
] ifFalse:[ |
2219 | 3712 |
rightArrow := superMenu rightArrow. |
3713 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3714 |
||
3715 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 3716 |
self font:(superMenu font). |
2761 | 3717 |
"/ self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3718 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3719 |
|
1829 | 3720 |
items notNil ifTrue:[ |
2219 | 3721 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 3722 |
]. |
3723 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3724 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3725 |
! |
3726 |
||
580 | 3727 |
initStyle |
3728 |
"initialize style specific stuff" |
|
3729 |
||
2609 | 3730 |
|fn| |
3731 |
||
580 | 3732 |
super initStyle. |
616 | 3733 |
|
2609 | 3734 |
fgColor := DefaultForegroundColor ? Color black. |
3735 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
3736 |
fn := self class defaultFont. |
|
2610 | 3737 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 3738 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3739 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3740 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3741 |
self updateLevelAndBorder. |
580 | 3742 |
! |
3743 |
||
388 | 3744 |
initialize |
2715 | 3745 |
"set default configuration" |
3746 |
||
388 | 3747 |
super initialize. |
616 | 3748 |
|
1730
4936edfc2eee
must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
3749 |
self enableMotionEvents. |
498 | 3750 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3751 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3752 |
self originChangedFlag:false. |
2253 | 3753 |
explicitExtent := nil. |
3754 |
shortKeyInset := 0. |
|
3755 |
mustRearrange := false. |
|
3756 |
showSeparatingLines := false. |
|
3757 |
showGroupDivider := true. |
|
388 | 3758 |
! |
3759 |
||
1573 | 3760 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3761 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 3762 |
If the grab fails, try again and unmap myself if that fails too." |
3763 |
||
1791 | 3764 |
|loIndices loItems| |
388 | 3765 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3766 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3767 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3768 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3769 |
self becomesActiveMenu. |
1573 | 3770 |
super map. |
2681 | 3771 |
self addDependencies. |
388 | 3772 |
|
1785 | 3773 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 3774 |
loItems := items ? #[]. |
3775 |
||
3776 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 3777 |
|
388 | 3778 |
self isPopUpView ifTrue:[ |
2681 | 3779 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3780 |
] ifFalse:[ |
2681 | 3781 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3782 |
]. |
1791 | 3783 |
loItems do:[:el| el updateIndicators ]. |
388 | 3784 |
|
1785 | 3785 |
loIndices size > 0 ifTrue:[ |
2681 | 3786 |
self redrawX:0 y:0 width:width height:height. |
3787 |
self openMenusFromItemIndices:loIndices. |
|
388 | 3788 |
]. |
3789 |
||
1177 | 3790 |
"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
|
3791 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 3792 |
! |
3793 |
||
3794 |
realize |
|
2715 | 3795 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3796 |
|
2761 | 3797 |
|bgColor| |
3798 |
||
388 | 3799 |
self isPopUpView ifTrue:[ |
2761 | 3800 |
bgColor := styleSheet colorAt:'menu.backgroundColor'. |
3801 |
bgColor notNil ifTrue:[ self viewBackground:bgColor ]. |
|
3802 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3803 |
"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
|
3804 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3805 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3806 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3807 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3808 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3809 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3810 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3811 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3812 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3813 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3814 |
self map. |
736 | 3815 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3816 |
super realize. |
1767 | 3817 |
]. |
3818 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3819 |
hideOnRelease := defaultHideOnRelease. |
388 | 3820 |
! |
3821 |
||
3822 |
recreate |
|
1832 | 3823 |
"this is called after a snapin or a migration. |
2715 | 3824 |
If the image was saved with an active menu, hide the menu" |
3825 |
||
1455 | 3826 |
selection := nil. |
388 | 3827 |
super recreate. |
3828 |
! |
|
3829 |
||
1130 | 3830 |
reinitStyle |
3831 |
"handle style change while being open (win32 only - for now)" |
|
3832 |
||
3833 |
super reinitStyle. |
|
3834 |
||
3835 |
self fetchDeviceResources. |
|
1811 | 3836 |
self mustRearrange. "/ care for changed font sizes etc. |
3837 |
||
3838 |
self do:[:anItem | |
|
3839 |
anItem reinitStyle |
|
3840 |
]. |
|
1130 | 3841 |
|
3842 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 3843 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 3844 |
! |
3845 |
||
388 | 3846 |
unmap |
1330 | 3847 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
3848 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 3849 |
|
2681 | 3850 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3851 |
self clearLastActiveMenu. |
1699 | 3852 |
self doUngrab:(superMenu isNil). |
3853 |
"/ self isPopUpView ifTrue:[ |
|
3854 |
"/ self doUngrab:(superMenu isNil) |
|
3855 |
"/ ]. |
|
3856 |
||
388 | 3857 |
super unmap. |
3858 |
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
|
3859 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3860 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3861 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3862 |
"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
|
3863 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3864 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3865 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3866 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3867 |
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
|
3868 |
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
|
3869 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3870 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 3871 |
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
|
3872 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3873 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3874 |
self level:lvl. |
388 | 3875 |
! ! |
3876 |
||
1878 | 3877 |
!MenuPanel methodsFor:'keyboard control'! |
3878 |
||
3879 |
mnemonicViewNext:aKeyEvent |
|
3880 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
3881 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 3882 |
return the topMenu otherwise nil." |
3883 |
||
2112 | 3884 |
|menu uKey lKey list index| |
3885 |
||
3886 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 3887 |
shown ifFalse:[^ nil]. |
3888 |
||
3889 |
uKey := aKeyEvent rawKey last asUppercase. |
|
3890 |
lKey := uKey asLowercase. |
|
2112 | 3891 |
|
3892 |
selection notNil ifTrue:[ |
|
2374 | 3893 |
"first lookup the current grapMenu before starting in the topMenu |
3894 |
" |
|
3895 |
menu := self detectGrabMenu. |
|
3896 |
||
3897 |
[ menu ~~ self ] whileTrue:[ |
|
3898 |
index := menu selectionIndex. |
|
3899 |
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
|
3900 |
maxDepth:10 from:(index + 1) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3901 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 3902 |
|
2374 | 3903 |
list size ~~ 0 ifTrue:[ |
3904 |
"/ has item which responds to the mnemonic |
|
3905 |
menu processCollectedIndices:list. |
|
3906 |
^ self |
|
3907 |
]. |
|
3908 |
menu := menu superMenu. |
|
3909 |
]. |
|
3910 |
index := self selectionIndex. |
|
3911 |
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
|
3912 |
maxDepth:10 from:(1 + index) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3913 |
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
|
3914 |
|
2112 | 3915 |
] ifFalse:[ |
2374 | 3916 |
index := 99999. |
3917 |
list := nil. |
|
2112 | 3918 |
]. |
3919 |
||
2374 | 3920 |
list isNil ifTrue:[ |
3921 |
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
|
3922 |
maxDepth:1 from:1 to:index |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3923 |
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
|
3924 |
|
2374 | 3925 |
|
3926 |
list isNil ifTrue:[ |
|
3927 |
"/ must clear existing selection |
|
3928 |
self selection:nil. |
|
3929 |
^ nil |
|
3930 |
] |
|
2112 | 3931 |
]. |
3932 |
||
3933 |
"/ has item which responds to the mnemonic |
|
3934 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3935 |
! |
1878 | 3936 |
|
3937 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 3938 |
"open all menus derived from sequence of item indices" |
3939 |
||
1878 | 3940 |
|item| |
3941 |
||
3942 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 3943 |
^ self |
1878 | 3944 |
]. |
3945 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
3946 |
||
3947 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 3948 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
3949 |
self selection:item openMenu:true. |
|
3950 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3951 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3952 |
! |
1878 | 3953 |
|
3954 |
processCollectedIndices:indices |
|
3955 |
|menu item| |
|
3956 |
||
3957 |
indices size == 0 ifTrue:[ |
|
2219 | 3958 |
^ self |
1878 | 3959 |
]. |
3960 |
menu := self. |
|
3961 |
||
3962 |
[menu selectionIndex == indices first] whileTrue:[ |
|
2219 | 3963 |
( (item := menu selection) isNil "/ shouldn't happen |
3964 |
or:[(menu := item submenu) isNil] "/ no more indices; done |
|
3965 |
) ifTrue:[ |
|
3966 |
^ true |
|
3967 |
]. |
|
3968 |
indices removeFirst. |
|
3969 |
||
3970 |
indices isEmpty ifTrue:[ |
|
3971 |
menu selection:nil. |
|
3972 |
^ self |
|
3973 |
] |
|
1878 | 3974 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3975 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3976 |
! |
1878 | 3977 |
|
3978 |
processShortcut:aKeyEvent |
|
3979 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
2715 | 3980 |
shortcut-key defined process the shortcut and return true otherwise false." |
3981 |
||
2219 | 3982 |
|menu rKey lKey list item| |
1878 | 3983 |
|
3984 |
superMenu notNil ifTrue:[ |
|
3985 |
^ superMenu processShortcut:aKeyEvent |
|
3986 |
]. |
|
3987 |
shown ifFalse:[^ false]. |
|
3988 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3989 |
lKey := aKeyEvent key. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3990 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3991 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3992 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3993 |
( #( CursorDown CursorUp CursorRight CursorLeft |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3994 |
) includes:lKey |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3995 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3996 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3997 |
]. |
1878 | 3998 |
rKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3999 |
item := nil. |
1878 | 4000 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
4001 |
||
4002 |
[true] whileTrue:[ |
|
4003 |
list := menu selectItemIndicesFor:[:el||skey| |
|
4004 |
item := el. |
|
4005 |
skey := el shortcutKey. |
|
4006 |
skey == rKey or:[skey == lKey] |
|
4007 |
] |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4008 |
maxDepth:10 from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4009 |
ignoreSubmenuBlock:[:anItem| anItem ignoreShortcutKeys ]. |
1878 | 4010 |
|
4011 |
list size ~~ 0 ifTrue:[ |
|
4012 |
"/ has item which responds to the shortcut |
|
4013 |
item hasSubmenu ifFalse:[ |
|
4014 |
menu accept:item |
|
4015 |
] ifTrue:[ |
|
4016 |
menu processCollectedIndices:list. |
|
4017 |
self windowGroup focusView:self. |
|
4018 |
]. |
|
4019 |
^ true |
|
4020 |
]. |
|
4021 |
||
4022 |
menu == self ifTrue:[ ^ false ]. |
|
4023 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4024 |
]. |
2219 | 4025 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4026 |
! |
1878 | 4027 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4028 |
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
|
4029 |
"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
|
4030 |
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
|
4031 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4032 |
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
|
4033 |
is created and passed through if the block returns false. |
2715 | 4034 |
Otherwise the item is not asked for its submenu." |
4035 |
||
2112 | 4036 |
|start stop| |
4037 |
||
4038 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
4039 |
||
4040 |
start := aStart max:1. |
|
4041 |
stop := aStop min:(items size). |
|
4042 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4043 |
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
|
4044 |
item := items at:i. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4045 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4046 |
(aOneArgBlock value:item) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4047 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4048 |
^ 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
|
4049 |
] |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4050 |
] ifFalse:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4051 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4052 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4053 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4054 |
menu := item submenu. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4055 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4056 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4057 |
result := menu selectItemIndicesFor:aOneArgBlock |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4058 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4059 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4060 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4061 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4062 |
result addFirst:i. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4063 |
^ result |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4064 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4065 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4066 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4067 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
4068 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
4069 |
]. |
1878 | 4070 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4071 |
^ nil |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
4072 |
! ! |
1878 | 4073 |
|
388 | 4074 |
!MenuPanel methodsFor:'misc'! |
4075 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4076 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4077 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4078 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4079 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4080 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
4081 |
|
388 | 4082 |
superMenu |
2715 | 4083 |
"returns supermenu or nil" |
4084 |
||
388 | 4085 |
^ superMenu |
4086 |
! |
|
4087 |
||
4088 |
topMenu |
|
2715 | 4089 |
"returns the topMenu; the one having no superMenu" |
4090 |
||
1791 | 4091 |
|menu smenu| |
4092 |
||
4093 |
menu := self. |
|
4094 |
||
4095 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2715 | 4096 |
menu := smenu |
1791 | 4097 |
]. |
4098 |
^ menu |
|
388 | 4099 |
! ! |
4100 |
||
1825 | 4101 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4102 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4103 |
printString |
2715 | 4104 |
"return a printed representation of the menu" |
4105 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4106 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4107 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4108 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4109 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4110 |
self do:[:anItem| |
2715 | 4111 |
label := anItem label ? ''. |
4112 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4113 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4114 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4115 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4116 |
"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
|
4117 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4118 |
|
388 | 4119 |
!MenuPanel methodsFor:'private'! |
4120 |
||
434 | 4121 |
application |
2715 | 4122 |
"optimize access to retrive the application" |
4123 |
||
2374 | 4124 |
application notNil ifTrue:[^ application ]. |
434 | 4125 |
|
4126 |
superMenu notNil ifTrue:[ |
|
2253 | 4127 |
application := superMenu application. |
2374 | 4128 |
^ application |
2253 | 4129 |
]. |
4130 |
application := super application. |
|
2374 | 4131 |
^ application |
1872 | 4132 |
! |
434 | 4133 |
|
1572 | 4134 |
detectItemForKey:aKey |
4135 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4136 |
if no item is detected nil is returned." |
4137 |
||
1572 | 4138 |
|cIdx uKey lKey item| |
4139 |
||
1699 | 4140 |
items isNil ifTrue:[^ nil]. |
4141 |
||
1572 | 4142 |
cIdx := self selectionIndex. |
4143 |
uKey := aKey asUppercase. |
|
4144 |
lKey := aKey asLowercase. |
|
4145 |
||
1699 | 4146 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2715 | 4147 |
( anIndex ~~ cIdx |
4148 |
and:[anItem canSelect |
|
4149 |
and:[(label := anItem textLabel) notNil |
|
4150 |
and:[label size ~~ 0]]] |
|
4151 |
) ifTrue:[ |
|
4152 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4153 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4154 |
^ anItem |
|
4155 |
] |
|
4156 |
] ifFalse:[ |
|
4157 |
char := label at:1. |
|
4158 |
||
4159 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4160 |
anIndex > cIdx ifTrue:[ |
|
4161 |
^ anItem |
|
4162 |
]. |
|
4163 |
item isNil ifTrue:[item := anItem] |
|
4164 |
] |
|
4165 |
] |
|
4166 |
] |
|
1572 | 4167 |
]. |
4168 |
^ item |
|
4169 |
! |
|
4170 |
||
390 | 4171 |
menuAdornmentAt:aSymbol |
2715 | 4172 |
"returns a value derived from adornment" |
4173 |
||
2374 | 4174 |
adornment isNil ifTrue:[^ nil]. |
4175 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4176 |
! |
4177 |
||
390 | 4178 |
menuAdornmentAt:aSymbol put:something |
2715 | 4179 |
"sets a value for the specific menu" |
4180 |
||
2253 | 4181 |
|oldValue| |
4182 |
||
653 | 4183 |
adornment isNil ifTrue:[ |
2374 | 4184 |
something isNil ifTrue:[^ self]. |
2253 | 4185 |
adornment := IdentityDictionary new. |
4186 |
] ifFalse:[ |
|
4187 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4188 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4189 |
]. |
4190 |
adornment at:aSymbol put:something. |
|
388 | 4191 |
! |
4192 |
||
4193 |
onEachPerform:aSelector withArgList:aList |
|
2715 | 4194 |
"on each item perform selector with an argument derived from aList" |
4195 |
||
388 | 4196 |
aList isCollection ifTrue:[ |
2715 | 4197 |
items size >= aList size ifTrue:[ |
4198 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4199 |
(items at:anIndex) perform:aSelector with:anArg |
|
4200 |
] |
|
4201 |
] |
|
388 | 4202 |
] ifFalse:[ |
2715 | 4203 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4204 |
] |
4205 |
! |
|
4206 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4207 |
registerImageOnDevice:anImage |
2269 | 4208 |
|
4209 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4210 |
^ self class image:anImage onDevice:device |
|
4211 |
||
4212 |
"/ |image| |
|
4213 |
"/ |
|
4214 |
"/ (image := anImage) notNil ifTrue:[ |
|
4215 |
"/ image device ~~ device ifTrue:[ |
|
4216 |
"/ image := image copy. |
|
4217 |
"/ ]. |
|
4218 |
"/ image := image onDevice:device. |
|
4219 |
"/ image := image clearMaskedPixels. |
|
4220 |
"/ ]. |
|
4221 |
"/ ^ image |
|
2355 | 4222 |
! |
4223 |
||
4224 |
superMenu:aSuperMenu |
|
2715 | 4225 |
"set my supermenu from which i'am activated" |
4226 |
||
2355 | 4227 |
superMenu := aSuperMenu. |
4228 |
||
2374 | 4229 |
superMenu notNil ifTrue:[ |
2355 | 4230 |
styleSheet := superMenu styleSheet. |
4231 |
rightArrow := superMenu rightArrow. |
|
4232 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4233 |
]. |
|
388 | 4234 |
! ! |
4235 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4236 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4237 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4238 |
activeMenu |
2715 | 4239 |
"returns the current active menu or self (the top menu)" |
4240 |
||
687 | 4241 |
^ lastActiveMenu ? self |
4242 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4243 |
"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
|
4244 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4245 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4246 |
activeMenu:aMenu |
2715 | 4247 |
"set the current active menu" |
4248 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4249 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4250 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4251 |
"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
|
4252 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4253 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4254 |
becomesActiveMenu |
2715 | 4255 |
"submenu becomes the active menu" |
4256 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4257 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4258 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4259 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4260 |
"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
|
4261 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4262 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4263 |
clearLastActiveMenu |
2715 | 4264 |
"reset the current active menu" |
4265 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4266 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4267 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4268 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4269 |
|
2251 | 4270 |
"/ prevFocusView notNil ifTrue:[ |
4271 |
"/ self windowGroup focusView:prevFocusView. |
|
4272 |
"/ prevFocusView := nil. |
|
4273 |
"/ ]. |
|
4274 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4275 |
top activeMenu == self ifTrue:[ |
2251 | 4276 |
top activeMenu:nil |
687 | 4277 |
] |
4278 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4279 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4280 |
! |
4281 |
||
4282 |
mapTime |
|
2715 | 4283 |
"returns the time when the menu becomes active" |
4284 |
||
687 | 4285 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4286 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4287 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4288 |
! ! |
4289 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4290 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4291 |
|
4292 |
hasScrollerAt:aDirection |
|
2715 | 4293 |
"returns true if a visible scroller at a direction exists" |
4294 |
||
2016 | 4295 |
|layout| |
4296 |
||
4297 |
self hasScrollers ifFalse:[ |
|
2715 | 4298 |
^ false |
2016 | 4299 |
]. |
4300 |
||
4301 |
aDirection == #PREV ifTrue:[ |
|
2715 | 4302 |
layout := items first layout. |
2016 | 4303 |
|
4304 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2715 | 4305 |
ifFalse:[ layout left < margin] |
2016 | 4306 |
]. |
4307 |
layout := items last layout. |
|
4308 |
||
4309 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2715 | 4310 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4311 |
! |
4312 |
||
4313 |
hasScrollers |
|
2715 | 4314 |
"returns true if scrollers are needed" |
4315 |
||
2018 | 4316 |
|maxExtent first last isVert| |
4317 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4318 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 4319 |
|
4320 |
isVert := self verticalLayout. |
|
4321 |
||
4322 |
superView notNil ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4323 |
((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
|
4324 |
or:[(last := items last layout) isNil] |
2715 | 4325 |
) ifTrue:[ |
4326 |
^ false |
|
4327 |
]. |
|
4328 |
isVert ifTrue:[ |
|
4329 |
^ first top < 0 or:[last bottom > height] |
|
4330 |
]. |
|
4331 |
^ first left < 0 or:[last right > width] |
|
2018 | 4332 |
]. |
4333 |
maxExtent := self maxExtent. |
|
4334 |
isVert ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4335 |
^ (height >= maxExtent y) |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4336 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4337 |
^ (width >= maxExtent x) |
2016 | 4338 |
! |
4339 |
||
4340 |
indexOfItemAtScroller:aDirection |
|
2715 | 4341 |
"returns the index of the item under the scroller or 0" |
4342 |
||
2016 | 4343 |
|bounds min max layout| |
4344 |
||
4345 |
bounds := self scrollerBoundsAt:aDirection. |
|
4346 |
||
4347 |
bounds isNil ifTrue:[ |
|
2715 | 4348 |
^ 0 |
2016 | 4349 |
]. |
4350 |
||
4351 |
self verticalLayout ifTrue:[ |
|
2715 | 4352 |
min := bounds top. |
4353 |
max := bounds bottom. |
|
4354 |
||
4355 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4356 |
anItem isVisible ifTrue:[ |
|
4357 |
layout := anItem layout. |
|
4358 |
||
4359 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4360 |
^ anIndex |
|
4361 |
]. |
|
4362 |
]. |
|
4363 |
]. |
|
2016 | 4364 |
] ifFalse:[ |
2715 | 4365 |
min := bounds left. |
4366 |
max := bounds right. |
|
4367 |
||
4368 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4369 |
anItem isVisible ifTrue:[ |
|
4370 |
layout := anItem layout. |
|
4371 |
||
4372 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4373 |
^ anIndex |
|
4374 |
]. |
|
4375 |
]. |
|
4376 |
] |
|
2016 | 4377 |
]. |
4378 |
^ 0 |
|
4379 |
! |
|
4380 |
||
4381 |
makeItemVisible:anItem |
|
2715 | 4382 |
"make an item visible" |
4383 |
||
2018 | 4384 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4385 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4386 |
inv1 inv2| |
2018 | 4387 |
|
4388 |
( anItem notNil |
|
4389 |
and:[self hasScrollers |
|
4390 |
and:[(layout := anItem layout) notNil]] |
|
4391 |
) ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4392 |
^ self |
2016 | 4393 |
]. |
2018 | 4394 |
index := self indexOfItem:anItem. |
2016 | 4395 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4396 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4397 |
||
2018 | 4398 |
isVertical := self verticalLayout. |
4399 |
||
4400 |
isVertical ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4401 |
boundsMin := boundsPREV bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4402 |
boundsMax := boundsNEXT top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4403 |
layoutMin := layout top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4404 |
layoutMax := layout bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4405 |
windowSz := height. |
2018 | 4406 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4407 |
boundsMin := boundsPREV right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4408 |
boundsMax := boundsNEXT left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4409 |
layoutMin := layout left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4410 |
layoutMax := layout right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4411 |
windowSz := width. |
2018 | 4412 |
]. |
4413 |
||
4414 |
||
4415 |
layoutMin < boundsMin ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4416 |
layoutMin >= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4417 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4418 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4419 |
"/ test whether is first visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4420 |
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
|
4421 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4422 |
index == 0 ifTrue:[ scr0 := margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4423 |
ifFalse:[ scr0 := boundsMin ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4424 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4425 |
delta := layoutMin negated + scr0. |
2016 | 4426 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4427 |
layoutMax > boundsMax ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4428 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4429 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4430 |
"/ test whether is last visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4431 |
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
|
4432 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4433 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4434 |
ifFalse:[ scr0 := boundsMax ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4435 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4436 |
delta := scr0 - layoutMax. |
2018 | 4437 |
]. |
4438 |
delta == 0 ifTrue:[ ^ self ]. |
|
4439 |
||
2016 | 4440 |
doScroll := false. |
4441 |
||
4442 |
shown ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4443 |
delta abs < (windowSz / 2) ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4444 |
doScroll := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4445 |
self repairDamage |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4446 |
] |
2016 | 4447 |
]. |
2018 | 4448 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4449 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4450 |
|
4451 |
doScroll ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4452 |
self invalidate. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4453 |
^ self |
2016 | 4454 |
]. |
4455 |
||
2018 | 4456 |
windowSz := windowSz - margin - margin. |
4457 |
||
4458 |
scr0 := boundsMin. |
|
4459 |
scr1 := scr0 + delta abs. |
|
4460 |
scrSz := boundsMax - scr1. |
|
4461 |
||
4462 |
delta < 0 ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4463 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4464 |
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
|
4465 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4466 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4467 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4468 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4469 |
"/ 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
|
4470 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4471 |
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
|
4472 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4473 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4474 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4475 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4476 |
"/ 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
|
4477 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4478 |
inv1 := boundsPREV. |
2016 | 4479 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4480 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4481 |
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
|
4482 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4483 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4484 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4485 |
"/ 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
|
4486 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4487 |
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
|
4488 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4489 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4490 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4491 |
"/ 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
|
4492 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4493 |
inv1 := boundsNEXT. |
2042 | 4494 |
]. |
4495 |
self invalidate:inv1. |
|
4496 |
self invalidate:inv2. |
|
2048 | 4497 |
|
4498 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4499 |
! |
4500 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4501 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4502 |
"returns the one and only scrollActivity - data holder |
2715 | 4503 |
for a menu and all contained submenus" |
4504 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4505 |
superMenu notNil ifTrue:[ |
2715 | 4506 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4507 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4508 |
scrollActivity isNil ifTrue:[ |
2715 | 4509 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4510 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4511 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4512 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4513 |
|
2016 | 4514 |
scrollerBoundsAt:aDirection |
2715 | 4515 |
"returns the bounds of the scroller at a direction or nil" |
4516 |
||
2016 | 4517 |
|y x w h inset| |
4518 |
||
4519 |
self hasScrollers ifFalse:[ |
|
2715 | 4520 |
^ nil |
2016 | 4521 |
]. |
4522 |
inset := 0. |
|
4523 |
x := y := inset. |
|
4524 |
w := h := 15. |
|
4525 |
||
4526 |
self verticalLayout ifTrue:[ |
|
2715 | 4527 |
aDirection == #NEXT ifTrue:[ |
4528 |
y := height - h - inset. |
|
4529 |
]. |
|
4530 |
w := width - inset - inset. |
|
2016 | 4531 |
] ifFalse:[ |
2715 | 4532 |
aDirection == #NEXT ifTrue:[ |
4533 |
x := width - w - inset. |
|
4534 |
]. |
|
4535 |
h := height - inset - inset. |
|
2016 | 4536 |
]. |
4537 |
^ Rectangle left:x top:y width:w height:h |
|
4538 |
! |
|
4539 |
||
2046 | 4540 |
scrollerDirectionAtPoint:aPoint |
2715 | 4541 |
"returns the scroller-direction at aPoint, or nil" |
4542 |
||
2046 | 4543 |
self hasScrollers ifTrue:[ |
2715 | 4544 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
4545 |
( (bounds := self scrollerBoundsAt:aDirection) notNil |
|
4546 |
and:[bounds containsPoint:aPoint] |
|
4547 |
) ifTrue:[ |
|
4548 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
4549 |
] |
|
4550 |
] |
|
2046 | 4551 |
]. |
4552 |
^ nil |
|
4553 |
||
4554 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4555 |
! ! |
4556 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4557 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4558 |
|
1699 | 4559 |
detectGrabMenu |
2715 | 4560 |
"returns the menu which is responsible for the grap; the last opened menu" |
4561 |
||
1699 | 4562 |
|subMenu| |
4563 |
||
4564 |
selection notNil ifTrue:[ |
|
2715 | 4565 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4566 |
^ subMenu detectGrabMenu |
|
4567 |
] |
|
1699 | 4568 |
]. |
4569 |
^ self |
|
4570 |
! |
|
4571 |
||
4572 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 4573 |
"returns the menu which contains the grab-point" |
4574 |
||
1699 | 4575 |
|dstMenu dstPoint firstMenu| |
4576 |
||
4577 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4578 |
||
4579 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2715 | 4580 |
firstMenu := self. |
1699 | 4581 |
]. |
4582 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4583 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2715 | 4584 |
^ firstMenu |
1699 | 4585 |
]. |
4586 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4587 |
^ dstMenu ? firstMenu |
1699 | 4588 |
! |
4589 |
||
1767 | 4590 |
detectViewAtX:x y:y in:aTopView |
2715 | 4591 |
"detect view at x@y" |
4592 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4593 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4594 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4595 |
"/ 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
|
4596 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4597 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4598 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4599 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4600 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4601 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4602 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4603 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4604 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4605 |
"/ 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
|
4606 |
"/ ^ 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
|
4607 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4608 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4609 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4610 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4611 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4612 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4613 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4614 |
! |
4615 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4616 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4617 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 4618 |
If no item match nil is returned." |
4619 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4620 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4621 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4622 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4623 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4624 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4625 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4626 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4627 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4628 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4629 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4630 |
itemAtPoint:aPoint |
2715 | 4631 |
"returns the item at aPoint or nil if none detected" |
4632 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4633 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4634 |
|
1699 | 4635 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4636 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4637 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4638 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 4639 |
]. |
4640 |
^ nil |
|
388 | 4641 |
! |
4642 |
||
2048 | 4643 |
superMenuAtPoint:aPoint |
2715 | 4644 |
"returns the superMenu which contains aPoint, or nil if none detected" |
4645 |
||
1699 | 4646 |
|grabPoint superMenu| |
4647 |
||
2048 | 4648 |
(self containsPoint:aPoint) ifTrue:[ |
2715 | 4649 |
^ self |
1699 | 4650 |
]. |
4651 |
||
2048 | 4652 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4653 |
superMenu := self. |
4654 |
||
4655 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2715 | 4656 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
4657 |
^ superMenu |
|
4658 |
] |
|
4659 |
]. |
|
4660 |
^ nil |
|
1699 | 4661 |
|
2048 | 4662 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4663 |
! ! |
4664 |
||
4665 |
!MenuPanel methodsFor:'queries'! |
|
4666 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4667 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4668 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4669 |
aView notNil ifTrue:[ |
2219 | 4670 |
"/ I am no longer a popUpView |
4671 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4672 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4673 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4674 |
|
388 | 4675 |
containsPoint:aPoint |
2715 | 4676 |
"returns true if the argument, aPoint is contained by the view" |
4677 |
||
388 | 4678 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
4679 |
! |
|
4680 |
||
4681 |
containsPointX:x y:y |
|
2715 | 4682 |
"returns true if point is contained by the view" |
4683 |
||
708 | 4684 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 4685 |
! |
4686 |
||
390 | 4687 |
hasGroupDividerAt:anIndex |
2715 | 4688 |
"returns true if a divider is defined at an index" |
4689 |
||
388 | 4690 |
|i| |
4691 |
||
4692 |
groupSizes size ~~ 0 ifTrue:[ |
|
2715 | 4693 |
i := 0. |
4694 |
||
4695 |
groupSizes do:[:t| |
|
4696 |
(i := i + t) == anIndex ifTrue:[ |
|
4697 |
^ true |
|
4698 |
] |
|
4699 |
] |
|
4700 |
]. |
|
4701 |
^ false |
|
388 | 4702 |
! |
4703 |
||
390 | 4704 |
hasGroupDividers |
2715 | 4705 |
"returns true if any group divider exists" |
4706 |
||
4707 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 4708 |
! |
4709 |
||
390 | 4710 |
isFitPanel |
4711 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4712 |
be fit to the extent of its superView; |
2715 | 4713 |
NOT SUPPORTED" |
4714 |
||
1699 | 4715 |
^ false |
390 | 4716 |
! |
4717 |
||
388 | 4718 |
isPopUpView |
4719 |
"return true if view is a popup view; without decoration |
|
2715 | 4720 |
and popUp to top immediately" |
4721 |
||
388 | 4722 |
^ superView isNil |
4723 |
! |
|
4724 |
||
4725 |
isVerticalLayout |
|
2715 | 4726 |
"returns true if vertical layout otherwise false( horizontal layout )" |
4727 |
||
1699 | 4728 |
^ self verticalLayout |
416 | 4729 |
! |
4730 |
||
1793 | 4731 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
4732 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 4733 |
! |
4734 |
||
416 | 4735 |
type |
428 | 4736 |
^ nil. |
416 | 4737 |
|
388 | 4738 |
! ! |
4739 |
||
4740 |
!MenuPanel methodsFor:'selection'! |
|
4741 |
||
4742 |
hasSelection |
|
2715 | 4743 |
"returns true if a selection exists" |
4744 |
||
388 | 4745 |
^ self selection notNil |
4746 |
! |
|
4747 |
||
2199 | 4748 |
openDelayed:anItem |
4749 |
||
2374 | 4750 |
superMenu notNil ifTrue:[ |
2219 | 4751 |
superMenu openDelayed:anItem. |
2374 | 4752 |
^ self |
4753 |
]. |
|
4754 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 4755 |
Processor removeTimedBlock:openDelayedMenuBlock. |
4756 |
openDelayedMenuBlock := nil. |
|
4757 |
]. |
|
2374 | 4758 |
anItem isNil ifTrue:[ |
2253 | 4759 |
openDelayedMenuBlock := nil. |
2374 | 4760 |
^ self |
2253 | 4761 |
]. |
4762 |
openDelayedMenuBlock := [ |
|
4763 |
openDelayedMenuBlock := nil. |
|
4764 |
anItem openDelayedSubmenu |
|
4765 |
]. |
|
4766 |
||
4767 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5. |
|
2199 | 4768 |
! |
4769 |
||
388 | 4770 |
selection |
2715 | 4771 |
"returns current selected item or nil" |
4772 |
||
388 | 4773 |
^ selection |
4774 |
! |
|
4775 |
||
4776 |
selection:anItemOrNil |
|
2016 | 4777 |
"change selection to an item or nil |
2715 | 4778 |
if the item has a submenu the first item might be selected (style-sheet)" |
4779 |
||
2249 | 4780 |
|openMenu openOnSelect submenu item| |
4781 |
||
4782 |
selection == anItemOrNil ifTrue:[^ self]. |
|
4783 |
||
4784 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
4785 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4786 |
^ self |
2249 | 4787 |
]. |
4788 |
||
4789 |
openMenu := self isPopUpView not. |
|
4790 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
4791 |
||
4792 |
openMenu ifFalse:[ |
|
4793 |
openMenu := openOnSelect. |
|
4794 |
]. |
|
4795 |
self selection:anItemOrNil openMenu:openMenu. |
|
4796 |
||
4797 |
openOnSelect ifFalse:[ |
|
4798 |
"/ select first item in submenu |
|
4799 |
||
4800 |
submenu := anItemOrNil currentSubmenu. |
|
4801 |
||
2374 | 4802 |
submenu notNil ifTrue:[ |
2249 | 4803 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4804 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 4805 |
submenu selection:item openMenu:false |
4806 |
] |
|
4807 |
]. |
|
4808 |
]. |
|
4809 |
! |
|
4810 |
||
4811 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 4812 |
"change selection to an item or nil" |
4813 |
||
2251 | 4814 |
|helpListener oldSelect| |
2249 | 4815 |
|
4816 |
anItemOrNil == selection ifTrue:[ |
|
4817 |
^ self |
|
2016 | 4818 |
]. |
2199 | 4819 |
self openDelayed:nil. |
388 | 4820 |
|
2251 | 4821 |
oldSelect := selection. |
4822 |
selection := nil. |
|
2249 | 4823 |
|
2374 | 4824 |
anItemOrNil notNil ifTrue:[ |
2249 | 4825 |
self makeItemVisible:anItemOrNil. |
4826 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 4827 |
selection := anItemOrNil |
2249 | 4828 |
] ifFalse:[ |
2374 | 4829 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 4830 |
]. |
4831 |
]. |
|
2374 | 4832 |
oldSelect notNil ifTrue:[ |
2249 | 4833 |
"/ clear current selection |
2251 | 4834 |
oldSelect isSelected:false. |
4835 |
]. |
|
2374 | 4836 |
selection isNil ifTrue:[^ self]. |
2251 | 4837 |
|
4838 |
selection == enteredItem ifTrue:[ |
|
2249 | 4839 |
enteredItem := nil |
2016 | 4840 |
] ifFalse:[ |
2249 | 4841 |
self pointerEntersItem:nil |
2016 | 4842 |
]. |
4843 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 4844 |
helpListener := ActiveHelp currentHelpListener. |
4845 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 4846 |
]. |
4847 |
shown ifTrue:[ |
|
4848 |
self rearrangeItems. |
|
4849 |
||
4850 |
openMenu ifFalse:[ |
|
4851 |
selection invalidate. |
|
4852 |
] |
|
4853 |
]. |
|
4854 |
openMenu ifTrue:[ |
|
4855 |
selection isSelected:true. |
|
4856 |
]. |
|
388 | 4857 |
! |
4858 |
||
4859 |
selectionIndex |
|
2715 | 4860 |
"returns index of current selection or 0" |
4861 |
||
388 | 4862 |
|item| |
4863 |
||
4864 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 4865 |
^ self findFirst:[:el| el == item ] |
388 | 4866 |
]. |
4867 |
^ 0 |
|
4868 |
! |
|
4869 |
||
4870 |
selectionIndex:anIndex |
|
2715 | 4871 |
"set selection at an index" |
4872 |
||
388 | 4873 |
self selection:(self itemAt:anIndex) |
4874 |
! ! |
|
4875 |
||
1791 | 4876 |
!MenuPanel methodsFor:'translation'! |
4877 |
||
4878 |
translateGrabPoint:aGrabPoint |
|
2715 | 4879 |
"translate the grab point into self" |
4880 |
||
1791 | 4881 |
superMenu isNil ifTrue:[ |
2715 | 4882 |
"I am the grapView" |
4883 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
4884 |
^ aGrabPoint |
|
1791 | 4885 |
]. |
4886 |
||
4887 |
relativeGrabOrigin isNil ifTrue:[ |
|
2715 | 4888 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
1791 | 4889 |
]. |
4890 |
^ relativeGrabOrigin + aGrabPoint |
|
4891 |
! |
|
4892 |
||
4893 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 4894 |
"translate a point into another menu its point" |
4895 |
||
1791 | 4896 |
|grapPoint| |
4897 |
||
4898 |
aMenu == self ifTrue:[ |
|
2715 | 4899 |
^ aPoint |
1791 | 4900 |
]. |
4901 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
4902 |
||
2715 | 4903 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 4904 |
! |
4905 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4906 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 4907 |
"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
|
4908 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4909 |
^ device |
2715 | 4910 |
translatePoint:aPoint asPoint |
4911 |
fromView:self |
|
4912 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4913 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4914 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 4915 |
! ! |
4916 |
||
388 | 4917 |
!MenuPanel::Item class methodsFor:'accessing'! |
4918 |
||
689 | 4919 |
horizontalInset |
4920 |
^ HorizontalInset |
|
4921 |
! |
|
4922 |
||
388 | 4923 |
labelRightOffset |
4924 |
^ LabelRightOffset |
|
4925 |
! |
|
4926 |
||
689 | 4927 |
verticalInset |
4928 |
^ VerticalInset |
|
1765 | 4929 |
! |
4930 |
||
4931 |
verticalPopUpInset |
|
4932 |
^ VerticalPopUpInset |
|
388 | 4933 |
! ! |
4934 |
||
616 | 4935 |
!MenuPanel::Item class methodsFor:'defaults'! |
4936 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4937 |
halfSeparatorSize |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4938 |
"returns size of a space-separator |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4939 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4940 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4941 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4942 |
|
1699 | 4943 |
separatorSize |
616 | 4944 |
"returns size of a separator |
4945 |
" |
|
1699 | 4946 |
^ 10 |
616 | 4947 |
! |
4948 |
||
4949 |
updateStyleCache |
|
388 | 4950 |
"setup defaults |
650 | 4951 |
self updateStyleCache |
388 | 4952 |
" |
1765 | 4953 |
<resource: #style (#'menuPanel.verticalInset')> |
4954 |
||
1699 | 4955 |
HorizontalInset := 2. |
1765 | 4956 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
4957 |
VerticalPopUpInset := 2. |
|
727 | 4958 |
|
4959 |
HorizontalButtonInset := 3. |
|
4960 |
VerticalButtonInset := 3. |
|
4961 |
||
681 | 4962 |
LabelRightOffset := 15. |
1765 | 4963 |
|
4964 |
||
1124 | 4965 |
! ! |
1078 | 4966 |
|
388 | 4967 |
!MenuPanel::Item class methodsFor:'instance creation'! |
4968 |
||
4969 |
in:aSuperMenu |
|
4970 |
^ self in:aSuperMenu label:nil |
|
4971 |
! |
|
4972 |
||
4973 |
in:aSuperMenu label:aLabel |
|
4974 |
|item| |
|
4975 |
||
4976 |
item := self new in:aSuperMenu. |
|
4977 |
item label:aLabel. |
|
4978 |
^ item |
|
4979 |
! |
|
4980 |
||
4981 |
in:aSuperMenu menuItem:aMenuItem |
|
4982 |
|item| |
|
4983 |
||
4984 |
item := self in:aSuperMenu. |
|
4985 |
item menuItem:aMenuItem. |
|
4986 |
^ item. |
|
2359 | 4987 |
! |
4988 |
||
4989 |
new |
|
4990 |
^ self basicNew initialize |
|
388 | 4991 |
! ! |
4992 |
||
1808 | 4993 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 4994 |
|
420 | 4995 |
canAccept |
4996 |
"returns true if item is acceptable |
|
4997 |
" |
|
2199 | 4998 |
self enabled ifFalse:[ ^ false]. |
4999 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
5000 |
||
5001 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
5002 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 5003 |
! |
5004 |
||
5005 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5006 |
"toggle indication or choice |
524 | 5007 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5008 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5009 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5010 |
indication notNil ifTrue:[ |
2359 | 5011 |
arg := self indicationValue not. |
5012 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5013 |
] ifFalse:[ |
2359 | 5014 |
choice notNil ifTrue:[ |
5015 |
choice value:(menuItem choiceValue). |
|
5016 |
^ true |
|
5017 |
] |
|
524 | 5018 |
]. |
5019 |
^ arg |
|
389 | 5020 |
! ! |
5021 |
||
388 | 5022 |
!MenuPanel::Item methodsFor:'accessing'! |
5023 |
||
5024 |
accessCharacter |
|
389 | 5025 |
"returns my accessCharacter or nil |
388 | 5026 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5027 |
^ accessCharacter |
388 | 5028 |
! |
5029 |
||
5030 |
accessCharacterPosition |
|
390 | 5031 |
"get the access character position or nil |
388 | 5032 |
" |
2359 | 5033 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5034 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5035 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5036 |
accessCharacterPosition:anIndex |
390 | 5037 |
"set the access character position or nil |
388 | 5038 |
" |
2359 | 5039 |
menuItem accessCharacterPosition:anIndex. |
388 | 5040 |
! |
5041 |
||
5042 |
argument |
|
5043 |
"gets the argument |
|
5044 |
" |
|
2359 | 5045 |
^ menuItem argument |
388 | 5046 |
! |
5047 |
||
5048 |
argument:anArgument |
|
5049 |
"sets the argument |
|
5050 |
" |
|
2359 | 5051 |
menuItem argument:anArgument. |
389 | 5052 |
! |
5053 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5054 |
displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5055 |
"returns my printable Label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5056 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5057 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5058 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5059 |
|
2614 | 5060 |
displayLabelExtent |
5061 |
"returns the labelExtent |
|
5062 |
" |
|
5063 |
|prevFont w h| |
|
5064 |
||
5065 |
displayLabelExtent notNil ifTrue:[ |
|
5066 |
^ displayLabelExtent |
|
5067 |
]. |
|
5068 |
||
5069 |
displayLabel isNil ifTrue:[ |
|
5070 |
displayLabelExtent := 0@0. |
|
5071 |
^ displayLabelExtent |
|
5072 |
]. |
|
5073 |
prevFont := menuPanel setFont:(self font). |
|
5074 |
||
5075 |
displayLabel isArray ifTrue:[ |
|
5076 |
w := h := 0. |
|
5077 |
||
5078 |
displayLabel do:[:aSubLabel| |
|
5079 |
aSubLabel notNil ifTrue:[ |
|
5080 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
5081 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
5082 |
] ifFalse:[ |
|
5083 |
h := h + (self spaceBetweenEmptyLines) |
|
5084 |
] |
|
5085 |
] |
|
5086 |
] ifFalse:[ |
|
5087 |
w := displayLabel widthOn:menuPanel. |
|
5088 |
h := displayLabel heightOn:menuPanel. |
|
5089 |
]. |
|
5090 |
"/ care for italic fonts - give a few more pixels at the end |
|
5091 |
menuPanel font italic ifTrue:[ |
|
5092 |
w := w + 2. |
|
5093 |
]. |
|
5094 |
displayLabelExtent := w@h. |
|
5095 |
||
5096 |
prevFont notNil ifTrue:[ |
|
5097 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5098 |
]. |
|
5099 |
^ displayLabelExtent |
|
5100 |
! |
|
5101 |
||
1727 | 5102 |
font |
5103 |
"returns the user configured font or nil (default menu font) |
|
5104 |
" |
|
2373 | 5105 |
|font| |
5106 |
||
5107 |
menuPanel isNil ifTrue:[^ nil]. |
|
5108 |
||
5109 |
font := menuItem font. |
|
5110 |
||
5111 |
font notNil ifTrue:[ |
|
5112 |
font := font onDevice:(menuPanel device). |
|
5113 |
menuItem font:font. |
|
5114 |
]. |
|
1727 | 5115 |
^ font |
5116 |
! |
|
5117 |
||
5118 |
font:aFont |
|
5119 |
"returns the user configured font or nil (default menu font) |
|
5120 |
" |
|
2373 | 5121 |
menuItem font:aFont. |
1727 | 5122 |
! |
5123 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5124 |
ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5125 |
"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
|
5126 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5127 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5128 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5129 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5130 |
ignoreMnemonicKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5131 |
"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
|
5132 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5133 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5134 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5135 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5136 |
ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5137 |
"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
|
5138 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5139 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5140 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5141 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5142 |
ignoreShortcutKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5143 |
"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
|
5144 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5145 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5146 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5147 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5148 |
itemValue |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5149 |
"gets value |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5150 |
" |
2360 | 5151 |
^ menuItem itemValue |
5152 |
! |
|
5153 |
||
5154 |
itemValue:aValue |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5155 |
"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
|
5156 |
" |
2360 | 5157 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5158 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5159 |
|
388 | 5160 |
label |
5161 |
"returns the label |
|
5162 |
" |
|
5163 |
^ label |
|
5164 |
! |
|
5165 |
||
5166 |
label:aLabel |
|
399 | 5167 |
"set a new label; if the label changed, a redraw is performed; |
5168 |
handle characters $& (ST-80 compatibility) |
|
388 | 5169 |
" |
2614 | 5170 |
|size char oldExtent| |
5171 |
||
5172 |
oldExtent := displayLabelExtent. |
|
5173 |
displayLabelExtent := nil. "/ force a recomputation |
|
5174 |
accessCharacter := disabledDisplayLabel := nil. |
|
5175 |
label := aLabel value. |
|
5176 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5177 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5178 |
displayLabel isString ifTrue:[ |
2359 | 5179 |
"CHECK FOR SEPARATOR" |
5180 |
||
5181 |
(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
|
5182 |
size := displayLabel size. |
2359 | 5183 |
|
5184 |
size == 0 ifTrue:[ |
|
2614 | 5185 |
displayLabel := nil. "blank separator" |
2359 | 5186 |
^ self |
5187 |
]. |
|
5188 |
||
5189 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5190 |
char := displayLabel first. |
2359 | 5191 |
|
5192 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5193 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5194 |
displayLabel := nil. |
2359 | 5195 |
^ self |
5196 |
] |
|
5197 |
] |
|
5198 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5199 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5200 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5201 |
displayLabel := displayLabel asArray. |
2359 | 5202 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5203 |
]. |
2614 | 5204 |
displayLabel notNil ifTrue:[ |
5205 |
displayLabel isArray ifTrue:[ |
|
5206 |
displayLabel keysAndValuesDo:[:i :el| |
|
5207 |
el notNil ifTrue:[ |
|
5208 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
5209 |
]. |
|
5210 |
]. |
|
5211 |
] ifFalse:[ |
|
5212 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
5213 |
]. |
|
5214 |
]. |
|
5215 |
||
5216 |
menuPanel shown ifTrue:[ |
|
5217 |
self fetchImages. |
|
5218 |
||
5219 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5220 |
self invalidate |
|
5221 |
] ifFalse:[ |
|
5222 |
menuPanel mustRearrange |
|
2359 | 5223 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5224 |
]. |
388 | 5225 |
! |
5226 |
||
5227 |
menuPanel |
|
5228 |
"returns my menuPanel |
|
5229 |
" |
|
399 | 5230 |
^ menuPanel |
388 | 5231 |
! |
5232 |
||
5233 |
nameKey |
|
5234 |
"gets the nameKey |
|
5235 |
" |
|
2359 | 5236 |
^ menuItem nameKey |
388 | 5237 |
! |
5238 |
||
5239 |
nameKey:aNameKey |
|
5240 |
"sets the nameKey |
|
5241 |
" |
|
2359 | 5242 |
menuItem nameKey:aNameKey. |
388 | 5243 |
! |
5244 |
||
5245 |
rawLabel |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5246 |
"returns my raw, unprocessed label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5247 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5248 |
^ menuItem rawLabel |
388 | 5249 |
! |
5250 |
||
5251 |
shortcutKey |
|
5252 |
"get the key to press to select the submenu from the keyboard or if |
|
5253 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5254 |
" |
|
2359 | 5255 |
^ menuItem shortcutKey |
388 | 5256 |
! |
5257 |
||
5258 |
shortcutKey:aKey |
|
5259 |
"set the key to press to select the submenu from the keyboard or if |
|
5260 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5261 |
" |
|
2359 | 5262 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5263 |
menuItem shortcutKey:aKey. |
|
5264 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5265 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5266 |
! |
388 | 5267 |
|
710 | 5268 |
startGroup |
5269 |
"start group #left #right #center ... or nil |
|
5270 |
at the moment only #right is implemented |
|
5271 |
" |
|
2359 | 5272 |
^ menuItem startGroup |
710 | 5273 |
! |
5274 |
||
5275 |
startGroup:aSymbol |
|
5276 |
"start group #left #right #center ... |
|
5277 |
at the moment only #right is implemented |
|
5278 |
" |
|
2359 | 5279 |
menuItem startGroup:aSymbol. |
710 | 5280 |
! |
5281 |
||
388 | 5282 |
submenu |
5283 |
"returns my submenu or nil |
|
5284 |
" |
|
464 | 5285 |
subMenu notNil ifTrue:[^ subMenu]. |
5286 |
^ self setupSubmenu |
|
388 | 5287 |
! |
5288 |
||
5289 |
submenu:aSubMenu |
|
5290 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
5291 |
to a redraw if 'hasSubmenu' changed |
|
5292 |
" |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5293 |
|widget| |
1767 | 5294 |
|
5295 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5296 |
subMenu notNil ifTrue:[ |
5297 |
subMenu destroy. |
|
5298 |
subMenu := nil. |
|
5299 |
]. |
|
5300 |
^ self |
|
1767 | 5301 |
]. |
5302 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5303 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5304 |
subMenu := MenuPanel new. |
5305 |
||
5306 |
menuPanel notNil ifTrue:[ |
|
5307 |
subMenu receiver:menuPanel receiver. |
|
5308 |
]. |
|
5309 |
subMenu superMenu:menuPanel. |
|
5310 |
||
5311 |
menuItem horizontalLayout == true ifTrue:[ |
|
5312 |
subMenu verticalLayout:false |
|
5313 |
]. |
|
5314 |
subMenu menu:aSubMenu. |
|
1767 | 5315 |
] ifFalse:[ |
2360 | 5316 |
aSubMenu isView ifFalse:[ |
5317 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5318 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5319 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5320 |
]. |
5321 |
widget := SimpleView new. |
|
5322 |
widget client:aSubMenu. |
|
5323 |
] ifTrue:[ |
|
5324 |
widget := aSubMenu |
|
5325 |
]. |
|
5326 |
||
5327 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5328 |
subMenu := widget. |
|
5329 |
||
5330 |
menuItem horizontalLayout == true ifTrue:[ |
|
5331 |
subMenu verticalLayout:false |
|
5332 |
]. |
|
5333 |
] ifFalse:[ |
|
5334 |
subMenu := MenuPanel new. |
|
5335 |
subMenu receiver:menuPanel receiver. |
|
5336 |
subMenu addSubView:widget. |
|
5337 |
subMenu extent:(widget preferredExtent). |
|
5338 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5339 |
]. |
|
5340 |
subMenu superMenu:menuPanel. |
|
5341 |
]. |
|
389 | 5342 |
! |
5343 |
||
390 | 5344 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5345 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5346 |
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
|
5347 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5348 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5349 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5350 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5351 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5352 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5353 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5354 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5355 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5356 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5357 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5358 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5359 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5360 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5361 |
^ nil |
390 | 5362 |
! |
5363 |
||
1841 | 5364 |
triggerOnDown |
5365 |
"trigger the action if pressed |
|
5366 |
" |
|
2359 | 5367 |
menuItem triggerOnDown ifTrue:[ |
5368 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5369 |
]. |
5370 |
^ false |
|
5371 |
! |
|
5372 |
||
5373 |
triggerOnDown:aBool |
|
5374 |
"trigger the action if pressed |
|
5375 |
" |
|
2359 | 5376 |
menuItem triggerOnDown:aBool. |
1841 | 5377 |
! |
5378 |
||
389 | 5379 |
value |
5380 |
"gets value |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5381 |
Left here for ST80 compatibility - value is a bad name |
389 | 5382 |
" |
2360 | 5383 |
^ menuItem itemValue |
5384 |
! |
|
5385 |
||
5386 |
value:aValue |
|
389 | 5387 |
"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
|
5388 |
Left here for ST80 compatibility - value: is a bad name |
389 | 5389 |
" |
2360 | 5390 |
menuItem itemValue:aValue. |
502 | 5391 |
! |
5392 |
||
5393 |
value:aValue argument:anArgument |
|
5394 |
"set the value and an argument |
|
5395 |
" |
|
2360 | 5396 |
menuItem itemValue:aValue. |
5397 |
menuItem argument:anArgument. |
|
388 | 5398 |
! ! |
5399 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5400 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5401 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5402 |
choice |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5403 |
"implements a radio group; the field |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5404 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5405 |
^ choice |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5406 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5407 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5408 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5409 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5410 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5411 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5412 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5413 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5414 |
choice isValueModel ifTrue:[ |
2219 | 5415 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5416 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5417 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5418 |
(choice := something) notNil ifTrue:[ |
2219 | 5419 |
choice isSymbol ifTrue:[ |
5420 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5421 |
choice := something |
|
5422 |
] |
|
5423 |
]. |
|
5424 |
choice isValueModel ifTrue:[ |
|
5425 |
choice addDependent:self |
|
5426 |
] |
|
1699 | 5427 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5428 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5429 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5430 |
choiceValue |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5431 |
"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
|
5432 |
" |
2359 | 5433 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5434 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5435 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5436 |
choiceValue:something |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5437 |
"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
|
5438 |
" |
2359 | 5439 |
menuItem choiceValue ~= something ifTrue:[ |
5440 |
menuItem choiceValue:something. |
|
5441 |
choice notNil ifTrue:[ self invalidate ]. |
|
5442 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5443 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5444 |
|
388 | 5445 |
enabled |
5446 |
"returns the enabled state |
|
5447 |
" |
|
524 | 5448 |
|state| |
5449 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5450 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5451 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5452 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5453 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5454 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5455 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5456 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5457 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5458 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5459 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5460 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5461 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5462 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5463 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5464 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5465 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5466 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5467 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5468 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5469 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5470 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5471 |
^ state ~~ false |
388 | 5472 |
! |
5473 |
||
389 | 5474 |
enabled:something |
388 | 5475 |
"change the enabled state; if the state changed, a redraw is performed |
5476 |
" |
|
390 | 5477 |
|oldState newState| |
5478 |
||
5479 |
enableChannel isNil ifTrue:[ |
|
2219 | 5480 |
oldState := true |
390 | 5481 |
] ifFalse:[ |
2219 | 5482 |
oldState := enableChannel value. |
5483 |
enableChannel isValueModel ifTrue:[ |
|
5484 |
enableChannel removeDependent:self |
|
5485 |
] |
|
388 | 5486 |
]. |
390 | 5487 |
enableChannel := something. |
5488 |
||
5489 |
enableChannel isNil ifTrue:[ |
|
2219 | 5490 |
menuPanel shown ifFalse:[^ self]. |
5491 |
newState := true |
|
390 | 5492 |
] ifFalse:[ |
2219 | 5493 |
enableChannel isValueModel ifTrue:[ |
5494 |
enableChannel addDependent:self |
|
5495 |
] ifFalse:[ |
|
5496 |
enableChannel isSymbol ifTrue:[^ self] |
|
5497 |
]. |
|
5498 |
menuPanel shown ifFalse:[^ self]. |
|
5499 |
newState := enableChannel value. |
|
390 | 5500 |
]. |
5501 |
||
5502 |
newState ~~ oldState ifTrue:[ |
|
2219 | 5503 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5504 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5505 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5506 |
|
1670 | 5507 |
hideMenuOnActivated |
5508 |
"hide the menu when the item was activated; the default is true |
|
5509 |
" |
|
2359 | 5510 |
^ menuItem hideMenuOnActivated |
1670 | 5511 |
! |
5512 |
||
5513 |
hideMenuOnActivated:aBool |
|
5514 |
"hide the menu when the item was activated; the default is true |
|
5515 |
" |
|
2359 | 5516 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5517 |
! |
5518 |
||
2216 | 5519 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5520 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5521 |
||
5522 |
(menuPanel receiver isNil |
|
5523 |
and:[ menuPanel application notNil |
|
5524 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5525 |
ifTrue:[ |
|
2219 | 5526 |
^ self "/ suppressed |
2216 | 5527 |
]. |
5528 |
aMessage infoPrintCR |
|
5529 |
! |
|
5530 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5531 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5532 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5533 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5534 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5535 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5536 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5537 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5538 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5539 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5540 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5541 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5542 |
indication isValueModel ifTrue:[ |
2219 | 5543 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5544 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5545 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5546 |
(indication := something) notNil ifTrue:[ |
2219 | 5547 |
indication isValueModel ifTrue:[ |
5548 |
indication addDependent:self |
|
5549 |
] ifFalse:[ |
|
5550 |
"/ to force an update of the value |
|
5551 |
self indicationValue |
|
5552 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5553 |
]. |
464 | 5554 |
! |
5555 |
||
1767 | 5556 |
keepLinkedMenu |
5557 |
"get the keepLinkedMenu flag |
|
5558 |
" |
|
2359 | 5559 |
^ menuItem keepLinkedMenu |
5560 |
! |
|
5561 |
||
5562 |
keepLinkedMenu:aBool |
|
1767 | 5563 |
"get the keepLinkedMenu flag |
5564 |
" |
|
2359 | 5565 |
menuItem keepLinkedMenu:aBool. |
1767 | 5566 |
! |
5567 |
||
2331 | 5568 |
sendToOriginator |
5569 |
"if true, the message is sent to the originating widget; |
|
5570 |
otherwise (the default), it it sent to the receiver/application." |
|
5571 |
||
2359 | 5572 |
^ menuItem sendToOriginator |
2331 | 5573 |
! |
5574 |
||
5575 |
sendToOriginator:aBoolean |
|
5576 |
"if true, the message is sent to the originating widget; |
|
5577 |
otherwise (the default), it it sent to the receiver/application." |
|
5578 |
||
2359 | 5579 |
menuItem sendToOriginator:aBoolean. |
2331 | 5580 |
! |
5581 |
||
464 | 5582 |
submenuChannel |
5583 |
"get the submenu channel |
|
5584 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5585 |
^ menuItem submenuChannel |
464 | 5586 |
! |
5587 |
||
5588 |
submenuChannel:aSelectorOrNil |
|
5589 |
"returns the submenu channel |
|
5590 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5591 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5592 |
! ! |
5593 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5594 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5595 |
|
2016 | 5596 |
moveBy:aPoint |
5597 |
"move layout origin |
|
5598 |
" |
|
5599 |
layout moveBy:aPoint. |
|
5600 |
! |
|
5601 |
||
1699 | 5602 |
preferredExtent |
5603 |
"compute my preferred extent excluding the shortCutKey and the menu identifier |
|
5604 |
" |
|
2614 | 5605 |
|isVertical icon wIcon isButton labelExtent |
1699 | 5606 |
x "{ Class:SmallInteger }" |
5607 |
y "{ Class:SmallInteger }" |
|
5608 |
s "{ Class:SmallInteger }" |
|
5609 |
| |
|
5610 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5611 |
||
2359 | 5612 |
isButton := menuItem isButton. |
5613 |
||
1699 | 5614 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5615 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5616 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5617 |
y := s + VerticalButtonInset. |
1699 | 5618 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5619 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5620 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5621 |
]. |
5622 |
x := x * 2. |
|
5623 |
y := y * 2. |
|
5624 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5625 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5626 |
|
2362 | 5627 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5628 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5629 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5630 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5631 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5632 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5633 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5634 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5635 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5636 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5637 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5638 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5639 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5640 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5641 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5642 |
]. |
1699 | 5643 |
] ifFalse:[ |
2614 | 5644 |
labelExtent := self displayLabelExtent. |
5645 |
||
5646 |
x := x + labelExtent x. |
|
5647 |
y := y + labelExtent y. |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5648 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5649 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5650 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5651 |
"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
|
5652 |
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
|
5653 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5654 |
(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
|
5655 |
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
|
5656 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5657 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5658 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5659 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5660 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5661 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5662 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5663 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5664 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5665 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5666 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5667 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5668 |
x := x + wIcon. |
1699 | 5669 |
]. |
5670 |
^ x@y |
|
388 | 5671 |
! ! |
5672 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5673 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5674 |
|
5675 |
activeHelpKey |
|
5676 |
"get the active helpKey; the key to retrieve the helpText from the application |
|
5677 |
" |
|
2359 | 5678 |
^ menuItem activeHelpKey |
1613 | 5679 |
! |
5680 |
||
5681 |
activeHelpKey:aHelpKey |
|
5682 |
"set the active helpKey; the key to retrieve the helpText from the application |
|
5683 |
" |
|
2359 | 5684 |
menuItem activeHelpKey:aHelpKey. |
5685 |
activeHelpText := nil. |
|
1613 | 5686 |
! |
5687 |
||
5688 |
activeHelpText |
|
5689 |
"get the active helpText or nil if not yet resolved |
|
5690 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5691 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5692 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5693 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5694 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5695 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5696 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5697 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5698 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5699 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5700 |
^ nil |
1613 | 5701 |
! |
5702 |
||
5703 |
activeHelpText:aText |
|
5704 |
"set the active helpText |
|
5705 |
" |
|
5706 |
activeHelpText := aText. |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5707 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5708 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5709 |
flyByHelpText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5710 |
"get the flyBy helpText or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5711 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5712 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5713 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5714 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5715 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5716 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5717 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5718 |
|
2471 | 5719 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
5720 |
"/ (if you have an argument for that let us know..) |
|
5721 |
"/ self isButton ifFalse:[^ nil]. |
|
5722 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5723 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5724 |
"/ 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
|
5725 |
key := self activeHelpKey. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5726 |
(key notNil and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5727 |
text := app flyByHelpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5728 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5729 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5730 |
"/ 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
|
5731 |
text isNil ifTrue:[ |
2676
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5732 |
self hasSubmenu ifTrue:[ |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5733 |
^ key |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5734 |
]. |
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5735 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5736 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5737 |
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
|
5738 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5739 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5740 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5741 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5742 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5743 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5744 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5745 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5746 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5747 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5748 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5749 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5750 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5751 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5752 |
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
|
5753 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5754 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5755 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5756 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5757 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5758 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5759 |
"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
|
5760 |
(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
|
5761 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5762 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5763 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5764 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5765 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5766 |
flyByHelpText:aText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5767 |
"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
|
5768 |
" |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5769 |
flyByHelpText := aText. |
1613 | 5770 |
! ! |
5771 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5772 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5773 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5774 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5775 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5776 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5777 |
" |
2360 | 5778 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5779 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5780 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5781 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5782 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5783 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5784 |
" |
2360 | 5785 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5786 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5787 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5788 |
isButton |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5789 |
"returns whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5790 |
" |
2359 | 5791 |
^ menuItem isButton |
5792 |
! |
|
5793 |
||
5794 |
isButton:aBool |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5795 |
"sets whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5796 |
" |
2359 | 5797 |
menuItem isButton ~~ aBool ifTrue:[ |
5798 |
menuItem isButton:aBool. |
|
5799 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5800 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5801 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5802 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5803 |
layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5804 |
"returns my layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5805 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5806 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5807 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5808 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5809 |
layout:aLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5810 |
"set a new layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5811 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5812 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5813 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5814 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5815 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5816 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5817 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5818 |
"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
|
5819 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5820 |
" |
2359 | 5821 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5822 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5823 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5824 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5825 |
"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
|
5826 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5827 |
" |
2359 | 5828 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5829 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5830 |
|
2504 | 5831 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 5832 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5833 |
currentSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5834 |
"returns the current submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5835 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5836 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5837 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5838 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5839 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5840 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5841 |
|
1705 | 5842 |
hideSubmenu |
5843 |
"hide submenu |
|
5844 |
" |
|
2199 | 5845 |
self hideSubmenu:subMenu. |
5846 |
! |
|
5847 |
||
5848 |
hideSubmenu:aSubmenu |
|
5849 |
"hide submenu |
|
5850 |
" |
|
1705 | 5851 |
|id| |
5852 |
||
2374 | 5853 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 5854 |
aSubmenu removeDependencies. |
2199 | 5855 |
|
5856 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5857 |
id := aSubmenu id. |
2374 | 5858 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 5859 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5860 |
aSubmenu hide |
2199 | 5861 |
]. |
5862 |
||
5863 |
aSubmenu windowGroup:nil. |
|
5864 |
menuPanel windowGroup removeView:aSubmenu. |
|
5865 |
||
5866 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5867 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5868 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5869 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5870 |
] |
2199 | 5871 |
]. |
5872 |
! |
|
5873 |
||
5874 |
openDelayedSubmenu |
|
5875 |
"called to open now my delayed submenu |
|
5876 |
" |
|
5877 |
|subm| |
|
5878 |
||
5879 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
5880 |
||
2374 | 5881 |
subMenu notNil ifTrue:[ |
5882 |
subMenu realized ifTrue:[ |
|
5883 |
"/ already open |
|
5884 |
^ self |
|
5885 |
]. |
|
2199 | 5886 |
]. |
5887 |
subm := self setupSubmenu. |
|
2374 | 5888 |
subm isNil ifTrue:[^ self]. |
2199 | 5889 |
|
5890 |
self openSubmenu. |
|
5891 |
||
5892 |
(subm == subMenu and:[self isSelected]) ifFalse:[ |
|
2374 | 5893 |
"/ closed during building or opening the submenu |
5894 |
self hideSubmenu:subm. |
|
2199 | 5895 |
]. |
1705 | 5896 |
! |
1701 | 5897 |
|
5898 |
openSubmenu |
|
5899 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
5900 |
is fully visible by shifting it into the visible screen area if |
|
5901 |
nescessary. |
|
5902 |
" |
|
2249 | 5903 |
|p o device isVertical topMenu windGrp prefExtent |
1701 | 5904 |
devBot "{ Class:SmallInteger }" |
5905 |
devRight "{ Class:SmallInteger }" |
|
5906 |
width "{ Class:SmallInteger }" |
|
5907 |
height "{ Class:SmallInteger }" |
|
5908 |
top "{ Class:SmallInteger }" |
|
5909 |
left "{ Class:SmallInteger }" |
|
5910 |
| |
|
5911 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
5912 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 5913 |
^ self |
1701 | 5914 |
]. |
5915 |
||
5916 |
topMenu := menuPanel topMenu. |
|
1829 | 5917 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 5918 |
subMenu releaseDeviceResources. |
5919 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
5920 |
subMenu recreate. |
|
1829 | 5921 |
]. |
5922 |
||
1701 | 5923 |
windGrp := topMenu windowGroup. |
5924 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5925 |
subMenu superMenu:menuPanel. |
1701 | 5926 |
subMenu becomesActiveMenu. |
5927 |
subMenu cursor:Cursor hand. |
|
5928 |
||
5929 |
windGrp notNil ifTrue:[ |
|
2249 | 5930 |
subMenu windowGroup:windGrp. |
5931 |
windGrp addTopView:subMenu. |
|
1701 | 5932 |
]. |
5933 |
||
2111 | 5934 |
"Q&D kludge - test whether the layout is nil; |
2249 | 5935 |
if true recompute the layouts |
2111 | 5936 |
" |
2374 | 5937 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 5938 |
|
1701 | 5939 |
" Q&D kludge - if any visibility attributes are blocks; |
5940 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 5941 |
(since I react correctly on valueHolder changes) |
1701 | 5942 |
" |
5943 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
5944 |
subMenu fixSize. |
|
5945 |
||
5946 |
"compute origin of subMenu |
|
5947 |
" |
|
5948 |
isVertical := menuPanel verticalLayout. |
|
5949 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5950 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5951 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5952 |
width := prefExtent x. |
1701 | 5953 |
devBot := device usableHeight. |
5954 |
devRight := device usableWidth. |
|
5955 |
||
5956 |
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
|
5957 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5958 |
menuPanel isPopUpView ifTrue:[ |
2249 | 5959 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5960 |
] ifFalse:[ |
2249 | 5961 |
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
|
5962 |
]. |
1701 | 5963 |
left := o x. |
5964 |
top := o y. |
|
5965 |
||
2016 | 5966 |
top + height > devBot ifTrue:[ |
2249 | 5967 |
top := isVertical ifTrue:[devBot - height] |
5968 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 5969 |
]. |
5970 |
top := top max:0. |
|
5971 |
||
5972 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
5973 |
"/ top < menuPanel bottom ifTrue:[ |
|
5974 |
"/ left := left + layout width. |
|
5975 |
"/ ]. |
|
5976 |
"/ left + width > devRight ifTrue:[ |
|
5977 |
"/ left := o x - width - 2 |
|
5978 |
"/ ]. |
|
5979 |
"/ ]. |
|
5980 |
||
1701 | 5981 |
left + width > devRight ifTrue:[ |
2249 | 5982 |
left := isVertical ifTrue:[left - layout width - width + 2] |
5983 |
ifFalse:[devRight - width] |
|
1701 | 5984 |
]. |
5985 |
left := left max:0. |
|
5986 |
||
5987 |
subMenu origin:(left@top). |
|
5988 |
||
5989 |
subMenu realized ifFalse:[ |
|
2249 | 5990 |
subMenu realize. |
1701 | 5991 |
] ifTrue:[ |
2249 | 5992 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5993 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5994 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5995 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5996 |
toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5997 |
"toggle the visibility of the submenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5998 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5999 |
subMenu notNil ifTrue:[ |
2219 | 6000 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6001 |
] ifFalse:[ |
2219 | 6002 |
(subMenu := self setupSubmenu) isNil ifTrue:[ |
6003 |
"/ cannot open a submenu |
|
6004 |
^ self |
|
6005 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6006 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6007 |
self openSubmenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6008 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6009 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6010 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6011 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6012 |
visibleSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6013 |
"returns the current visible submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6014 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6015 |
subMenu notNil ifTrue:[ |
2219 | 6016 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6017 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6018 |
^ nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6019 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
6020 |
|
1701 | 6021 |
|
6022 |
! ! |
|
6023 |
||
524 | 6024 |
!MenuPanel::Item methodsFor:'building'! |
6025 |
||
6026 |
aspectAt:aKey |
|
6027 |
"retursns value assigned to key or nil |
|
6028 |
" |
|
6029 |
|appl value| |
|
6030 |
||
6031 |
appl := menuPanel receiver. |
|
6032 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
6033 |
(appl isValueModel) ifTrue:[ |
2359 | 6034 |
^ appl value:aKey |
524 | 6035 |
]. |
6036 |
||
2123 | 6037 |
appl isNil ifTrue:[ |
2359 | 6038 |
appl := menuPanel application. |
2123 | 6039 |
]. |
6040 |
appl isNil ifTrue:[ ^ nil]. |
|
6041 |
||
6042 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 6043 |
ex selector == aKey ifFalse:[ |
6044 |
ex reject |
|
6045 |
]. |
|
6046 |
self ifNotInUIBuilderInfoPrintCR: |
|
2545
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
6047 |
('MenuPanel::Item [info]: application (class %1) does not provide aspect: %2' |
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
6048 |
bindWith:appl className with:aKey). |
2123 | 6049 |
] do:[ |
2359 | 6050 |
aKey numArgs == 1 ifTrue:[ |
6051 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
6052 |
] ifFalse:[ |
|
6053 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
6054 |
value := appl aspectFor:aKey |
|
6055 |
] ifFalse:[ |
|
6056 |
value := appl perform:aKey |
|
6057 |
] |
|
6058 |
] |
|
524 | 6059 |
]. |
6060 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6061 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
6062 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 6063 |
! ! |
6064 |
||
390 | 6065 |
!MenuPanel::Item methodsFor:'change & update'! |
6066 |
||
2614 | 6067 |
fontChanged |
6068 |
"called whenever the font changed |
|
6069 |
" |
|
6070 |
displayLabel notNil ifTrue:[ |
|
6071 |
displayLabelExtent := nil. |
|
6072 |
||
6073 |
subMenu notNil ifTrue:[ |
|
6074 |
subMenu font:(menuPanel font). |
|
6075 |
]. |
|
6076 |
]. |
|
6077 |
! |
|
6078 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6079 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6080 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6081 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6082 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6083 |
(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
|
6084 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6085 |
self isSeparator ifFalse:[ |
2359 | 6086 |
"/ NOT A SEPARATOR |
6087 |
||
6088 |
menuPanel shown ifTrue:[ |
|
6089 |
changedObject == enableChannel ifTrue:[ |
|
6090 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6091 |
^ menuPanel selection:nil. |
|
6092 |
]. |
|
6093 |
^ self invalidate |
|
6094 |
]. |
|
6095 |
||
6096 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6097 |
menuItem isButton ifTrue:[ |
|
6098 |
self invalidate |
|
6099 |
] ifFalse:[ |
|
6100 |
"/ invalidate the interactor only |
|
6101 |
"/ take any interactor; interactors has the same extent |
|
6102 |
form := menuPanel iconIndicationOff. |
|
6103 |
||
6104 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6105 |
top:(layout top) |
|
6106 |
width:(form width) |
|
6107 |
height:(layout height). |
|
6108 |
||
6109 |
menuPanel invalidate:rect repairNow:false |
|
6110 |
]. |
|
6111 |
^ self |
|
6112 |
]. |
|
6113 |
]. |
|
498 | 6114 |
]. |
712 | 6115 |
|
6116 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6117 |
menuPanel mustRearrange. |
6118 |
menuPanel rearrangeItems. |
|
6119 |
^ self. |
|
712 | 6120 |
]. |
6121 |
||
498 | 6122 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6123 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6124 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6125 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6126 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6127 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6128 |
(indication notNil and:[indication isSymbol]) ifTrue:[ |
2219 | 6129 |
" indication is a selector otherwise a change notification |
6130 |
is raised from the model !!!! |
|
6131 |
" |
|
6132 |
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
|
6133 |
] |
390 | 6134 |
! ! |
6135 |
||
388 | 6136 |
!MenuPanel::Item methodsFor:'converting'! |
6137 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6138 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6139 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6140 |
" |
2359 | 6141 |
^ menuItem |
388 | 6142 |
! |
6143 |
||
6144 |
menuItem:aMenuItem |
|
6145 |
"setup attributes from a MenuItem |
|
6146 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6147 |
|lbl| |
389 | 6148 |
|
388 | 6149 |
menuPanel disabledRedrawDo:[ |
2359 | 6150 |
menuItem := aMenuItem. |
6151 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6152 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6153 |
label := displayLabel := activeHelpText := nil. |
2359 | 6154 |
|
6155 |
self enabled:(menuItem enabled). |
|
6156 |
self indication:(menuItem indication). |
|
6157 |
self choice:(menuItem choice). |
|
6158 |
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
|
6159 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6160 |
"/ we should call here resourceRetriever insteat of labelImage |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6161 |
"/ but ... ?? |
2359 | 6162 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6163 |
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
|
6164 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6165 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6166 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6167 |
self label:lbl. |
388 | 6168 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6169 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6170 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6171 |
! ! |
6172 |
||
2681 | 6173 |
!MenuPanel::Item methodsFor:'dependents access'! |
6174 |
||
6175 |
addDependencies |
|
6176 |
"add all dependencies |
|
6177 |
" |
|
6178 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
|
6179 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
6180 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
6181 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
6182 |
! |
|
6183 |
||
6184 |
removeDependencies |
|
6185 |
"remove all dependencies |
|
6186 |
" |
|
6187 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
|
6188 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
6189 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
6190 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
6191 |
! ! |
|
6192 |
||
388 | 6193 |
!MenuPanel::Item methodsFor:'drawing'! |
6194 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6195 |
draw |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6196 |
"redraw item |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6197 |
" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6198 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6199 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6200 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6201 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6202 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6203 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6204 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6205 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6206 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6207 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6208 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6209 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6210 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6211 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6212 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6213 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6214 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6215 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6216 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6217 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6218 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6219 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6220 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6221 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6222 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6223 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6224 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6225 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6226 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6227 |
]]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6228 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6229 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6230 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6231 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6232 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6233 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6234 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6235 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6236 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6237 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6238 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6239 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6240 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6241 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6242 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6243 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6244 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6245 |
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
|
6246 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6247 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6248 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6249 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6250 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6251 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6252 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6253 |
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
|
6254 |
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
|
6255 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6256 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6257 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6258 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6259 |
drawButton |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6260 |
"draw as button |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6261 |
" |
2362 | 6262 |
|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
|
6263 |
x "{ Class:SmallInteger }" |
2143 | 6264 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6265 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6266 |
drawObject := displayLabel. |
2362 | 6267 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6268 |
isSelected := self isSelected. |
2362 | 6269 |
|
6270 |
isSelected ifFalse:[ |
|
6271 |
"/ test whether button has pressed toggle behaviour |
|
6272 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6273 |
] ifTrue:[ |
|
6274 |
showSelected := isSelected |
|
6275 |
]. |
|
6276 |
||
6277 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6278 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6279 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6280 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6281 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6282 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6283 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6284 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6285 |
]. |
2059 | 6286 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6287 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6288 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6289 |
fg := menuPanel disabledForegroundColor. |
2059 | 6290 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6291 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6292 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6293 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6294 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6295 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6296 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6297 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6298 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6299 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6300 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6301 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6302 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6303 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6304 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6305 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6306 |
|
6307 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6308 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6309 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6310 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6311 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6312 |
"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
|
6313 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6314 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6315 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6316 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6317 |
] ifFalse:[ |
2359 | 6318 |
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
|
6319 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6320 |
]. |
2143 | 6321 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6322 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6323 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6324 |
level := menuPanel buttonActiveLevel. |
2142 | 6325 |
x := x + 1 "level abs". |
2143 | 6326 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6327 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6328 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6329 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6330 |
]. |
6331 |
||
2362 | 6332 |
drawObject isEmptyOrNil ifFalse:[ |
6333 |
etchFg notNil ifTrue:[ |
|
6334 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6335 |
]. |
|
6336 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6337 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6338 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6339 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6340 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6341 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6342 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6343 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6344 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6345 |
drawLabel |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6346 |
"draw a labeled entry; no button, no separator. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6347 |
" |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6348 |
|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
|
6349 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6350 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6351 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6352 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6353 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6354 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6355 |
drawObject := displayLabel. |
2362 | 6356 |
isEnabled := self enabled. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6357 |
isSelected := self isSelected. |
2362 | 6358 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6359 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6360 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6361 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6362 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6363 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6364 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6365 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6366 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6367 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6368 |
] ifFalse:[ |
2362 | 6369 |
fg := menuPanel disabledForegroundColor. |
6370 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6371 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6372 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6373 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6374 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6375 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6376 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6377 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6378 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6379 |
((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
|
6380 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6381 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6382 |
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
|
6383 |
x := x + 2 + form width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6384 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6385 |
|
2362 | 6386 |
drawObject isEmptyOrNil ifFalse:[ |
6387 |
etchFg notNil ifTrue:[ |
|
6388 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6389 |
]. |
|
6390 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6391 |
]. |
|
6392 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6393 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6394 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6395 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6396 |
|
2359 | 6397 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6398 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6399 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6400 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6401 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6402 |
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
|
6403 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6404 |
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
|
6405 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6406 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6407 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6408 |
|
2362 | 6409 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6410 |
^ self |
|
6411 |
]. |
|
6412 |
arrow := menuPanel rightArrow. |
|
6413 |
x := layout right - arrow width - HorizontalInset. |
|
6414 |
y := t + (h - arrow height // 2). |
|
6415 |
||
6416 |
(menuPanel styleSheet is3D not |
|
6417 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6418 |
^ menuPanel displayForm:arrow x:x y:y |
|
6419 |
]. |
|
6420 |
cLa := menuPanel shadowColor. |
|
6421 |
cLb := menuPanel lightColor. |
|
6422 |
||
6423 |
isSelected ifFalse:[ |
|
6424 |
fg := cLa. |
|
6425 |
cLa := cLb. |
|
6426 |
cLb := fg |
|
6427 |
]. |
|
6428 |
menuPanel paint:cLa. |
|
6429 |
menuPanel displayForm:arrow x:x y:y. |
|
6430 |
menuPanel paint:cLb. |
|
6431 |
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
|
6432 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6433 |
"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
|
6434 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6435 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6436 |
drawMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6437 |
"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
|
6438 |
" |
2220 | 6439 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6440 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6441 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6442 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6443 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6444 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6445 |
icon := MenuPanel menuIndicator. |
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 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6448 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6449 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6450 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6451 |
x := layout right - icon width. |
2460 | 6452 |
false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[ |
2220 | 6453 |
y := layout height - icon height // 2 + layout top. |
6454 |
] ifFalse:[ |
|
6455 |
y := layout bottom - icon height - 2. |
|
6456 |
]. |
|
6457 |
||
6458 |
bAbsLevel := 0. |
|
2359 | 6459 |
menuItem isButton ifTrue:[ |
2220 | 6460 |
self isSelected ifTrue:[ |
6461 |
x := x + 1. |
|
6462 |
y := y + 1. |
|
6463 |
]. |
|
6464 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6465 |
x := x - bAbsLevel. |
|
6466 |
y := y - bAbsLevel. |
|
6467 |
]. |
|
6468 |
x := x - 1 "- HorizontalInset". |
|
6469 |
||
6470 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6471 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6472 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6473 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6474 |
|
2234 | 6475 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2761 | 6476 |
ifTrue:[ |
2220 | 6477 |
menuPanel paint:menuPanel buttonShadowColor. |
6478 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6479 |
menuPanel paint:menuPanel buttonLightColor. |
|
6480 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6481 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6482 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6483 |
|
2059 | 6484 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6485 |
"draw a labeled entry; no button, no separator. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6486 |
" |
2614 | 6487 |
|mfont labelExtent |
1727 | 6488 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6489 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6490 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6491 |
| |
2059 | 6492 |
|
2373 | 6493 |
mfont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6494 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6495 |
menuPanel paint:fg. |
2614 | 6496 |
labelExtent := self displayLabelExtent. |
6497 |
||
6498 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 6499 |
"/ menuPanel centerItems ifTrue:[self halt]. |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6500 |
aLabel isArray ifFalse:[ |printLabel| |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6501 |
aLabel isText ifTrue:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6502 |
"/background of label already drawn |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6503 |
printLabel := aLabel withoutEmphasis:#backgroundColor. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6504 |
] ifFalse:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6505 |
printLabel := aLabel. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6506 |
]. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6507 |
y := y + (printLabel ascentOn:menuPanel). |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6508 |
printLabel displayOn:menuPanel x:x y:y. |
1727 | 6509 |
] ifTrue:[ |
2337 | 6510 |
aLabel do:[:el| |
6511 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6512 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6513 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6514 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6515 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6516 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6517 |
"/ ]. |
2614 | 6518 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 6519 |
el displayOn:menuPanel x:x0 y:y0. |
6520 |
y := y + 1 + (el heightOn:menuPanel) |
|
6521 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6522 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 6523 |
] |
6524 |
]. |
|
1727 | 6525 |
]. |
6526 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6527 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6528 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6529 |
drawSeparatingLines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6530 |
"draw separating lines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6531 |
" |
2059 | 6532 |
|myIndex lfSep rtSep items prevItem nextItem |
6533 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6534 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6535 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6536 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6537 |
b "{ Class:SmallInteger }" |
706 | 6538 |
| |
2059 | 6539 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6540 |
items := menuPanel items. |
2059 | 6541 |
myIndex := items identityIndexOf:self. |
6542 |
||
6543 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6544 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6545 |
||
6546 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6547 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6548 |
||
6549 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2219 | 6550 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6551 |
]. |
2059 | 6552 |
|
6553 |
lightColor := menuPanel lightColor. |
|
6554 |
shadowColor := menuPanel shadowColor. |
|
6555 |
||
6556 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6557 |
|
608 | 6558 |
l := layout left. |
6559 |
t := layout top. |
|
6560 |
r := layout right. |
|
6561 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6562 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6563 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6564 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
6565 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
6566 |
||
6567 |
menuPanel paint:shadowColor. |
|
6568 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
6569 |
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
|
6570 |
] ifFalse:[ |
2219 | 6571 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
6572 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
6573 |
||
6574 |
menuPanel paint:shadowColor. |
|
6575 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
6576 |
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
|
6577 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6578 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6579 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6580 |
drawSeparator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6581 |
"draw as separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6582 |
" |
2059 | 6583 |
|type lightColor shadowColor isDouble |
6584 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6585 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6586 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6587 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6588 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6589 |
| |
2059 | 6590 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6591 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6592 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2219 | 6593 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6594 |
]. |
2059 | 6595 |
|
6596 |
isDouble := type == #doubleLine. |
|
6597 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6598 |
lightColor := menuPanel lightColor. |
2059 | 6599 |
shadowColor := menuPanel shadowColor. |
6600 |
menuPanel paint:shadowColor. |
|
6601 |
||
6602 |
left := layout left. |
|
6603 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6604 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6605 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6606 |
x0 := left + HorizontalInset. |
6607 |
x1 := layout right - HorizontalInset. |
|
6608 |
y0 := top - 1 + (layout height // 2). |
|
6609 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
6610 |
||
6611 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
6612 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
6613 |
||
6614 |
menuPanel paint:lightColor. |
|
6615 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
6616 |
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
|
6617 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6618 |
] ifFalse:[ |
2219 | 6619 |
y1 := layout bottom. |
6620 |
x0 := left - 1 + (layout width // 2). |
|
6621 |
y0 := top. |
|
6622 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
6623 |
||
6624 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
6625 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
6626 |
||
6627 |
menuPanel paint:lightColor. |
|
6628 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
6629 |
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
|
6630 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6631 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6632 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6633 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6634 |
|
2362 | 6635 |
layout isNil ifTrue:[^ self]. |
6636 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6637 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 6638 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6639 |
] |
388 | 6640 |
! ! |
6641 |
||
6642 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6643 |
||
6644 |
destroy |
|
616 | 6645 |
"destroy submenus, remove dependencies |
388 | 6646 |
" |
616 | 6647 |
self submenu:nil. |
2681 | 6648 |
self removeDependencies. |
616 | 6649 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6650 |
menuPanel := nil. |
616 | 6651 |
! |
6652 |
||
794 | 6653 |
in:aPanel |
6654 |
"create item in a menuPanel |
|
6655 |
" |
|
6656 |
menuPanel := aPanel. |
|
2359 | 6657 |
|
6658 |
menuItem isNil ifTrue:[ |
|
6659 |
self halt. |
|
6660 |
menuItem := MenuItem new |
|
6661 |
]. |
|
6662 |
! |
|
6663 |
||
6664 |
initialize |
|
6665 |
menuItem := MenuItem new. |
|
1811 | 6666 |
! |
6667 |
||
6668 |
reinitStyle |
|
6669 |
||
6670 |
subMenu notNil ifTrue:[ |
|
2219 | 6671 |
subMenu reinitStyle |
1811 | 6672 |
]. |
6673 |
||
6674 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
6675 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 6676 |
! ! |
6677 |
||
6678 |
!MenuPanel::Item methodsFor:'label basics'! |
|
6679 |
||
6680 |
disabledRawLabel |
|
6681 |
"returns the label used if the item is disabled |
|
6682 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6683 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6684 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6685 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6686 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6687 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6688 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6689 |
disabledDisplayLabel isString ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6690 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6691 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6692 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6693 |
block := [:el| |rslt| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6694 |
(rslt := el) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6695 |
el isImageOrForm ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6696 |
el colorMap notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6697 |
rslt := menuPanel lightenedImageOnDevice:el |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6698 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6699 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6700 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6701 |
((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
|
6702 |
form := menuPanel lightenedImageOnDevice:form |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6703 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6704 |
((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
|
6705 |
image := menuPanel lightenedImageOnDevice:image |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6706 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6707 |
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
|
6708 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6709 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6710 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6711 |
rslt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6712 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6713 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6714 |
displayLabel isArray ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6715 |
disabledDisplayLabel := Array new:(displayLabel size). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6716 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6717 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6718 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6719 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6720 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6721 |
disabledDisplayLabel := block value:displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6722 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6723 |
^ disabledDisplayLabel |
794 | 6724 |
! |
6725 |
||
1829 | 6726 |
fetchDeviceResources |
2373 | 6727 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6728 |
disabledDisplayLabel := nil. |
1829 | 6729 |
self fetchImages. |
6730 |
! |
|
6731 |
||
616 | 6732 |
fetchImages |
6733 |
"fetch images |
|
6734 |
" |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6735 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6736 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6737 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6738 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6739 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6740 |
displayLabel isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6741 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6742 |
^ self. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6743 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6744 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6745 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6746 |
(icon := displayLabel image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6747 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6748 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6749 |
(icon := displayLabel icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6750 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6751 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6752 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6753 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6754 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6755 |
displayLabel isArray ifFalse:[^ self]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6756 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6757 |
displayLabel keysAndValuesDo:[:i :el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6758 |
(el notNil and:[el isString not]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6759 |
el isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6760 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6761 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6762 |
el class == LabelAndIcon ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6763 |
(icon := el image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6764 |
el image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6765 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6766 |
(icon := el icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6767 |
el icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6768 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6769 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6770 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6771 |
] |
1078 | 6772 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6773 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6774 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6775 |
updateAccessCharacterFor:aLabel |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6776 |
"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
|
6777 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6778 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6779 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6780 |
(accessCharacter notNil or:[aLabel isNil]) ifTrue:[ |
2359 | 6781 |
^ aLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6782 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6783 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6784 |
aLabel isString ifFalse:[ |
2359 | 6785 |
aLabel class == LabelAndIcon ifTrue:[ |
6786 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
6787 |
]. |
|
6788 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6789 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6790 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6791 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6792 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6793 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6794 |
label := aLabel. |
2359 | 6795 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6796 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6797 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 6798 |
rest := label copyFrom:(i+1). |
6799 |
||
6800 |
i == 1 ifTrue:[label := rest] |
|
6801 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
6802 |
||
6803 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
6804 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6805 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6806 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6807 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 6808 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6809 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6810 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6811 |
label isText ifFalse:[ |
2359 | 6812 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6813 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6814 |
label emphasisAt:pos add:#underline. |
2359 | 6815 |
^ label |
388 | 6816 |
! ! |
6817 |
||
1573 | 6818 |
!MenuPanel::Item methodsFor:'printing & storing'! |
6819 |
||
6820 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6821 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6822 |
|
1573 | 6823 |
! ! |
6824 |
||
388 | 6825 |
!MenuPanel::Item methodsFor:'private'! |
6826 |
||
650 | 6827 |
activeBackgroundColor |
6828 |
"returns the active background color derived from menuPanel |
|
6829 |
" |
|
2359 | 6830 |
menuItem isButton ifTrue:[ |
6831 |
^ menuPanel buttonActiveBackgroundColor |
|
6832 |
]. |
|
6833 |
^ menuPanel activeBackgroundColor |
|
650 | 6834 |
! |
6835 |
||
6836 |
activeForegroundColor |
|
6837 |
"returns the active foreground color derived from menuPanel |
|
6838 |
" |
|
6839 |
||
6840 |
^menuPanel activeForegroundColor |
|
6841 |
! |
|
6842 |
||
727 | 6843 |
backgroundColor |
6844 |
"returns the background color derived from menuPanel |
|
6845 |
" |
|
2359 | 6846 |
menuItem isButton ifTrue:[ |
6847 |
^ menuPanel buttonPassiveBackgroundColor |
|
6848 |
]. |
|
6849 |
^ menuPanel backgroundColor |
|
727 | 6850 |
! |
6851 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6852 |
backgroundColorFromLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6853 |
"returns the background color derived from label or nil |
388 | 6854 |
" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6855 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6856 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6857 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6858 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6859 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6860 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6861 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6862 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6863 |
run size == 0 ifTrue:[ |
2145 | 6864 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
6865 |
^ run value |
|
6866 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6867 |
] ifFalse:[ |
2145 | 6868 |
run do:[:r| |
6869 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
6870 |
^ r value |
|
6871 |
] |
|
6872 |
] |
|
388 | 6873 |
]. |
6874 |
^ nil |
|
6875 |
! |
|
6876 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6877 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6878 |
"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
|
6879 |
derived from menuPanel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6880 |
" |
2359 | 6881 |
menuItem isButton ifTrue:[ |
6882 |
^ menuPanel buttonEnteredBackgroundColor |
|
6883 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6884 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6885 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6886 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6887 |
choiceForm |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6888 |
"returns choice form or nil |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6889 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6890 |
|isOn| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6891 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6892 |
choice isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6893 |
|
2359 | 6894 |
isOn := (choice value = menuItem choiceValue). |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6895 |
self enabled ifFalse:[ |
2359 | 6896 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
6897 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6898 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6899 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
2359 | 6900 |
ifFalse:[menuPanel iconRadioGroupOff] |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6901 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6902 |
|
663 | 6903 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6904 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6905 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6906 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6907 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6908 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6909 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6910 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6911 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6912 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6913 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6914 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6915 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6916 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6917 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6918 |
numArgs == 0 ifTrue:[ |
2359 | 6919 |
MessageNotUnderstood handle:[:ex | |
6920 |
|selector| |
|
6921 |
||
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
6922 |
((selector := ex selector) == sel |
2359 | 6923 |
or:[selector == #aspectFor:]) ifFalse:[ |
6924 |
ex reject |
|
6925 |
]. |
|
6926 |
] do:[ |
|
6927 |
subm := aRecv aspectFor:sel. |
|
6928 |
]. |
|
6929 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6930 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6931 |
|
2043 | 6932 |
(Array with:(aRecv) with:(aRecv class)) |
6933 |
do:[:aPossibleReceiver | |
|
2359 | 6934 |
MessageNotUnderstood handle:[:ex| |
6935 |
ex message selector == sel ifFalse:[ ex reject ] |
|
6936 |
] do:[ |
|
6937 |
numArgs == 0 ifTrue:[ |
|
6938 |
subm := aPossibleReceiver perform:sel |
|
6939 |
] ifFalse:[ |
|
6940 |
numArgs == 1 ifTrue:[ |
|
6941 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
6942 |
] ifFalse:[ |
|
6943 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
6944 |
] |
|
6945 |
] |
|
6946 |
]. |
|
6947 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6948 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6949 |
|
663 | 6950 |
^ subm |
2043 | 6951 |
|
6952 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 6953 |
! |
6954 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6955 |
indicationValue |
524 | 6956 |
"returns indication value or nil in case of no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6957 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6958 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6959 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6960 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6961 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6962 |
indication isSymbol ifFalse:[ |
2359 | 6963 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6964 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6965 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6966 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 6967 |
recv := menuPanel receiver. |
6968 |
||
6969 |
(recv isValueModel) ifFalse:[ |
|
6970 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
6971 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
6972 |
sel := sel asSymbol. |
|
6973 |
||
6974 |
MessageNotUnderstood handle:[:ex| |
|
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
6975 |
ex selector == sel ifFalse:[ |
2359 | 6976 |
ex reject |
6977 |
]. |
|
6978 |
] do:[ |
|
6979 |
sel := recv perform:sel with:(menuItem argument) |
|
6980 |
] |
|
6981 |
]. |
|
6982 |
]. |
|
6983 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6984 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6985 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6986 |
numArgs ~~ 0 ifTrue:[ |
2359 | 6987 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6988 |
] ifFalse:[ |
2359 | 6989 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6990 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6991 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6992 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6993 |
sel isValueModel ifTrue:[ |
2359 | 6994 |
indication := sel. |
6995 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6996 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6997 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6998 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6999 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7000 |
indicationValue:aValue |
1218 | 7001 |
"set the indication value |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7002 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7003 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7004 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7005 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7006 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7007 |
indication isSymbol ifFalse:[ |
2359 | 7008 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
7009 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7010 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7011 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7012 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 7013 |
^ self |
1218 | 7014 |
]. |
7015 |
||
524 | 7016 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7017 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7018 |
|
1218 | 7019 |
recv isNil ifTrue:[ |
2359 | 7020 |
recv := menuPanel application. |
7021 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7022 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7023 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
7024 |
MessageNotUnderstood handle:[:ex| |
2737
b0daaddb418b
Use MessageNotUnderstood>>#selector
Stefan Vogel <sv@exept.de>
parents:
2736
diff
changeset
|
7025 |
(ex selector ~~ indication) ifTrue:[ |
2359 | 7026 |
ex reject |
7027 |
]. |
|
7028 |
self ifNotInUIBuilderInfoPrintCR: |
|
2545
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
7029 |
('MenuPanel::Item [info]: application (class %1) does not respond to: %2' |
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
7030 |
bindWith:recv className with:indication). |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7031 |
] do:[ |
2359 | 7032 |
numArgs == 1 ifTrue:[ |
7033 |
recv perform:indication with:aValue |
|
7034 |
] ifFalse:[ |
|
7035 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
7036 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7037 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7038 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7039 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
7040 |
indicatorForm |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7041 |
"returns indication form or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7042 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
7043 |
|val| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
7044 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7045 |
indication isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7046 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
7047 |
val := self indicationValue. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
7048 |
self enabled ifFalse:[ |
2219 | 7049 |
^ val == true |
7050 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
7051 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
7052 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
7053 |
^ val == true |
2219 | 7054 |
ifTrue:[menuPanel iconIndicationOn] |
7055 |
ifFalse:[menuPanel iconIndicationOff] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7056 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7057 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7058 |
isEntered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7059 |
"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
|
7060 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7061 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7062 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7063 |
"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
|
7064 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
7065 |
|
464 | 7066 |
separatorType |
7067 |
"returns type of separator line or nil |
|
388 | 7068 |
" |
390 | 7069 |
|c lbl| |
388 | 7070 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7071 |
self isSeparator ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7072 |
^ nil |
388 | 7073 |
]. |
7074 |
||
390 | 7075 |
(lbl := label value) isNil ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7076 |
^ #singleLine |
388 | 7077 |
]. |
7078 |
||
390 | 7079 |
lbl size == 1 ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7080 |
c := lbl first. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7081 |
c == $- ifTrue:[^ #singleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7082 |
c == $= ifTrue:[^ #doubleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7083 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7084 |
^ #blankLine |
1130 | 7085 |
! |
7086 |
||
7087 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7088 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7089 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7090 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7091 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7092 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7093 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7094 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7095 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7096 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7097 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7098 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7099 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7100 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7101 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7102 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7103 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7104 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7105 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7106 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7107 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7108 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7109 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7110 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7111 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7112 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7113 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7114 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7115 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7116 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7117 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7118 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7119 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7120 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7121 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7122 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7123 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7124 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7125 |
submenuEncoding := submenu. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7126 |
submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7127 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7128 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7129 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7130 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7131 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7132 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7133 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7134 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7135 |
self submenu:submenu. |
1130 | 7136 |
^ subMenu |
7137 |
||
7138 |
"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
|
7139 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7140 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7141 |
spaceBetweenEmptyLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7142 |
^ 3 |
388 | 7143 |
! ! |
7144 |
||
7145 |
!MenuPanel::Item methodsFor:'queries'! |
|
7146 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7147 |
canChangeVisibility |
1699 | 7148 |
"return true if I am not always visible; can only be changed by a selector |
7149 |
otherwise there is a change notification raised if the model changed |
|
7150 |
" |
|
7151 |
^ isVisible isSymbol |
|
7152 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7153 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7154 |
|
388 | 7155 |
canSelect |
1699 | 7156 |
"returns true if item is selectable; no separator, visible and enabled. |
7157 |
in case of a choice (RadioButton) i have to check for the choiceValue |
|
388 | 7158 |
" |
2362 | 7159 |
self isSeparator ifTrue:[^ false]. |
7160 |
||
7161 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 7162 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
7163 |
^ true |
|
7164 |
]. |
|
1078 | 7165 |
]. |
7166 |
^ false |
|
388 | 7167 |
! |
7168 |
||
2046 | 7169 |
containsPoint:aPoint |
7170 |
"returns true if aPoint is contained in my layout |
|
7171 |
" |
|
7172 |
(self isVisible and:[layout notNil]) ifTrue:[ |
|
2219 | 7173 |
^ layout containsPoint:aPoint |
2046 | 7174 |
]. |
7175 |
^ false |
|
7176 |
||
7177 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
7178 |
! |
|
7179 |
||
388 | 7180 |
containsPointX:x y:y |
7181 |
"returns true if point is contained in my layout |
|
7182 |
" |
|
712 | 7183 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2219 | 7184 |
^ layout containsPointX:x y:y |
505 | 7185 |
]. |
7186 |
^ false |
|
388 | 7187 |
! |
7188 |
||
2199 | 7189 |
hasDelayedMenu |
7190 |
"returns true if a delayed menu exists |
|
7191 |
" |
|
2360 | 7192 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7193 |
^ false |
2199 | 7194 |
]. |
2360 | 7195 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7196 |
||
7197 |
(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
|
7198 |
^ false |
2199 | 7199 |
]. |
7200 |
^ true |
|
7201 |
! |
|
7202 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7203 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7204 |
"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
|
7205 |
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
|
7206 |
" |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7207 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7208 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7209 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7210 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7211 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7212 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7213 |
hasIndication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7214 |
"returns true if on/off indication exists |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7215 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7216 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7217 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7218 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7219 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7220 |
"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
|
7221 |
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
|
7222 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7223 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7224 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7225 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7226 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7227 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7228 |
|
388 | 7229 |
hasSubmenu |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7230 |
"returns true if the item is configured as an subMenu entry |
388 | 7231 |
" |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7232 |
^ subMenu notNil or:[menuItem submenuChannel notNil] |
388 | 7233 |
! |
7234 |
||
7235 |
isEnabled |
|
7236 |
"returns enabled state |
|
7237 |
" |
|
7238 |
^ self enabled |
|
7239 |
! |
|
7240 |
||
608 | 7241 |
isSeparator |
7242 |
"returns true if item is a separator |
|
7243 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7244 |
^ displayLabel isNil |
608 | 7245 |
! |
7246 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7247 |
isToggle |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7248 |
"returns true if on/off indication exists |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7249 |
" |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7250 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7251 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7252 |
|
712 | 7253 |
isVisible |
7254 |
"returns the visibility state |
|
7255 |
" |
|
7256 |
|state| |
|
7257 |
||
7258 |
isVisible isSymbol ifTrue:[ |
|
2219 | 7259 |
state := self aspectAt:isVisible. |
7260 |
||
7261 |
state isValueModel ifTrue:[ |
|
7262 |
isVisible := state. |
|
7263 |
isVisible addDependent:self. |
|
7264 |
state := isVisible. |
|
7265 |
] |
|
712 | 7266 |
] ifFalse:[ |
2219 | 7267 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7268 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7269 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7270 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7271 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7272 |
! |
7273 |
||
7274 |
isVisible:something |
|
7275 |
"change the state; if the state changed, a redraw is performed |
|
7276 |
" |
|
7277 |
|oldState newState| |
|
7278 |
||
7279 |
isVisible isNil ifTrue:[ |
|
2219 | 7280 |
oldState := true |
712 | 7281 |
] ifFalse:[ |
2219 | 7282 |
oldState := isVisible value. |
7283 |
isVisible isValueModel ifTrue:[ |
|
7284 |
isVisible removeDependent:self |
|
7285 |
] |
|
712 | 7286 |
]. |
7287 |
isVisible := something. |
|
7288 |
||
7289 |
isVisible isNil ifTrue:[ |
|
2219 | 7290 |
newState := true |
712 | 7291 |
] ifFalse:[ |
2219 | 7292 |
isVisible isValueModel ifTrue:[ |
7293 |
isVisible addDependent:self |
|
7294 |
] ifFalse:[ |
|
7295 |
isVisible isSymbol ifTrue:[^ self] |
|
7296 |
]. |
|
7297 |
menuPanel shown ifFalse:[^ self]. |
|
7298 |
newState := isVisible value. |
|
712 | 7299 |
]. |
7300 |
||
7301 |
newState ~~ oldState ifTrue:[ |
|
2219 | 7302 |
menuPanel mustRearrange |
712 | 7303 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7304 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7305 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7306 |
! |
7307 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7308 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7309 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7310 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7311 |
|
388 | 7312 |
shortcutKeyAsString |
7313 |
"converts shortcutKey to a text object |
|
7314 |
" |
|
2359 | 7315 |
|nm prefix shortcutKey| |
7316 |
||
7317 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7318 |
|
7319 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7320 |
^ nil |
1609 | 7321 |
]. |
7322 |
||
7323 |
shortcutKey isCharacter ifTrue:[ |
|
2359 | 7324 |
nm := shortcutKey asString |
388 | 7325 |
] ifFalse:[ |
2359 | 7326 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
7327 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
|
7328 |
"/ Ask the devices keyboardMap for the backtranslation. |
|
7329 |
||
7330 |
nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey. |
|
7331 |
"/ |
|
7332 |
"/ some modifier-key combination ? |
|
7333 |
"/ |
|
7334 |
(nm startsWith:#Cmd) ifTrue:[ |
|
7335 |
prefix := #Cmd. |
|
7336 |
] ifFalse:[(nm startsWith:#Alt) ifTrue:[ |
|
7337 |
prefix := #Alt. |
|
7338 |
] ifFalse:[(nm startsWith:#Meta) ifTrue:[ |
|
7339 |
prefix := #Meta. |
|
7340 |
] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[ |
|
7341 |
prefix := #Ctrl. |
|
7342 |
]]]]. |
|
7343 |
prefix notNil ifTrue:[ |
|
7344 |
nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1)) |
|
7345 |
] ifFalse:[ |
|
7346 |
nm := nm asString |
|
7347 |
] |
|
388 | 7348 |
]. |
608 | 7349 |
^ nm |
388 | 7350 |
|
987 | 7351 |
"Modified: / 17.7.1998 / 11:56:40 / cg" |
388 | 7352 |
! |
7353 |
||
7354 |
shortcutKeyPrefixFor:aModifier |
|
7355 |
"returns prefix assigned to a modifier |
|
7356 |
" |
|
7357 |
|m| |
|
7358 |
||
7359 |
m := menuPanel device modifierKeyTopFor:aModifier. |
|
7360 |
m notNil ifTrue:[ |
|
2145 | 7361 |
^ m , '-' |
388 | 7362 |
]. |
987 | 7363 |
^ aModifier , '-'. |
7364 |
||
7365 |
"Modified: / 17.7.1998 / 11:56:46 / cg" |
|
388 | 7366 |
! ! |
7367 |
||
7368 |
!MenuPanel::Item methodsFor:'selection'! |
|
7369 |
||
7370 |
isSelected |
|
7371 |
"returns true if item is selected |
|
7372 |
" |
|
1998 | 7373 |
|
7374 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 7375 |
! |
7376 |
||
2249 | 7377 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7378 |
"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
|
7379 |
submenu and perform a redraw |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7380 |
" |
2249 | 7381 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
7382 |
self invalidate. |
|
7383 |
self hideSubmenu. |
|
2359 | 7384 |
^ self |
2249 | 7385 |
]. |
7386 |
||
2199 | 7387 |
menuPanel realized ifFalse:[ ^ self ]. |
7388 |
||
2359 | 7389 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 7390 |
self invalidate |
2199 | 7391 |
]. |
7392 |
self hasSubmenu ifFalse:[ ^ self]. |
|
7393 |
||
7394 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 7395 |
menuPanel openDelayed:self |
2199 | 7396 |
] ifFalse:[ |
2249 | 7397 |
subMenu := self setupSubmenu. |
2374 | 7398 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
1701 | 7399 |
]. |
388 | 7400 |
! ! |
7401 |
||
2692 | 7402 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
7403 |
||
7404 |
argument2 |
|
7405 |
||
7406 |
^ argument2 |
|
7407 |
! |
|
7408 |
||
7409 |
argument2:anArgumentOrNil |
|
7410 |
||
7411 |
argument2 := anArgumentOrNil |
|
7412 |
! ! |
|
7413 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7414 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7415 |
|
2018 | 7416 |
icon |
2016 | 7417 |
"This resource specification was automatically generated |
7418 |
by the ImageEditor of ST/X." |
|
7419 |
||
7420 |
"Do not manually edit this!! If it is corrupted, |
|
7421 |
the ImageEditor may not be able to read the specification." |
|
7422 |
||
7423 |
" |
|
2018 | 7424 |
self icon inspect |
7425 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7426 |
" |
7427 |
||
7428 |
<resource: #image> |
|
7429 |
||
7430 |
^Icon |
|
2219 | 7431 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7432 |
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 | 7433 |
! ! |
7434 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7435 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7436 |
|
7437 |
new |
|
7438 |
^ self basicNew initialize |
|
7439 |
! ! |
|
7440 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7441 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7442 |
|
7443 |
activeMenu |
|
7444 |
"returns the active menu the scrolling is activated on; nil |
|
7445 |
is returned if scrolling is deactivated |
|
7446 |
" |
|
7447 |
^ activeMenu |
|
7448 |
! |
|
7449 |
||
7450 |
direction |
|
7451 |
"returns the scroll-direction |
|
7452 |
" |
|
7453 |
^ direction |
|
7454 |
! |
|
7455 |
||
7456 |
iconAt:aDirection on:aMenu |
|
2018 | 7457 |
|icon device index| |
2016 | 7458 |
|
7459 |
device := aMenu device. |
|
7460 |
||
7461 |
aDirection == #PREV ifTrue:[ |
|
2219 | 7462 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7463 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7464 |
] ifFalse:[ |
2219 | 7465 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7466 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7467 |
]. |
7468 |
||
7469 |
icon := icons at:index. |
|
7470 |
||
7471 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
2219 | 7472 |
icon := self class icon. |
7473 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7474 |
ifFalse:[ icon := icon copy ]. |
|
7475 |
||
7476 |
icon := icon onDevice:device. |
|
7477 |
icon clearMaskedPixels. |
|
7478 |
icons at:index put:icon |
|
2018 | 7479 |
]. |
7480 |
^ icon |
|
2016 | 7481 |
! ! |
7482 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7483 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7484 |
|
7485 |
initialize |
|
7486 |
||
7487 |
semaLock := RecursionLock new. |
|
2018 | 7488 |
icons := Array new:4. |
2016 | 7489 |
! ! |
7490 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7491 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7492 |
|
7493 |
isActive |
|
7494 |
"returns true if scrolling is activated |
|
7495 |
" |
|
7496 |
^ activeMenu notNil |
|
7497 |
! ! |
|
7498 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7499 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7500 |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7501 |
startIfRequiredAt:aDirection on:aMenu |
2016 | 7502 |
"start scrolling; returns true if scrolling is activated |
7503 |
" |
|
7504 |
|bounds index| |
|
7505 |
||
7506 |
semaLock critical:[ |
|
2219 | 7507 |
self stop. |
7508 |
||
7509 |
( aDirection notNil |
|
7510 |
and:[aMenu notNil |
|
7511 |
and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]] |
|
7512 |
) ifTrue:[ |
|
7513 |
activeMenu := aMenu. |
|
7514 |
direction := aDirection. |
|
7515 |
||
7516 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7517 |
||
7518 |
index ~~ 0 ifTrue:[ |
|
7519 |
scrollTask := |
|
7520 |
[ |
|
7521 |
|item step| |
|
7522 |
||
7523 |
[ |
|
7524 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7525 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7526 |
aMenu makeItemVisible:item. |
|
7527 |
index := index + step. |
|
7528 |
]. |
|
7529 |
||
7530 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7531 |
||
7532 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
|
7533 |
aMenu makeItemVisible:item. |
|
7534 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7535 |
index := index + step. |
|
7536 |
]. |
|
7537 |
item := nil. |
|
7538 |
] ensure:[ |
|
7539 |
scrollTask := nil. |
|
7540 |
||
7541 |
item notNil ifTrue:[ |
|
7542 |
"/ process was killed |
|
7543 |
aMenu invalidate:bounds |
|
7544 |
] |
|
7545 |
] |
|
7546 |
] forkAt:8. |
|
7547 |
] |
|
7548 |
] |
|
2016 | 7549 |
]. |
7550 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7551 |
|
2048 | 7552 |
"Created: ca" |
7553 |
||
7554 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7555 |
! |
7556 |
||
7557 |
stop |
|
7558 |
"stop scrolling; returns true if the scrolling was activated otherwise false |
|
7559 |
" |
|
7560 |
|task resp| |
|
7561 |
||
7562 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7563 |
^ false |
2016 | 7564 |
]. |
7565 |
semaLock critical:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7566 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7567 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7568 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7569 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7570 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7571 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7572 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7573 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7574 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7575 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7576 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7577 |
activeMenu := direction := nil. |
2016 | 7578 |
]. |
7579 |
^ resp |
|
7580 |
! ! |
|
7581 |
||
388 | 7582 |
!MenuPanel class methodsFor:'documentation'! |
7583 |
||
7584 |
version |
|
2761 | 7585 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.401 2004-10-15 13:14:13 cg Exp $' |
388 | 7586 |
! ! |
2199 | 7587 |
|
388 | 7588 |
MenuPanel initialize! |