author | Stefan Vogel <sv@exept.de> |
Tue, 13 Jul 2004 10:46:33 +0200 | |
changeset 2731 | 7382424af8d9 |
parent 2729 | d28bc8243494 |
child 2736 | f6869c5b9108 |
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 |
26 |
DefaultForegroundColor DefaultBackgroundColor' |
|
2145 | 27 |
poolDictionaries:'' |
28 |
category:'Views-Menus' |
|
388 | 29 |
! |
30 |
||
31 |
Object subclass:#Item |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
32 |
instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
33 |
disabledDisplayLabel enableChannel label activeHelpText |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
34 |
flyByHelpText isVisible indication choice accessCharacter' |
2145 | 35 |
classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
36 |
VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
|
37 |
poolDictionaries:'' |
|
38 |
privateIn:MenuPanel |
|
388 | 39 |
! |
40 |
||
2692 | 41 |
Object subclass:#Adornment |
42 |
instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2 |
|
43 |
choice choiceValue' |
|
44 |
classVariableNames:'' |
|
45 |
poolDictionaries:'' |
|
46 |
privateIn:MenuPanel::Item |
|
47 |
! |
|
48 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
49 |
Object subclass:#ScrollActivity |
2145 | 50 |
instanceVariableNames:'semaLock activeMenu scrollTask direction icons' |
51 |
classVariableNames:'' |
|
52 |
poolDictionaries:'' |
|
53 |
privateIn:MenuPanel |
|
2016 | 54 |
! |
55 |
||
388 | 56 |
!MenuPanel class methodsFor:'documentation'! |
57 |
||
2005 | 58 |
copyright |
59 |
" |
|
60 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
2145 | 61 |
All Rights Reserved |
2005 | 62 |
|
63 |
This software is furnished under a license and may be used |
|
64 |
only in accordance with the terms of that license and with the |
|
65 |
inclusion of the above copyright notice. This software may not |
|
66 |
be provided or otherwise made available to, or used by, any |
|
67 |
other person. No title to or ownership of the software is |
|
68 |
hereby transferred. |
|
69 |
" |
|
70 |
||
388 | 71 |
! |
72 |
||
73 |
documentation |
|
74 |
" |
|
75 |
a menu panel used for both pull-down-menus and pop-up-menus. |
|
76 |
||
2170 | 77 |
this will eventually replace most of the MenuView and PopUpMenu stuff. |
388 | 78 |
(and hopefully be ST-80 compatible ...) |
79 |
||
502 | 80 |
To create a menu, there exists a MenuEditor which will generate |
81 |
a menu specification. |
|
82 |
||
83 |
||
2061 | 84 |
Notice: |
85 |
This is going to replace the obsolete MenuView. |
|
86 |
||
388 | 87 |
[author:] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
88 |
Claus Atzkern |
388 | 89 |
|
90 |
[see also:] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
91 |
Menu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
92 |
MenuItem |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
93 |
MenuEditor |
2170 | 94 |
|
95 |
cg: this code is so ugly - needs a complete rewrite... |
|
96 |
||
388 | 97 |
" |
98 |
! |
|
99 |
||
100 |
examples |
|
101 |
||
102 |
" |
|
103 |
start as PullDownMenu |
|
2219 | 104 |
[exBegin] |
388 | 105 |
|top subView mview desc s1 s2 s3 img lbs labels| |
106 |
||
107 |
top := StandardSystemView new. |
|
108 |
||
436 | 109 |
mview := MenuPanel in:top. |
388 | 110 |
|
502 | 111 |
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ). |
388 | 112 |
mview level:2. |
113 |
mview verticalLayout:false. |
|
114 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 115 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'. |
388 | 116 |
mview labels:lbs. |
117 |
mview shortcutKeyAt:2 put:#Cut. |
|
118 |
mview accessCharacterPositionAt:1 put:1. |
|
119 |
mview accessCharacterPositionAt:2 put:2. |
|
120 |
||
121 |
mview enabledAt:5 put:false. |
|
122 |
mview groupSizes:#( 2 2 ). |
|
436 | 123 |
s1 := MenuPanel labels:labels. |
388 | 124 |
s1 accessCharacterPositionAt:1 put:1. |
125 |
s1 accessCharacterPositionAt:2 put:2. |
|
126 |
s1 groupSizes:#( 2 2 ). |
|
436 | 127 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
128 |
s3 := MenuPanel labels:lbs. |
|
388 | 129 |
|
130 |
s1 subMenuAt:2 put:s2. |
|
436 | 131 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 132 |
s2 subMenuAt:3 put:s3. |
436 | 133 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 134 |
s3 shortcutKeyAt:3 put:$q. |
135 |
||
136 |
mview subMenuAt:1 put:s1. |
|
436 | 137 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 138 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
139 |
s1 shortcutKeyAt:1 put:#Copy. |
|
140 |
s1 shortcutKeyAt:3 put:#Paste. |
|
141 |
||
436 | 142 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
616 | 143 |
top extent:(mview preferredExtent). |
388 | 144 |
top open. |
2219 | 145 |
[exEnd] |
146 |
||
147 |
[exBegin] |
|
1767 | 148 |
|top menu view item| |
149 |
||
150 |
top := StandardSystemView extent:240@100. |
|
151 |
menu := MenuPanel in:top. |
|
152 |
menu labels:#( 'foo' 'Application' 'Clock' ). |
|
153 |
menu verticalLayout:false. |
|
154 |
||
155 |
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )). |
|
156 |
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )). |
|
157 |
||
158 |
view := ClockView new. |
|
159 |
view preferredExtent:100@100. |
|
160 |
item := menu itemAt:3. |
|
161 |
item submenu:view. |
|
162 |
||
163 |
view := SimpleView new. |
|
164 |
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new). |
|
165 |
view preferredExtent:(400@50). |
|
166 |
item := menu itemAt:2. |
|
167 |
item submenu:view. |
|
168 |
||
169 |
menu origin:0@0 corner:1.0@30. |
|
170 |
top open. |
|
2219 | 171 |
[exEnd] |
388 | 172 |
|
173 |
||
174 |
start as PopUpMenu |
|
2219 | 175 |
[exBegin] |
388 | 176 |
|subView mview desc s1 s2 s3 img lbs labels| |
177 |
||
436 | 178 |
mview := MenuPanel new. |
502 | 179 |
labels := #( 'foo' 'bar' 'baz' ). |
388 | 180 |
mview level:2. |
181 |
||
182 |
img := Image fromFile:'bitmaps/SBrowser.xbm'. |
|
502 | 183 |
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'. |
388 | 184 |
mview labels:lbs. |
185 |
||
436 | 186 |
s1 := MenuPanel labels:labels. |
187 |
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ). |
|
188 |
s3 := MenuPanel labels:lbs. |
|
388 | 189 |
s1 subMenuAt:2 put:s2. |
436 | 190 |
s1 subMenuAt:3 put:(MenuPanel labels:lbs). |
388 | 191 |
s2 subMenuAt:3 put:s3. |
436 | 192 |
s3 subMenuAt:3 put:(MenuPanel labels:labels). |
388 | 193 |
s3 shortcutKeyAt:3 put:$q. |
194 |
||
195 |
mview subMenuAt:1 put:s1. |
|
436 | 196 |
mview subMenuAt:4 put:(MenuPanel labels:lbs). |
388 | 197 |
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy. |
198 |
s1 shortcutKeyAt:1 put:#Copy. |
|
199 |
s1 shortcutKeyAt:3 put:#Paste. |
|
200 |
||
436 | 201 |
mview subMenuAt:2 put:(MenuPanel labels:labels). |
388 | 202 |
mview startUp |
2219 | 203 |
[exEnd] |
388 | 204 |
|
205 |
||
206 |
start from menu spec |
|
2219 | 207 |
[exBegin] |
388 | 208 |
|menu| |
209 |
||
436 | 210 |
menu := MenuPanel menu: |
2219 | 211 |
#(#Menu #( #(#MenuItem |
212 |
#label: 'File' |
|
213 |
#submenu: |
|
214 |
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit ) |
|
215 |
(#MenuItem |
|
216 |
#label: 'edit' |
|
217 |
#submenu: |
|
218 |
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit ) |
|
219 |
#(#MenuItem #label: 'close' #value:#close) |
|
220 |
) |
|
221 |
nil |
|
222 |
nil |
|
223 |
) |
|
224 |
) |
|
225 |
#(#MenuItem #label: 'help' #value:#help ) |
|
226 |
) |
|
227 |
nil |
|
228 |
nil |
|
229 |
) |
|
230 |
) |
|
231 |
#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) |
|
232 |
#(#MenuItem #label: 'Bar' |
|
233 |
#submenu: |
|
234 |
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 ) |
|
235 |
#(#MenuItem #label: 'bar 2' #value:#bar2 ) |
|
236 |
) |
|
237 |
nil |
|
238 |
nil |
|
239 |
) |
|
240 |
) |
|
241 |
) |
|
242 |
#( 2 ) |
|
243 |
nil |
|
244 |
) decodeAsLiteralArray. |
|
388 | 245 |
|
246 |
menu verticalLayout:false. |
|
247 |
Transcript showCR:(menu startUp). |
|
2219 | 248 |
[exEnd] |
388 | 249 |
|
250 |
" |
|
251 |
||
252 |
! ! |
|
253 |
||
254 |
!MenuPanel class methodsFor:'instance creation'! |
|
255 |
||
256 |
fromSpec:aSpec |
|
257 |
^ self fromSpec:aSpec receiver:nil |
|
258 |
! |
|
259 |
||
260 |
fromSpec:aSpec receiver:aReceiver |
|
261 |
|menu| |
|
262 |
||
263 |
aSpec notNil ifTrue:[ |
|
2219 | 264 |
menu := Menu new. |
265 |
menu receiver:aReceiver. |
|
266 |
menu fromLiteralArrayEncoding:aSpec. |
|
388 | 267 |
]. |
268 |
^ self menu:menu receiver:aReceiver |
|
269 |
! |
|
270 |
||
271 |
labels:labels |
|
272 |
^ self labels:labels nameKeys:nil receiver:nil |
|
273 |
! |
|
274 |
||
275 |
labels:labels nameKeys:nameKeys |
|
276 |
^ self labels:labels nameKeys:nameKeys receiver:nil |
|
277 |
! |
|
278 |
||
279 |
labels:labels nameKeys:nameKeys receiver:aReceiver |
|
280 |
|mview| |
|
281 |
||
282 |
mview := self menu:nil receiver:aReceiver. |
|
283 |
mview labels:labels. |
|
284 |
mview nameKeys:nameKeys. |
|
285 |
^ mview |
|
286 |
||
287 |
! |
|
288 |
||
502 | 289 |
labels:labels receiver:aReceiver |
290 |
^ self labels:labels nameKeys:nil receiver:aReceiver |
|
291 |
! |
|
292 |
||
388 | 293 |
menu:aMenu |
294 |
^ self menu:aMenu receiver:nil |
|
295 |
! |
|
296 |
||
297 |
menu:aMenu receiver:aReceiver |
|
298 |
|mview| |
|
299 |
||
300 |
mview := self new. |
|
1955 | 301 |
|
302 |
(aMenu notNil and:[aMenu receiver isNil]) ifTrue:[ |
|
2219 | 303 |
"/ no receiver specified in the menu; thus set the receiver immediately |
304 |
mview receiver:aReceiver |
|
1955 | 305 |
]. |
306 |
||
388 | 307 |
mview menu:aMenu. |
308 |
||
1955 | 309 |
|
388 | 310 |
"/ a menu itself may contain a receiver |
311 |
"/ thus we do not overwrite the receiver |
|
312 |
||
313 |
aReceiver notNil ifTrue:[ |
|
2219 | 314 |
mview receiver:aReceiver |
388 | 315 |
]. |
316 |
^ mview |
|
317 |
! ! |
|
318 |
||
319 |
!MenuPanel class methodsFor:'class initialization'! |
|
320 |
||
321 |
initialize |
|
322 |
InitialSelectionQuerySignal isNil ifTrue:[ |
|
2253 | 323 |
InitialSelectionQuerySignal := QuerySignal new. |
388 | 324 |
]. |
325 |
||
2715 | 326 |
" |
327 |
self initialize |
|
328 |
" |
|
329 |
||
660
d1670dfe5445
Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents:
658
diff
changeset
|
330 |
"Modified: / 15.1.1998 / 23:08:31 / stefan" |
794 | 331 |
! |
332 |
||
333 |
preSnapshot |
|
2715 | 334 |
"remove all resources" |
335 |
||
794 | 336 |
Images := nil. |
337 |
LigthenedImages := nil. |
|
616 | 338 |
! ! |
339 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
340 |
!MenuPanel class methodsFor:'default icons'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
341 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
342 |
delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
343 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
344 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
345 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
346 |
"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
|
347 |
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
|
348 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
349 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
350 |
self delayedMenuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
351 |
ImageEditor openOnClass:self andSelector:#delayedMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
352 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
353 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
354 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
355 |
<resource: #image> |
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 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
358 |
constantNamed:#'MenuPanel class delayedMenuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
359 |
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
|
360 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
361 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
362 |
iconIndicationDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
363 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
364 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
365 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
366 |
"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
|
367 |
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
|
368 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
369 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
370 |
self iconIndicationDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
371 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff |
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 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
374 |
<resource: #image> |
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 |
^Icon |
2219 | 377 |
constantNamed:#'MenuPanel iconIndicationDisabledOff' |
378 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
379 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
380 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
381 |
iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
382 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
383 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
384 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
385 |
"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
|
386 |
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
|
387 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
388 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
389 |
self iconIndicationDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
390 |
ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
391 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
392 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
393 |
<resource: #image> |
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 |
^Icon |
2219 | 396 |
constantNamed:#'MenuPanel iconIndicationDisabledOn' |
397 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
398 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
399 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
400 |
iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
401 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
402 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
403 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
404 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
405 |
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
|
406 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
407 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
408 |
self iconIndicationOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
409 |
ImageEditor openOnClass:self andSelector:#iconIndicationOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
410 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
411 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
412 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
413 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
414 |
^Icon |
2219 | 415 |
constantNamed:#'MenuPanel iconIndicationOff' |
416 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
417 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
418 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
419 |
iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
420 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
421 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
422 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
423 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
424 |
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
|
425 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
426 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
427 |
self iconIndicationOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
428 |
ImageEditor openOnClass:self andSelector:#iconIndicationOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
429 |
" |
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 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
432 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
433 |
^Icon |
2219 | 434 |
constantNamed:#'MenuPanel iconIndicationOn' |
435 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
436 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
437 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
438 |
iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
439 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
440 |
by the ImageEditor of ST/X." |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
441 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
442 |
"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
|
443 |
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
|
444 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
445 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
446 |
self iconRadioGroupDisabledOff inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
447 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
448 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
449 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
450 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
451 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
452 |
^Icon |
2219 | 453 |
constantNamed:#'MenuPanel iconRadioGroupDisabledOff' |
454 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
455 |
! |
1798
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 |
iconRadioGroupDisabledOn |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
458 |
"This resource specification was automatically generated |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
459 |
by the ImageEditor of ST/X." |
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 |
"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
|
462 |
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
|
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 |
self iconRadioGroupDisabledOn inspect |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
466 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn |
2337 | 467 |
Icon flushCachedIcons |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
468 |
" |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
469 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
470 |
<resource: #image> |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
471 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
472 |
^Icon |
2337 | 473 |
constantNamed:#'MenuPanel class iconRadioGroupDisabledOn' |
474 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
475 |
! |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
476 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
477 |
iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
478 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
479 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
480 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
481 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
482 |
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
|
483 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
484 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
485 |
self iconRadioGroupOff inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
486 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOff |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
487 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
488 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
489 |
<resource: #image> |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
490 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
491 |
^Icon |
2219 | 492 |
constantNamed:#'MenuPanel iconRadioGroupOff' |
493 |
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] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
494 |
! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
495 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
496 |
iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
497 |
"This resource specification was automatically generated |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
498 |
by the ImageEditor of ST/X." |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
499 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
500 |
"Do not manually edit this!! If it is corrupted, |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
501 |
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
|
502 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
503 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
504 |
self iconRadioGroupOn inspect |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
505 |
ImageEditor openOnClass:self andSelector:#iconRadioGroupOn |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
506 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
507 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
508 |
<resource: #image> |
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 |
^Icon |
2219 | 511 |
constantNamed:#'MenuPanel iconRadioGroupOn' |
512 |
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] |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
513 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
514 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
515 |
menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
516 |
"This resource specification was automatically generated |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
517 |
by the ImageEditor of ST/X." |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
518 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
519 |
"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
|
520 |
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
|
521 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
522 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
523 |
self menuIndicator inspect |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
524 |
ImageEditor openOnClass:self andSelector:#menuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
525 |
Icon flushCachedIcons |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
526 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
527 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
528 |
<resource: #image> |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
529 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
530 |
^Icon |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
531 |
constantNamed:#'MenuPanel::Item class menuIndicator' |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
532 |
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
|
533 |
! ! |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
534 |
|
616 | 535 |
!MenuPanel class methodsFor:'defaults'! |
450 | 536 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
537 |
defaultBackgroundColor |
2609 | 538 |
DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor]. |
2372 | 539 |
^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
540 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
541 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
542 |
defaultLevel |
2372 | 543 |
^ StyleSheet at:#'pullDownMenu.level' default:1 |
544 |
" |
|
545 |
self defaultLevel |
|
546 |
" |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
547 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
548 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
549 |
delayedMenuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
550 |
"returns an additional offset between the label and the |
2715 | 551 |
delayedMenu indication (i.e. the down-arrow icon)" |
552 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
553 |
^ 1 "2" |
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 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
556 |
menuIndicatorOffset |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
557 |
"returns an additional offset between the label and the |
2715 | 558 |
delayedMenu indication (i.e. the down-arrow icon)" |
559 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
560 |
^ 1 "2" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
561 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
562 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
563 |
mnemonicIdentifier |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
564 |
"returns the identifier each mnemonic starts with; |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
565 |
ex: |
2715 | 566 |
&File mnemonic := Cmdf |
567 |
F&ile mnemonic := Cmdi |
|
568 |
....." |
|
569 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
570 |
^ 'Cmd' |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
571 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
572 |
|
450 | 573 |
updateStyleCache |
657 | 574 |
|
2219 | 575 |
<resource: #style ( |
576 |
#'popup.borderWidth' #'popup.level' |
|
577 |
#'selection.disabledForegroundColor' |
|
578 |
#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level' |
|
579 |
#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace' |
|
580 |
#'menu.buttonItemVerticalSpace' |
|
581 |
#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel' |
|
582 |
#'menu.hilightLevel' #'menu.enteredLevel' |
|
583 |
#'menu.groupDividerSize' #'menu.itemMargin' |
|
584 |
#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor' |
|
585 |
#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor' |
|
586 |
#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor' |
|
587 |
#'menu.selectionFollowsMouse' |
|
588 |
#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor' |
|
589 |
#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor' |
|
590 |
#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor' |
|
591 |
#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle' |
|
592 |
)> |
|
593 |
||
594 |
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor |
|
595 |
buttonActiveLevel buttonPassiveLevel buttonEnteredLevel| |
|
2607 | 596 |
|
2611 | 597 |
"clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor |
598 |
which returns the default cashed DefaultBackgroundColor |
|
599 |
" |
|
600 |
DefaultBackgroundColor := nil. |
|
601 |
||
2219 | 602 |
MenuView updateStyleCache. |
603 |
SelectionInListView updateStyleCache. |
|
1699 | 604 |
|
2372 | 605 |
styleSheet := StyleSheet. |
606 |
style := styleSheet name. |
|
607 |
||
2607 | 608 |
DefaultFont := MenuView defaultFont. |
2609 | 609 |
foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black. |
610 |
backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor. |
|
2219 | 611 |
|
612 |
var := styleSheet at:#'menu.buttonItemHorizontalSpace'. |
|
2374 | 613 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 614 |
styleSheet at:#'menuPanel.buttonInsetX' put:(var abs). |
615 |
||
616 |
var := styleSheet at:#'menu.buttonItemVerticalSpace'. |
|
2374 | 617 |
var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ]. |
2219 | 618 |
styleSheet at:#'menuPanel.buttonInsetY' put:(var abs). |
619 |
||
620 |
var := styleSheet at:#'menu.itemHorizontalSpace'. |
|
2374 | 621 |
var isNil ifTrue:[ var := styleSheet at:#'menu.itemSpace' default:0 ]. |
2219 | 622 |
styleSheet at:#'menuPanel.itemSpace' put:var. |
623 |
||
624 |
var := styleSheet colorAt:#'menu.hilightBackgroundColor'. |
|
2374 | 625 |
var isNil ifTrue:[ |
2219 | 626 |
style == #motif ifTrue:[ var := backgroundColor ] |
627 |
ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ] |
|
628 |
]. |
|
629 |
styleSheet at:#'menuPanel.activeBackgroundColor' put:var. |
|
630 |
||
631 |
var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'. |
|
2374 | 632 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ]. |
2219 | 633 |
styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var. |
634 |
||
635 |
var := styleSheet colorAt:#'menu.disabledForegroundColor'. |
|
2374 | 636 |
var isNil ifTrue:[ |
2219 | 637 |
var := styleSheet colorAt:#'selection.disabledForegroundColor'. |
2374 | 638 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ] |
2219 | 639 |
]. |
640 |
styleSheet at:#'menuPanel.disabledForegroundColor' put:var. |
|
641 |
||
642 |
var := styleSheet colorAt:#'menu.hilightForegroundColor'. |
|
2374 | 643 |
var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ]. |
2219 | 644 |
styleSheet at:#'menuPanel.activeForegroundColor' put:var. |
645 |
||
646 |
||
647 |
buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]). |
|
2374 | 648 |
buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ]. |
2219 | 649 |
styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel. |
650 |
||
651 |
buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'. |
|
2374 | 652 |
buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])]. |
2219 | 653 |
styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel. |
654 |
||
655 |
buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel. |
|
656 |
styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel. |
|
657 |
||
658 |
var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs). |
|
659 |
styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var. |
|
660 |
||
661 |
buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'. |
|
2374 | 662 |
buttonPassiveBackgroundColor isNil ifTrue:[ |
2219 | 663 |
buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor |
664 |
]. |
|
665 |
styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor. |
|
666 |
||
667 |
var := styleSheet at:#'button.lightColor'. |
|
2374 | 668 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ]. |
2219 | 669 |
styleSheet at:#'menuPanel.buttonLightColor' put:var. |
670 |
||
671 |
var := styleSheet at:#'button.shadowColor'. |
|
2374 | 672 |
var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ]. |
2219 | 673 |
styleSheet at:#'menuPanel.buttonShadowColor' put:var. |
674 |
||
675 |
var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'. |
|
2374 | 676 |
var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ]. |
2219 | 677 |
styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var. |
678 |
||
679 |
Item updateStyleCache. |
|
2607 | 680 |
|
681 |
" |
|
682 |
self updateStyleCache |
|
683 |
" |
|
388 | 684 |
! ! |
685 |
||
794 | 686 |
!MenuPanel class methodsFor:'image registration'! |
687 |
||
688 |
image:anImage onDevice:aDevice |
|
689 |
" |
|
690 |
Images := nil |
|
691 |
" |
|
2269 | 692 |
|deviceImages| |
794 | 693 |
|
1156
6fa33dc93509
fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
694 |
anImage device == aDevice ifTrue:[ |
2269 | 695 |
^ anImage |
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
696 |
]. |
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
697 |
|
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
698 |
Images isNil ifTrue:[ Images := WeakIdentityDictionary new ]. |
794 | 699 |
|
1097 | 700 |
(deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2269 | 701 |
Images at:aDevice put:(deviceImages := Dictionary new) |
702 |
]. |
|
703 |
||
704 |
^ deviceImages at:anImage ifAbsentPut:[ |image| |
|
705 |
image := anImage copy onDevice:aDevice. |
|
706 |
image clearMaskedPixels. |
|
707 |
deviceImages at:anImage put:image. |
|
708 |
image |
|
709 |
]. |
|
794 | 710 |
! |
711 |
||
712 |
lightenedImage:anImage onDevice:aDevice |
|
713 |
" |
|
714 |
LigthenedImages := nil |
|
715 |
" |
|
2374 | 716 |
|deviceImages image colorMap| |
794 | 717 |
|
1853
399e2eac3b99
Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents:
1841
diff
changeset
|
718 |
LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ]. |
794 | 719 |
|
1097 | 720 |
(deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[ |
2374 | 721 |
LigthenedImages at:aDevice put:(deviceImages := Dictionary new) |
1097 | 722 |
]. |
723 |
||
724 |
(image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[ |
|
2374 | 725 |
^ image |
726 |
]. |
|
727 |
||
728 |
colorMap := anImage perform:#colorMap ifNotUnderstood:nil. |
|
729 |
||
730 |
colorMap notNil ifTrue:[ |
|
731 |
image := anImage copy lightened onDevice:aDevice. |
|
732 |
image clearMaskedPixels. |
|
794 | 733 |
] ifFalse:[ |
2374 | 734 |
image := self image:anImage onDevice:aDevice |
794 | 735 |
]. |
1097 | 736 |
deviceImages at:anImage put:image. |
794 | 737 |
^ image |
738 |
! ! |
|
739 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
740 |
!MenuPanel class methodsFor:'private'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
741 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
742 |
subMenu:aSubMenu |
2715 | 743 |
"create a submenu; can be redifined in derived classes" |
744 |
||
745 |
^ (self new) menu:aSubMenu. |
|
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
746 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
747 |
"Modified: / 8.8.1998 / 02:13:11 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
748 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
749 |
|
1808 | 750 |
!MenuPanel methodsFor:'accepting'! |
389 | 751 |
|
752 |
accept |
|
2715 | 753 |
"accept current selected item" |
754 |
||
1670 | 755 |
^ self acceptItem:(self selection) inMenu:self |
389 | 756 |
! |
757 |
||
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
758 |
accept:anItem |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
759 |
"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
|
760 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
761 |
|value item tgState itemIdx recv panel masterGroup winGrp acceptAction| |
1630 | 762 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
763 |
self superMenu notNil ifTrue:[ |
2253 | 764 |
^ self topMenu accept:anItem |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
765 |
]. |
2199 | 766 |
self openDelayed:nil. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
767 |
self scrollActivity stop. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
768 |
self selection:nil. |
420 | 769 |
|
770 |
(anItem notNil and:[anItem canAccept]) ifTrue:[ |
|
2253 | 771 |
tgState := anItem toggleIndication. |
772 |
panel := anItem menuPanel. |
|
773 |
itemIdx := panel findFirst:[:el| el == anItem ]. |
|
774 |
item := anItem. |
|
775 |
recv := panel receiver. |
|
389 | 776 |
]. |
1699 | 777 |
self doUngrab:true. |
389 | 778 |
|
510 | 779 |
self isPopUpView ifFalse:[ |
2253 | 780 |
self do:[:el| el updateIndicators]. |
781 |
self windowGroup processExposeEvents. |
|
524 | 782 |
] ifTrue:[ |
2253 | 783 |
self unmap. |
2712 | 784 |
self device sync. "/ round trip - all expose events are now received |
2253 | 785 |
(winGrp := self windowGroup) notNil ifTrue:[ |
786 |
"/ give expose event a chance to arrive |
|
787 |
[shown and:[realized]] whileTrue:[ |
|
788 |
winGrp processExposeEventsFor:self |
|
789 |
]. |
|
790 |
masterGroup := winGrp previousGroup. |
|
791 |
]. |
|
792 |
"/ cg: disabled-not needed - try PopUpList with destroy... |
|
793 |
"/ self destroy. |
|
794 |
masterGroup notNil ifTrue:[masterGroup processExposeEvents]. |
|
524 | 795 |
]. |
1710 | 796 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
797 |
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
|
798 |
|
1710 | 799 |
(item notNil |
800 |
and:[item showBusyCursorWhilePerforming |
|
801 |
and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]]) |
|
802 |
ifTrue:[ |
|
2253 | 803 |
winGrp withWaitCursorDo:acceptAction |
2132 | 804 |
] ifFalse:[acceptAction value]. |
524 | 805 |
|
806 |
self isPopUpView ifTrue:[ |
|
2253 | 807 |
self menuAdornmentAt:#item put:item. |
524 | 808 |
]. |
1699 | 809 |
^ item. |
524 | 810 |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
811 |
"Modified: / 15.11.2001 / 17:05:40 / cg" |
524 | 812 |
! |
813 |
||
814 |
accept:anItem index:anIndex toggle:aState receiver:aReceiver |
|
2715 | 815 |
"accept an item" |
816 |
||
2253 | 817 |
|value argument numArgs isValueModel rec args arg2 |
1697
345d3664e10c
added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
818 |
app master fallBack| |
524 | 819 |
|
820 |
anItem isNil ifTrue:[ |
|
2253 | 821 |
self menuAdornmentAt:#hasPerformed put:true. |
822 |
^ nil |
|
823 |
]. |
|
824 |
||
825 |
isValueModel := aReceiver isValueModel. |
|
826 |
||
827 |
self menuAdornmentAt:#hasPerformed put:isValueModel. |
|
524 | 828 |
|
829 |
(value := anItem value) isNil ifTrue:[ |
|
2253 | 830 |
^ anIndex |
524 | 831 |
]. |
832 |
||
833 |
(argument := anItem argument) isNil ifTrue:[ |
|
2253 | 834 |
argument := aState ? anItem |
389 | 835 |
]. |
524 | 836 |
|
837 |
value isSymbol ifFalse:[ |
|
2253 | 838 |
"/ a valueHolder or block |
839 |
(value respondsTo:#valueWithArguments:) ifFalse:[ |
|
840 |
^ value |
|
841 |
]. |
|
842 |
||
843 |
numArgs := value perform:#numArgs ifNotUnderstood:0. |
|
844 |
||
845 |
numArgs == 0 ifTrue:[ |
|
846 |
args := nil |
|
847 |
] ifFalse:[ |
|
848 |
numArgs == 1 ifTrue:[ |
|
849 |
args := Array with:argument |
|
850 |
] ifFalse:[ |
|
851 |
args := Array with:argument with:self |
|
852 |
] |
|
853 |
]. |
|
854 |
||
855 |
value valueWithArguments:args. |
|
856 |
||
857 |
self menuAdornmentAt:#hasPerformed put:true. |
|
858 |
^ anIndex |
|
524 | 859 |
]. |
860 |
||
2331 | 861 |
anItem sendToOriginator ifTrue:[ |
2473 | 862 |
rec := self originator. |
863 |
rec isNil ifTrue:[ |
|
864 |
self error:'no originating widget (no target for message)'. |
|
865 |
]. |
|
2331 | 866 |
] ifFalse:[ |
867 |
rec := aReceiver |
|
868 |
]. |
|
869 |
||
870 |
rec isNil ifTrue:[ |
|
2253 | 871 |
^ value |
872 |
]. |
|
873 |
||
874 |
isValueModel ifTrue:[ |
|
2331 | 875 |
rec value:value |
465 | 876 |
] ifFalse:[ |
2253 | 877 |
arg2 := self. |
878 |
||
879 |
"/ support for ST80 style applications |
|
880 |
"/ (expecting the message to go to the application |
|
881 |
"/ if not understood by the view) |
|
882 |
"/ These expect the controller to be passed as argument. |
|
883 |
"/ sigh. |
|
884 |
||
2331 | 885 |
(rec isView |
886 |
and:[(rec respondsTo:value) not |
|
887 |
and:[(app := rec application) ~~ rec |
|
2253 | 888 |
and:[app notNil]]]) ifTrue:[ |
2331 | 889 |
arg2 := rec controller. "/ the Views controller |
2253 | 890 |
rec := app. |
891 |
]. |
|
892 |
||
893 |
(numArgs := value numArgs) == 0 ifTrue:[ |
|
894 |
args := nil |
|
895 |
] ifFalse:[ |
|
896 |
numArgs == 1 ifTrue:[ |
|
897 |
args := Array with:argument |
|
898 |
] ifFalse:[ |
|
899 |
args := Array with:argument with:arg2 |
|
900 |
] |
|
901 |
]. |
|
902 |
||
903 |
fallBack := |
|
904 |
[ |
|
905 |
"/ mhmh - the receiver did not respond to that message; |
|
906 |
"/ if there is a master-application, try that one |
|
907 |
"/ (recursive) |
|
908 |
master := rec perform:#masterApplication ifNotUnderstood:nil. |
|
909 |
master notNil ifTrue:[ |
|
910 |
rec := master. |
|
911 |
rec perform:value withArguments:args ifNotUnderstood:fallBack |
|
912 |
] ifFalse:[ |
|
913 |
self |
|
914 |
error:'unimplemented (or error in) menu message: ' , value |
|
915 |
mayProceed:true |
|
916 |
]. |
|
917 |
]. |
|
918 |
||
919 |
rec perform:value withArguments:args ifNotUnderstood:fallBack. |
|
420 | 920 |
]. |
524 | 921 |
self menuAdornmentAt:#hasPerformed put:true. |
1270
0ae582fd7294
send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents:
1267
diff
changeset
|
922 |
^ value |
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
923 |
|
1719
ba7ebb56e6fd
recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents:
1715
diff
changeset
|
924 |
"Modified: / 19.2.2000 / 11:08:22 / cg" |
389 | 925 |
! |
926 |
||
1670 | 927 |
acceptItem:anItem inMenu:aMenu |
2199 | 928 |
|tgState topMenu| |
929 |
||
930 |
topMenu := self topMenu. |
|
931 |
topMenu openDelayed:nil. |
|
1670 | 932 |
|
1841 | 933 |
(anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[ |
2219 | 934 |
topMenu accept:anItem |
1670 | 935 |
] ifFalse:[ |
2219 | 936 |
anItem canAccept ifTrue:[ |
937 |
tgState := anItem toggleIndication. |
|
938 |
||
939 |
self accept:anItem |
|
940 |
index:(aMenu selectionIndex) |
|
941 |
toggle:tgState |
|
942 |
receiver:(aMenu receiver). |
|
943 |
||
944 |
aMenu do:[:el| el updateIndicators]. |
|
945 |
] |
|
1670 | 946 |
] |
947 |
! |
|
948 |
||
389 | 949 |
lastItemAccepted |
2715 | 950 |
"returns last item selected or nil" |
951 |
||
390 | 952 |
^ self topMenu menuAdornmentAt:#item |
389 | 953 |
! |
954 |
||
955 |
lastValueAccepted |
|
2715 | 956 |
"returns last value accepted or nil" |
957 |
||
2253 | 958 |
^ self lastItemAccepted value |
389 | 959 |
! ! |
960 |
||
388 | 961 |
!MenuPanel methodsFor:'accessing'! |
962 |
||
963 |
accessCharacterPositionAt:stringOrNumber |
|
2715 | 964 |
"get the access character position for a textLabel" |
965 |
||
2059 | 966 |
^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ] |
388 | 967 |
! |
968 |
||
969 |
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil |
|
2715 | 970 |
"get the access character position for a textLabel" |
971 |
||
388 | 972 |
self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ] |
973 |
! |
|
974 |
||
975 |
accessCharacterPositions |
|
2715 | 976 |
"returns a collection of accessCharacterPositions or nil" |
977 |
||
388 | 978 |
^ self collect:[:anItem| anItem accessCharacterPosition ] |
979 |
! |
|
980 |
||
981 |
accessCharacterPositions:something |
|
2715 | 982 |
"define accessCharacterPositions for each item" |
983 |
||
388 | 984 |
self onEachPerform:#accessCharacterPosition: withArgList:something |
985 |
! |
|
986 |
||
987 |
args |
|
2715 | 988 |
"returns a collection of arguments or nil" |
989 |
||
388 | 990 |
^ self collect:[:anItem| anItem argument ] |
991 |
! |
|
992 |
||
993 |
args:something |
|
2715 | 994 |
"define arguments for each item" |
995 |
||
388 | 996 |
self onEachPerform:#argument: withArgList:something |
997 |
! |
|
998 |
||
999 |
argsAt:stringOrNumber |
|
2715 | 1000 |
"gets the argument of an item or nil" |
1001 |
||
2059 | 1002 |
^ self itemAt:stringOrNumber do:[:el| el argument ] |
388 | 1003 |
! |
1004 |
||
1005 |
argsAt:stringOrNumber put:anArgument |
|
2715 | 1006 |
"sets the argument of an item" |
1007 |
||
388 | 1008 |
self itemAt:stringOrNumber do:[:el| el argument:anArgument ] |
1009 |
! |
|
1010 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1011 |
enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1012 |
"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
|
1013 |
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
|
1014 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1015 |
^ enteredItem |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1016 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1017 |
"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
|
1018 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1019 |
|
388 | 1020 |
groupSizes |
2715 | 1021 |
"gets collection of group sizes" |
1022 |
||
388 | 1023 |
^ groupSizes |
1024 |
! |
|
1025 |
||
1026 |
groupSizes:aGroupSizes |
|
2715 | 1027 |
"sets collection of group sizes" |
1028 |
||
388 | 1029 |
aGroupSizes = groupSizes ifFalse:[ |
2715 | 1030 |
groupSizes := aGroupSizes copy. |
1031 |
self mustRearrange. |
|
388 | 1032 |
]. |
1033 |
! |
|
1034 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1035 |
hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1036 |
^ hideOnRelease |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1037 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1038 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1039 |
hideOnRelease:something |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1040 |
hideOnRelease := something. |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1041 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1042 |
|
388 | 1043 |
labelAt:stringOrNumber |
2715 | 1044 |
"gets the label of an item or nil" |
1045 |
||
388 | 1046 |
^ self itemAt:stringOrNumber do:[:el| el label ] |
1047 |
! |
|
1048 |
||
1049 |
labelAt:stringOrNumber put:aLabel |
|
2715 | 1050 |
"sets the label of an item" |
1051 |
||
388 | 1052 |
self itemAt:stringOrNumber do:[:el| el label:aLabel ] |
1053 |
! |
|
1054 |
||
1055 |
labels |
|
2715 | 1056 |
"returns a collection of labels's or nil" |
1057 |
||
388 | 1058 |
^ self collect:[:anItem| anItem label ] |
1059 |
! |
|
1060 |
||
1061 |
labels:labels |
|
2715 | 1062 |
"define labels for each item" |
1063 |
||
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1064 |
|size| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1065 |
|
388 | 1066 |
self disabledRedrawDo:[ |
2715 | 1067 |
self removeAll. |
1068 |
size := labels size. |
|
1069 |
||
1070 |
size > 0 ifTrue:[ |
|
1071 |
items := OrderedCollection new:size. |
|
1072 |
labels do:[:aLabel| items add:(Item in:self label:aLabel) ] |
|
1073 |
] |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
1074 |
]. |
388 | 1075 |
! |
1076 |
||
1999 | 1077 |
menuPerformer:anObject |
1078 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1079 |
from all submenus no specific receiver is defined )." |
1080 |
||
1999 | 1081 |
^ self receiver:anObject |
1082 |
! |
|
1083 |
||
388 | 1084 |
nameKeyAt:stringOrNumber |
2715 | 1085 |
"gets the nameKey of an item or nil" |
1086 |
||
1087 |
^ self itemAt:stringOrNumber do:[:el| el nameKey ] |
|
388 | 1088 |
! |
1089 |
||
1090 |
nameKeyAt:stringOrNumber put:aNameKey |
|
2715 | 1091 |
"sets the nameKey of an item" |
1092 |
||
388 | 1093 |
self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ] |
1094 |
! |
|
1095 |
||
1096 |
nameKeys |
|
2715 | 1097 |
"returns a collection of nameKeyss or nil" |
1098 |
||
388 | 1099 |
^ self collect:[:anItem| anItem nameKey ] |
1100 |
! |
|
1101 |
||
1102 |
nameKeys:something |
|
2715 | 1103 |
"define nameKeys for each item" |
1104 |
||
388 | 1105 |
self onEachPerform:#nameKey: withArgList:something |
1106 |
! |
|
1107 |
||
1108 |
numberOfItems |
|
2715 | 1109 |
"gets number of items" |
1110 |
||
388 | 1111 |
^ items size |
1112 |
! |
|
1113 |
||
2331 | 1114 |
originator |
1115 |
originator notNil ifTrue:[^ originator]. |
|
1116 |
superMenu notNil ifTrue:[ |
|
1117 |
^ superMenu originator |
|
1118 |
]. |
|
1119 |
^ nil |
|
1120 |
! |
|
1121 |
||
388 | 1122 |
receiver |
1123 |
"get the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1124 |
from all submenus no specific receiver is defined )." |
1125 |
||
389 | 1126 |
(receiver isNil and:[superMenu notNil]) ifTrue:[ |
2715 | 1127 |
^ superMenu receiver |
388 | 1128 |
]. |
389 | 1129 |
^ receiver |
388 | 1130 |
! |
1131 |
||
1132 |
receiver:anObject |
|
1133 |
"set the menu-receiver. Thats the one who gets the messages ( both from myself and |
|
2715 | 1134 |
from all submenus no specific receiver is defined )." |
1135 |
||
389 | 1136 |
receiver := anObject |
388 | 1137 |
! |
1138 |
||
1139 |
shortcutKeyAt:stringOrNumber |
|
2715 | 1140 |
"gets the shortCutKey of an item or nil" |
1141 |
||
1142 |
^ self itemAt:stringOrNumber do:[:el| el shortcutKey ] |
|
388 | 1143 |
! |
1144 |
||
1145 |
shortcutKeyAt:stringOrNumber put:aKey |
|
2715 | 1146 |
"sets the shortCutKey of an item" |
1147 |
||
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
1148 |
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
|
1149 |
! |
388 | 1150 |
|
1151 |
shortcutKeys |
|
2715 | 1152 |
"returns a collection of shortcutKeys or nil" |
1153 |
||
388 | 1154 |
^ self collect:[:anItem| anItem shortcutKey ] |
1155 |
! |
|
1156 |
||
1157 |
shortcutKeys:something |
|
2715 | 1158 |
"define shortcutKeys for each item" |
1159 |
||
388 | 1160 |
self onEachPerform:#shortcutKey: withArgList:something |
1161 |
! |
|
1162 |
||
1163 |
valueAt:stringOrNumber |
|
2715 | 1164 |
"gets value of an item; a block, valueHolder, ..." |
1165 |
||
1166 |
^ self itemAt:stringOrNumber do:[:el| el value ] |
|
388 | 1167 |
! |
1168 |
||
1169 |
valueAt:stringOrNumber put:someThing |
|
2715 | 1170 |
"sets value of an item; a block, valueHolder, ..." |
1171 |
||
388 | 1172 |
self itemAt:stringOrNumber do:[:el| el value:someThing ] |
1173 |
! |
|
1174 |
||
1175 |
values:something |
|
2715 | 1176 |
"define values for each item" |
1177 |
||
388 | 1178 |
self onEachPerform:#value: withArgList:something |
1179 |
! ! |
|
1180 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1181 |
!MenuPanel methodsFor:'accessing-behavior'! |
388 | 1182 |
|
1183 |
disableAll |
|
2715 | 1184 |
"disable all items; not the menu in case of enabled" |
1185 |
||
498 | 1186 |
self do:[:anItem| anItem enabled:false] |
388 | 1187 |
! |
1188 |
||
1189 |
disableAll:collectionOfIndicesOrNames |
|
2715 | 1190 |
"disable an collection of items" |
1191 |
||
388 | 1192 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ]. |
1193 |
! |
|
1194 |
||
1195 |
enableAll |
|
2715 | 1196 |
"enable all items; not the menu in case of disabled" |
1197 |
||
498 | 1198 |
self do:[:anItem| anItem enabled:true] |
388 | 1199 |
! |
1200 |
||
1201 |
enableAll:collectionOfIndicesOrNames |
|
2715 | 1202 |
"enable an collection of items" |
1203 |
||
388 | 1204 |
collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ]. |
1205 |
! |
|
1206 |
||
1207 |
enabled |
|
2715 | 1208 |
"returns enabled state" |
1209 |
||
498 | 1210 |
^ enabled |
388 | 1211 |
! |
1212 |
||
1213 |
enabled:aState |
|
2715 | 1214 |
"change enabled state of menu" |
1215 |
||
545 | 1216 |
|state| |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1217 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1218 |
state := aState ? true. |
388 | 1219 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1220 |
enabled ~~ state ifTrue:[ |
2715 | 1221 |
enabled := state. |
1222 |
self invalidate. |
|
498 | 1223 |
]. |
388 | 1224 |
! |
1225 |
||
1226 |
enabledAt:stringOrNumber |
|
2715 | 1227 |
"gets the enabled state of an item or false" |
1228 |
||
388 | 1229 |
^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false |
1230 |
! |
|
1231 |
||
1232 |
enabledAt:stringOrNumber put:aState |
|
2715 | 1233 |
"sets the enabled state of an item" |
1234 |
||
388 | 1235 |
self itemAt:stringOrNumber do:[:el| el enabled:aState ] |
1236 |
! |
|
1237 |
||
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1238 |
exclusivePointer:aBoolean |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1239 |
"Do nothing here. Compatibility with PopUpListController" |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1240 |
|
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1241 |
^ self |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1242 |
! |
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
1243 |
|
388 | 1244 |
isEnabled:stringOrNumber |
2715 | 1245 |
"gets the enabled state of an item or false" |
1246 |
||
388 | 1247 |
^ self enabledAt:stringOrNumber |
1248 |
! ! |
|
1249 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1250 |
!MenuPanel methodsFor:'accessing-channels'! |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1251 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1252 |
enableChannel:aValueHolder |
2715 | 1253 |
"set my enableChannel" |
1254 |
||
498 | 1255 |
enableChannel notNil ifTrue:[ |
2715 | 1256 |
enableChannel removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1257 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1258 |
|
498 | 1259 |
(enableChannel := aValueHolder) notNil ifTrue:[ |
2715 | 1260 |
enableChannel addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1261 |
]. |
498 | 1262 |
self enabled:(enableChannel value). |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1263 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1264 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1265 |
menuHolder:aValueHolder |
2715 | 1266 |
"set my menuHolder" |
1267 |
||
498 | 1268 |
menuHolder notNil ifTrue:[ |
2715 | 1269 |
menuHolder removeDependent:self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1270 |
]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1271 |
|
498 | 1272 |
(menuHolder := aValueHolder) notNil ifTrue:[ |
2715 | 1273 |
menuHolder addDependent:self. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1274 |
]. |
498 | 1275 |
self menu:(menuHolder value) |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1276 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1277 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1278 |
!MenuPanel methodsFor:'accessing-color & font'! |
390 | 1279 |
|
616 | 1280 |
activeBackgroundColor |
2715 | 1281 |
"get the background drawing color used to highlight selection" |
1282 |
||
2219 | 1283 |
^ styleSheet colorAt:#'menuPanel.activeBackgroundColor' |
616 | 1284 |
! |
1285 |
||
1286 |
activeForegroundColor |
|
2715 | 1287 |
"get the foreground color used to highlight selections" |
1288 |
||
2219 | 1289 |
^ styleSheet colorAt:#'menuPanel.activeForegroundColor' |
616 | 1290 |
! |
1291 |
||
390 | 1292 |
backgroundColor |
2715 | 1293 |
"return the background color" |
1294 |
||
502 | 1295 |
^ super viewBackground |
390 | 1296 |
! |
1297 |
||
1298 |
backgroundColor:aColor |
|
1299 |
"set the background drawing color. You should not use this method; |
|
2715 | 1300 |
instead, leave the value as defined in the styleSheet." |
1301 |
||
1302 |
self backgroundColor ~~ aColor ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1303 |
super viewBackground:aColor. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1304 |
self invalidate "/ RepairNow:true |
616 | 1305 |
] |
1306 |
||
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
1307 |
"Modified: / 6.6.1998 / 19:50:06 / cg" |
390 | 1308 |
! |
1309 |
||
727 | 1310 |
buttonActiveBackgroundColor |
2715 | 1311 |
"get the background drawing color used to highlight button selection" |
1312 |
||
2219 | 1313 |
^ styleSheet colorAt:#'button.activeBackgroundColor' |
1314 |
default:(self viewBackground) |
|
727 | 1315 |
! |
1316 |
||
730 | 1317 |
buttonEdgeStyle |
2715 | 1318 |
"get the button edge style" |
1319 |
||
2219 | 1320 |
^ styleSheet at:#'button.edgeStyle' |
730 | 1321 |
! |
1322 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1323 |
buttonEnteredBackgroundColor |
2715 | 1324 |
"get the background drawing color used to highlight entered button items" |
1325 |
||
2219 | 1326 |
^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1327 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1328 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1329 |
buttonEnteredLevel |
2715 | 1330 |
"get the 3D-level used to highlight entered button items" |
1331 |
||
2219 | 1332 |
^ styleSheet at:#'menuPanel.buttonEnteredLevel' |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1333 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
1334 |
|
730 | 1335 |
buttonHalfLightColor |
2715 | 1336 |
"get the background drawing color used to half light button frame" |
1337 |
||
2219 | 1338 |
^ styleSheet colorAt:#'button.halfLightColor' |
730 | 1339 |
! |
1340 |
||
1341 |
buttonHalfShadowColor |
|
2715 | 1342 |
"get the background drawing color used to half shadow button frame" |
1343 |
||
2219 | 1344 |
^ styleSheet colorAt:#'button.halfShadowColor' |
727 | 1345 |
! |
1346 |
||
1347 |
buttonLightColor |
|
2715 | 1348 |
"get the background drawing color used to light button frame" |
1349 |
||
2219 | 1350 |
^ styleSheet colorAt:#'menuPanel.buttonLightColor' |
727 | 1351 |
! |
1352 |
||
1353 |
buttonPassiveBackgroundColor |
|
2715 | 1354 |
"get the background drawing color used for button" |
1355 |
||
2219 | 1356 |
^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor' |
727 | 1357 |
! |
1358 |
||
1359 |
buttonShadowColor |
|
2715 | 1360 |
"get the background drawing color used to shadow button frame" |
1361 |
||
2219 | 1362 |
^ styleSheet colorAt:#'menuPanel.buttonShadowColor' |
2059 | 1363 |
! |
1364 |
||
1365 |
disabledEtchedForegroundColor |
|
1366 |
"return the color used for etching disabled items. |
|
2715 | 1367 |
If nil, no 3D effect is drawn." |
1368 |
||
2219 | 1369 |
^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor' |
727 | 1370 |
! |
1371 |
||
390 | 1372 |
disabledForegroundColor |
2715 | 1373 |
"return the foreground color used by disabled items" |
1374 |
||
2219 | 1375 |
^ styleSheet colorAt:#'menuPanel.disabledForegroundColor' |
390 | 1376 |
! |
1377 |
||
2170 | 1378 |
enteredBackgroundColor |
2715 | 1379 |
"return the background color for entered items" |
1380 |
||
2219 | 1381 |
^ styleSheet colorAt:#'menu.enteredBackgroundColor' |
1382 |
default:(self backgroundColor) |
|
2170 | 1383 |
! |
1384 |
||
1385 |
enteredForegroundColor |
|
2715 | 1386 |
"return the foreground color for entered items" |
1387 |
||
2219 | 1388 |
^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor |
2170 | 1389 |
! |
1390 |
||
390 | 1391 |
font:aFont |
2715 | 1392 |
"set the font" |
1393 |
||
2614 | 1394 |
(aFont isNil or:[aFont = font]) ifTrue:[ ^ self ]. |
1395 |
||
1396 |
super font:aFont. |
|
1397 |
self do:[:anItem| anItem fontChanged ]. |
|
1398 |
||
1399 |
(shown and:[superMenu notNil]) ifTrue:[ |
|
1400 |
self extent:(self preferredExtent) |
|
1401 |
]. |
|
1402 |
self mustRearrange. |
|
390 | 1403 |
! |
1404 |
||
1405 |
foregroundColor |
|
2715 | 1406 |
"return the passive foreground color" |
1407 |
||
2059 | 1408 |
^ fgColor |
390 | 1409 |
! |
1410 |
||
1411 |
foregroundColor:aColor |
|
1412 |
"set the foregroundColor drawing color. You should not use this method; |
|
2715 | 1413 |
instead leave the value as defined in the styleSheet." |
1414 |
||
2219 | 1415 |
aColor ~= fgColor ifTrue:[ |
1478 | 1416 |
fgColor := aColor onDevice:device. |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
1417 |
self invalidate |
2219 | 1418 |
]. |
580 | 1419 |
! |
1420 |
||
1699 | 1421 |
maxAbsoluteButtonLevel |
1422 |
"returns the maximum absolute button level; used to compute the preferred |
|
2715 | 1423 |
extent of a button" |
1424 |
||
2219 | 1425 |
^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' |
390 | 1426 |
! |
1427 |
||
730 | 1428 |
selectionFrameBrightColor |
2715 | 1429 |
"get the selection frame bright color" |
1430 |
||
2219 | 1431 |
^ Color white |
730 | 1432 |
! |
1433 |
||
1434 |
selectionFrameDarkColor |
|
2715 | 1435 |
"get the selection frame dark color" |
1436 |
||
2219 | 1437 |
^ Color black |
730 | 1438 |
! |
1439 |
||
1727 | 1440 |
setFont:aFont |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1441 |
"set the font if the argument is nonNil; |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1442 |
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
|
1443 |
|
1727 | 1444 |
|currentFont| |
1445 |
||
1446 |
(aFont notNil and:[aFont ~= font]) ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1447 |
currentFont := font. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
1448 |
super font:aFont. |
1727 | 1449 |
]. |
1450 |
^ currentFont |
|
390 | 1451 |
! ! |
1452 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1453 |
!MenuPanel methodsFor:'accessing-dimensions'! |
388 | 1454 |
|
1455 |
height |
|
2715 | 1456 |
"default height" |
1457 |
||
388 | 1458 |
(explicitExtent ~~ true) ifTrue:[ |
2715 | 1459 |
^ self preferredExtent y |
388 | 1460 |
]. |
1461 |
^ super height |
|
1462 |
! |
|
1463 |
||
2016 | 1464 |
maxExtent |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1465 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1466 |
device notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1467 |
^ device usableExtent - 2. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1468 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1469 |
superMenu notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1470 |
^ superMenu maxExtent |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1471 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1472 |
"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
|
1473 |
self error:'don''t know maxExtent'. |
2016 | 1474 |
! |
1475 |
||
388 | 1476 |
preferredExtent |
2715 | 1477 |
"compute and returns my preferred extent" |
1478 |
||
2253 | 1479 |
|maxExtent usedExtent| |
2024 | 1480 |
|
2016 | 1481 |
preferredExtent notNil ifTrue:[ |
2253 | 1482 |
^ preferredExtent |
2016 | 1483 |
]. |
2024 | 1484 |
usedExtent := self preferredExtentOfItems. |
1485 |
||
1486 |
superView isNil ifTrue:[ |
|
2253 | 1487 |
"/ is standalone |
2374 | 1488 |
preferredWidth notNil ifTrue:[ |
2253 | 1489 |
usedExtent x < preferredWidth ifTrue:[ |
1490 |
usedExtent := preferredWidth @ usedExtent y. |
|
1491 |
] |
|
1492 |
] |
|
2024 | 1493 |
]. |
1494 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1495 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1496 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1497 |
usedExtent := usedExtent min:maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1498 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
1499 |
^ usedExtent |
2024 | 1500 |
|
1501 |
"Modified: / 10.10.2001 / 14:57:25 / cg" |
|
2016 | 1502 |
! |
1503 |
||
1504 |
preferredExtentOfItems |
|
1505 |
"compute and returns my preferred extent including all items |
|
2715 | 1506 |
!!!!!! changes have influence on method #rearrangeItems !!!!!!" |
1507 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1508 |
|hasMenu shCtKey extent showAcc sck |
2219 | 1509 |
x "{ Class:SmallInteger }" |
1510 |
y "{ Class:SmallInteger }" |
|
1511 |
size "{ Class:SmallInteger }" |
|
2145 | 1512 |
buttonInsetX "{ Class:SmallInteger }" |
1513 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 1514 |
labelInsetX "{ Class:SmallInteger }" |
1515 |
labelInsetY "{ Class:SmallInteger }" |
|
1516 |
itemSpace "{ Class:SmallInteger }" |
|
1517 |
itemMargin "{ Class:SmallInteger }" |
|
1518 |
groupDividerSize "{ Class:SmallInteger }" |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
1519 |
| |
388 | 1520 |
|
1699 | 1521 |
(size := items size) == 0 ifTrue:[ |
2219 | 1522 |
self isViewWrapper ifTrue:[ ^ subViews first extent ]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1523 |
^ 32 @ 32 |
2219 | 1524 |
]. |
1525 |
buttonInsetX := 2 * self buttonInsetX. |
|
1526 |
buttonInsetY := 2 * self buttonInsetY. |
|
1699 | 1527 |
|
1528 |
self isPopUpView ifFalse:[ |
|
2219 | 1529 |
labelInsetX := labelInsetY := 2 * (self enteredLevel abs). |
1699 | 1530 |
] ifTrue:[ |
2145 | 1531 |
labelInsetX := labelInsetY := 0. |
1699 | 1532 |
]. |
1533 |
||
1534 |
x := 0. |
|
1535 |
y := 0. |
|
2219 | 1536 |
groupDividerSize := self groupDividerSize. |
388 | 1537 |
|
1538 |
self verticalLayout ifFalse:[ |
|
2219 | 1539 |
itemSpace := self itemSpace. |
1540 |
||
1699 | 1541 |
items keysAndValuesDo:[:key :el| |eX eY| |
1542 |
extent := el preferredExtent. |
|
1543 |
||
1544 |
"/ check for visibility (extent x ~~ 0) |
|
1545 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1546 |
eY := extent y. |
|
1547 |
||
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1548 |
el isButton ifTrue:[ |
2145 | 1549 |
eX := eX + buttonInsetX. |
1550 |
eY := eY + buttonInsetY. |
|
1699 | 1551 |
] ifFalse:[ |
2145 | 1552 |
eX := eX + labelInsetX. |
1553 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1554 |
]. |
1699 | 1555 |
key ~~ size ifTrue:[ |
1556 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1557 |
x := x + groupDividerSize |
|
1558 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1559 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1560 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
1561 |
] |
1699 | 1562 |
] |
1563 |
]. |
|
1564 |
x := eX + x. |
|
1565 |
y := eY max:y. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1566 |
] |
1699 | 1567 |
] |
388 | 1568 |
] ifTrue:[ |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1569 |
hasMenu := false. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1570 |
shCtKey := 0. |
1699 | 1571 |
showAcc := MenuView showAcceleratorKeys == true. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1572 |
y := x. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1573 |
x := 0. |
2219 | 1574 |
itemMargin := 2 * self itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1575 |
|
1699 | 1576 |
items keysAndValuesDo:[:key :el| |eX eY| |
1577 |
extent := el preferredExtent. |
|
1578 |
||
1579 |
"/ check for visibility (extent x ~~ 0) |
|
1580 |
(eX := extent x) ~~ 0 ifTrue:[ |
|
1581 |
eY := extent y. |
|
1582 |
||
1583 |
el isButton ifTrue:[ |
|
2145 | 1584 |
eX := eX + buttonInsetX. |
1585 |
eY := eY + buttonInsetY. |
|
1699 | 1586 |
] ifFalse:[ |
2145 | 1587 |
eX := eX + labelInsetX. |
1588 |
eY := eY + labelInsetY. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1589 |
]. |
1699 | 1590 |
hasMenu ifFalse:[ |
1591 |
hasMenu := el hasSubmenu |
|
1592 |
]. |
|
1593 |
(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[ |
|
1594 |
shCtKey := shCtKey max:(sck widthOn:self) |
|
1595 |
]. |
|
1596 |
key ~~ size ifTrue:[ |
|
1597 |
(self hasGroupDividerAt:key) ifTrue:[ |
|
1598 |
y := y + groupDividerSize |
|
1599 |
] |
|
1600 |
]. |
|
1601 |
y := eY + y. |
|
1602 |
x := eX max:x. |
|
1603 |
]. |
|
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1604 |
]. |
2219 | 1605 |
x := x + itemMargin. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1606 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1607 |
(hasMenu or:[shCtKey ~~ 0]) ifTrue:[ |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1608 |
shortKeyInset := x + Item labelRightOffset. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1609 |
x := shortKeyInset + shCtKey + self subMenuIndicationWidth. |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1610 |
|
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1611 |
(shCtKey ~~ 0 and:[hasMenu]) ifTrue:[ |
2219 | 1612 |
x := x + self shortcutKeyOffset. |
1472
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1613 |
] |
fd1871a0d888
call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents:
1464
diff
changeset
|
1614 |
]. |
1699 | 1615 |
"/ to have a small inset |
1616 |
y := y + 1. |
|
1617 |
"/ x := x + 1. |
|
1618 |
]. |
|
1619 |
x := x + margin + margin. |
|
1620 |
y := y + margin + margin. |
|
1621 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
1622 |
^ x @ y |
388 | 1623 |
! |
1624 |
||
2253 | 1625 |
preferredWidth:aWidthOrNil |
1626 |
"used for example by combo box to setup the preferred width for the popup menu. |
|
1627 |
If nil (default), the width is computed from the contained items. |
|
2715 | 1628 |
If not nil, the width is the maximum from the contained items and the required width." |
1629 |
||
2253 | 1630 |
preferredWidth := aWidthOrNil. |
2024 | 1631 |
! |
1632 |
||
388 | 1633 |
shortKeyInset |
2715 | 1634 |
"left inset of shortcutKey" |
1635 |
||
1636 |
^ shortKeyInset |
|
616 | 1637 |
! |
1638 |
||
1639 |
subMenuIndicationWidth |
|
2219 | 1640 |
^ self rightArrow width |
388 | 1641 |
! ! |
1642 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1643 |
!MenuPanel methodsFor:'accessing-interactors'! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1644 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1645 |
iconIndicationDisabledOff |
2219 | 1646 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1647 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1648 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1649 |
iconIndicationDisabledOn |
2219 | 1650 |
^ self registerImageOnDevice:(self class iconIndicationDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1651 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1652 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1653 |
iconIndicationOff |
2219 | 1654 |
^ self registerImageOnDevice:(self class iconIndicationOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1655 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1656 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1657 |
iconIndicationOn |
2219 | 1658 |
^ self registerImageOnDevice:(self class iconIndicationOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1659 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1660 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1661 |
iconRadioGroupDisabledOff |
2219 | 1662 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1663 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1664 |
|
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1665 |
iconRadioGroupDisabledOn |
2219 | 1666 |
^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn) |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1667 |
! |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
1668 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1669 |
iconRadioGroupOff |
2219 | 1670 |
^ self registerImageOnDevice:(self class iconRadioGroupOff) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1671 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1672 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1673 |
iconRadioGroupOn |
2219 | 1674 |
^ self registerImageOnDevice:(self class iconRadioGroupOn) |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1675 |
! ! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
1676 |
|
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1677 |
!MenuPanel methodsFor:'accessing-items'! |
388 | 1678 |
|
1679 |
itemAt:stringOrNumber do:aOneArgBlock |
|
2505
56607624d05a
Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents:
2504
diff
changeset
|
1680 |
"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
|
1681 |
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
|
1682 |
|
388 | 1683 |
^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil |
1684 |
! |
|
1685 |
||
1686 |
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock |
|
1687 |
"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
|
1688 |
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
|
1689 |
|
388 | 1690 |
|item| |
1691 |
||
1692 |
item := self itemAt:stringOrNumber. |
|
1693 |
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
|
1694 |
^ exceptionBlock value |
706 | 1695 |
! |
1696 |
||
1697 |
itemAtIndex:anIndex |
|
2715 | 1698 |
"returns item at an index or nil" |
1699 |
||
706 | 1700 |
^ 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
|
1701 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1702 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1703 |
items |
2715 | 1704 |
"returns list of items or nil" |
1705 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
1706 |
^ items |
388 | 1707 |
! ! |
1708 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1709 |
!MenuPanel methodsFor:'accessing-look'! |
388 | 1710 |
|
727 | 1711 |
buttonActiveLevel |
2715 | 1712 |
"get the buttons active level" |
1713 |
||
2219 | 1714 |
^ styleSheet at:#'menuPanel.buttonActiveLevel' |
727 | 1715 |
! |
1716 |
||
1717 |
buttonPassiveLevel |
|
2715 | 1718 |
"get the buttons passive level" |
1719 |
||
2219 | 1720 |
^ styleSheet at:#'menuPanel.buttonPassiveLevel' |
727 | 1721 |
! |
1722 |
||
2337 | 1723 |
centerItems |
1724 |
^ centerItems ? false |
|
1725 |
! |
|
1726 |
||
1727 |
centerItems:aBoolean |
|
1728 |
centerItems := aBoolean |
|
1729 |
! |
|
1730 |
||
390 | 1731 |
fitFirstPanel |
1732 |
"gets true if the first panel in the menu hierarchy must be fit |
|
1733 |
to the extent of its superView |
|
1699 | 1734 |
|
2715 | 1735 |
NOT SUPPORTED" |
1736 |
||
2219 | 1737 |
^ false |
388 | 1738 |
! |
1739 |
||
390 | 1740 |
fitFirstPanel:aState |
1741 |
"sets true if the first panel in the menu hierarchy must be fit |
|
1742 |
to the extent of its superView |
|
1699 | 1743 |
|
2715 | 1744 |
NOT SUPPORTED" |
616 | 1745 |
! |
1746 |
||
1093 | 1747 |
level:anInt |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1748 |
anInt ~~ level ifTrue:[ |
2219 | 1749 |
super level:anInt. |
1750 |
self mustRearrange |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
1751 |
] |
2052 | 1752 |
|
1753 |
"Modified: / 15.11.2001 / 17:42:07 / cg" |
|
1093 | 1754 |
! |
1755 |
||
616 | 1756 |
rightArrow |
2374 | 1757 |
rightArrow isNil ifTrue:[ |
1758 |
device isNil ifTrue:[ |
|
2219 | 1759 |
^ SelectionInListView rightArrowFormOn:Display |
1760 |
]. |
|
1761 |
rightArrow := SelectionInListView rightArrowFormOn:device |
|
1762 |
]. |
|
616 | 1763 |
^ rightArrow |
1764 |
! |
|
1765 |
||
1766 |
rightArrowShadow |
|
1767 |
^ rightArrowShadow |
|
388 | 1768 |
! |
1769 |
||
390 | 1770 |
showGroupDivider |
2715 | 1771 |
"get the enabled flag for showing groupDiveders" |
1772 |
||
2253 | 1773 |
^ showGroupDivider |
388 | 1774 |
! |
1775 |
||
390 | 1776 |
showGroupDivider:aState |
2715 | 1777 |
"set the enabled flag for showing groupDiveders" |
1778 |
||
2253 | 1779 |
showGroupDivider ~~ aState ifTrue:[ |
1780 |
showGroupDivider := aState. |
|
1781 |
self mustRearrange. |
|
653 | 1782 |
] |
388 | 1783 |
! |
1784 |
||
1785 |
showSeparatingLines |
|
2715 | 1786 |
"gets true if drawing of separating lines is enabled." |
1787 |
||
2253 | 1788 |
^ showSeparatingLines |
388 | 1789 |
! |
1790 |
||
390 | 1791 |
showSeparatingLines:aState |
2715 | 1792 |
"turn on/off drawing of separating lines." |
1793 |
||
2253 | 1794 |
aState ~~ showSeparatingLines ifTrue:[ |
1795 |
showSeparatingLines := aState. |
|
1796 |
self mustRearrange |
|
1797 |
]. |
|
388 | 1798 |
! |
1799 |
||
1800 |
verticalLayout |
|
2715 | 1801 |
"get the layout: vertical( true ) or horizontal( false )" |
1802 |
||
2374 | 1803 |
verticalLayout notNil ifTrue:[ ^ verticalLayout ]. |
2253 | 1804 |
|
1805 |
superMenu notNil ifTrue:[ verticalLayout := true ] |
|
1806 |
ifFalse:[ verticalLayout := self isPopUpView ]. |
|
2374 | 1807 |
^ verticalLayout |
388 | 1808 |
! |
1809 |
||
1810 |
verticalLayout:aState |
|
2715 | 1811 |
"set the layout: vertical( true ) or horizontal( false )" |
1812 |
||
2253 | 1813 |
aState ~~ verticalLayout ifTrue:[ |
1814 |
verticalLayout isNil ifTrue:[ |
|
1815 |
verticalLayout := aState |
|
1816 |
] ifFalse:[ |
|
1817 |
verticalLayout := aState. |
|
1818 |
self mustRearrange. |
|
1819 |
]. |
|
1820 |
]. |
|
388 | 1821 |
! ! |
1822 |
||
2219 | 1823 |
!MenuPanel methodsFor:'accessing-style'! |
1824 |
||
1825 |
buttonInsetX |
|
2715 | 1826 |
"returns the verical button space" |
1827 |
||
2219 | 1828 |
^ styleSheet at:#'menuPanel.buttonInsetX' |
1829 |
! |
|
1830 |
||
1831 |
buttonInsetY |
|
2715 | 1832 |
"returns the verical button space" |
1833 |
||
2219 | 1834 |
^ styleSheet at:#'menuPanel.buttonInsetY' |
1835 |
! |
|
1836 |
||
1837 |
enteredLevel |
|
2715 | 1838 |
"returns the enter-level for an unselected item moved through" |
1839 |
||
2219 | 1840 |
^ styleSheet at:#'menu.enteredLevel' default:0 |
1841 |
! |
|
1842 |
||
1843 |
groupDividerSize |
|
2715 | 1844 |
"returns the width of a group divider" |
1845 |
||
2219 | 1846 |
^ styleSheet at:#'menu.groupDividerSize' default:6 |
1847 |
! |
|
1848 |
||
1849 |
itemMargin |
|
2715 | 1850 |
"returns the margin of an item" |
1851 |
||
2219 | 1852 |
^ styleSheet at:#'menu.itemMargin' default:0 |
1853 |
! |
|
1854 |
||
1855 |
itemSpace |
|
2715 | 1856 |
"returns the additional space for an item in a (vertical) panel" |
1857 |
||
2219 | 1858 |
^ styleSheet at:#'menuPanel.itemSpace' |
1859 |
! |
|
1860 |
||
1861 |
selectionFollowsMouse |
|
2715 | 1862 |
"returns true if the selection follows the mouse" |
1863 |
||
2219 | 1864 |
^ styleSheet at:#'menu.selectionFollowsMouse' default:false |
1865 |
! |
|
1866 |
||
1867 |
shortcutKeyOffset |
|
2715 | 1868 |
"returns the offset for a shortcutKey" |
1869 |
||
2219 | 1870 |
^ 5 |
1871 |
! ! |
|
1872 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
1873 |
!MenuPanel methodsFor:'accessing-submenu'! |
388 | 1874 |
|
1875 |
subMenuAt:stringOrNumber |
|
2715 | 1876 |
"gets the submenu of an item or nil" |
1877 |
||
1878 |
^ self itemAt:stringOrNumber do:[:el| el submenu ] |
|
388 | 1879 |
! |
1880 |
||
1881 |
subMenuAt:stringOrNumber put:aSubMenu |
|
2715 | 1882 |
"sets the submenu of an item" |
1883 |
||
388 | 1884 |
self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ] |
1885 |
! |
|
1886 |
||
1887 |
subMenuShown |
|
2715 | 1888 |
"return the currently visible submenu - or nil if there is none" |
1889 |
||
388 | 1890 |
|item| |
1891 |
||
1892 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 1893 |
^ item submenu |
1894 |
]. |
|
1895 |
^ nil |
|
388 | 1896 |
! ! |
1897 |
||
2504 | 1898 |
!MenuPanel methodsFor:'activation & deactivation'! |
388 | 1899 |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1900 |
closeMenus |
2715 | 1901 |
"close all menus without accepting" |
1902 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1903 |
self topMenu accept:nil. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1904 |
! |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
1905 |
|
388 | 1906 |
hide |
2715 | 1907 |
"hide the view, leave its modal event loop" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
1908 |
|
2407 | 1909 |
"/ TODO: replace with LeaveSignal raise. |
1910 |
||
388 | 1911 |
self selection:nil. |
1912 |
self unmap. |
|
1913 |
! |
|
1914 |
||
1915 |
show |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1916 |
"realize the view at its last position; |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1917 |
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
|
1918 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 1919 |
to some performer)" |
1920 |
||
1921 |
^ self showAt:(self origin) resizing:true |
|
388 | 1922 |
! |
1923 |
||
1924 |
showAt:aPoint |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1925 |
"realize the view at aPoint. |
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1926 |
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
|
1927 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 1928 |
to some performer)" |
1929 |
||
388 | 1930 |
^ self showAt:aPoint resizing:true |
1931 |
! |
|
1932 |
||
1933 |
showAt:aPoint resizing:aBoolean |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1934 |
"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
|
1935 |
or if I have already performed. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1936 |
Return the items value, otherwise. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1937 |
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
|
1938 |
menu (i.e. the view or controller), which will perform the action |
2715 | 1939 |
if a non-nil is returned." |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1940 |
|
1331
aae37cbfb30a
fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents:
1330
diff
changeset
|
1941 |
self rearrangeItemsIfItemVisibilityChanged. |
388 | 1942 |
|
1943 |
aBoolean ifTrue:[ |
|
2715 | 1944 |
self fixSize. |
388 | 1945 |
]. |
1946 |
self origin:aPoint. |
|
1459 | 1947 |
"/ self makeFullyVisible. -- done in realize |
388 | 1948 |
self openModal:[true]. "realize " |
1949 |
||
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1950 |
"/ if I have already performed, |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1951 |
"/ return nil - to avoid items triggering twice. |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1952 |
|
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1953 |
(self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[ |
2715 | 1954 |
^ nil |
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1955 |
]. |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1956 |
|
984
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1957 |
^ self lastValueAccepted |
87d36803b9d8
oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents:
971
diff
changeset
|
1958 |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1959 |
"Modified: / 15.9.1998 / 12:50:23 / cg" |
388 | 1960 |
! |
1961 |
||
1962 |
showAtPointer |
|
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1963 |
"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
|
1964 |
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
|
1965 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 1966 |
to some performer)" |
1967 |
||
388 | 1968 |
^ self showAt:(device pointerPosition) resizing:true |
1969 |
! |
|
1970 |
||
1971 |
showCenteredIn:aView |
|
1972 |
"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
|
1973 |
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
|
1974 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 1975 |
to some performer)" |
1976 |
||
388 | 1977 |
|top| |
1978 |
||
1979 |
top := aView topView. |
|
1980 |
top raise. |
|
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1981 |
^ 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
|
1982 |
|
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
1983 |
"Modified: / 15.9.1998 / 12:45:50 / cg" |
388 | 1984 |
! |
1985 |
||
1986 |
startUp |
|
1987 |
"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
|
1988 |
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
|
1989 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 1990 |
to some performer)" |
1991 |
||
388 | 1992 |
^ self showAtPointer |
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1993 |
! |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1994 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1995 |
startUpAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
1996 |
"realize the menu at aPoint |
1836
89a1b938c09e
fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents:
1832
diff
changeset
|
1997 |
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
|
1998 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 1999 |
to some performer)" |
2000 |
||
897
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2001 |
^ self showAt:aPoint |
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2002 |
|
6bbc8c15ac0a
added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents:
890
diff
changeset
|
2003 |
"Created: / 21.5.1998 / 14:15:57 / cg" |
1750 | 2004 |
! |
2005 |
||
2332 | 2006 |
startUpFor:originatingWidget |
2007 |
"realize the menu at the current pointer position |
|
2008 |
return the value of the selectedItem or nil, of none was selected |
|
2009 |
(unless the menu has already performed its action, by sending an appropriate message |
|
2715 | 2010 |
to some performer)" |
2011 |
||
2332 | 2012 |
originator := originatingWidget. |
2013 |
^ self startUp |
|
2014 |
! |
|
2015 |
||
1750 | 2016 |
startUpOrNil |
2017 |
"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
|
2018 |
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
|
2019 |
(unless the menu has already performed its action, by sending an appropriate message |
2715 | 2020 |
to some performer)" |
2021 |
||
1750 | 2022 |
^ self showAtPointer |
388 | 2023 |
! ! |
2024 |
||
2025 |
!MenuPanel methodsFor:'adding & removing'! |
|
2026 |
||
2027 |
createAtIndex:anIndexOrNil |
|
1800 | 2028 |
"create an item and add this item to the index. In case of nil, the item |
2029 |
is added to the end. If the index is not valid nil is returned; |
|
2715 | 2030 |
otherwise the new created item is returned." |
2031 |
||
388 | 2032 |
|max item| |
2033 |
||
2034 |
max := (items size) + 1. |
|
2035 |
||
2036 |
anIndexOrNil notNil ifTrue:[ |
|
2715 | 2037 |
(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[ |
2038 |
^ nil |
|
2039 |
] |
|
388 | 2040 |
]. |
2041 |
items isNil ifTrue:[ |
|
2715 | 2042 |
items := OrderedCollection new |
1151
199863d6a463
items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents:
1137
diff
changeset
|
2043 |
] ifFalse:[ |
2715 | 2044 |
items := items asOrderedCollection |
388 | 2045 |
]. |
2046 |
item := Item in:self. |
|
2047 |
||
2048 |
(anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[ |
|
2715 | 2049 |
items add:item |
388 | 2050 |
] ifFalse:[ |
2715 | 2051 |
items add:item beforeIndex:anIndexOrNil |
388 | 2052 |
]. |
2053 |
^ item |
|
2054 |
! |
|
2055 |
||
2056 |
remove:stringOrNumber |
|
2057 |
"remove the first item which is assigned to stringOrNumber; |
|
2715 | 2058 |
if found, remove and return it" |
2059 |
||
388 | 2060 |
|item| |
2061 |
||
2062 |
(item := self itemAt:stringOrNumber) notNil ifTrue:[ |
|
2715 | 2063 |
items remove:item. |
2064 |
item destroy. |
|
2065 |
items isEmpty ifTrue:[items := nil]. |
|
2066 |
self mustRearrange. |
|
388 | 2067 |
]. |
2068 |
^ item |
|
2069 |
! |
|
2070 |
||
2071 |
removeAll |
|
2715 | 2072 |
"remove all items and submenus" |
2073 |
||
388 | 2074 |
self disabledRedrawDo:[ |
2715 | 2075 |
self selection:nil. |
2076 |
groupSizes := nil. |
|
2077 |
items notNil ifTrue:[ |
|
2078 |
items copy do:[:el| el destroy ]. |
|
2079 |
]. |
|
2080 |
items := nil |
|
2050
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2081 |
]. |
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2082 |
|
ef5517d7a2d0
do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents:
2048
diff
changeset
|
2083 |
"Modified: / 15.11.2001 / 17:02:51 / cg" |
388 | 2084 |
! ! |
2085 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2086 |
!MenuPanel methodsFor:'change & update'! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2087 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2088 |
update:something with:aParameter from:changedObject |
498 | 2089 |
|
2090 |
changedObject == menuHolder ifTrue:[^ self menu:(menuHolder value)]. |
|
2091 |
changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)]. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2092 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2093 |
super update:something with:aParameter from:changedObject |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2094 |
! ! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2095 |
|
388 | 2096 |
!MenuPanel methodsFor:'converting'! |
2097 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2098 |
asMenu |
2715 | 2099 |
"convert contents to menu" |
2100 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2101 |
|menu| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2102 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2103 |
menu := Menu new. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2104 |
menu groupSizes:groupSizes. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2105 |
self do:[:anItem| menu addItem:(anItem asMenuItem) ]. |
2059 | 2106 |
^ menu |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2107 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2108 |
|
388 | 2109 |
fromSpec:aMenuSpec |
2715 | 2110 |
"build from spec" |
2111 |
||
388 | 2112 |
|menu| |
2113 |
||
2114 |
menu := Menu new. |
|
2115 |
menu fromLiteralArrayEncoding:aMenuSpec. |
|
2116 |
self menu:menu |
|
2117 |
! |
|
2118 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2119 |
menu:aMenu |
2715 | 2120 |
"convert to Menu" |
2121 |
||
388 | 2122 |
self disabledRedrawDo:[ |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2123 |
|menu newItems menuReceiver| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2124 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2125 |
self removeAll. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2126 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2127 |
(menu := aMenu) notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2128 |
(aMenu isCollection) ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2129 |
menu := Menu new. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2130 |
menu fromLiteralArrayEncoding:aMenu. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2131 |
] ifFalse:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2132 |
menuReceiver := menu receiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2133 |
menuReceiver notNil ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2134 |
receiver := menuReceiver. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2135 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2136 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2137 |
(newItems := menu menuItems) size > 0 ifTrue:[ |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2138 |
items := newItems collect:[:ni | |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2139 |
|i| |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2140 |
|
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2141 |
i:= Item in:self. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2142 |
i menuItem:ni. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2143 |
i. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2144 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2145 |
]. |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2146 |
self groupSizes:(menu groupSizes). |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
2147 |
] |
1063
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2148 |
] |
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2149 |
|
08b7ca464437
dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents:
1054
diff
changeset
|
2150 |
"Modified: / 8.8.1998 / 02:05:04 / cg" |
388 | 2151 |
! ! |
2152 |
||
2681 | 2153 |
!MenuPanel methodsFor:'dependents access'! |
2154 |
||
2155 |
addDependencies |
|
2715 | 2156 |
"add all dependencies" |
2157 |
||
2681 | 2158 |
self do:[:anItem| anItem addDependencies ]. |
2159 |
||
2160 |
menuHolder notNil ifTrue:[menuHolder addDependent:self]. |
|
2161 |
enableChannel notNil ifTrue:[enableChannel addDependent:self]. |
|
2162 |
! |
|
2163 |
||
2164 |
removeDependencies |
|
2715 | 2165 |
"remove all dependencies" |
2166 |
||
2681 | 2167 |
self do:[:anItem| anItem removeDependencies ]. |
2168 |
||
2169 |
menuHolder notNil ifTrue:[menuHolder removeDependent:self]. |
|
2170 |
enableChannel notNil ifTrue:[enableChannel removeDependent:self]. |
|
2171 |
! ! |
|
2172 |
||
388 | 2173 |
!MenuPanel methodsFor:'drawing'! |
2174 |
||
2175 |
disabledRedrawDo:aBlock |
|
2176 |
"evaluate a block without redrawing within the block; after processing |
|
2715 | 2177 |
of the block a redraw might be performed" |
2178 |
||
388 | 2179 |
|state| |
2180 |
||
2181 |
state := mustRearrange. |
|
2182 |
mustRearrange := true. |
|
2183 |
aBlock value. |
|
2184 |
mustRearrange := state. |
|
2185 |
self mustRearrange |
|
2186 |
! |
|
2187 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2188 |
drawButtonEdgesFor:anItem level:aLevel |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2189 |
|layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2190 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2191 |
aLevel ~~ 0 ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2192 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2193 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2194 |
styleSheet is3D ifFalse:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2195 |
self displayRectangle:layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2196 |
] ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2197 |
self drawEdgesForX:(layout left) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2198 |
y:(layout top) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2199 |
width:(layout width) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2200 |
height:(layout height) |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2201 |
level:aLevel |
2219 | 2202 |
shadow:(self buttonShadowColor) |
2203 |
light:(self buttonLightColor) |
|
2204 |
halfShadow:(self buttonHalfShadowColor) |
|
2205 |
halfLight:(self buttonHalfLightColor) |
|
2206 |
style:(self buttonEdgeStyle) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2207 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2208 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2209 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2210 |
|
2016 | 2211 |
drawItemsX:x y:y width:w height:h |
2715 | 2212 |
"redraw items and groups in a damage" |
2213 |
||
2016 | 2214 |
|isVertical item layout prevClip |
2215 |
x1 "{ Class:SmallInteger }" |
|
2216 |
x2 "{ Class:SmallInteger }" |
|
2217 |
y1 "{ Class:SmallInteger }" |
|
2218 |
y2 "{ Class:SmallInteger }" |
|
2219 |
start "{ Class:SmallInteger }" |
|
2220 |
stop "{ Class:SmallInteger }" |
|
2221 |
size "{ Class:SmallInteger }" |
|
2222 |
groupDivInset "{ Class:SmallInteger }" |
|
2223 |
| |
|
2224 |
||
2225 |
size := items size. |
|
2226 |
isVertical := self verticalLayout. |
|
2227 |
||
2228 |
isVertical ifTrue:[ |
|
2064 | 2229 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]]. |
2016 | 2230 |
start == 0 ifTrue:[ ^ self ]. |
2231 |
y1 := y + h. |
|
2064 | 2232 |
stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] |
2233 |
startingAt:(start + 1). |
|
2016 | 2234 |
] ifFalse:[ |
2064 | 2235 |
start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]]. |
2016 | 2236 |
start == 0 ifTrue:[ ^ self ]. |
2237 |
x1 := x + w. |
|
2064 | 2238 |
stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] |
2239 |
startingAt:(start + 1). |
|
2016 | 2240 |
]. |
2241 |
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1]. |
|
2242 |
||
2253 | 2243 |
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[ |
2219 | 2244 |
groupDivInset := self groupDividerSize // 2. |
2016 | 2245 |
|
2246 |
groupDivInset ~~ 0 ifTrue:[ |
|
2247 |
(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[ |
|
2248 |
start := start - 1 |
|
2249 |
] |
|
2250 |
]. |
|
2251 |
] ifFalse:[ |
|
2252 |
groupDivInset := 0 |
|
2253 |
]. |
|
2254 |
||
2255 |
prevClip := clipRect. |
|
2256 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2257 |
||
2258 |
start to:stop do:[:i| |
|
2259 |
item := items at:i. |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
2260 |
item draw. |
2016 | 2261 |
|
2262 |
(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[ |
|
2263 |
layout := item layout. |
|
2264 |
||
2265 |
isVertical ifTrue:[ |
|
2266 |
x1 := layout left. |
|
2267 |
x2 := layout right. |
|
2268 |
y1 := layout bottom + groupDivInset. |
|
2269 |
y2 := y1. |
|
2270 |
] ifFalse:[ |
|
2271 |
y1 := layout top. |
|
2272 |
y2 := layout bottom. |
|
2273 |
x1 := layout right + groupDivInset. |
|
2274 |
x2 := x1. |
|
2275 |
]. |
|
2276 |
self paint:shadowColor. |
|
2277 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2. |
|
2278 |
self paint:lightColor. |
|
2279 |
||
2280 |
isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ] |
|
2281 |
ifFalse:[x1 := x1 + 1. x2 := x1 ]. |
|
2282 |
||
2283 |
self displayLineFromX:x1 y:y1 toX:x2 y:y2 |
|
2284 |
] |
|
2285 |
]. |
|
2286 |
self clippingRectangle:prevClip. |
|
2287 |
! |
|
2288 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2289 |
drawLabelEdgeFor:anItem selected:isSelected |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2290 |
|level layout| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2291 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2292 |
isSelected ifTrue:[ |
2219 | 2293 |
level := styleSheet at:#'menu.hilightLevel' default:0. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2294 |
] ifFalse:[ |
2219 | 2295 |
anItem == enteredItem ifTrue:[ level := self enteredLevel ] |
2296 |
ifFalse:[ level := 0 ] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2297 |
]. |
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2298 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
2299 |
level ~~ 0 ifTrue:[ |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2300 |
layout := anItem layout. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2301 |
|
1691 | 2302 |
self drawEdgesForX:(layout left) |
2303 |
y:(layout top) |
|
2304 |
width:(layout width) |
|
2305 |
height:(layout height) |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2306 |
level:level |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2307 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2308 |
! |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2309 |
|
2016 | 2310 |
drawScrollerAt:aDirection bounds:bounds |
2715 | 2311 |
"draw a scroller" |
2312 |
||
2016 | 2313 |
|scrolling icon level x y w h| |
2314 |
||
2315 |
x := bounds left. |
|
2316 |
y := bounds top. |
|
2317 |
w := bounds width. |
|
2318 |
h := bounds height. |
|
2319 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2320 |
scrolling := self scrollActivity. |
2016 | 2321 |
|
2322 |
(scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[ |
|
2715 | 2323 |
level := -2 |
2016 | 2324 |
] ifFalse:[ |
2715 | 2325 |
level := 1 |
2016 | 2326 |
]. |
2327 |
||
2328 |
level ~~ 0 ifTrue:[ |
|
2715 | 2329 |
self drawEdgesForX:x y:y width:w height:h level:level. |
2016 | 2330 |
]. |
2331 |
icon := scrolling iconAt:aDirection on:self. |
|
2332 |
||
2333 |
icon displayOn:self x:(x + (w - icon width // 2)) |
|
2715 | 2334 |
y:(y + (h - icon height // 2)). |
2016 | 2335 |
! |
2336 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2337 |
invalidateItem:anItem repairNow:aBool |
2715 | 2338 |
"an item changed; invalidate the items layout" |
2339 |
||
2016 | 2340 |
|layout| |
2341 |
||
2073
26c30a04413d
do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents:
2069
diff
changeset
|
2342 |
self sensor isNil ifTrue:[^ self]. |
26c30a04413d
do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents:
2069
diff
changeset
|
2343 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
2344 |
(mustRearrange not and:[shown]) ifTrue:[ |
2715 | 2345 |
layout := anItem layout. |
2346 |
||
2347 |
(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[ |
|
2348 |
self invalidate:(layout copy insetBy:-1) repairNow:aBool |
|
2349 |
] |
|
1728 | 2350 |
]. |
2351 |
||
2352 |
"Modified: / 29.2.2000 / 11:28:59 / cg" |
|
746 | 2353 |
! |
2354 |
||
388 | 2355 |
mustRearrange |
2715 | 2356 |
"force rearrange (i.e. set the rearrange flag)" |
2357 |
||
2080 | 2358 |
mustRearrange ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2359 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2360 |
self invalidate "/ RepairNow:true |
388 | 2361 |
] |
590 | 2362 |
|
911
6b1ad8b039c5
no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents:
910
diff
changeset
|
2363 |
"Modified: / 6.6.1998 / 19:51:07 / cg" |
388 | 2364 |
! |
2365 |
||
710 | 2366 |
rearrangeGroups |
2715 | 2367 |
"implements the groupIdentifier #right in a horizontal menu" |
2368 |
||
1699 | 2369 |
|layout point |
710 | 2370 |
dltX "{ Class:SmallInteger }" |
2371 |
start "{ Class:SmallInteger }" |
|
2372 |
| |
|
2373 |
||
2374 |
(self isPopUpView or:[self verticalLayout]) ifTrue:[ |
|
2715 | 2375 |
^ self |
710 | 2376 |
]. |
2377 |
||
2378 |
layout := items last layout. |
|
2379 |
||
1699 | 2380 |
(dltX := width - margin - layout right) <= 0 ifTrue:[ |
2715 | 2381 |
^ self "/ no free space |
710 | 2382 |
]. |
2383 |
start := items findFirst:[:anItem| anItem startGroup == #right ]. |
|
2384 |
||
2385 |
start == 0 ifTrue:[ |
|
2715 | 2386 |
^ self "/ no item detected |
1699 | 2387 |
]. |
2388 |
point := dltX @ 0. |
|
2389 |
||
2390 |
"/ move items layout to right |
|
710 | 2391 |
|
2392 |
items from:start do:[:anItem| |
|
2715 | 2393 |
anItem isVisible ifTrue:[ |
2394 |
anItem layout moveBy:point. |
|
2395 |
] |
|
710 | 2396 |
]. |
2397 |
! |
|
2398 |
||
388 | 2399 |
rearrangeItems |
1699 | 2400 |
"recompute the layout of each item |
2715 | 2401 |
!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!" |
2402 |
||
1791 | 2403 |
|isVertical extent isPopUpMenu |
2219 | 2404 |
x "{ Class:SmallInteger }" |
2405 |
y "{ Class:SmallInteger }" |
|
2406 |
x0 "{ Class:SmallInteger }" |
|
2407 |
y0 "{ Class:SmallInteger }" |
|
2408 |
x1 "{ Class:SmallInteger }" |
|
2409 |
y1 "{ Class:SmallInteger }" |
|
2410 |
size "{ Class:SmallInteger }" |
|
2411 |
insetX "{ Class:SmallInteger }" |
|
2412 |
insetY "{ Class:SmallInteger }" |
|
2413 |
labelInsetX "{ Class:SmallInteger }" |
|
2414 |
labelInsetY "{ Class:SmallInteger }" |
|
2145 | 2415 |
buttonInsetX "{ Class:SmallInteger }" |
2416 |
buttonInsetY "{ Class:SmallInteger }" |
|
2219 | 2417 |
itemMargin "{ Class:SmallInteger }" |
2418 |
itemSpace "{ Class:SmallInteger }" |
|
2419 |
groupDividerSize "{ Class:SmallInteger }" |
|
710 | 2420 |
| |
1699 | 2421 |
(mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[ |
1478 | 2422 |
mustRearrange := false. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2423 |
^ self |
390 | 2424 |
]. |
2219 | 2425 |
|
2080 | 2426 |
"/ DON'T SET THIS!! |
2427 |
"/ item layout: below of first item -> item invalidate |
|
2428 |
"/ -> menuPanel invalidateItem:repairDamage: |
|
2429 |
"/ -> invalidate:rapairDamage: |
|
2430 |
"/ -> redrawX:y:width:height: |
|
2431 |
"/ tries to get uninitialized layout from second item. |
|
2432 |
"/ This happens in a modal debugger!! |
|
2433 |
"/ mustRearrange := false. |
|
2219 | 2434 |
isVertical := self verticalLayout. |
2435 |
itemSpace := self itemSpace. |
|
2436 |
groupDividerSize := self groupDividerSize. |
|
2437 |
buttonInsetX := self buttonInsetX. |
|
2438 |
buttonInsetY := self buttonInsetY. |
|
2439 |
isPopUpMenu := self isPopUpView. |
|
1791 | 2440 |
|
2441 |
isPopUpMenu ifFalse:[ |
|
2219 | 2442 |
labelInsetX := labelInsetY := self enteredLevel abs. |
1699 | 2443 |
] ifTrue:[ |
2145 | 2444 |
labelInsetX := labelInsetY := 0 |
388 | 2445 |
]. |
390 | 2446 |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2447 |
(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
|
2448 |
extent := self preferredExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2449 |
|
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2450 |
isPopUpMenu ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2451 |
maxExtent := self maxExtent. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2452 |
maxExtent notNil ifTrue:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2453 |
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
|
2454 |
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
|
2455 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2456 |
] ifFalse:[ |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2457 |
extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y]. |
1478 | 2458 |
]. |
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
2459 |
self extent:extentToSet. |
390 | 2460 |
] ifFalse:[ |
1699 | 2461 |
extent := self computeExtent |
390 | 2462 |
]. |
1082
382324ddce3f
support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2463 |
|
1093 | 2464 |
x := y := margin. |
2465 |
||
1699 | 2466 |
isVertical ifFalse:[ |
2467 |
y0 := margin. |
|
2468 |
y1 := extent y - margin. |
|
2469 |
||
2470 |
items keysAndValuesDo:[:anIndex :el| |
|
2471 |
el isVisible ifFalse:[ |
|
2472 |
el layout:(Rectangle left:x top:y0 right:x bottom:y1) |
|
2473 |
] ifTrue:[ |
|
1478 | 2474 |
el isButton ifTrue:[ |
2145 | 2475 |
insetX := buttonInsetX. |
2476 |
insetY := buttonInsetY. |
|
2062 | 2477 |
] ifFalse:[ |
2145 | 2478 |
insetX := labelInsetX. |
2479 |
insetY := labelInsetY. |
|
1478 | 2480 |
]. |
2145 | 2481 |
x0 := x + insetX. |
2171 | 2482 |
x1 := x0 + (el preferredExtent x). |
2145 | 2483 |
el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)). |
2484 |
x := x1 + insetX. |
|
1699 | 2485 |
|
2486 |
size ~~ anIndex ifTrue:[ |
|
2487 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2488 |
x := x + groupDividerSize |
|
2489 |
] ifFalse:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
2490 |
el needsItemSpaceWhenDrawing ifTrue:[ |
1723
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2491 |
x := x + itemSpace |
f633725a0ace
use itemSpace only for horizontal menus and between labeled items
ca
parents:
1719
diff
changeset
|
2492 |
] |
1699 | 2493 |
] |
2494 |
] |
|
1478 | 2495 |
]. |
1699 | 2496 |
]. |
2497 |
] ifTrue:[ |
|
2219 | 2498 |
itemMargin := self itemMargin. |
1699 | 2499 |
x0 := margin. |
2219 | 2500 |
x1 := extent x - margin - itemMargin. "/ -1 |
1699 | 2501 |
|
2502 |
items keysAndValuesDo:[:anIndex :el| |
|
2503 |
el isVisible ifFalse:[ |
|
2504 |
el layout:(Rectangle left:x0 top:y right:x1 bottom:y) |
|
2505 |
] ifTrue:[ |
|
2506 |
el isButton ifTrue:[ |
|
2145 | 2507 |
insetX := buttonInsetX. |
2508 |
insetY := buttonInsetY. |
|
1699 | 2509 |
] ifFalse:[ |
2145 | 2510 |
insetX := labelInsetX. |
2511 |
insetY := labelInsetY. |
|
1699 | 2512 |
]. |
2145 | 2513 |
y0 := y + insetY. |
1699 | 2514 |
y1 := y0 + el preferredExtent y. |
2219 | 2515 |
el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1). |
2145 | 2516 |
y := y1 + insetY. |
1699 | 2517 |
|
2518 |
size ~~ anIndex ifTrue:[ |
|
2519 |
(self hasGroupDividerAt:anIndex) ifTrue:[ |
|
2520 |
y := y + groupDividerSize |
|
2521 |
] |
|
2522 |
] |
|
1478 | 2523 |
] |
2524 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
2525 |
]. |
710 | 2526 |
self rearrangeGroups. |
2048 | 2527 |
selection notNil ifTrue:[self makeItemVisible:selection]. |
388 | 2528 |
mustRearrange := false. |
2048 | 2529 |
|
2530 |
"Modified: / 13.11.2001 / 20:17:21 / cg" |
|
388 | 2531 |
! |
2532 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2533 |
rearrangeItemsIfItemVisibilityChanged |
1699 | 2534 |
"check for items which can change its visibility; |
2715 | 2535 |
if at least one item exists, rearrange all items" |
2536 |
||
1464 | 2537 |
items isNil ifTrue:[^ self]. |
1699 | 2538 |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2539 |
items do:[:item | |
2715 | 2540 |
item canChangeVisibility ifTrue:[ |
2541 |
mustRearrange := true. |
|
2542 |
self rearrangeItems. |
|
2543 |
^ self |
|
2544 |
]. |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2545 |
] |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2546 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2547 |
|
388 | 2548 |
redrawX:x y:y width:w height:h |
2715 | 2549 |
"redraw a damage" |
2550 |
||
2052 | 2551 |
|y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller| |
388 | 2552 |
|
710 | 2553 |
(shown and:[w ~~ 0]) ifFalse:[^ self]. |
388 | 2554 |
|
1699 | 2555 |
mustRearrange ifTrue:[ |
2569 | 2556 |
self isPopUpView ifFalse:[explicitExtent := true]. |
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2557 |
self rearrangeItems. |
2569 | 2558 |
self invalidate. |
2559 |
^ self |
|
1699 | 2560 |
]. |
2219 | 2561 |
self paint:(self viewBackground). |
1699 | 2562 |
self clearRectangleX:x y:y width:w height:h. |
2563 |
||
2016 | 2564 |
items size == 0 ifTrue:[ |
1699 | 2565 |
^ self |
2566 |
]. |
|
2016 | 2567 |
y0 := y. |
2568 |
y1 := y + h. |
|
2018 | 2569 |
x0 := x. |
2570 |
x1 := x + w. |
|
2016 | 2571 |
|
2572 |
self hasScrollers ifTrue:[ |
|
2573 |
(self hasScrollerAt:#PREV) ifTrue:[ |
|
2574 |
bounds := self scrollerBoundsAt:#PREV. |
|
2052 | 2575 |
mustDrawPrevScroller := false. |
2016 | 2576 |
|
2018 | 2577 |
self verticalLayout ifTrue:[ |
2578 |
bounds bottom > y ifTrue:[ |
|
2579 |
y0 := bounds bottom. |
|
2052 | 2580 |
mustDrawPrevScroller := true. |
2018 | 2581 |
]. |
2582 |
] ifFalse:[ |
|
2583 |
bounds right > x ifTrue:[ |
|
2584 |
x0 := bounds right. |
|
2052 | 2585 |
mustDrawPrevScroller := true. |
2018 | 2586 |
]. |
2052 | 2587 |
]. |
2588 |
mustDrawPrevScroller ifTrue:[ |
|
2589 |
self drawScrollerAt:#PREV bounds:bounds. |
|
2590 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2591 |
]. |
2016 | 2592 |
|
2593 |
(self hasScrollerAt:#NEXT) ifTrue:[ |
|
2594 |
bounds := self scrollerBoundsAt:#NEXT. |
|
2052 | 2595 |
mustDrawNextScroller := false. |
2016 | 2596 |
|
2018 | 2597 |
self verticalLayout ifTrue:[ |
2598 |
bounds top < y1 ifTrue:[ |
|
2599 |
y1 := bounds top. |
|
2052 | 2600 |
mustDrawNextScroller := true. |
2018 | 2601 |
] |
2602 |
] ifFalse:[ |
|
2603 |
bounds left < x1 ifTrue:[ |
|
2604 |
x1 := bounds left. |
|
2052 | 2605 |
mustDrawNextScroller := true. |
2018 | 2606 |
] |
2052 | 2607 |
]. |
2608 |
mustDrawNextScroller ifTrue:[ |
|
2609 |
self drawScrollerAt:#NEXT bounds:bounds. |
|
2610 |
]. |
|
1387
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2611 |
] |
ad7a920fdf61
less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents:
1382
diff
changeset
|
2612 |
]. |
2018 | 2613 |
(y1 > y0 and:[x1 > x0]) ifTrue:[ |
2614 |
self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0) |
|
2016 | 2615 |
]. |
2052 | 2616 |
|
2617 |
"Modified: / 15.11.2001 / 20:57:32 / cg" |
|
388 | 2618 |
! ! |
2619 |
||
2620 |
!MenuPanel methodsFor:'enumerting & searching'! |
|
2621 |
||
2622 |
collect:aOneArgBlock |
|
2623 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel |
|
2715 | 2624 |
and return a collection of the results" |
2625 |
||
388 | 2626 |
items notNil ifTrue:[^ items collect:aOneArgBlock ]. |
2059 | 2627 |
^ nil |
388 | 2628 |
! |
2629 |
||
2630 |
do:aOneArgBlock |
|
2715 | 2631 |
"evaluate the argument, aOneArgBlock for every item in the menuPanel." |
2632 |
||
388 | 2633 |
items notNil ifTrue:[ items do:aOneArgBlock ]. |
2634 |
! |
|
2635 |
||
2636 |
findFirst:aOneArgBlock |
|
2637 |
"find the first item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2638 |
returns true; return its index or 0 if none detected." |
2639 |
||
388 | 2640 |
items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ]. |
2715 | 2641 |
^ 0 |
388 | 2642 |
! |
2643 |
||
2644 |
findLast:aOneArgBlock |
|
2645 |
"find the last item, for which evaluation of the argument, aOneArgBlock |
|
2715 | 2646 |
returns true; return its index or 0 if none detected." |
2647 |
||
388 | 2648 |
items notNil ifTrue:[ ^ items findLast:aOneArgBlock ]. |
2715 | 2649 |
^ 0 |
388 | 2650 |
! |
2651 |
||
390 | 2652 |
indexOf:something |
2653 |
"returns index of an item assigned to an index, nameKey, textLabel or value if symbol. |
|
2715 | 2654 |
If no item match 0 is returned. No range checks are performed on a number argument" |
2655 |
||
390 | 2656 |
|i v| |
2657 |
||
2658 |
something isNumber ifTrue:[ ^ something ]. |
|
2659 |
something isNil ifTrue:[ ^ 0 ]. |
|
2660 |
||
1218 | 2661 |
i := self findFirst:[:el | (el nameKey = something) or: [el = something]]. |
390 | 2662 |
|
2663 |
i ~~ 0 ifTrue:[ |
|
2715 | 2664 |
^ i |
388 | 2665 |
]. |
390 | 2666 |
|
2667 |
something isSymbol ifTrue:[ |
|
2715 | 2668 |
i := self findFirst:[:el| |
2669 |
v := el value. |
|
2670 |
v isSymbol and:[v == something] |
|
2671 |
]. |
|
2672 |
i ~~ 0 ifTrue:[ |
|
2673 |
^ i |
|
2674 |
] |
|
390 | 2675 |
]. |
2676 |
||
2677 |
(something respondsTo:#string) ifTrue:[ |
|
2715 | 2678 |
v := something string. |
1218 | 2679 |
^ self findFirst:[:el | el textLabel = v]. |
2680 |
]. |
|
2681 |
^ 0 |
|
388 | 2682 |
! |
2683 |
||
706 | 2684 |
indexOfItem:anItem |
2715 | 2685 |
"returns the index of the item or 0" |
2686 |
||
706 | 2687 |
^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0] |
2688 |
! |
|
2689 |
||
388 | 2690 |
keysAndValuesDo:aTwoArgBlock |
2715 | 2691 |
"evaluate the argument, aTwoArgBlock for every item in the menuPanel." |
2692 |
||
388 | 2693 |
items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ]. |
2694 |
! ! |
|
2695 |
||
2696 |
!MenuPanel methodsFor:'event handling'! |
|
2697 |
||
2698 |
buttonMotion:state x:x y:y |
|
2715 | 2699 |
"open or close the corresponding submenu" |
2700 |
||
2046 | 2701 |
|menue motionPoint translatedPoint sensor| |
1699 | 2702 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2703 |
self scrollActivity isActive ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2704 |
^ self |
2016 | 2705 |
]. |
2706 |
||
1699 | 2707 |
sensor := self sensor. |
2708 |
||
2709 |
(sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[ |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2710 |
^ self |
1699 | 2711 |
]. |
2712 |
menue := self detectGrabMenu. |
|
1841 | 2713 |
|
2046 | 2714 |
motionPoint := x@y. |
2715 |
translatedPoint := menue translateGrabPoint:motionPoint. |
|
2048 | 2716 |
menue handleButtonMotion:state atPoint:translatedPoint. |
1699 | 2717 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2718 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2719 |
|
1699 | 2720 |
(self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2721 |
^ self |
1699 | 2722 |
]. |
2723 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2724 |
(selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2725 |
"/ 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
|
2726 |
(self containsPoint:motionPoint) ifFalse:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2727 |
^ self accept:nil |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2728 |
] |
1699 | 2729 |
]. |
2730 |
||
2048 | 2731 |
"Modified: / 13.11.2001 / 20:21:49 / cg" |
1699 | 2732 |
! |
2733 |
||
2734 |
buttonPress:button x:x y:y |
|
2715 | 2735 |
"any button pressed; open or close the corresponding submenus" |
2736 |
||
2016 | 2737 |
|menu point| |
2738 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2739 |
hideOnRelease := true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2740 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2741 |
self scrollActivity stop. |
2016 | 2742 |
point := x@y. |
2743 |
menu := self detectMenuAtGrabPoint:point. |
|
2744 |
||
2745 |
menu isNil ifTrue:[ |
|
2133
293dadf237ad
hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
2746 |
"/ self accept:nil |
2016 | 2747 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2748 |
point := menu translateGrabPoint:point. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2749 |
menu handleButtonPressAtPoint:point. |
2016 | 2750 |
] |
2046 | 2751 |
|
2752 |
"Modified: / 13.11.2001 / 14:12:32 / cg" |
|
1699 | 2753 |
! |
2754 |
||
2755 |
buttonRelease:button x:x y:y |
|
2715 | 2756 |
"button release action; accept selection and close all views" |
2757 |
||
2679 | 2758 |
|topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction |
2715 | 2759 |
buttonReleaseTime menuOpenTime| |
2199 | 2760 |
|
2761 |
topMenu := self topMenu. |
|
2762 |
topMenu openDelayed:nil. |
|
1699 | 2763 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2764 |
self scrollActivity stop ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2765 |
^ self |
2016 | 2766 |
]. |
2767 |
||
1699 | 2768 |
dstMenu := topMenu activeMenu. |
2769 |
||
2679 | 2770 |
hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not]. |
2771 |
||
2772 |
hideMenuAndPerformAction ifFalse:[ |
|
2773 |
hideOnRelease ifTrue:[ |
|
2774 |
buttonReleaseTime := Time millisecondClockValue. |
|
2775 |
menuOpenTime := dstMenu mapTime. |
|
2776 |
"/ t := windowGroup lastEvent timeStamp. |
|
2777 |
hideMenuAndPerformAction := (OperatingSystem millisecondTimeDeltaBetween:buttonReleaseTime and:menuOpenTime) |
|
2778 |
> (PopUpMenu maxClickTimeToStayOpen). |
|
2779 |
]. |
|
2780 |
]. |
|
2781 |
||
2782 |
hideMenuAndPerformAction ifTrue:[ |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2783 |
srcPoint := x@y. |
1699 | 2784 |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2785 |
( (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2786 |
and:[(item := dstMenu selection) notNil] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2787 |
) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2788 |
item visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2789 |
dstMenu selection:nil. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2790 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2791 |
(selection isNil and:[self isPopUpView not]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2792 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2793 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2794 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2795 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2796 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2797 |
subm := item currentSubmenu. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2798 |
|
2374 | 2799 |
subm notNil ifTrue:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2800 |
subm shown ifTrue:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2801 |
"/ test whether any action is assigned to the menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2802 |
"/ if not ignorre accept |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2803 |
item hasDelayedMenu ifFalse:[^ self]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2804 |
"/ handle action defined for the delayed menu |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2805 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2806 |
dstPoint := dstMenu translateGrabPoint:srcPoint. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2807 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2808 |
(dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[ |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2809 |
item := nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2810 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2811 |
topMenu acceptItem:item inMenu:dstMenu. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
2812 |
^ self |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2813 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2814 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2815 |
(selection notNil and:[dstMenu == self]) ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2816 |
selection visibleSubmenu notNil ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2817 |
^ self |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2818 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2819 |
]. |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2820 |
self accept:nil. |
1699 | 2821 |
]. |
2822 |
! |
|
2823 |
||
2824 |
keyPress:key x:x y:y |
|
2715 | 2825 |
"any key is pressed" |
2826 |
||
2251 | 2827 |
|menu superMenu sensor| |
2828 |
||
2829 |
sensor := self sensor. |
|
2374 | 2830 |
sensor isNil ifTrue:[^ self]. |
2251 | 2831 |
|
2832 |
sensor anyButtonPressed ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2833 |
^ self "/ ignored while any button is pressed |
2251 | 2834 |
]. |
1699 | 2835 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2836 |
self scrollActivity isActive ifTrue:[ |
2016 | 2837 |
key ~~ #Escape ifTrue:[ |
2838 |
^ self |
|
2839 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2840 |
self scrollActivity stop |
2016 | 2841 |
]. |
2842 |
||
1699 | 2843 |
(key == #Tab |
2844 |
or:[key == #FocusNext |
|
2845 |
or:[key == #FocusPrevious]]) ifTrue:[ |
|
2846 |
self accept:nil. |
|
2374 | 2847 |
^ super keyPress:key x:x y:y |
1699 | 2848 |
]. |
2849 |
||
2850 |
menu := self detectGrabMenu. |
|
2251 | 2851 |
superMenu := menu superMenu. |
1699 | 2852 |
|
2853 |
key == #Escape ifTrue:[ |
|
2854 |
"/ must hide the active menu |
|
2251 | 2855 |
(superMenu notNil and:[superMenu ~~ self]) ifTrue:[ |
1703 | 2856 |
"/ hide active menu but keep the grab |
2251 | 2857 |
superMenu selection:nil |
1699 | 2858 |
] ifFalse:[ |
1703 | 2859 |
"/ hide active menu and ungrab |
1699 | 2860 |
self accept:nil |
2251 | 2861 |
]. |
2862 |
^ self |
|
2863 |
]. |
|
2864 |
||
2865 |
menu isViewWrapper ifFalse:[ |
|
2866 |
sensor compressKeyPressEventsWithKey:key. |
|
2867 |
menu handleKeyPress:key. |
|
2374 | 2868 |
^ self |
2251 | 2869 |
]. |
2870 |
superMenu == self ifFalse:[^ self]. |
|
2871 |
||
2872 |
"/ allow cursor movement |
|
2873 |
(key == #CursorLeft or:[key == #CursorRight]) ifTrue:[ |
|
2874 |
(self containsPoint:x@y) ifTrue:[ |
|
2875 |
self handleKeyPress:key. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2876 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
2877 |
]. |
1699 | 2878 |
! |
2879 |
||
2880 |
pointerLeave:state |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2881 |
|sensor| |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2882 |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
2883 |
self scrollActivity isActive ifTrue:[^ self]. |
2016 | 2884 |
|
1699 | 2885 |
self detectGrabMenu handlePointerLeave:state. |
2886 |
||
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2887 |
(selection isNil or:[self isPopUpView]) ifTrue:[ |
2251 | 2888 |
^ self |
2889 |
]. |
|
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2890 |
|
2374 | 2891 |
selection visibleSubmenu notNil ifTrue:[^ self]. |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2892 |
|
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2893 |
windowGroup focusView ~~ self ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2894 |
self accept:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2895 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2896 |
selection isButton ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2897 |
sensor := self sensor. |
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 |
sensor isNil ifTrue:[ |
2251 | 2900 |
self accept:nil |
2255
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2901 |
] ifFalse:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2902 |
"/ I'have the focus; if no button pressed, than keep the selection |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2903 |
sensor anyButtonPressed ifTrue:[ |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2904 |
self selection:nil |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2905 |
] |
e8bf6618da02
#pointerLeave: depends on selection, focusView, mouseButton...
ca
parents:
2253
diff
changeset
|
2906 |
]. |
2251 | 2907 |
] |
1699 | 2908 |
]. |
2909 |
! |
|
2910 |
||
2911 |
sizeChanged:how |
|
2715 | 2912 |
"redraw #right groups" |
2913 |
||
2018 | 2914 |
self isPopUpView ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2915 |
mustRearrange := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
2916 |
self invalidate |
1699 | 2917 |
]. |
2918 |
super sizeChanged:how |
|
2919 |
! ! |
|
2920 |
||
2503 | 2921 |
!MenuPanel methodsFor:'event handling-processing'! |
1699 | 2922 |
|
1767 | 2923 |
clearImplicitGrab |
2253 | 2924 |
implicitGrabView := lastPointerView := nil. |
1767 | 2925 |
! |
2926 |
||
2927 |
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2928 |
"dispatch and handle an event" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
2929 |
|
2253 | 2930 |
|view x y p syntheticEvent menu| |
1767 | 2931 |
|
2658 | 2932 |
ev isDamage ifTrue:[ |
2933 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2934 |
]. |
|
2935 |
||
1767 | 2936 |
"/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.) |
2937 |
"/ but never get the buttonRelease, since someone else (a popUp) grabbed the |
|
2938 |
"/ pointer in the meantime, and has eaten the release event ... (double-sigh) |
|
2939 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 2940 |
self sensor leftButtonPressed ifFalse:[ |
2941 |
self clearImplicitGrab. |
|
2942 |
]. |
|
1767 | 2943 |
]. |
2944 |
||
2945 |
((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[ |
|
2253 | 2946 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false. |
1767 | 2947 |
]. |
2948 |
||
2949 |
implicitGrabView notNil ifTrue:[ |
|
2253 | 2950 |
ev isButtonEvent ifTrue:[ |
2951 |
p := device translatePoint:(x@y) fromView:self toView:implicitGrabView. |
|
2952 |
ev view:implicitGrabView. |
|
2953 |
ev arguments at:2 put:p x. |
|
2954 |
ev arguments at:3 put:p y. |
|
2955 |
implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2956 |
||
2957 |
ev isButtonReleaseEvent ifTrue:[ |
|
2958 |
self clearImplicitGrab. |
|
2959 |
]. |
|
2960 |
^ self |
|
2961 |
] |
|
1767 | 2962 |
]. |
2963 |
menu := self detectMenuAtGrabPoint:(x@y). |
|
2964 |
||
2016 | 2965 |
(menu isNil or:[menu isViewWrapper not]) ifTrue:[ |
2253 | 2966 |
self clearImplicitGrab. |
1767 | 2967 |
^ super dispatchEvent:ev withFocusOn:focusView delegate:false |
2968 |
]. |
|
2969 |
||
2970 |
p := menu translateGrabPoint:(x@y). |
|
2971 |
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
|
2972 |
p := device translatePoint:(x@y) fromView:self toView:view. |
1767 | 2973 |
|
2974 |
ev isButtonPressEvent ifTrue:[ |
|
2253 | 2975 |
(view wantsFocusWithButtonPress) ifTrue:[ |
2976 |
view requestFocus. |
|
2977 |
]. |
|
2978 |
view ~~ self ifTrue:[ "/ can this ever be self ? |
|
2979 |
implicitGrabView := view. |
|
2980 |
] |
|
2981 |
]. |
|
1767 | 2982 |
|
2983 |
ev isButtonMotionEvent ifTrue:[ |
|
2253 | 2984 |
lastPointerView ~~ view ifTrue:[ |
2985 |
"/ must generate enter/leave ... (sigh) |
|
2986 |
lastPointerView notNil ifTrue:[ |
|
2987 |
"/ XXX: should be fixed |
|
2988 |
syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView. |
|
2989 |
lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2990 |
]. |
|
2991 |
view notNil ifTrue:[ |
|
2992 |
syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view. |
|
2993 |
view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false. |
|
2994 |
]. |
|
2995 |
lastPointerView := view. |
|
2996 |
]. |
|
1767 | 2997 |
]. |
2998 |
||
2999 |
ev view:view. |
|
3000 |
ev x:p x. |
|
3001 |
ev y:p y. |
|
3002 |
view dispatchEvent:ev withFocusOn:focusView delegate:false. |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3003 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
3004 |
"Modified: / 10.10.2001 / 13:54:47 / cg" |
1767 | 3005 |
! |
3006 |
||
2048 | 3007 |
handleButtonMotion:state atPoint:motionPoint |
2715 | 3008 |
"open or close the corresponding submenus" |
3009 |
||
2251 | 3010 |
|menu item translatedPoint containsPoint| |
3011 |
||
3012 |
containsPoint := self containsPoint:motionPoint. |
|
3013 |
containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ] |
|
3014 |
ifFalse:[ item := nil ]. |
|
3015 |
||
3016 |
self pointerEntersItem:item. |
|
1699 | 3017 |
|
1910 | 3018 |
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[ |
2251 | 3019 |
"/ only update pointerEnter |
2048 | 3020 |
^ self |
3021 |
]. |
|
3022 |
||
2251 | 3023 |
containsPoint ifTrue:[ |
3024 |
self selection:item openMenu:true. |
|
2374 | 3025 |
^ self |
2251 | 3026 |
]. |
3027 |
||
3028 |
menu := self superMenuAtPoint:motionPoint. |
|
3029 |
||
2374 | 3030 |
menu notNil ifTrue:[ |
2046 | 3031 |
translatedPoint := self translateMenuPoint:motionPoint toMenu:menu. |
2251 | 3032 |
menu handleButtonMotion:state atPoint:translatedPoint. |
2374 | 3033 |
^ self |
2251 | 3034 |
]. |
3035 |
self isPopUpView ifTrue:[ |
|
3036 |
self selection:nil |
|
3037 |
]. |
|
2046 | 3038 |
! |
3039 |
||
3040 |
handleButtonPressAtPoint:aPoint |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3041 |
"a button pressed; open or close the corresponding submenus" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3042 |
|
2251 | 3043 |
| item sensor direction wasSelected| |
2016 | 3044 |
|
2046 | 3045 |
item := self itemAtPoint:aPoint. |
2374 | 3046 |
item isNil ifTrue:[ |
2251 | 3047 |
self selection:nil openMenu:false. |
2374 | 3048 |
^ self |
2251 | 3049 |
]. |
3050 |
||
3051 |
direction := self scrollerDirectionAtPoint:aPoint. |
|
3052 |
direction notNil ifTrue:[ |
|
3053 |
(self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[ |
|
3054 |
self pointerEntersItem:nil. |
|
3055 |
^ self |
|
2238 | 3056 |
] |
2016 | 3057 |
]. |
2251 | 3058 |
|
3059 |
wasSelected := (selection == item). |
|
3060 |
wasSelected ifFalse:[ |
|
3061 |
self selection:item openMenu:true |
|
3062 |
]. |
|
2199 | 3063 |
item hasDelayedMenu ifTrue:[^ self]. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
3064 |
|
2238 | 3065 |
(item isToggle or:[item triggerOnDown]) ifFalse:[ |
2251 | 3066 |
(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[ |
3067 |
item toggleSubmenuVisibility |
|
3068 |
]. |
|
2238 | 3069 |
^ self |
3070 |
]. |
|
3071 |
(item canAccept and:[item == self selection]) ifFalse:[ |
|
3072 |
^ self |
|
3073 |
]. |
|
3074 |
self invalidateItem:item repairNow:true. |
|
3075 |
self acceptItem:item inMenu:self. |
|
3076 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3077 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3078 |
[sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3079 |
sensor flushUserEvents. |
2238 | 3080 |
self selection:nil. |
2046 | 3081 |
|
3082 |
"Created: / 13.11.2001 / 14:12:04 / cg" |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
3083 |
"Modified: / 13.11.2001 / 19:50:52 / cg" |
2016 | 3084 |
! |
3085 |
||
1699 | 3086 |
handleCursorKey:aKey |
2715 | 3087 |
"handle a cursor key" |
3088 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3089 |
|next menu item isVrt backKey p1 p2 |
2354 | 3090 |
idx0 "{ Class:SmallInteger }" |
687 | 3091 |
idx "{ Class:SmallInteger }" |
1705 | 3092 |
size "{ Class:SmallInteger }" |
687 | 3093 |
| |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3094 |
(size := items size) == 0 ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3095 |
superMenu notNil ifTrue:[superMenu handleCursorKey:aKey]. |
2354 | 3096 |
^ self |
388 | 3097 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3098 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3099 |
isVrt := self verticalLayout. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3100 |
|
2016 | 3101 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3102 |
( (isVrt and:[aKey == #CursorUp or:[aKey == #CursorDown]]) |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3103 |
or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3104 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3105 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3106 |
(superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3107 |
^ superMenu handleCursorKey:aKey |
1699 | 3108 |
]. |
2016 | 3109 |
idx := 0. |
3110 |
||
3111 |
isVrt ifTrue:[ |
|
3112 |
"/ used because of vertical scrolling |
|
3113 |
idx := items findFirst:[:el| el layout top > 0 ]. |
|
2354 | 3114 |
idx ~~ 0 ifTrue:[idx := idx - 1 ] |
2016 | 3115 |
]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3116 |
] ifFalse:[ |
2016 | 3117 |
idx := self indexOf:selection. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3118 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3119 |
next := aKey == #CursorRight or:[aKey == #CursorDown]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3120 |
|
2354 | 3121 |
idx0 := idx. |
3122 |
size timesRepeat:[ |
|
3123 |
|el| |
|
3124 |
||
3125 |
next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1]. |
|
3126 |
||
3127 |
idx > size ifTrue:[ |
|
3128 |
idx := 0 "1" |
|
3129 |
] ifFalse:[ |
|
3130 |
idx < 0 ifTrue:[ |
|
3131 |
idx := size |
|
3132 |
] |
|
3133 |
]. |
|
3134 |
||
3135 |
idx == 0 ifTrue:[ |
|
3136 |
self selection:nil. |
|
3137 |
^ self |
|
3138 |
] ifFalse:[ |
|
3139 |
(el := items at:idx ifAbsent:nil) notNil ifTrue:[ |
|
3140 |
el canSelect ifTrue:[ |
|
3141 |
el hasDelayedMenu ifTrue:[ |
|
3142 |
"/ do not open menu |
|
3143 |
self selection:el openMenu:false |
|
3144 |
] ifFalse:[ |
|
3145 |
"/ open comes from style-sheet |
|
3146 |
self selection:el. |
|
3147 |
]. |
|
3148 |
^ self |
|
2249 | 3149 |
]. |
2354 | 3150 |
] |
3151 |
]. |
|
3152 |
idx == idx0 ifTrue:[ |
|
3153 |
^ self |
|
3154 |
]. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3155 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3156 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3157 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3158 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3159 |
superMenu notNil ifTrue:[ |
1791 | 3160 |
p1 := self translateGrabPoint:0. |
3161 |
p2 := superMenu translateGrabPoint:0. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3162 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3163 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3164 |
isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3165 |
(superMenu notNil and:[p1 x > p2 x]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3166 |
backKey := #CursorRight |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3167 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3168 |
backKey := #CursorLeft. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3169 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3170 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3171 |
(superMenu notNil and:[p1 y > p2 y]) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3172 |
backKey := #CursorDown |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3173 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3174 |
backKey := #CursorUp. |
1699 | 3175 |
] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3176 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3177 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3178 |
aKey == backKey ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3179 |
superMenu isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3180 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3181 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3182 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3183 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3184 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3185 |
superMenu selection hideSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3186 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3187 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3188 |
^ self |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3189 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3190 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3191 |
selection isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3192 |
superMenu isNil ifTrue:[^ self accept:nil]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3193 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3194 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3195 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3196 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3197 |
(item := items findFirst:[:el| el canSelect]) notNil ifTrue:[ |
2249 | 3198 |
self selectionIndex:item |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3199 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3200 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3201 |
^ self |
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 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3204 |
selection hasSubmenu ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3205 |
(menu := selection visibleSubmenu) isNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3206 |
selection toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3207 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3208 |
menu selectionIndex:1 |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3209 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3210 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3211 |
superMenu notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3212 |
superMenu verticalLayout ~~ isVrt ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3213 |
superMenu handleCursorKey:aKey |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3214 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3215 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3216 |
self accept:nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3217 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3218 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3219 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3220 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3221 |
handleKeyPress:key |
2715 | 3222 |
"any key is pressed" |
3223 |
||
2219 | 3224 |
|item inMenu| |
1699 | 3225 |
|
3226 |
(key == #Return or:[key == Character space]) ifTrue:[ |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3227 |
self handleReturnPressed |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3228 |
] ifFalse:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3229 |
key isCharacter ifTrue:[ |
1862 | 3230 |
"/ selection notNil ifTrue:[ |
3231 |
"/ inMenu := self |
|
3232 |
"/ ] ifFalse:[ |
|
3233 |
"/ (inMenu := superMenu) isNil ifTrue:[^ self]. |
|
3234 |
"/ ]. |
|
3235 |
inMenu := self. |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3236 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3237 |
(item := inMenu detectItemForKey:key) notNil ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3238 |
inMenu selection:item |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3239 |
] |
1699 | 3240 |
] ifFalse:[ |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3241 |
( key == #CursorDown or:[key == #CursorUp |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3242 |
or:[key == #CursorLeft or:[key == #CursorRight]]] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3243 |
) ifTrue:[ |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3244 |
self handleCursorKey:key |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3245 |
] |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3246 |
] |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3247 |
] |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3248 |
! |
1699 | 3249 |
|
3250 |
handlePointerLeave:state |
|
3251 |
self pointerEntersItem:nil. |
|
3252 |
super pointerLeave:state |
|
3253 |
! |
|
3254 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3255 |
handleReturnPressed |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3256 |
"any key is pressed" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3257 |
|
2238 | 3258 |
|sensor subm item| |
3259 |
||
3260 |
(item := selection) isNil ifTrue:[ |
|
3261 |
superMenu notNil ifTrue:[ |
|
2249 | 3262 |
item := superMenu selection. |
3263 |
||
3264 |
item value notNil ifTrue:[ |
|
3265 |
"/ is a delayed menu |
|
3266 |
self accept:item |
|
3267 |
] ifFalse:[ |
|
3268 |
item toggleSubmenuVisibility |
|
3269 |
] |
|
2238 | 3270 |
] ifFalse:[ |
3271 |
self accept |
|
3272 |
]. |
|
3273 |
^ self |
|
1841 | 3274 |
]. |
3275 |
selection hasSubmenu ifTrue:[ |
|
2238 | 3276 |
selection hasDelayedMenu ifFalse:[ |
2249 | 3277 |
selection toggleSubmenuVisibility. |
3278 |
^ self |
|
2238 | 3279 |
]. |
3280 |
subm := selection currentSubmenu. |
|
3281 |
||
3282 |
(subm notNil and:[subm shown]) ifTrue:[ |
|
2249 | 3283 |
selection toggleSubmenuVisibility. |
3284 |
^ self |
|
2238 | 3285 |
]. |
3286 |
self openDelayed:nil |
|
1841 | 3287 |
]. |
3288 |
self accept. |
|
3289 |
||
2238 | 3290 |
" test for toggle " |
3291 |
item isToggle ifTrue:[ |
|
3292 |
self selection:item. |
|
3293 |
] ifFalse:[ |
|
3294 |
(selection notNil and:[selection triggerOnDown]) ifFalse:[ |
|
3295 |
^ self |
|
3296 |
] |
|
3297 |
]. |
|
1841 | 3298 |
|
3299 |
(sensor := self sensor) isNil ifTrue:[ |
|
2238 | 3300 |
^ self |
1841 | 3301 |
]. |
3302 |
||
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3303 |
[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3304 |
sensor flushKeyboardFor:nil. |
2238 | 3305 |
Delay waitForSeconds:0.1. |
3306 |
sensor hasKeyPressEventFor:nil. |
|
1841 | 3307 |
] whileTrue. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3308 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
3309 |
|
1699 | 3310 |
pointerEntersItem:anItemOrNil |
3311 |
"the pointer moves over an item or nil; restore the old item and |
|
2715 | 3312 |
redraw the new item highlighted." |
3313 |
||
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3314 |
|oldItem newItem| |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3315 |
|
1699 | 3316 |
( anItemOrNil notNil |
3317 |
and:[anItemOrNil canSelect |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3318 |
and:[selection isNil |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3319 |
and:[self isPopUpView not]]]) ifTrue:[ |
1699 | 3320 |
anItemOrNil isButton ifTrue:[ |
2219 | 3321 |
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor |
3322 |
or:[self buttonEnteredLevel ~= self buttonPassiveLevel] |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3323 |
) ifTrue:[ |
1699 | 3324 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3325 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3326 |
] ifFalse:[ |
2219 | 3327 |
(self enteredLevel ~~ 0 |
3328 |
or:[self enteredBackgroundColor ~= self backgroundColor] |
|
3329 |
) ifTrue:[ |
|
1699 | 3330 |
newItem := anItemOrNil |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3331 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3332 |
] |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3333 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3334 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3335 |
newItem ~~ enteredItem ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3336 |
oldItem := enteredItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3337 |
enteredItem := newItem. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3338 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3339 |
oldItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3340 |
self invalidateItem:oldItem repairNow:(enteredItem isNil). |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3341 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3342 |
|
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3343 |
enteredItem notNil ifTrue:[ |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3344 |
self invalidateItem:enteredItem repairNow:true. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3345 |
]. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3346 |
]. |
388 | 3347 |
! ! |
3348 |
||
2251 | 3349 |
!MenuPanel methodsFor:'focus handling'! |
3350 |
||
3351 |
hasKeyboardFocus:aBoolean |
|
2715 | 3352 |
"notification from the windowGroup that I got/lost the keyboard focus." |
3353 |
||
2251 | 3354 |
|focusView| |
3355 |
||
3356 |
self isPopUpView ifTrue:[ |
|
3357 |
"/ not visible for popup menus |
|
3358 |
^ super hasKeyboardFocus:aBoolean |
|
3359 |
]. |
|
3360 |
||
3361 |
(aBoolean not and:[selection notNil]) ifTrue:[ |
|
3362 |
hasImplicitGrap ~~ true ifTrue:[ |
|
3363 |
focusView := windowGroup focusView. |
|
3364 |
||
3365 |
focusView == self ifFalse:[ |
|
3366 |
self selection:nil. |
|
3367 |
] |
|
3368 |
] |
|
3369 |
]. |
|
3370 |
super hasKeyboardFocus:aBoolean. |
|
3371 |
! ! |
|
3372 |
||
388 | 3373 |
!MenuPanel methodsFor:'grabbing'! |
3374 |
||
1699 | 3375 |
doGrab |
3376 |
relativeGrabOrigin := nil. |
|
3377 |
||
3378 |
superMenu notNil ifTrue:[ |
|
2219 | 3379 |
superMenu doGrab |
1699 | 3380 |
] ifFalse:[ |
2219 | 3381 |
hasImplicitGrap ~~ true ifTrue:[ |
3382 |
self grabMouseAndKeyboard. |
|
3383 |
hasImplicitGrap := true |
|
3384 |
] |
|
1699 | 3385 |
] |
3386 |
! |
|
3387 |
||
3388 |
doUngrab:forceDo |
|
3389 |
||
3390 |
relativeGrabOrigin := nil. |
|
1767 | 3391 |
self clearImplicitGrab. |
1699 | 3392 |
|
3393 |
superMenu notNil ifTrue:[ |
|
2219 | 3394 |
forceDo ifTrue:[ |
3395 |
superMenu doUngrab:true |
|
3396 |
]. |
|
3397 |
^ self |
|
1699 | 3398 |
]. |
3399 |
||
3400 |
hasImplicitGrap ~~ true ifTrue:[ |
|
2219 | 3401 |
^ self |
1699 | 3402 |
]. |
3403 |
||
3404 |
forceDo ifFalse:[ |
|
2219 | 3405 |
(selection notNil or:[prevFocusView == self]) ifTrue:[ |
3406 |
^ self |
|
3407 |
]. |
|
1699 | 3408 |
]. |
3409 |
self ungrabMouseAndKeyboard. |
|
3410 |
self selection:nil. |
|
3411 |
hasImplicitGrap := nil. |
|
1703 | 3412 |
prevFocusView := nil. |
3413 |
||
1699 | 3414 |
! |
3415 |
||
1630 | 3416 |
grabKeyboard |
2715 | 3417 |
"grap the keyboard; keep previous grab" |
3418 |
||
1630 | 3419 |
previousKeyboardGrab := device activeKeyboardGrab. |
2713 | 3420 |
^ super grabKeyboard |
1630 | 3421 |
! |
3422 |
||
388 | 3423 |
grabMouseAndKeyboard |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3424 |
"get exclusive access to pointer and keyboard" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3425 |
|
388 | 3426 |
|sensor| |
3427 |
||
3428 |
realized ifTrue:[ |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3429 |
prevFocusView := self windowGroup focusView. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3430 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3431 |
sensor := self sensor. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3432 |
device activePointerGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3433 |
sensor flushMotionEventsFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3434 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3435 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3436 |
Delay waitForSeconds:0.1. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3437 |
(self grabPointer) ifFalse:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3438 |
"give up" |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3439 |
'MenuPanel [warning]: could not grab pointer' errorPrintCR. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3440 |
self unmap |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3441 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3442 |
] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3443 |
]. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3444 |
|
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3445 |
device activeKeyboardGrab ~~ self ifTrue:[ |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3446 |
device sync. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3447 |
sensor flushKeyboardFor:nil. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3448 |
self grabKeyboard. |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2481
diff
changeset
|
3449 |
] |
388 | 3450 |
] |
3451 |
||
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3452 |
"Modified: / 2.2.1998 / 23:43:59 / stefan" |
1254 | 3453 |
"Modified: / 15.3.1999 / 12:01:38 / cg" |
388 | 3454 |
! |
3455 |
||
1630 | 3456 |
grabPointerWithCursor:aCursorOrNil |
2715 | 3457 |
"grap the pointer; keep previous grab" |
3458 |
||
1630 | 3459 |
previousPointerGrab := device activePointerGrab. |
1699 | 3460 |
hasImplicitGrap := true. |
2715 | 3461 |
^ super grabPointerWithCursor:aCursorOrNil |
1630 | 3462 |
! |
3463 |
||
3464 |
ungrabKeyboard |
|
2715 | 3465 |
"ungrap the keyboard; restore previous grab" |
3466 |
||
1630 | 3467 |
super ungrabKeyboard. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3468 |
|
2579 | 3469 |
(previousKeyboardGrab notNil |
3470 |
and:[ previousKeyboardGrab realized ]) ifTrue:[ |
|
3471 |
device grabKeyboardInView:previousKeyboardGrab. |
|
3472 |
]. |
|
1630 | 3473 |
! |
3474 |
||
388 | 3475 |
ungrabMouseAndKeyboard |
2715 | 3476 |
"ungrab resources (mouse and keyboard)" |
3477 |
||
1630 | 3478 |
self ungrabPointer. |
3479 |
self ungrabKeyboard. |
|
3480 |
! |
|
3481 |
||
3482 |
ungrabPointer |
|
2715 | 3483 |
"ungrap the pointer; restore previous grab" |
3484 |
||
1630 | 3485 |
super ungrabPointer. |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3486 |
|
2579 | 3487 |
(previousPointerGrab notNil |
3488 |
and:[ previousPointerGrab realized ]) ifTrue:[ |
|
3489 |
device grabPointerInView:previousPointerGrab. |
|
1630 | 3490 |
]. |
388 | 3491 |
! ! |
3492 |
||
1251 | 3493 |
!MenuPanel methodsFor:'help'! |
3494 |
||
2058 | 3495 |
flyByHelpTextAt:srcPoint |
3496 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
|
2715 | 3497 |
If there is a selection, that items helpText is used (ignoring the given point)." |
3498 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3499 |
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
|
3500 |
^ nil |
2058 | 3501 |
! |
3502 |
||
3503 |
flyByHelpTextForItem:anItem |
|
2715 | 3504 |
"returns the helpText for an item (empty if none)" |
3505 |
||
2063 | 3506 |
anItem isNil ifTrue:[^ nil]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3507 |
^ anItem flyByHelpText. |
2058 | 3508 |
! |
3509 |
||
1251 | 3510 |
helpText |
2715 | 3511 |
"return the helpText for the currently selected item (empty if none)" |
3512 |
||
1613 | 3513 |
^ self helpTextForItem:selection |
1251 | 3514 |
! |
3515 |
||
1699 | 3516 |
helpTextAt:srcPoint |
1252 | 3517 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item). |
2715 | 3518 |
If there is a selection, that items helpText is used (ignoreing the given point)." |
3519 |
||
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3520 |
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
|
3521 |
^ '' |
1613 | 3522 |
! |
3523 |
||
3524 |
helpTextForItem:anItem |
|
2715 | 3525 |
"returns the helpText for an item (empty if none)" |
3526 |
||
1613 | 3527 |
anItem isNil ifTrue:[^ '']. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
3528 |
^ anItem activeHelpText. |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3529 |
! |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3530 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3531 |
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
|
3532 |
|dstMenu dstPoint item| |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3533 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3534 |
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
|
3535 |
dstMenu notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
3536 |
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
|
3537 |
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
|
3538 |
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
|
3539 |
] |
1251 | 3540 |
! ! |
3541 |
||
794 | 3542 |
!MenuPanel methodsFor:'image registration'! |
3543 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
3544 |
imageOnMyDevice:anImage |
2715 | 3545 |
"returns image registered on device" |
3546 |
||
794 | 3547 |
^ self class image:anImage onDevice:device |
3548 |
! |
|
3549 |
||
3550 |
lightenedImageOnDevice:anImage |
|
2715 | 3551 |
"returns lightened image registered on device" |
3552 |
||
794 | 3553 |
^ self class lightenedImage:anImage onDevice:device |
3554 |
! ! |
|
3555 |
||
1688 | 3556 |
!MenuPanel methodsFor:'initialization & release'! |
388 | 3557 |
|
767
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3558 |
addToCurrentProject |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3559 |
"ignored here" |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3560 |
! |
ffa2a09a1039
added #addToCurrentProject in order to avoid restart errors
tz
parents:
746
diff
changeset
|
3561 |
|
388 | 3562 |
create |
2715 | 3563 |
"create the shadow view for a none contained submenu" |
3564 |
||
388 | 3565 |
super create. |
3566 |
||
3567 |
self isPopUpView ifTrue:[ |
|
2715 | 3568 |
(PopUpView shadowsOnDevice:device) ifTrue:[ |
3569 |
shadowView isNil ifTrue:[ |
|
3570 |
shadowView := (ShadowView onDevice:device) for:self |
|
3571 |
] ifFalse:[ |
|
3572 |
self saveUnder:true. |
|
3573 |
]. |
|
3574 |
] |
|
388 | 3575 |
] ifFalse:[ |
2715 | 3576 |
explicitExtent == true ifTrue:[ |
3577 |
(self width) == (superView width) ifTrue:[ |
|
3578 |
self verticalLayout:false |
|
3579 |
] |
|
3580 |
] |
|
388 | 3581 |
] |
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3582 |
|
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3583 |
"Modified: / 28.7.1998 / 02:11:44 / cg" |
388 | 3584 |
! |
3585 |
||
3586 |
destroy |
|
2715 | 3587 |
"destroy items and shadowView; remove dependencies" |
3588 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3589 |
self clearLastActiveMenu. |
2051 | 3590 |
items notNil ifTrue:[items copy do:[:el|el destroy]]. |
2681 | 3591 |
items := nil. |
3592 |
self removeDependencies. |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3593 |
|
388 | 3594 |
super destroy. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3595 |
superMenu := nil. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3596 |
shadowView notNil ifTrue:[shadowView destroy]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3597 |
|
2051 | 3598 |
"Modified: / 15.11.2001 / 17:08:45 / cg" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3599 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3600 |
|
616 | 3601 |
fetchDeviceResources |
2715 | 3602 |
"fetch device colors, to avoid reallocation at redraw time" |
3603 |
||
2219 | 3604 |
|style| |
3605 |
||
2374 | 3606 |
superMenu notNil ifTrue:[ |
2219 | 3607 |
styleSheet := superMenu styleSheet |
3608 |
]. |
|
616 | 3609 |
|
3610 |
super fetchDeviceResources. |
|
3611 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
3612 |
"/ 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
|
3613 |
"/ (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
|
3614 |
|
616 | 3615 |
superMenu isNil ifTrue:[ |
2374 | 3616 |
rightArrow isNil ifTrue:[ |
2219 | 3617 |
rightArrow := SelectionInListView rightArrowFormOn:device. |
2059 | 3618 |
]. |
2219 | 3619 |
fgColor := fgColor onDevice:device. |
3620 |
style := styleSheet name. |
|
3621 |
||
3622 |
(style ~~ #os2 and:[style ~~ #win95]) ifTrue:[ |
|
3623 |
rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device |
|
3624 |
] ifFalse:[ |
|
3625 |
rightArrowShadow := nil |
|
3626 |
]. |
|
616 | 3627 |
] ifFalse:[ |
2219 | 3628 |
rightArrow := superMenu rightArrow. |
3629 |
rightArrowShadow := superMenu rightArrowShadow. |
|
3630 |
||
3631 |
self foregroundColor:(superMenu foregroundColor). |
|
2614 | 3632 |
self font:(superMenu font). |
2219 | 3633 |
self viewBackground:(superMenu viewBackground). |
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3634 |
]. |
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3635 |
|
1829 | 3636 |
items notNil ifTrue:[ |
2219 | 3637 |
items do:[:eachItem| eachItem fetchDeviceResources ] |
1829 | 3638 |
]. |
3639 |
||
1137
7df0b776e47a
fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents:
1130
diff
changeset
|
3640 |
"Modified: / 15.9.1998 / 12:51:29 / cg" |
616 | 3641 |
! |
3642 |
||
580 | 3643 |
initStyle |
3644 |
"initialize style specific stuff" |
|
3645 |
||
2609 | 3646 |
|fn| |
3647 |
||
580 | 3648 |
super initStyle. |
616 | 3649 |
|
2609 | 3650 |
fgColor := DefaultForegroundColor ? Color black. |
3651 |
DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ]. |
|
3652 |
fn := self class defaultFont. |
|
2610 | 3653 |
fn notNil ifTrue:[ self font:fn ]. |
1923 | 3654 |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3655 |
defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3656 |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3657 |
self updateLevelAndBorder. |
580 | 3658 |
! |
3659 |
||
388 | 3660 |
initialize |
2715 | 3661 |
"set default configuration" |
3662 |
||
388 | 3663 |
super initialize. |
616 | 3664 |
|
1730
4936edfc2eee
must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents:
1728
diff
changeset
|
3665 |
self enableMotionEvents. |
498 | 3666 |
enabled := true. |
1877
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3667 |
self extentChangedFlag:false. |
3b415fa4710f
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
1874
diff
changeset
|
3668 |
self originChangedFlag:false. |
2253 | 3669 |
explicitExtent := nil. |
3670 |
shortKeyInset := 0. |
|
3671 |
mustRearrange := false. |
|
3672 |
showSeparatingLines := false. |
|
3673 |
showGroupDivider := true. |
|
388 | 3674 |
! |
3675 |
||
1573 | 3676 |
map |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3677 |
"grab the pointer here, when visible (but not if control has already been lost). |
2715 | 3678 |
If the grab fails, try again and unmap myself if that fails too." |
3679 |
||
1791 | 3680 |
|loIndices loItems| |
388 | 3681 |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3682 |
enteredItem := nil. |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
3683 |
|
1024
28c87a2369f6
show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents:
1022
diff
changeset
|
3684 |
self enableMotionEvents. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3685 |
self becomesActiveMenu. |
1573 | 3686 |
super map. |
2681 | 3687 |
self addDependencies. |
388 | 3688 |
|
1785 | 3689 |
loIndices := InitialSelectionQuerySignal query. |
1791 | 3690 |
loItems := items ? #[]. |
3691 |
||
3692 |
loItems do:[:anItem| anItem fetchImages ]. |
|
1572 | 3693 |
|
388 | 3694 |
self isPopUpView ifTrue:[ |
2681 | 3695 |
self doGrab |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3696 |
] ifFalse:[ |
2681 | 3697 |
super viewBackground:(self backgroundColor). |
717
540e638fdebb
Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents:
712
diff
changeset
|
3698 |
]. |
1791 | 3699 |
loItems do:[:el| el updateIndicators ]. |
388 | 3700 |
|
1785 | 3701 |
loIndices size > 0 ifTrue:[ |
2681 | 3702 |
self redrawX:0 y:0 width:width height:height. |
3703 |
self openMenusFromItemIndices:loIndices. |
|
388 | 3704 |
]. |
3705 |
||
1177 | 3706 |
"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
|
3707 |
"Modified: / 18.3.1999 / 18:22:18 / stefan" |
388 | 3708 |
! |
3709 |
||
3710 |
realize |
|
2715 | 3711 |
"realize menu and shadowView" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
3712 |
|
388 | 3713 |
self isPopUpView ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3714 |
"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
|
3715 |
shadowView must be realized before self" |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3716 |
self hiddenOnRealize:true. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3717 |
super realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3718 |
self resize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3719 |
self makeFullyVisible. |
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3720 |
"/ self mustRearrange. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3721 |
shadowView notNil ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3722 |
shadowView realize. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3723 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3724 |
self raise. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3725 |
self map. |
736 | 3726 |
] ifFalse:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3727 |
super realize. |
1767 | 3728 |
]. |
3729 |
self allSubViewsDo:[:aView| aView realize ]. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
3730 |
hideOnRelease := defaultHideOnRelease. |
388 | 3731 |
! |
3732 |
||
3733 |
recreate |
|
1832 | 3734 |
"this is called after a snapin or a migration. |
2715 | 3735 |
If the image was saved with an active menu, hide the menu" |
3736 |
||
1455 | 3737 |
selection := nil. |
388 | 3738 |
super recreate. |
3739 |
! |
|
3740 |
||
1130 | 3741 |
reinitStyle |
3742 |
"handle style change while being open (win32 only - for now)" |
|
3743 |
||
3744 |
super reinitStyle. |
|
3745 |
||
3746 |
self fetchDeviceResources. |
|
1811 | 3747 |
self mustRearrange. "/ care for changed font sizes etc. |
3748 |
||
3749 |
self do:[:anItem | |
|
3750 |
anItem reinitStyle |
|
3751 |
]. |
|
1130 | 3752 |
|
3753 |
"Created: / 10.9.1998 / 21:37:05 / cg" |
|
1811 | 3754 |
"Modified: / 17.8.2000 / 18:01:33 / cg" |
1130 | 3755 |
! |
3756 |
||
388 | 3757 |
unmap |
1330 | 3758 |
"unmap the view - the view stays created (but invisible), and can be remapped again later. |
3759 |
If we have a popup supermenu, it will get all keyboard and mouse events." |
|
736 | 3760 |
|
2681 | 3761 |
self removeDependencies. |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
3762 |
self clearLastActiveMenu. |
1699 | 3763 |
self doUngrab:(superMenu isNil). |
3764 |
"/ self isPopUpView ifTrue:[ |
|
3765 |
"/ self doUngrab:(superMenu isNil) |
|
3766 |
"/ ]. |
|
3767 |
||
388 | 3768 |
super unmap. |
3769 |
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
|
3770 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3771 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3772 |
updateLevelAndBorder |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3773 |
"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
|
3774 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3775 |
|bw lvl| |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3776 |
|
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3777 |
self isPopUpView ifTrue:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3778 |
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
|
3779 |
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
|
3780 |
] ifFalse:[ |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3781 |
bw := styleSheet is3D ifFalse:[1] ifTrue:[0]. |
2372 | 3782 |
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
|
3783 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3784 |
self borderWidth:bw. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
3785 |
self level:lvl. |
388 | 3786 |
! ! |
3787 |
||
1878 | 3788 |
!MenuPanel methodsFor:'keyboard control'! |
3789 |
||
3790 |
mnemonicViewNext:aKeyEvent |
|
3791 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
|
3792 |
is the mnemonic-key defined for any menuItem, handle the menuItem and |
|
2715 | 3793 |
return the topMenu otherwise nil." |
3794 |
||
2112 | 3795 |
|menu uKey lKey list index| |
3796 |
||
3797 |
superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ]. |
|
1878 | 3798 |
shown ifFalse:[^ nil]. |
3799 |
||
3800 |
uKey := aKeyEvent rawKey last asUppercase. |
|
3801 |
lKey := uKey asLowercase. |
|
2112 | 3802 |
|
3803 |
selection notNil ifTrue:[ |
|
2374 | 3804 |
"first lookup the current grapMenu before starting in the topMenu |
3805 |
" |
|
3806 |
menu := self detectGrabMenu. |
|
3807 |
||
3808 |
[ menu ~~ self ] whileTrue:[ |
|
3809 |
index := menu selectionIndex. |
|
3810 |
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
|
3811 |
maxDepth:10 from:(index + 1) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3812 |
ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ]. |
2112 | 3813 |
|
2374 | 3814 |
list size ~~ 0 ifTrue:[ |
3815 |
"/ has item which responds to the mnemonic |
|
3816 |
menu processCollectedIndices:list. |
|
3817 |
^ self |
|
3818 |
]. |
|
3819 |
menu := menu superMenu. |
|
3820 |
]. |
|
3821 |
index := self selectionIndex. |
|
3822 |
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
|
3823 |
maxDepth:10 from:(1 + index) to:99999 |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3824 |
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
|
3825 |
|
2112 | 3826 |
] ifFalse:[ |
2374 | 3827 |
index := 99999. |
3828 |
list := nil. |
|
2112 | 3829 |
]. |
3830 |
||
2374 | 3831 |
list isNil ifTrue:[ |
3832 |
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
|
3833 |
maxDepth:1 from:1 to:index |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3834 |
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
|
3835 |
|
2374 | 3836 |
|
3837 |
list isNil ifTrue:[ |
|
3838 |
"/ must clear existing selection |
|
3839 |
self selection:nil. |
|
3840 |
^ nil |
|
3841 |
] |
|
2112 | 3842 |
]. |
3843 |
||
3844 |
"/ has item which responds to the mnemonic |
|
3845 |
self processCollectedIndices:list. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3846 |
! |
1878 | 3847 |
|
3848 |
openMenusFromItemIndices:anItemIndiceList |
|
2715 | 3849 |
"open all menus derived from sequence of item indices" |
3850 |
||
1878 | 3851 |
|item| |
3852 |
||
3853 |
anItemIndiceList size == 0 ifTrue:[ |
|
2249 | 3854 |
^ self |
1878 | 3855 |
]. |
3856 |
item := self itemAt:(anItemIndiceList removeFirst). |
|
3857 |
||
3858 |
(item notNil and:[item enabled]) ifTrue:[ |
|
2249 | 3859 |
InitialSelectionQuerySignal answer:anItemIndiceList do:[ |
3860 |
self selection:item openMenu:true. |
|
3861 |
] |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3862 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3863 |
! |
1878 | 3864 |
|
3865 |
processCollectedIndices:indices |
|
3866 |
|menu item| |
|
3867 |
||
3868 |
indices size == 0 ifTrue:[ |
|
2219 | 3869 |
^ self |
1878 | 3870 |
]. |
3871 |
menu := self. |
|
3872 |
||
3873 |
[menu selectionIndex == indices first] whileTrue:[ |
|
2219 | 3874 |
( (item := menu selection) isNil "/ shouldn't happen |
3875 |
or:[(menu := item submenu) isNil] "/ no more indices; done |
|
3876 |
) ifTrue:[ |
|
3877 |
^ true |
|
3878 |
]. |
|
3879 |
indices removeFirst. |
|
3880 |
||
3881 |
indices isEmpty ifTrue:[ |
|
3882 |
menu selection:nil. |
|
3883 |
^ self |
|
3884 |
] |
|
1878 | 3885 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3886 |
menu openMenusFromItemIndices:indices. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3887 |
! |
1878 | 3888 |
|
3889 |
processShortcut:aKeyEvent |
|
3890 |
"a shortcutKey event as forwarded from the keyboardProcessor - if there is the |
|
2715 | 3891 |
shortcut-key defined process the shortcut and return true otherwise false." |
3892 |
||
2219 | 3893 |
|menu rKey lKey list item| |
1878 | 3894 |
|
3895 |
superMenu notNil ifTrue:[ |
|
3896 |
^ superMenu processShortcut:aKeyEvent |
|
3897 |
]. |
|
3898 |
shown ifFalse:[^ false]. |
|
3899 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3900 |
lKey := aKeyEvent key. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3901 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3902 |
"/ fast check, cursor keys are not supported |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3903 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3904 |
( #( CursorDown CursorUp CursorRight CursorLeft |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3905 |
) includes:lKey |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3906 |
) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3907 |
^ false. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3908 |
]. |
1878 | 3909 |
rKey := aKeyEvent rawKey. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3910 |
item := nil. |
1878 | 3911 |
menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu |
3912 |
||
3913 |
[true] whileTrue:[ |
|
3914 |
list := menu selectItemIndicesFor:[:el||skey| |
|
3915 |
item := el. |
|
3916 |
skey := el shortcutKey. |
|
3917 |
skey == rKey or:[skey == lKey] |
|
3918 |
] |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3919 |
maxDepth:10 from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3920 |
ignoreSubmenuBlock:[:anItem| anItem ignoreShortcutKeys ]. |
1878 | 3921 |
|
3922 |
list size ~~ 0 ifTrue:[ |
|
3923 |
"/ has item which responds to the shortcut |
|
3924 |
item hasSubmenu ifFalse:[ |
|
3925 |
menu accept:item |
|
3926 |
] ifTrue:[ |
|
3927 |
menu processCollectedIndices:list. |
|
3928 |
self windowGroup focusView:self. |
|
3929 |
]. |
|
3930 |
^ true |
|
3931 |
]. |
|
3932 |
||
3933 |
menu == self ifTrue:[ ^ false ]. |
|
3934 |
menu := self. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3935 |
]. |
2219 | 3936 |
^ false "/ never reached |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3937 |
! |
1878 | 3938 |
|
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3939 |
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
|
3940 |
"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
|
3941 |
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
|
3942 |
true. If no item is detected, nil is returned. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3943 |
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
|
3944 |
is created and passed through if the block returns false. |
2715 | 3945 |
Otherwise the item is not asked for its submenu." |
3946 |
||
2112 | 3947 |
|start stop| |
3948 |
||
3949 |
maxDepth <= 0 ifTrue:[^ nil]. |
|
3950 |
||
3951 |
start := aStart max:1. |
|
3952 |
stop := aStop min:(items size). |
|
3953 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3954 |
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
|
3955 |
item := items at:i. |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3956 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3957 |
(aOneArgBlock value:item) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3958 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3959 |
^ 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
|
3960 |
] |
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3961 |
] ifFalse:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3962 |
(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3963 |
(item enabled and:[item isVisible]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3964 |
(ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3965 |
menu := item submenu. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3966 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3967 |
(menu notNil and:[menu isEnabled]) ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3968 |
result := menu selectItemIndicesFor:aOneArgBlock |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3969 |
maxDepth:(maxDepth - 1) from:1 to:99999 |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3970 |
ignoreSubmenuBlock:ignoreSubmenueBlock. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3971 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3972 |
result notNil ifTrue:[ |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3973 |
result addFirst:i. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3974 |
^ result |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3975 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3976 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3977 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3978 |
]. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
3979 |
]. |
2603
edb5408fd3e7
prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents:
2579
diff
changeset
|
3980 |
]. |
1878 | 3981 |
]. |
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3982 |
^ nil |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
3983 |
! ! |
1878 | 3984 |
|
388 | 3985 |
!MenuPanel methodsFor:'misc'! |
3986 |
||
427
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3987 |
raiseDeiconified |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3988 |
^ self raise |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3989 |
|
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3990 |
"Created: 21.6.1997 / 13:29:12 / cg" |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3991 |
! |
82cbad72e197
raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents:
420
diff
changeset
|
3992 |
|
388 | 3993 |
superMenu |
2715 | 3994 |
"returns supermenu or nil" |
3995 |
||
388 | 3996 |
^ superMenu |
3997 |
! |
|
3998 |
||
3999 |
topMenu |
|
2715 | 4000 |
"returns the topMenu; the one having no superMenu" |
4001 |
||
1791 | 4002 |
|menu smenu| |
4003 |
||
4004 |
menu := self. |
|
4005 |
||
4006 |
[(smenu := menu superMenu) notNil] whileTrue:[ |
|
2715 | 4007 |
menu := smenu |
1791 | 4008 |
]. |
4009 |
^ menu |
|
388 | 4010 |
! ! |
4011 |
||
1825 | 4012 |
!MenuPanel methodsFor:'printing & storing'! |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4013 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4014 |
printString |
2715 | 4015 |
"return a printed representation of the menu" |
4016 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4017 |
|string label| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4018 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4019 |
string := 'Menu:'. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4020 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4021 |
self do:[:anItem| |
2715 | 4022 |
label := anItem label ? ''. |
4023 |
string := string ,' ', label printString. |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4024 |
]. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4025 |
^ string |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4026 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4027 |
"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
|
4028 |
! ! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4029 |
|
388 | 4030 |
!MenuPanel methodsFor:'private'! |
4031 |
||
434 | 4032 |
application |
2715 | 4033 |
"optimize access to retrive the application" |
4034 |
||
2374 | 4035 |
application notNil ifTrue:[^ application ]. |
434 | 4036 |
|
4037 |
superMenu notNil ifTrue:[ |
|
2253 | 4038 |
application := superMenu application. |
2374 | 4039 |
^ application |
2253 | 4040 |
]. |
4041 |
application := super application. |
|
2374 | 4042 |
^ application |
1872 | 4043 |
! |
434 | 4044 |
|
1572 | 4045 |
detectItemForKey:aKey |
4046 |
"returns the item assigned to a key, accessCharacter or starts with. |
|
2715 | 4047 |
if no item is detected nil is returned." |
4048 |
||
1572 | 4049 |
|cIdx uKey lKey item| |
4050 |
||
1699 | 4051 |
items isNil ifTrue:[^ nil]. |
4052 |
||
1572 | 4053 |
cIdx := self selectionIndex. |
4054 |
uKey := aKey asUppercase. |
|
4055 |
lKey := aKey asLowercase. |
|
4056 |
||
1699 | 4057 |
items keysAndValuesDo:[:anIndex :anItem| |char label| |
2715 | 4058 |
( anIndex ~~ cIdx |
4059 |
and:[anItem canSelect |
|
4060 |
and:[(label := anItem textLabel) notNil |
|
4061 |
and:[label size ~~ 0]]] |
|
4062 |
) ifTrue:[ |
|
4063 |
(char := anItem accessCharacter) notNil ifTrue:[ |
|
4064 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4065 |
^ anItem |
|
4066 |
] |
|
4067 |
] ifFalse:[ |
|
4068 |
char := label at:1. |
|
4069 |
||
4070 |
(char == uKey or:[char == lKey]) ifTrue:[ |
|
4071 |
anIndex > cIdx ifTrue:[ |
|
4072 |
^ anItem |
|
4073 |
]. |
|
4074 |
item isNil ifTrue:[item := anItem] |
|
4075 |
] |
|
4076 |
] |
|
4077 |
] |
|
1572 | 4078 |
]. |
4079 |
^ item |
|
4080 |
! |
|
4081 |
||
390 | 4082 |
menuAdornmentAt:aSymbol |
2715 | 4083 |
"returns a value derived from adornment" |
4084 |
||
2374 | 4085 |
adornment isNil ifTrue:[^ nil]. |
4086 |
^ adornment at:aSymbol ifAbsent:nil |
|
388 | 4087 |
! |
4088 |
||
390 | 4089 |
menuAdornmentAt:aSymbol put:something |
2715 | 4090 |
"sets a value for the specific menu" |
4091 |
||
2253 | 4092 |
|oldValue| |
4093 |
||
653 | 4094 |
adornment isNil ifTrue:[ |
2374 | 4095 |
something isNil ifTrue:[^ self]. |
2253 | 4096 |
adornment := IdentityDictionary new. |
4097 |
] ifFalse:[ |
|
4098 |
oldValue := adornment at:aSymbol ifAbsent:nil. |
|
4099 |
oldValue == something ifTrue:[^ self]. |
|
653 | 4100 |
]. |
4101 |
adornment at:aSymbol put:something. |
|
388 | 4102 |
! |
4103 |
||
4104 |
onEachPerform:aSelector withArgList:aList |
|
2715 | 4105 |
"on each item perform selector with an argument derived from aList" |
4106 |
||
388 | 4107 |
aList isCollection ifTrue:[ |
2715 | 4108 |
items size >= aList size ifTrue:[ |
4109 |
aList keysAndValuesDo:[:anIndex :anArg| |
|
4110 |
(items at:anIndex) perform:aSelector with:anArg |
|
4111 |
] |
|
4112 |
] |
|
388 | 4113 |
] ifFalse:[ |
2715 | 4114 |
self do:[:anItem| anItem perform:aSelector with:aList ] |
388 | 4115 |
] |
4116 |
! |
|
4117 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4118 |
registerImageOnDevice:anImage |
2269 | 4119 |
|
4120 |
anImage isNil ifTrue:[ ^ nil ]. |
|
4121 |
^ self class image:anImage onDevice:device |
|
4122 |
||
4123 |
"/ |image| |
|
4124 |
"/ |
|
4125 |
"/ (image := anImage) notNil ifTrue:[ |
|
4126 |
"/ image device ~~ device ifTrue:[ |
|
4127 |
"/ image := image copy. |
|
4128 |
"/ ]. |
|
4129 |
"/ image := image onDevice:device. |
|
4130 |
"/ image := image clearMaskedPixels. |
|
4131 |
"/ ]. |
|
4132 |
"/ ^ image |
|
2355 | 4133 |
! |
4134 |
||
4135 |
superMenu:aSuperMenu |
|
2715 | 4136 |
"set my supermenu from which i'am activated" |
4137 |
||
2355 | 4138 |
superMenu := aSuperMenu. |
4139 |
||
2374 | 4140 |
superMenu notNil ifTrue:[ |
2355 | 4141 |
styleSheet := superMenu styleSheet. |
4142 |
rightArrow := superMenu rightArrow. |
|
4143 |
rightArrowShadow := superMenu rightArrowShadow. |
|
4144 |
]. |
|
388 | 4145 |
! ! |
4146 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4147 |
!MenuPanel methodsFor:'private-activation'! |
687 | 4148 |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4149 |
activeMenu |
2715 | 4150 |
"returns the current active menu or self (the top menu)" |
4151 |
||
687 | 4152 |
^ lastActiveMenu ? self |
4153 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4154 |
"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
|
4155 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4156 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4157 |
activeMenu:aMenu |
2715 | 4158 |
"set the current active menu" |
4159 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4160 |
lastActiveMenu := aMenu |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4161 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4162 |
"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
|
4163 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4164 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4165 |
becomesActiveMenu |
2715 | 4166 |
"submenu becomes the active menu" |
4167 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4168 |
mapTime := Time millisecondClockValue. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4169 |
self topMenu activeMenu:self. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4170 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4171 |
"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
|
4172 |
! |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4173 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4174 |
clearLastActiveMenu |
2715 | 4175 |
"reset the current active menu" |
4176 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4177 |
|top| |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4178 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4179 |
top := self topMenu. |
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4180 |
|
2251 | 4181 |
"/ prevFocusView notNil ifTrue:[ |
4182 |
"/ self windowGroup focusView:prevFocusView. |
|
4183 |
"/ prevFocusView := nil. |
|
4184 |
"/ ]. |
|
4185 |
"/ |
|
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4186 |
top activeMenu == self ifTrue:[ |
2251 | 4187 |
top activeMenu:nil |
687 | 4188 |
] |
4189 |
||
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4190 |
"Created: / 27.2.1998 / 17:41:17 / cg" |
687 | 4191 |
! |
4192 |
||
4193 |
mapTime |
|
2715 | 4194 |
"returns the time when the menu becomes active" |
4195 |
||
687 | 4196 |
^ mapTime |
798
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4197 |
|
74f4e7b66a46
ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents:
794
diff
changeset
|
4198 |
"Modified: / 27.2.1998 / 17:41:18 / cg" |
687 | 4199 |
! ! |
4200 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4201 |
!MenuPanel methodsFor:'private-scrolling'! |
2016 | 4202 |
|
4203 |
hasScrollerAt:aDirection |
|
2715 | 4204 |
"returns true if a visible scroller at a direction exists" |
4205 |
||
2016 | 4206 |
|layout| |
4207 |
||
4208 |
self hasScrollers ifFalse:[ |
|
2715 | 4209 |
^ false |
2016 | 4210 |
]. |
4211 |
||
4212 |
aDirection == #PREV ifTrue:[ |
|
2715 | 4213 |
layout := items first layout. |
2016 | 4214 |
|
4215 |
^ self verticalLayout ifTrue:[ layout top < margin] |
|
2715 | 4216 |
ifFalse:[ layout left < margin] |
2016 | 4217 |
]. |
4218 |
layout := items last layout. |
|
4219 |
||
4220 |
^ self verticalLayout ifTrue:[ layout bottom > (height - margin)] |
|
2715 | 4221 |
ifFalse:[ layout right > (width - margin)] |
2016 | 4222 |
! |
4223 |
||
4224 |
hasScrollers |
|
2715 | 4225 |
"returns true if scrollers are needed" |
4226 |
||
2018 | 4227 |
|maxExtent first last isVert| |
4228 |
||
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4229 |
(mustRearrange or:[items size <= 1]) ifTrue:[^ false]. |
2018 | 4230 |
|
4231 |
isVert := self verticalLayout. |
|
4232 |
||
4233 |
superView notNil ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4234 |
((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
|
4235 |
or:[(last := items last layout) isNil] |
2715 | 4236 |
) ifTrue:[ |
4237 |
^ false |
|
4238 |
]. |
|
4239 |
isVert ifTrue:[ |
|
4240 |
^ first top < 0 or:[last bottom > height] |
|
4241 |
]. |
|
4242 |
^ first left < 0 or:[last right > width] |
|
2018 | 4243 |
]. |
4244 |
maxExtent := self maxExtent. |
|
4245 |
isVert ifTrue:[ |
|
2729
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4246 |
^ (height >= maxExtent y) |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4247 |
]. |
d28bc8243494
Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents:
2715
diff
changeset
|
4248 |
^ (width >= maxExtent x) |
2016 | 4249 |
! |
4250 |
||
4251 |
indexOfItemAtScroller:aDirection |
|
2715 | 4252 |
"returns the index of the item under the scroller or 0" |
4253 |
||
2016 | 4254 |
|bounds min max layout| |
4255 |
||
4256 |
bounds := self scrollerBoundsAt:aDirection. |
|
4257 |
||
4258 |
bounds isNil ifTrue:[ |
|
2715 | 4259 |
^ 0 |
2016 | 4260 |
]. |
4261 |
||
4262 |
self verticalLayout ifTrue:[ |
|
2715 | 4263 |
min := bounds top. |
4264 |
max := bounds bottom. |
|
4265 |
||
4266 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4267 |
anItem isVisible ifTrue:[ |
|
4268 |
layout := anItem layout. |
|
4269 |
||
4270 |
(layout top < max and:[layout bottom > min]) ifTrue:[ |
|
4271 |
^ anIndex |
|
4272 |
]. |
|
4273 |
]. |
|
4274 |
]. |
|
2016 | 4275 |
] ifFalse:[ |
2715 | 4276 |
min := bounds left. |
4277 |
max := bounds right. |
|
4278 |
||
4279 |
items keysAndValuesDo:[:anIndex :anItem| |
|
4280 |
anItem isVisible ifTrue:[ |
|
4281 |
layout := anItem layout. |
|
4282 |
||
4283 |
(layout left < max and:[layout right > min]) ifTrue:[ |
|
4284 |
^ anIndex |
|
4285 |
]. |
|
4286 |
]. |
|
4287 |
] |
|
2016 | 4288 |
]. |
4289 |
^ 0 |
|
4290 |
! |
|
4291 |
||
4292 |
makeItemVisible:anItem |
|
2715 | 4293 |
"make an item visible" |
4294 |
||
2018 | 4295 |
|boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll |
4296 |
isVertical boundsMin layoutMin boundsMax layoutMax dltOrg |
|
2042 | 4297 |
inv1 inv2| |
2018 | 4298 |
|
4299 |
( anItem notNil |
|
4300 |
and:[self hasScrollers |
|
4301 |
and:[(layout := anItem layout) notNil]] |
|
4302 |
) ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4303 |
^ self |
2016 | 4304 |
]. |
2018 | 4305 |
index := self indexOfItem:anItem. |
2016 | 4306 |
boundsPREV := self scrollerBoundsAt:#PREV. |
4307 |
boundsNEXT := self scrollerBoundsAt:#NEXT. |
|
4308 |
||
2018 | 4309 |
isVertical := self verticalLayout. |
4310 |
||
4311 |
isVertical ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4312 |
boundsMin := boundsPREV bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4313 |
boundsMax := boundsNEXT top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4314 |
layoutMin := layout top. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4315 |
layoutMax := layout bottom. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4316 |
windowSz := height. |
2018 | 4317 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4318 |
boundsMin := boundsPREV right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4319 |
boundsMax := boundsNEXT left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4320 |
layoutMin := layout left. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4321 |
layoutMax := layout right. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4322 |
windowSz := width. |
2018 | 4323 |
]. |
4324 |
||
4325 |
||
4326 |
layoutMin < boundsMin ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4327 |
layoutMin >= 0 ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4328 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4329 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4330 |
"/ test whether is first visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4331 |
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
|
4332 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4333 |
index == 0 ifTrue:[ scr0 := margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4334 |
ifFalse:[ scr0 := boundsMin ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4335 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4336 |
delta := layoutMin negated + scr0. |
2016 | 4337 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4338 |
layoutMax > boundsMax ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4339 |
^ self |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4340 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4341 |
"/ test whether is last visible item |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4342 |
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
|
4343 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4344 |
index == 0 ifTrue:[ scr0 := windowSz - margin ] |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4345 |
ifFalse:[ scr0 := boundsMax ]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4346 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4347 |
delta := scr0 - layoutMax. |
2018 | 4348 |
]. |
4349 |
delta == 0 ifTrue:[ ^ self ]. |
|
4350 |
||
2016 | 4351 |
doScroll := false. |
4352 |
||
4353 |
shown ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4354 |
delta abs < (windowSz / 2) ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4355 |
doScroll := true. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4356 |
self repairDamage |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4357 |
] |
2016 | 4358 |
]. |
2018 | 4359 |
isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0]. |
4360 |
items do:[:el| el moveBy:dltOrg ]. |
|
2016 | 4361 |
|
4362 |
doScroll ifFalse:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4363 |
self invalidate. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4364 |
^ self |
2016 | 4365 |
]. |
4366 |
||
2018 | 4367 |
windowSz := windowSz - margin - margin. |
4368 |
||
4369 |
scr0 := boundsMin. |
|
4370 |
scr1 := scr0 + delta abs. |
|
4371 |
scrSz := boundsMax - scr1. |
|
4372 |
||
4373 |
delta < 0 ifTrue:[ |
|
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4374 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4375 |
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
|
4376 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4377 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4378 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4379 |
inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4380 |
"/ 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
|
4381 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4382 |
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
|
4383 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4384 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4385 |
scr1 := scr0 + scrSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4386 |
inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4387 |
"/ 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
|
4388 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4389 |
inv1 := boundsPREV. |
2016 | 4390 |
] ifFalse:[ |
2659
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4391 |
isVertical ifTrue:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4392 |
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
|
4393 |
width:windowSz height:scrSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4394 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4395 |
inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)). |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4396 |
"/ 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
|
4397 |
] ifFalse:[ |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4398 |
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
|
4399 |
width:scrSz height:windowSz async:false. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4400 |
|
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4401 |
inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4402 |
"/ 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
|
4403 |
]. |
3af857eb52fb
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2658
diff
changeset
|
4404 |
inv1 := boundsNEXT. |
2042 | 4405 |
]. |
4406 |
self invalidate:inv1. |
|
4407 |
self invalidate:inv2. |
|
2048 | 4408 |
|
4409 |
"Modified: / 13.11.2001 / 20:26:42 / cg" |
|
2016 | 4410 |
! |
4411 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4412 |
scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4413 |
"returns the one and only scrollActivity - data holder |
2715 | 4414 |
for a menu and all contained submenus" |
4415 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4416 |
superMenu notNil ifTrue:[ |
2715 | 4417 |
^ superMenu scrollActivity |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4418 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4419 |
scrollActivity isNil ifTrue:[ |
2715 | 4420 |
scrollActivity := ScrollActivity new. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4421 |
]. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4422 |
^ scrollActivity |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4423 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4424 |
|
2016 | 4425 |
scrollerBoundsAt:aDirection |
2715 | 4426 |
"returns the bounds of the scroller at a direction or nil" |
4427 |
||
2016 | 4428 |
|y x w h inset| |
4429 |
||
4430 |
self hasScrollers ifFalse:[ |
|
2715 | 4431 |
^ nil |
2016 | 4432 |
]. |
4433 |
inset := 0. |
|
4434 |
x := y := inset. |
|
4435 |
w := h := 15. |
|
4436 |
||
4437 |
self verticalLayout ifTrue:[ |
|
2715 | 4438 |
aDirection == #NEXT ifTrue:[ |
4439 |
y := height - h - inset. |
|
4440 |
]. |
|
4441 |
w := width - inset - inset. |
|
2016 | 4442 |
] ifFalse:[ |
2715 | 4443 |
aDirection == #NEXT ifTrue:[ |
4444 |
x := width - w - inset. |
|
4445 |
]. |
|
4446 |
h := height - inset - inset. |
|
2016 | 4447 |
]. |
4448 |
^ Rectangle left:x top:y width:w height:h |
|
4449 |
! |
|
4450 |
||
2046 | 4451 |
scrollerDirectionAtPoint:aPoint |
2715 | 4452 |
"returns the scroller-direction at aPoint, or nil" |
4453 |
||
2046 | 4454 |
self hasScrollers ifTrue:[ |
2715 | 4455 |
#( PREV NEXT ) do:[:aDirection| |bounds| |
4456 |
( (bounds := self scrollerBoundsAt:aDirection) notNil |
|
4457 |
and:[bounds containsPoint:aPoint] |
|
4458 |
) ifTrue:[ |
|
4459 |
^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil] |
|
4460 |
] |
|
4461 |
] |
|
2046 | 4462 |
]. |
4463 |
^ nil |
|
4464 |
||
4465 |
"Created: / 13.11.2001 / 14:13:16 / cg" |
|
2016 | 4466 |
! ! |
4467 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4468 |
!MenuPanel methodsFor:'private-searching'! |
388 | 4469 |
|
1699 | 4470 |
detectGrabMenu |
2715 | 4471 |
"returns the menu which is responsible for the grap; the last opened menu" |
4472 |
||
1699 | 4473 |
|subMenu| |
4474 |
||
4475 |
selection notNil ifTrue:[ |
|
2715 | 4476 |
(subMenu := selection visibleSubmenu) notNil ifTrue:[ |
4477 |
^ subMenu detectGrabMenu |
|
4478 |
] |
|
1699 | 4479 |
]. |
4480 |
^ self |
|
4481 |
! |
|
4482 |
||
4483 |
detectMenuAtGrabPoint:aGrabPoint |
|
2715 | 4484 |
"returns the menu which contains the grab-point" |
4485 |
||
1699 | 4486 |
|dstMenu dstPoint firstMenu| |
4487 |
||
4488 |
dstPoint := self translateGrabPoint:aGrabPoint. |
|
4489 |
||
4490 |
((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[ |
|
2715 | 4491 |
firstMenu := self. |
1699 | 4492 |
]. |
4493 |
||
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
4494 |
(selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[ |
2715 | 4495 |
^ firstMenu |
1699 | 4496 |
]. |
4497 |
dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint. |
|
2059 | 4498 |
^ dstMenu ? firstMenu |
1699 | 4499 |
! |
4500 |
||
1767 | 4501 |
detectViewAtX:x y:y in:aTopView |
2715 | 4502 |
"detect view at x@y" |
4503 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4504 |
^ aTopView detectViewAt:(x@y). |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4505 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4506 |
"/ 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
|
4507 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4508 |
"/ |p subViews| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4509 |
"/ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4510 |
"/ (subViews := aTopView subViews) notNil ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4511 |
"/ subViews do:[:v| |p| |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4512 |
"/ v shown ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4513 |
"/ ( (x between:(v left) and:(v right)) |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4514 |
"/ and:[y between:(v top) and:(v bottom)] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4515 |
"/ ) ifTrue:[ |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4516 |
"/ 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
|
4517 |
"/ ^ 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
|
4518 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4519 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4520 |
"/ ] |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4521 |
"/ ]. |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4522 |
"/ ^ aTopView |
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4523 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4524 |
"Modified: / 10.10.2001 / 13:45:56 / cg" |
1767 | 4525 |
! |
4526 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4527 |
itemAt:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4528 |
"returns item assigned to an index, nameKey, textLabel or value if symbol. |
2715 | 4529 |
If no item match nil is returned." |
4530 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4531 |
|idx| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4532 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4533 |
stringOrNumberOrPoint isPoint ifTrue:[ |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4534 |
^ self itemAtPoint:stringOrNumberOrPoint |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4535 |
]. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4536 |
idx := self indexOf:stringOrNumberOrPoint. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4537 |
(idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ]. |
2046 | 4538 |
^ nil |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4539 |
! |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4540 |
|
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4541 |
itemAtPoint:aPoint |
2715 | 4542 |
"returns the item at aPoint or nil if none detected" |
4543 |
||
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4544 |
|x y| |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4545 |
|
1699 | 4546 |
items notNil ifTrue:[ |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4547 |
x := aPoint x. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4548 |
y := aPoint y. |
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4549 |
^ items detect:[:el| el containsPointX:x y:y] ifNone:nil |
1699 | 4550 |
]. |
4551 |
^ nil |
|
388 | 4552 |
! |
4553 |
||
2048 | 4554 |
superMenuAtPoint:aPoint |
2715 | 4555 |
"returns the superMenu which contains aPoint, or nil if none detected" |
4556 |
||
1699 | 4557 |
|grabPoint superMenu| |
4558 |
||
2048 | 4559 |
(self containsPoint:aPoint) ifTrue:[ |
2715 | 4560 |
^ self |
1699 | 4561 |
]. |
4562 |
||
2048 | 4563 |
grabPoint := aPoint - (self translateGrabPoint:0). |
1699 | 4564 |
superMenu := self. |
4565 |
||
4566 |
[ (superMenu := superMenu superMenu) notNil ] whileTrue:[ |
|
2715 | 4567 |
(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[ |
4568 |
^ superMenu |
|
4569 |
] |
|
4570 |
]. |
|
4571 |
^ nil |
|
1699 | 4572 |
|
2048 | 4573 |
"Created: / 13.11.2001 / 20:22:53 / cg" |
388 | 4574 |
! ! |
4575 |
||
4576 |
!MenuPanel methodsFor:'queries'! |
|
4577 |
||
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4578 |
container:aView |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4579 |
super container:aView. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4580 |
aView notNil ifTrue:[ |
2219 | 4581 |
"/ I am no longer a popUpView |
4582 |
self updateLevelAndBorder |
|
2003
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4583 |
]. |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4584 |
! |
732fbaf5864f
avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents:
2000
diff
changeset
|
4585 |
|
388 | 4586 |
containsPoint:aPoint |
2715 | 4587 |
"returns true if the argument, aPoint is contained by the view" |
4588 |
||
388 | 4589 |
^ self containsPointX:(aPoint x) y:(aPoint y) |
4590 |
! |
|
4591 |
||
4592 |
containsPointX:x y:y |
|
2715 | 4593 |
"returns true if point is contained by the view" |
4594 |
||
708 | 4595 |
^ (x between:0 and:width) and:[y between:0 and:height] |
388 | 4596 |
! |
4597 |
||
390 | 4598 |
hasGroupDividerAt:anIndex |
2715 | 4599 |
"returns true if a divider is defined at an index" |
4600 |
||
388 | 4601 |
|i| |
4602 |
||
4603 |
groupSizes size ~~ 0 ifTrue:[ |
|
2715 | 4604 |
i := 0. |
4605 |
||
4606 |
groupSizes do:[:t| |
|
4607 |
(i := i + t) == anIndex ifTrue:[ |
|
4608 |
^ true |
|
4609 |
] |
|
4610 |
] |
|
4611 |
]. |
|
4612 |
^ false |
|
388 | 4613 |
! |
4614 |
||
390 | 4615 |
hasGroupDividers |
2715 | 4616 |
"returns true if any group divider exists" |
4617 |
||
4618 |
^ (items size ~~ 0 and:[groupSizes size ~~ 0]) |
|
388 | 4619 |
! |
4620 |
||
390 | 4621 |
isFitPanel |
4622 |
"returns true if the panel is the first in the menu hierarchy in must |
|
1699 | 4623 |
be fit to the extent of its superView; |
2715 | 4624 |
NOT SUPPORTED" |
4625 |
||
1699 | 4626 |
^ false |
390 | 4627 |
! |
4628 |
||
388 | 4629 |
isPopUpView |
4630 |
"return true if view is a popup view; without decoration |
|
2715 | 4631 |
and popUp to top immediately" |
4632 |
||
388 | 4633 |
^ superView isNil |
4634 |
! |
|
4635 |
||
4636 |
isVerticalLayout |
|
2715 | 4637 |
"returns true if vertical layout otherwise false( horizontal layout )" |
4638 |
||
1699 | 4639 |
^ self verticalLayout |
416 | 4640 |
! |
4641 |
||
1793 | 4642 |
isViewWrapper |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
4643 |
^ items size == 0 and:[subViews size ~~ 0] |
1793 | 4644 |
! |
4645 |
||
416 | 4646 |
type |
428 | 4647 |
^ nil. |
416 | 4648 |
|
388 | 4649 |
! ! |
4650 |
||
4651 |
!MenuPanel methodsFor:'selection'! |
|
4652 |
||
4653 |
hasSelection |
|
2715 | 4654 |
"returns true if a selection exists" |
4655 |
||
388 | 4656 |
^ self selection notNil |
4657 |
! |
|
4658 |
||
2199 | 4659 |
openDelayed:anItem |
4660 |
||
2374 | 4661 |
superMenu notNil ifTrue:[ |
2219 | 4662 |
superMenu openDelayed:anItem. |
2374 | 4663 |
^ self |
4664 |
]. |
|
4665 |
openDelayedMenuBlock notNil ifTrue:[ |
|
2253 | 4666 |
Processor removeTimedBlock:openDelayedMenuBlock. |
4667 |
openDelayedMenuBlock := nil. |
|
4668 |
]. |
|
2374 | 4669 |
anItem isNil ifTrue:[ |
2253 | 4670 |
openDelayedMenuBlock := nil. |
2374 | 4671 |
^ self |
2253 | 4672 |
]. |
4673 |
openDelayedMenuBlock := [ |
|
4674 |
openDelayedMenuBlock := nil. |
|
4675 |
anItem openDelayedSubmenu |
|
4676 |
]. |
|
4677 |
||
4678 |
Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5. |
|
2199 | 4679 |
! |
4680 |
||
388 | 4681 |
selection |
2715 | 4682 |
"returns current selected item or nil" |
4683 |
||
388 | 4684 |
^ selection |
4685 |
! |
|
4686 |
||
4687 |
selection:anItemOrNil |
|
2016 | 4688 |
"change selection to an item or nil |
2715 | 4689 |
if the item has a submenu the first item might be selected (style-sheet)" |
4690 |
||
2249 | 4691 |
|openMenu openOnSelect submenu item| |
4692 |
||
4693 |
selection == anItemOrNil ifTrue:[^ self]. |
|
4694 |
||
4695 |
(anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[ |
|
4696 |
self selection:anItemOrNil openMenu:false. |
|
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4697 |
^ self |
2249 | 4698 |
]. |
4699 |
||
4700 |
openMenu := self isPopUpView not. |
|
4701 |
openOnSelect := styleSheet at:#'menu.openOnSelect' default:false. |
|
4702 |
||
4703 |
openMenu ifFalse:[ |
|
4704 |
openMenu := openOnSelect. |
|
4705 |
]. |
|
4706 |
self selection:anItemOrNil openMenu:openMenu. |
|
4707 |
||
4708 |
openOnSelect ifFalse:[ |
|
4709 |
"/ select first item in submenu |
|
4710 |
||
4711 |
submenu := anItemOrNil currentSubmenu. |
|
4712 |
||
2374 | 4713 |
submenu notNil ifTrue:[ |
2249 | 4714 |
item := submenu itemAt:1. |
2347
9c22beda83cd
hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents:
2345
diff
changeset
|
4715 |
(item notNil and:[item hasSubmenu not]) ifTrue:[ |
2249 | 4716 |
submenu selection:item openMenu:false |
4717 |
] |
|
4718 |
]. |
|
4719 |
]. |
|
4720 |
! |
|
4721 |
||
4722 |
selection:anItemOrNil openMenu:openMenu |
|
2715 | 4723 |
"change selection to an item or nil" |
4724 |
||
2251 | 4725 |
|helpListener oldSelect| |
2249 | 4726 |
|
4727 |
anItemOrNil == selection ifTrue:[ |
|
4728 |
^ self |
|
2016 | 4729 |
]. |
2199 | 4730 |
self openDelayed:nil. |
388 | 4731 |
|
2251 | 4732 |
oldSelect := selection. |
4733 |
selection := nil. |
|
2249 | 4734 |
|
2374 | 4735 |
anItemOrNil notNil ifTrue:[ |
2249 | 4736 |
self makeItemVisible:anItemOrNil. |
4737 |
anItemOrNil canSelect ifTrue:[ |
|
2251 | 4738 |
selection := anItemOrNil |
2249 | 4739 |
] ifFalse:[ |
2374 | 4740 |
oldSelect isNil ifTrue:[^ self]. |
2249 | 4741 |
]. |
4742 |
]. |
|
2374 | 4743 |
oldSelect notNil ifTrue:[ |
2249 | 4744 |
"/ clear current selection |
2251 | 4745 |
oldSelect isSelected:false. |
4746 |
]. |
|
2374 | 4747 |
selection isNil ifTrue:[^ self]. |
2251 | 4748 |
|
4749 |
selection == enteredItem ifTrue:[ |
|
2249 | 4750 |
enteredItem := nil |
2016 | 4751 |
] ifFalse:[ |
2249 | 4752 |
self pointerEntersItem:nil |
2016 | 4753 |
]. |
4754 |
ActiveHelp isActive ifTrue:[ |
|
2251 | 4755 |
helpListener := ActiveHelp currentHelpListener. |
4756 |
helpListener initiateHelpFor:self at:nil now:true. |
|
2249 | 4757 |
]. |
4758 |
shown ifTrue:[ |
|
4759 |
self rearrangeItems. |
|
4760 |
||
4761 |
openMenu ifFalse:[ |
|
4762 |
selection invalidate. |
|
4763 |
] |
|
4764 |
]. |
|
4765 |
openMenu ifTrue:[ |
|
4766 |
selection isSelected:true. |
|
4767 |
]. |
|
388 | 4768 |
! |
4769 |
||
4770 |
selectionIndex |
|
2715 | 4771 |
"returns index of current selection or 0" |
4772 |
||
388 | 4773 |
|item| |
4774 |
||
4775 |
(item := self selection) notNil ifTrue:[ |
|
2715 | 4776 |
^ self findFirst:[:el| el == item ] |
388 | 4777 |
]. |
4778 |
^ 0 |
|
4779 |
! |
|
4780 |
||
4781 |
selectionIndex:anIndex |
|
2715 | 4782 |
"set selection at an index" |
4783 |
||
388 | 4784 |
self selection:(self itemAt:anIndex) |
4785 |
! ! |
|
4786 |
||
1791 | 4787 |
!MenuPanel methodsFor:'translation'! |
4788 |
||
4789 |
translateGrabPoint:aGrabPoint |
|
2715 | 4790 |
"translate the grab point into self" |
4791 |
||
1791 | 4792 |
superMenu isNil ifTrue:[ |
2715 | 4793 |
"I am the grapView" |
4794 |
aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint]. |
|
4795 |
^ aGrabPoint |
|
1791 | 4796 |
]. |
4797 |
||
4798 |
relativeGrabOrigin isNil ifTrue:[ |
|
2715 | 4799 |
relativeGrabOrigin := self topMenu translatePoint:0 to:self. |
1791 | 4800 |
]. |
4801 |
^ relativeGrabOrigin + aGrabPoint |
|
4802 |
! |
|
4803 |
||
4804 |
translateMenuPoint:aPoint toMenu:aMenu |
|
2715 | 4805 |
"translate a point into another menu its point" |
4806 |
||
1791 | 4807 |
|grapPoint| |
4808 |
||
4809 |
aMenu == self ifTrue:[ |
|
2715 | 4810 |
^ aPoint |
1791 | 4811 |
]. |
4812 |
grapPoint := aPoint - (self translateGrabPoint:0). |
|
4813 |
||
2715 | 4814 |
^ aMenu translateGrabPoint:grapPoint |
1791 | 4815 |
! |
4816 |
||
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4817 |
translatePoint:aPoint to:anotherWindowOrNilForScreen |
2715 | 4818 |
"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
|
4819 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4820 |
^ device |
2715 | 4821 |
translatePoint:aPoint asPoint |
4822 |
fromView:self |
|
4823 |
toView:anotherWindowOrNilForScreen |
|
2020
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4824 |
|
1f1868eba475
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2018
diff
changeset
|
4825 |
"Modified: / 10.10.2001 / 14:11:47 / cg" |
1791 | 4826 |
! ! |
4827 |
||
388 | 4828 |
!MenuPanel::Item class methodsFor:'accessing'! |
4829 |
||
689 | 4830 |
horizontalInset |
4831 |
^ HorizontalInset |
|
4832 |
! |
|
4833 |
||
388 | 4834 |
labelRightOffset |
4835 |
^ LabelRightOffset |
|
4836 |
! |
|
4837 |
||
689 | 4838 |
verticalInset |
4839 |
^ VerticalInset |
|
1765 | 4840 |
! |
4841 |
||
4842 |
verticalPopUpInset |
|
4843 |
^ VerticalPopUpInset |
|
388 | 4844 |
! ! |
4845 |
||
616 | 4846 |
!MenuPanel::Item class methodsFor:'defaults'! |
4847 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4848 |
halfSeparatorSize |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4849 |
"returns size of a space-separator |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4850 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4851 |
^ 5 |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4852 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
4853 |
|
1699 | 4854 |
separatorSize |
616 | 4855 |
"returns size of a separator |
4856 |
" |
|
1699 | 4857 |
^ 10 |
616 | 4858 |
! |
4859 |
||
4860 |
updateStyleCache |
|
388 | 4861 |
"setup defaults |
650 | 4862 |
self updateStyleCache |
388 | 4863 |
" |
1765 | 4864 |
<resource: #style (#'menuPanel.verticalInset')> |
4865 |
||
1699 | 4866 |
HorizontalInset := 2. |
1765 | 4867 |
VerticalInset := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2. |
4868 |
VerticalPopUpInset := 2. |
|
727 | 4869 |
|
4870 |
HorizontalButtonInset := 3. |
|
4871 |
VerticalButtonInset := 3. |
|
4872 |
||
681 | 4873 |
LabelRightOffset := 15. |
1765 | 4874 |
|
4875 |
||
1124 | 4876 |
! ! |
1078 | 4877 |
|
388 | 4878 |
!MenuPanel::Item class methodsFor:'instance creation'! |
4879 |
||
4880 |
in:aSuperMenu |
|
4881 |
^ self in:aSuperMenu label:nil |
|
4882 |
! |
|
4883 |
||
4884 |
in:aSuperMenu label:aLabel |
|
4885 |
|item| |
|
4886 |
||
4887 |
item := self new in:aSuperMenu. |
|
4888 |
item label:aLabel. |
|
4889 |
^ item |
|
4890 |
! |
|
4891 |
||
4892 |
in:aSuperMenu menuItem:aMenuItem |
|
4893 |
|item| |
|
4894 |
||
4895 |
item := self in:aSuperMenu. |
|
4896 |
item menuItem:aMenuItem. |
|
4897 |
^ item. |
|
2359 | 4898 |
! |
4899 |
||
4900 |
new |
|
4901 |
^ self basicNew initialize |
|
388 | 4902 |
! ! |
4903 |
||
1808 | 4904 |
!MenuPanel::Item methodsFor:'accepting'! |
389 | 4905 |
|
420 | 4906 |
canAccept |
4907 |
"returns true if item is acceptable |
|
4908 |
" |
|
2199 | 4909 |
self enabled ifFalse:[ ^ false]. |
4910 |
self hasSubmenu ifFalse:[ ^ true ]. |
|
4911 |
||
4912 |
self hasDelayedMenu ifFalse:[^ false ]. |
|
4913 |
^ subMenu isNil or:[subMenu shown not] |
|
524 | 4914 |
! |
4915 |
||
4916 |
toggleIndication |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4917 |
"toggle indication or choice |
524 | 4918 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4919 |
|arg| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4920 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4921 |
indication notNil ifTrue:[ |
2359 | 4922 |
arg := self indicationValue not. |
4923 |
self indicationValue:arg. |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
4924 |
] ifFalse:[ |
2359 | 4925 |
choice notNil ifTrue:[ |
4926 |
choice value:(menuItem choiceValue). |
|
4927 |
^ true |
|
4928 |
] |
|
524 | 4929 |
]. |
4930 |
^ arg |
|
389 | 4931 |
! ! |
4932 |
||
388 | 4933 |
!MenuPanel::Item methodsFor:'accessing'! |
4934 |
||
4935 |
accessCharacter |
|
389 | 4936 |
"returns my accessCharacter or nil |
388 | 4937 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4938 |
^ accessCharacter |
388 | 4939 |
! |
4940 |
||
4941 |
accessCharacterPosition |
|
390 | 4942 |
"get the access character position or nil |
388 | 4943 |
" |
2359 | 4944 |
^ menuItem accessCharacterPosition |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4945 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4946 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
4947 |
accessCharacterPosition:anIndex |
390 | 4948 |
"set the access character position or nil |
388 | 4949 |
" |
2359 | 4950 |
menuItem accessCharacterPosition:anIndex. |
388 | 4951 |
! |
4952 |
||
4953 |
argument |
|
4954 |
"gets the argument |
|
4955 |
" |
|
2359 | 4956 |
^ menuItem argument |
388 | 4957 |
! |
4958 |
||
4959 |
argument:anArgument |
|
4960 |
"sets the argument |
|
4961 |
" |
|
2359 | 4962 |
menuItem argument:anArgument. |
389 | 4963 |
! |
4964 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4965 |
displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4966 |
"returns my printable Label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4967 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4968 |
^ displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4969 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
4970 |
|
2614 | 4971 |
displayLabelExtent |
4972 |
"returns the labelExtent |
|
4973 |
" |
|
4974 |
|prevFont w h| |
|
4975 |
||
4976 |
displayLabelExtent notNil ifTrue:[ |
|
4977 |
^ displayLabelExtent |
|
4978 |
]. |
|
4979 |
||
4980 |
displayLabel isNil ifTrue:[ |
|
4981 |
displayLabelExtent := 0@0. |
|
4982 |
^ displayLabelExtent |
|
4983 |
]. |
|
4984 |
prevFont := menuPanel setFont:(self font). |
|
4985 |
||
4986 |
displayLabel isArray ifTrue:[ |
|
4987 |
w := h := 0. |
|
4988 |
||
4989 |
displayLabel do:[:aSubLabel| |
|
4990 |
aSubLabel notNil ifTrue:[ |
|
4991 |
w := w max:(aSubLabel widthOn:menuPanel). |
|
4992 |
h := h + 1 + (aSubLabel heightOn:menuPanel). |
|
4993 |
] ifFalse:[ |
|
4994 |
h := h + (self spaceBetweenEmptyLines) |
|
4995 |
] |
|
4996 |
] |
|
4997 |
] ifFalse:[ |
|
4998 |
w := displayLabel widthOn:menuPanel. |
|
4999 |
h := displayLabel heightOn:menuPanel. |
|
5000 |
]. |
|
5001 |
"/ care for italic fonts - give a few more pixels at the end |
|
5002 |
menuPanel font italic ifTrue:[ |
|
5003 |
w := w + 2. |
|
5004 |
]. |
|
5005 |
displayLabelExtent := w@h. |
|
5006 |
||
5007 |
prevFont notNil ifTrue:[ |
|
5008 |
menuPanel setFont:prevFont. "/ restore previous font |
|
5009 |
]. |
|
5010 |
^ displayLabelExtent |
|
5011 |
! |
|
5012 |
||
1727 | 5013 |
font |
5014 |
"returns the user configured font or nil (default menu font) |
|
5015 |
" |
|
2373 | 5016 |
|font| |
5017 |
||
5018 |
menuPanel isNil ifTrue:[^ nil]. |
|
5019 |
||
5020 |
font := menuItem font. |
|
5021 |
||
5022 |
font notNil ifTrue:[ |
|
5023 |
font := font onDevice:(menuPanel device). |
|
5024 |
menuItem font:font. |
|
5025 |
]. |
|
1727 | 5026 |
^ font |
5027 |
! |
|
5028 |
||
5029 |
font:aFont |
|
5030 |
"returns the user configured font or nil (default menu font) |
|
5031 |
" |
|
2373 | 5032 |
menuItem font:aFont. |
1727 | 5033 |
! |
5034 |
||
2604
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5035 |
ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5036 |
"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
|
5037 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5038 |
^ menuItem ignoreMnemonicKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5039 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5040 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5041 |
ignoreMnemonicKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5042 |
"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
|
5043 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5044 |
menuItem ignoreMnemonicKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5045 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5046 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5047 |
ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5048 |
"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
|
5049 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5050 |
^ menuItem ignoreShortcutKeys |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5051 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5052 |
|
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5053 |
ignoreShortcutKeys:aBoolean |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5054 |
"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
|
5055 |
" |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5056 |
menuItem ignoreShortcutKeys:aBoolean. |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5057 |
! |
34401b14b068
support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents:
2603
diff
changeset
|
5058 |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5059 |
itemValue |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5060 |
"gets value |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5061 |
" |
2360 | 5062 |
^ menuItem itemValue |
5063 |
! |
|
5064 |
||
5065 |
itemValue:aValue |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5066 |
"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
|
5067 |
" |
2360 | 5068 |
menuItem itemValue:aValue. |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5069 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5070 |
|
388 | 5071 |
label |
5072 |
"returns the label |
|
5073 |
" |
|
5074 |
^ label |
|
5075 |
! |
|
5076 |
||
5077 |
label:aLabel |
|
399 | 5078 |
"set a new label; if the label changed, a redraw is performed; |
5079 |
handle characters $& (ST-80 compatibility) |
|
388 | 5080 |
" |
2614 | 5081 |
|size char oldExtent| |
5082 |
||
5083 |
oldExtent := displayLabelExtent. |
|
5084 |
displayLabelExtent := nil. "/ force a recomputation |
|
5085 |
accessCharacter := disabledDisplayLabel := nil. |
|
5086 |
label := aLabel value. |
|
5087 |
displayLabel := label value ? ''. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5088 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5089 |
displayLabel isString ifTrue:[ |
2359 | 5090 |
"CHECK FOR SEPARATOR" |
5091 |
||
5092 |
(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
|
5093 |
size := displayLabel size. |
2359 | 5094 |
|
5095 |
size == 0 ifTrue:[ |
|
2614 | 5096 |
displayLabel := nil. "blank separator" |
2359 | 5097 |
^ self |
5098 |
]. |
|
5099 |
||
5100 |
size == 1 ifTrue:[ |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5101 |
char := displayLabel first. |
2359 | 5102 |
|
5103 |
(char == $- or:[char == $=]) ifTrue:[ |
|
2614 | 5104 |
label := displayLabel. "line separator" |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5105 |
displayLabel := nil. |
2359 | 5106 |
^ self |
5107 |
] |
|
5108 |
] |
|
5109 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5110 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5111 |
displayLabel isCollection ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5112 |
displayLabel := displayLabel asArray. |
2359 | 5113 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5114 |
]. |
2614 | 5115 |
displayLabel notNil ifTrue:[ |
5116 |
displayLabel isArray ifTrue:[ |
|
5117 |
displayLabel keysAndValuesDo:[:i :el| |
|
5118 |
el notNil ifTrue:[ |
|
5119 |
displayLabel at:i put:(self updateAccessCharacterFor:el). |
|
5120 |
]. |
|
5121 |
]. |
|
5122 |
] ifFalse:[ |
|
5123 |
displayLabel := self updateAccessCharacterFor:displayLabel. |
|
5124 |
]. |
|
5125 |
]. |
|
5126 |
||
5127 |
menuPanel shown ifTrue:[ |
|
5128 |
self fetchImages. |
|
5129 |
||
5130 |
oldExtent = self displayLabelExtent ifTrue:[ |
|
5131 |
self invalidate |
|
5132 |
] ifFalse:[ |
|
5133 |
menuPanel mustRearrange |
|
2359 | 5134 |
] |
1978
a53447b8cbe2
set label; reange menu if extent changed otherwise redraw only the item
martin
parents:
1955
diff
changeset
|
5135 |
]. |
388 | 5136 |
! |
5137 |
||
5138 |
menuPanel |
|
5139 |
"returns my menuPanel |
|
5140 |
" |
|
399 | 5141 |
^ menuPanel |
388 | 5142 |
! |
5143 |
||
5144 |
nameKey |
|
5145 |
"gets the nameKey |
|
5146 |
" |
|
2359 | 5147 |
^ menuItem nameKey |
388 | 5148 |
! |
5149 |
||
5150 |
nameKey:aNameKey |
|
5151 |
"sets the nameKey |
|
5152 |
" |
|
2359 | 5153 |
menuItem nameKey:aNameKey. |
388 | 5154 |
! |
5155 |
||
5156 |
rawLabel |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5157 |
"returns my raw, unprocessed label |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5158 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5159 |
^ menuItem rawLabel |
388 | 5160 |
! |
5161 |
||
5162 |
shortcutKey |
|
5163 |
"get the key to press to select the submenu from the keyboard or if |
|
5164 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5165 |
" |
|
2359 | 5166 |
^ menuItem shortcutKey |
388 | 5167 |
! |
5168 |
||
5169 |
shortcutKey:aKey |
|
5170 |
"set the key to press to select the submenu from the keyboard or if |
|
5171 |
no submenu exists evaluate the action assigned to the item (accept). |
|
5172 |
" |
|
2359 | 5173 |
menuItem shortcutKey ~= aKey ifTrue:[ |
5174 |
menuItem shortcutKey:aKey. |
|
5175 |
self invalidate. |
|
1889
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5176 |
]. |
43516e4588ce
give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents:
1878
diff
changeset
|
5177 |
! |
388 | 5178 |
|
710 | 5179 |
startGroup |
5180 |
"start group #left #right #center ... or nil |
|
5181 |
at the moment only #right is implemented |
|
5182 |
" |
|
2359 | 5183 |
^ menuItem startGroup |
710 | 5184 |
! |
5185 |
||
5186 |
startGroup:aSymbol |
|
5187 |
"start group #left #right #center ... |
|
5188 |
at the moment only #right is implemented |
|
5189 |
" |
|
2359 | 5190 |
menuItem startGroup:aSymbol. |
710 | 5191 |
! |
5192 |
||
388 | 5193 |
submenu |
5194 |
"returns my submenu or nil |
|
5195 |
" |
|
464 | 5196 |
subMenu notNil ifTrue:[^ subMenu]. |
5197 |
^ self setupSubmenu |
|
388 | 5198 |
! |
5199 |
||
5200 |
submenu:aSubMenu |
|
5201 |
"set a new submenu; an existing submenu will be destroyed. This might lead |
|
5202 |
to a redraw if 'hasSubmenu' changed |
|
5203 |
" |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5204 |
|widget| |
1767 | 5205 |
|
5206 |
aSubMenu isNil ifTrue:[ |
|
2360 | 5207 |
subMenu notNil ifTrue:[ |
5208 |
subMenu destroy. |
|
5209 |
subMenu := nil. |
|
5210 |
]. |
|
5211 |
^ self |
|
1767 | 5212 |
]. |
5213 |
||
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
5214 |
(aSubMenu isKindOf:Menu) ifTrue:[ |
2360 | 5215 |
subMenu := MenuPanel new. |
5216 |
||
5217 |
menuPanel notNil ifTrue:[ |
|
5218 |
subMenu receiver:menuPanel receiver. |
|
5219 |
]. |
|
5220 |
subMenu superMenu:menuPanel. |
|
5221 |
||
5222 |
menuItem horizontalLayout == true ifTrue:[ |
|
5223 |
subMenu verticalLayout:false |
|
5224 |
]. |
|
5225 |
subMenu menu:aSubMenu. |
|
1767 | 5226 |
] ifFalse:[ |
2360 | 5227 |
aSubMenu isView ifFalse:[ |
5228 |
(aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
|
5229 |
"/ ... mhhhh .... |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5230 |
^ menuItem submenuChannel:aSubMenu |
2360 | 5231 |
]. |
5232 |
widget := SimpleView new. |
|
5233 |
widget client:aSubMenu. |
|
5234 |
] ifTrue:[ |
|
5235 |
widget := aSubMenu |
|
5236 |
]. |
|
5237 |
||
5238 |
(widget isKindOf:MenuPanel) ifTrue:[ |
|
5239 |
subMenu := widget. |
|
5240 |
||
5241 |
menuItem horizontalLayout == true ifTrue:[ |
|
5242 |
subMenu verticalLayout:false |
|
5243 |
]. |
|
5244 |
] ifFalse:[ |
|
5245 |
subMenu := MenuPanel new. |
|
5246 |
subMenu receiver:menuPanel receiver. |
|
5247 |
subMenu addSubView:widget. |
|
5248 |
subMenu extent:(widget preferredExtent). |
|
5249 |
widget origin:0.0@0.0 corner:1.0@1.0. |
|
5250 |
]. |
|
5251 |
subMenu superMenu:menuPanel. |
|
5252 |
]. |
|
389 | 5253 |
! |
5254 |
||
390 | 5255 |
textLabel |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5256 |
"returns my textLabel or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5257 |
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
|
5258 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5259 |
|txt| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5260 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5261 |
displayLabel notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5262 |
displayLabel isArray ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5263 |
^ displayLabel perform:#string ifNotUnderstood:nil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5264 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5265 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5266 |
displayLabel do:[:el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5267 |
(txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5268 |
^ txt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5269 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5270 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5271 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5272 |
^ nil |
390 | 5273 |
! |
5274 |
||
1841 | 5275 |
triggerOnDown |
5276 |
"trigger the action if pressed |
|
5277 |
" |
|
2359 | 5278 |
menuItem triggerOnDown ifTrue:[ |
5279 |
self hasSubmenu ifFalse:[^ true]. |
|
1841 | 5280 |
]. |
5281 |
^ false |
|
5282 |
! |
|
5283 |
||
5284 |
triggerOnDown:aBool |
|
5285 |
"trigger the action if pressed |
|
5286 |
" |
|
2359 | 5287 |
menuItem triggerOnDown:aBool. |
1841 | 5288 |
! |
5289 |
||
389 | 5290 |
value |
5291 |
"gets value |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5292 |
Left here for ST80 compatibility - value is a bad name |
389 | 5293 |
" |
2360 | 5294 |
^ menuItem itemValue |
5295 |
! |
|
5296 |
||
5297 |
value:aValue |
|
389 | 5298 |
"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
|
5299 |
Left here for ST80 compatibility - value: is a bad name |
389 | 5300 |
" |
2360 | 5301 |
menuItem itemValue:aValue. |
502 | 5302 |
! |
5303 |
||
5304 |
value:aValue argument:anArgument |
|
5305 |
"set the value and an argument |
|
5306 |
" |
|
2360 | 5307 |
menuItem itemValue:aValue. |
5308 |
menuItem argument:anArgument. |
|
388 | 5309 |
! ! |
5310 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5311 |
!MenuPanel::Item methodsFor:'accessing-behavior'! |
388 | 5312 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5313 |
choice |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5314 |
"implements a radio group; the field |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5315 |
" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5316 |
^ choice |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5317 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5318 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5319 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5320 |
choice:something |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5321 |
"set choice indication |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5322 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5323 |
choice == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5324 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5325 |
choice isValueModel ifTrue:[ |
2219 | 5326 |
choice removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5327 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5328 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5329 |
(choice := something) notNil ifTrue:[ |
2219 | 5330 |
choice isSymbol ifTrue:[ |
5331 |
(choice := self aspectAt:choice) isNil ifTrue:[ |
|
5332 |
choice := something |
|
5333 |
] |
|
5334 |
]. |
|
5335 |
choice isValueModel ifTrue:[ |
|
5336 |
choice addDependent:self |
|
5337 |
] |
|
1699 | 5338 |
]. |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5339 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5340 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5341 |
choiceValue |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5342 |
"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
|
5343 |
" |
2359 | 5344 |
^ menuItem choiceValue |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5345 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5346 |
|
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
5347 |
choiceValue:something |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5348 |
"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
|
5349 |
" |
2359 | 5350 |
menuItem choiceValue ~= something ifTrue:[ |
5351 |
menuItem choiceValue:something. |
|
5352 |
choice notNil ifTrue:[ self invalidate ]. |
|
5353 |
]. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5354 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5355 |
|
388 | 5356 |
enabled |
5357 |
"returns the enabled state |
|
5358 |
" |
|
524 | 5359 |
|state| |
5360 |
||
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5361 |
menuPanel enabled ifFalse:[^ false]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5362 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5363 |
enableChannel isSymbol ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5364 |
state := self aspectAt:enableChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5365 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5366 |
state isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5367 |
self ifNotInUIBuilderInfoPrintCR: |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5368 |
('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5369 |
^ true |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5370 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5371 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5372 |
state isValueModel ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5373 |
enableChannel := state. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5374 |
enableChannel addDependent:self. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5375 |
state := enableChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5376 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5377 |
state := state value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5378 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5379 |
] ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5380 |
state := enableChannel value |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5381 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5382 |
^ state ~~ false |
388 | 5383 |
! |
5384 |
||
389 | 5385 |
enabled:something |
388 | 5386 |
"change the enabled state; if the state changed, a redraw is performed |
5387 |
" |
|
390 | 5388 |
|oldState newState| |
5389 |
||
5390 |
enableChannel isNil ifTrue:[ |
|
2219 | 5391 |
oldState := true |
390 | 5392 |
] ifFalse:[ |
2219 | 5393 |
oldState := enableChannel value. |
5394 |
enableChannel isValueModel ifTrue:[ |
|
5395 |
enableChannel removeDependent:self |
|
5396 |
] |
|
388 | 5397 |
]. |
390 | 5398 |
enableChannel := something. |
5399 |
||
5400 |
enableChannel isNil ifTrue:[ |
|
2219 | 5401 |
menuPanel shown ifFalse:[^ self]. |
5402 |
newState := true |
|
390 | 5403 |
] ifFalse:[ |
2219 | 5404 |
enableChannel isValueModel ifTrue:[ |
5405 |
enableChannel addDependent:self |
|
5406 |
] ifFalse:[ |
|
5407 |
enableChannel isSymbol ifTrue:[^ self] |
|
5408 |
]. |
|
5409 |
menuPanel shown ifFalse:[^ self]. |
|
5410 |
newState := enableChannel value. |
|
390 | 5411 |
]. |
5412 |
||
5413 |
newState ~~ oldState ifTrue:[ |
|
2219 | 5414 |
self invalidate |
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
5415 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5416 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5417 |
|
1670 | 5418 |
hideMenuOnActivated |
5419 |
"hide the menu when the item was activated; the default is true |
|
5420 |
" |
|
2359 | 5421 |
^ menuItem hideMenuOnActivated |
1670 | 5422 |
! |
5423 |
||
5424 |
hideMenuOnActivated:aBool |
|
5425 |
"hide the menu when the item was activated; the default is true |
|
5426 |
" |
|
2359 | 5427 |
menuItem hideMenuOnActivated:aBool. |
1670 | 5428 |
! |
5429 |
||
2216 | 5430 |
ifNotInUIBuilderInfoPrintCR:aMessage |
5431 |
"/ q&d hack to suppress info-messages in UIBuilder |
|
5432 |
||
5433 |
(menuPanel receiver isNil |
|
5434 |
and:[ menuPanel application notNil |
|
5435 |
and:[ menuPanel application askFor:#isUIPainter]]) |
|
5436 |
ifTrue:[ |
|
2219 | 5437 |
^ self "/ suppressed |
2216 | 5438 |
]. |
5439 |
aMessage infoPrintCR |
|
5440 |
! |
|
5441 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5442 |
indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5443 |
"get on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5444 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5445 |
^ indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5446 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5447 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5448 |
indication:something |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5449 |
"set on/off indication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
5450 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5451 |
indication == something ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5452 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5453 |
indication isValueModel ifTrue:[ |
2219 | 5454 |
indication removeDependent:self |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5455 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5456 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5457 |
(indication := something) notNil ifTrue:[ |
2219 | 5458 |
indication isValueModel ifTrue:[ |
5459 |
indication addDependent:self |
|
5460 |
] ifFalse:[ |
|
5461 |
"/ to force an update of the value |
|
5462 |
self indicationValue |
|
5463 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5464 |
]. |
464 | 5465 |
! |
5466 |
||
1767 | 5467 |
keepLinkedMenu |
5468 |
"get the keepLinkedMenu flag |
|
5469 |
" |
|
2359 | 5470 |
^ menuItem keepLinkedMenu |
5471 |
! |
|
5472 |
||
5473 |
keepLinkedMenu:aBool |
|
1767 | 5474 |
"get the keepLinkedMenu flag |
5475 |
" |
|
2359 | 5476 |
menuItem keepLinkedMenu:aBool. |
1767 | 5477 |
! |
5478 |
||
2331 | 5479 |
sendToOriginator |
5480 |
"if true, the message is sent to the originating widget; |
|
5481 |
otherwise (the default), it it sent to the receiver/application." |
|
5482 |
||
2359 | 5483 |
^ menuItem sendToOriginator |
2331 | 5484 |
! |
5485 |
||
5486 |
sendToOriginator:aBoolean |
|
5487 |
"if true, the message is sent to the originating widget; |
|
5488 |
otherwise (the default), it it sent to the receiver/application." |
|
5489 |
||
2359 | 5490 |
menuItem sendToOriginator:aBoolean. |
2331 | 5491 |
! |
5492 |
||
464 | 5493 |
submenuChannel |
5494 |
"get the submenu channel |
|
5495 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5496 |
^ menuItem submenuChannel |
464 | 5497 |
! |
5498 |
||
5499 |
submenuChannel:aSelectorOrNil |
|
5500 |
"returns the submenu channel |
|
5501 |
" |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5502 |
menuItem submenuChannel:aSelectorOrNil. |
388 | 5503 |
! ! |
5504 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5505 |
!MenuPanel::Item methodsFor:'accessing-dimension'! |
388 | 5506 |
|
2016 | 5507 |
moveBy:aPoint |
5508 |
"move layout origin |
|
5509 |
" |
|
5510 |
layout moveBy:aPoint. |
|
5511 |
! |
|
5512 |
||
1699 | 5513 |
preferredExtent |
5514 |
"compute my preferred extent excluding the shortCutKey and the menu identifier |
|
5515 |
" |
|
2614 | 5516 |
|isVertical icon wIcon isButton labelExtent |
1699 | 5517 |
x "{ Class:SmallInteger }" |
5518 |
y "{ Class:SmallInteger }" |
|
5519 |
s "{ Class:SmallInteger }" |
|
5520 |
| |
|
5521 |
self isVisible ifFalse:[^ 0@0 ]. |
|
5522 |
||
2359 | 5523 |
isButton := menuItem isButton. |
5524 |
||
1699 | 5525 |
isButton ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5526 |
s := menuPanel maxAbsoluteButtonLevel. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5527 |
x := s + HorizontalButtonInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5528 |
y := s + VerticalButtonInset. |
1699 | 5529 |
] ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5530 |
x := HorizontalInset. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5531 |
y := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2. |
1699 | 5532 |
]. |
5533 |
x := x * 2. |
|
5534 |
y := y * 2. |
|
5535 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5536 |
isVertical := menuPanel verticalLayout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5537 |
|
2362 | 5538 |
self isSeparator ifTrue:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5539 |
"SEPARATOR" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5540 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5541 |
s := self class separatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5542 |
label = '' ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5543 |
s := self class halfSeparatorSize. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5544 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5545 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5546 |
"width of doubleSeparator is 5 !!!!" |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5547 |
isVertical ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5548 |
x := x max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5549 |
y := y + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5550 |
] ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5551 |
y := y max:s. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5552 |
x := x + 5. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5553 |
]. |
1699 | 5554 |
] ifFalse:[ |
2614 | 5555 |
labelExtent := self displayLabelExtent. |
5556 |
||
5557 |
x := x + labelExtent x. |
|
5558 |
y := y + labelExtent y. |
|
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5559 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5560 |
isButton ifFalse:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5561 |
menuPanel showSeparatingLines ifTrue:[ |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5562 |
"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
|
5563 |
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
|
5564 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5565 |
(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
|
5566 |
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
|
5567 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5568 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5569 |
wIcon := 0. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5570 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5571 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5572 |
wIcon := MenuPanel menuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5573 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5574 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5575 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5576 |
wIcon := MenuPanel delayedMenuIndicatorOffset + icon width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5577 |
] |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
5578 |
]. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
5579 |
x := x + wIcon. |
1699 | 5580 |
]. |
5581 |
^ x@y |
|
388 | 5582 |
! ! |
5583 |
||
1679
af40842718f6
when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents:
1670
diff
changeset
|
5584 |
!MenuPanel::Item methodsFor:'accessing-help'! |
1613 | 5585 |
|
5586 |
activeHelpKey |
|
5587 |
"get the active helpKey; the key to retrieve the helpText from the application |
|
5588 |
" |
|
2359 | 5589 |
^ menuItem activeHelpKey |
1613 | 5590 |
! |
5591 |
||
5592 |
activeHelpKey:aHelpKey |
|
5593 |
"set the active helpKey; the key to retrieve the helpText from the application |
|
5594 |
" |
|
2359 | 5595 |
menuItem activeHelpKey:aHelpKey. |
5596 |
activeHelpText := nil. |
|
1613 | 5597 |
! |
5598 |
||
5599 |
activeHelpText |
|
5600 |
"get the active helpText or nil if not yet resolved |
|
5601 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5602 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5603 |
|app key| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5604 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5605 |
activeHelpText notNil ifTrue:[^ activeHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5606 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5607 |
((key := self activeHelpKey) notNil |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5608 |
and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5609 |
^ app helpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5610 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5611 |
^ nil |
1613 | 5612 |
! |
5613 |
||
5614 |
activeHelpText:aText |
|
5615 |
"set the active helpText |
|
5616 |
" |
|
5617 |
activeHelpText := aText. |
|
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5618 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5619 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5620 |
flyByHelpText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5621 |
"get the flyBy helpText or nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5622 |
" |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5623 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5624 |
|text key app| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5625 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5626 |
flyByHelpText notNil ifTrue:[^ flyByHelpText]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5627 |
|
2574
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5628 |
self isSeparator ifTrue:[^ nil]. |
366e5807711f
separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2569
diff
changeset
|
5629 |
|
2471 | 5630 |
"/ its NOT the button-attribute, which controls flyByHelp suppression... |
5631 |
"/ (if you have an argument for that let us know..) |
|
5632 |
"/ self isButton ifFalse:[^ nil]. |
|
5633 |
(menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil]. |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5634 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5635 |
"/ 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
|
5636 |
key := self activeHelpKey. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5637 |
(key notNil and:[(app := menuPanel application) notNil]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5638 |
text := app flyByHelpTextForKey:key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5639 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5640 |
|
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5641 |
"/ 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
|
5642 |
text isNil ifTrue:[ |
2676
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5643 |
self hasSubmenu ifTrue:[ |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5644 |
^ key |
01dc236c3dcd
flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents:
2675
diff
changeset
|
5645 |
]. |
2652
686c0f0acb90
do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents:
2617
diff
changeset
|
5646 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5647 |
text := key. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5648 |
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
|
5649 |
displayLabel isString ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5650 |
text := displayLabel string. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5651 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5652 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5653 |
text isNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5654 |
text := self rawLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5655 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5656 |
text := menuItem rawLabel. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5657 |
text isString ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5658 |
text := nil. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5659 |
] |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5660 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5661 |
text notNil ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5662 |
(text includes:$&) ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5663 |
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
|
5664 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5665 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5666 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5667 |
]. |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5668 |
|
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5669 |
text = displayLabel ifTrue:[ |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5670 |
"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
|
5671 |
(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
|
5672 |
^ nil |
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
5673 |
]. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5674 |
^ text |
2345
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5675 |
! |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5676 |
|
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5677 |
flyByHelpText:aText |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
5678 |
"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
|
5679 |
" |
8b7b3e384002
fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents:
2344
diff
changeset
|
5680 |
flyByHelpText := aText. |
1613 | 5681 |
! ! |
5682 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5683 |
!MenuPanel::Item methodsFor:'accessing-look'! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5684 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5685 |
horizontalLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5686 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5687 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5688 |
" |
2360 | 5689 |
^ menuItem horizontalLayout ? false |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5690 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5691 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5692 |
horizontalLayout:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5693 |
"on default submenus has a vertical layout; |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5694 |
true, the submenu has a horizontal layout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5695 |
" |
2360 | 5696 |
menuItem horizontalLayout:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5697 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5698 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5699 |
isButton |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5700 |
"returns whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5701 |
" |
2359 | 5702 |
^ menuItem isButton |
5703 |
! |
|
5704 |
||
5705 |
isButton:aBool |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5706 |
"sets whether item looks like a Button |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5707 |
" |
2359 | 5708 |
menuItem isButton ~~ aBool ifTrue:[ |
5709 |
menuItem isButton:aBool. |
|
5710 |
self invalidate. |
|
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5711 |
] |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5712 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5713 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5714 |
layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5715 |
"returns my layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5716 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5717 |
^ layout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5718 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5719 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5720 |
layout:aLayout |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5721 |
"set a new layout ( Rectangle ) |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5722 |
" |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5723 |
layout := aLayout. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5724 |
self invalidate. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5725 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5726 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5727 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5728 |
showBusyCursorWhilePerforming |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5729 |
"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
|
5730 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5731 |
" |
2359 | 5732 |
^ menuItem showBusyCursorWhilePerforming |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5733 |
! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5734 |
|
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5735 |
showBusyCursorWhilePerforming:aBoolean |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5736 |
"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
|
5737 |
while performing the menu action. Defaults to false. |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5738 |
" |
2359 | 5739 |
menuItem showBusyCursorWhilePerforming:aBoolean. |
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5740 |
! ! |
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
5741 |
|
2504 | 5742 |
!MenuPanel::Item methodsFor:'activation & deactivation'! |
1705 | 5743 |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5744 |
currentSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5745 |
"returns the current submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5746 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5747 |
^ subMenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5748 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5749 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5750 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5751 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5752 |
|
1705 | 5753 |
hideSubmenu |
5754 |
"hide submenu |
|
5755 |
" |
|
2199 | 5756 |
self hideSubmenu:subMenu. |
5757 |
! |
|
5758 |
||
5759 |
hideSubmenu:aSubmenu |
|
5760 |
"hide submenu |
|
5761 |
" |
|
1705 | 5762 |
|id| |
5763 |
||
2374 | 5764 |
aSubmenu isNil ifTrue:[^ self]. |
2681 | 5765 |
aSubmenu removeDependencies. |
2199 | 5766 |
|
5767 |
aSubmenu realized ifFalse:[ |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5768 |
id := aSubmenu id. |
2374 | 5769 |
id notNil ifTrue:[ menuPanel device unmapWindow:id ] |
2199 | 5770 |
] ifTrue:[ |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5771 |
aSubmenu hide |
2199 | 5772 |
]. |
5773 |
||
5774 |
aSubmenu windowGroup:nil. |
|
5775 |
menuPanel windowGroup removeView:aSubmenu. |
|
5776 |
||
5777 |
"/ release menu if derived from channel |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5778 |
(subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5779 |
menuItem keepLinkedMenu ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5780 |
subMenu := nil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
5781 |
] |
2199 | 5782 |
]. |
5783 |
! |
|
5784 |
||
5785 |
openDelayedSubmenu |
|
5786 |
"called to open now my delayed submenu |
|
5787 |
" |
|
5788 |
|subm| |
|
5789 |
||
5790 |
(self isSelected and:[menuPanel shown]) ifFalse:[^ self]. |
|
5791 |
||
2374 | 5792 |
subMenu notNil ifTrue:[ |
5793 |
subMenu realized ifTrue:[ |
|
5794 |
"/ already open |
|
5795 |
^ self |
|
5796 |
]. |
|
2199 | 5797 |
]. |
5798 |
subm := self setupSubmenu. |
|
2374 | 5799 |
subm isNil ifTrue:[^ self]. |
2199 | 5800 |
|
5801 |
self openSubmenu. |
|
5802 |
||
5803 |
(subm == subMenu and:[self isSelected]) ifFalse:[ |
|
2374 | 5804 |
"/ closed during building or opening the submenu |
5805 |
self hideSubmenu:subm. |
|
2199 | 5806 |
]. |
1705 | 5807 |
! |
1701 | 5808 |
|
5809 |
openSubmenu |
|
5810 |
"opens the submenu; make sure, that the submenu and the menPanel |
|
5811 |
is fully visible by shifting it into the visible screen area if |
|
5812 |
nescessary. |
|
5813 |
" |
|
2249 | 5814 |
|p o device isVertical topMenu windGrp prefExtent |
1701 | 5815 |
devBot "{ Class:SmallInteger }" |
5816 |
devRight "{ Class:SmallInteger }" |
|
5817 |
width "{ Class:SmallInteger }" |
|
5818 |
height "{ Class:SmallInteger }" |
|
5819 |
top "{ Class:SmallInteger }" |
|
5820 |
left "{ Class:SmallInteger }" |
|
5821 |
| |
|
5822 |
||
1737
c18896a7cb50
replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents:
1735
diff
changeset
|
5823 |
(subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[ |
2249 | 5824 |
^ self |
1701 | 5825 |
]. |
5826 |
||
5827 |
topMenu := menuPanel topMenu. |
|
1829 | 5828 |
(subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[ |
2249 | 5829 |
subMenu releaseDeviceResources. |
5830 |
subMenu setDevice:topMenu device id:nil gcId:nil. |
|
5831 |
subMenu recreate. |
|
1829 | 5832 |
]. |
5833 |
||
1701 | 5834 |
windGrp := topMenu windowGroup. |
5835 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5836 |
subMenu superMenu:menuPanel. |
1701 | 5837 |
subMenu becomesActiveMenu. |
5838 |
subMenu cursor:Cursor hand. |
|
5839 |
||
5840 |
windGrp notNil ifTrue:[ |
|
2249 | 5841 |
subMenu windowGroup:windGrp. |
5842 |
windGrp addTopView:subMenu. |
|
1701 | 5843 |
]. |
5844 |
||
2111 | 5845 |
"Q&D kludge - test whether the layout is nil; |
2249 | 5846 |
if true recompute the layouts |
2111 | 5847 |
" |
2374 | 5848 |
layout isNil ifTrue:[menuPanel rearrangeItems]. |
2111 | 5849 |
|
1701 | 5850 |
" Q&D kludge - if any visibility attributes are blocks; |
5851 |
TODO: only invoke mustRearrange if any are blocks |
|
2249 | 5852 |
(since I react correctly on valueHolder changes) |
1701 | 5853 |
" |
5854 |
subMenu rearrangeItemsIfItemVisibilityChanged. |
|
5855 |
subMenu fixSize. |
|
5856 |
||
5857 |
"compute origin of subMenu |
|
5858 |
" |
|
5859 |
isVertical := menuPanel verticalLayout. |
|
5860 |
device := menuPanel device. |
|
1714
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5861 |
prefExtent := subMenu preferredExtent. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5862 |
height := prefExtent y. |
b4c05977e9d5
get heigth and width from preferredExtent when open a submenu
ca
parents:
1710
diff
changeset
|
5863 |
width := prefExtent x. |
1701 | 5864 |
devBot := device usableHeight. |
5865 |
devRight := device usableWidth. |
|
5866 |
||
5867 |
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
|
5868 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5869 |
menuPanel isPopUpView ifTrue:[ |
2249 | 5870 |
o := menuPanel origin + p |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
5871 |
] ifFalse:[ |
2249 | 5872 |
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
|
5873 |
]. |
1701 | 5874 |
left := o x. |
5875 |
top := o y. |
|
5876 |
||
2016 | 5877 |
top + height > devBot ifTrue:[ |
2249 | 5878 |
top := isVertical ifTrue:[devBot - height] |
5879 |
ifFalse:[top - layout height - height + 2] |
|
2016 | 5880 |
]. |
5881 |
top := top max:0. |
|
5882 |
||
5883 |
"/ (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[ |
|
5884 |
"/ top < menuPanel bottom ifTrue:[ |
|
5885 |
"/ left := left + layout width. |
|
5886 |
"/ ]. |
|
5887 |
"/ left + width > devRight ifTrue:[ |
|
5888 |
"/ left := o x - width - 2 |
|
5889 |
"/ ]. |
|
5890 |
"/ ]. |
|
5891 |
||
1701 | 5892 |
left + width > devRight ifTrue:[ |
2249 | 5893 |
left := isVertical ifTrue:[left - layout width - width + 2] |
5894 |
ifFalse:[devRight - width] |
|
1701 | 5895 |
]. |
5896 |
left := left max:0. |
|
5897 |
||
5898 |
subMenu origin:(left@top). |
|
5899 |
||
5900 |
subMenu realized ifFalse:[ |
|
2249 | 5901 |
subMenu realize. |
1701 | 5902 |
] ifTrue:[ |
2249 | 5903 |
topMenu device mapWindow:(subMenu id). |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5904 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5905 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5906 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5907 |
toggleSubmenuVisibility |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5908 |
"toggle the visibility of the submenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5909 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5910 |
subMenu notNil ifTrue:[ |
2219 | 5911 |
subMenu shown ifTrue:[^ self hideSubmenu] |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5912 |
] ifFalse:[ |
2219 | 5913 |
(subMenu := self setupSubmenu) isNil ifTrue:[ |
5914 |
"/ cannot open a submenu |
|
5915 |
^ self |
|
5916 |
] |
|
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5917 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5918 |
self openSubmenu. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5919 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5920 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5921 |
! |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5922 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5923 |
visibleSubmenu |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5924 |
"returns the current visible submenu or nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5925 |
" |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5926 |
subMenu notNil ifTrue:[ |
2219 | 5927 |
subMenu shown ifTrue:[^ subMenu]. |
1786
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5928 |
]. |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5929 |
^ nil |
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5930 |
|
f27f48940f48
change behaviour of cursor/key control and menu actication
ca
parents:
1785
diff
changeset
|
5931 |
|
1701 | 5932 |
|
5933 |
! ! |
|
5934 |
||
524 | 5935 |
!MenuPanel::Item methodsFor:'building'! |
5936 |
||
5937 |
aspectAt:aKey |
|
5938 |
"retursns value assigned to key or nil |
|
5939 |
" |
|
5940 |
|appl value| |
|
5941 |
||
5942 |
appl := menuPanel receiver. |
|
5943 |
||
1219
6a0d677a6fac
removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents:
1218
diff
changeset
|
5944 |
(appl isValueModel) ifTrue:[ |
2359 | 5945 |
^ appl value:aKey |
524 | 5946 |
]. |
5947 |
||
2123 | 5948 |
appl isNil ifTrue:[ |
2359 | 5949 |
appl := menuPanel application. |
2123 | 5950 |
]. |
5951 |
appl isNil ifTrue:[ ^ nil]. |
|
5952 |
||
5953 |
MessageNotUnderstood handle:[:ex| |
|
2359 | 5954 |
ex selector == aKey ifFalse:[ |
5955 |
ex reject |
|
5956 |
]. |
|
5957 |
self ifNotInUIBuilderInfoPrintCR: |
|
2545
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
5958 |
('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
|
5959 |
bindWith:appl className with:aKey). |
2123 | 5960 |
] do:[ |
2359 | 5961 |
aKey numArgs == 1 ifTrue:[ |
5962 |
value := appl perform:aKey with:(menuItem argument ? self). |
|
5963 |
] ifFalse:[ |
|
5964 |
(appl respondsTo:#aspectFor:) ifTrue:[ |
|
5965 |
value := appl aspectFor:aKey |
|
5966 |
] ifFalse:[ |
|
5967 |
value := appl perform:aKey |
|
5968 |
] |
|
5969 |
] |
|
524 | 5970 |
]. |
5971 |
^ value |
|
1029
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5972 |
|
c9e90585fa89
only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents:
1026
diff
changeset
|
5973 |
"Modified: / 29.7.1998 / 11:59:50 / cg" |
524 | 5974 |
! ! |
5975 |
||
390 | 5976 |
!MenuPanel::Item methodsFor:'change & update'! |
5977 |
||
2614 | 5978 |
fontChanged |
5979 |
"called whenever the font changed |
|
5980 |
" |
|
5981 |
displayLabel notNil ifTrue:[ |
|
5982 |
displayLabelExtent := nil. |
|
5983 |
||
5984 |
subMenu notNil ifTrue:[ |
|
5985 |
subMenu font:(menuPanel font). |
|
5986 |
]. |
|
5987 |
]. |
|
5988 |
! |
|
5989 |
||
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5990 |
update:something with:aParameter from:changedObject |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5991 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5992 |
|form rect| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5993 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5994 |
(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
|
5995 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
5996 |
self isSeparator ifFalse:[ |
2359 | 5997 |
"/ NOT A SEPARATOR |
5998 |
||
5999 |
menuPanel shown ifTrue:[ |
|
6000 |
changedObject == enableChannel ifTrue:[ |
|
6001 |
(enableChannel value == false and:[self isSelected]) ifTrue:[ |
|
6002 |
^ menuPanel selection:nil. |
|
6003 |
]. |
|
6004 |
^ self invalidate |
|
6005 |
]. |
|
6006 |
||
6007 |
(changedObject == indication or:[changedObject == choice]) ifTrue:[ |
|
6008 |
menuItem isButton ifTrue:[ |
|
6009 |
self invalidate |
|
6010 |
] ifFalse:[ |
|
6011 |
"/ invalidate the interactor only |
|
6012 |
"/ take any interactor; interactors has the same extent |
|
6013 |
form := menuPanel iconIndicationOff. |
|
6014 |
||
6015 |
rect := Rectangle left:(layout left + HorizontalInset) |
|
6016 |
top:(layout top) |
|
6017 |
width:(form width) |
|
6018 |
height:(layout height). |
|
6019 |
||
6020 |
menuPanel invalidate:rect repairNow:false |
|
6021 |
]. |
|
6022 |
^ self |
|
6023 |
]. |
|
6024 |
]. |
|
498 | 6025 |
]. |
712 | 6026 |
|
6027 |
changedObject == isVisible ifTrue:[ |
|
2359 | 6028 |
menuPanel mustRearrange. |
6029 |
menuPanel rearrangeItems. |
|
6030 |
^ self. |
|
712 | 6031 |
]. |
6032 |
||
498 | 6033 |
super update:something with:aParameter from:changedObject |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6034 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6035 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6036 |
updateIndicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6037 |
"update indicators |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6038 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6039 |
(indication notNil and:[indication isSymbol]) ifTrue:[ |
2219 | 6040 |
" indication is a selector otherwise a change notification |
6041 |
is raised from the model !!!! |
|
6042 |
" |
|
6043 |
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
|
6044 |
] |
390 | 6045 |
! ! |
6046 |
||
388 | 6047 |
!MenuPanel::Item methodsFor:'converting'! |
6048 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6049 |
asMenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6050 |
"convert to a MenuItem |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6051 |
" |
2359 | 6052 |
^ menuItem |
388 | 6053 |
! |
6054 |
||
6055 |
menuItem:aMenuItem |
|
6056 |
"setup attributes from a MenuItem |
|
6057 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6058 |
|lbl| |
389 | 6059 |
|
388 | 6060 |
menuPanel disabledRedrawDo:[ |
2359 | 6061 |
menuItem := aMenuItem. |
6062 |
menuItem isNil ifTrue:[ menuItem := MenuItem new]. |
|
6063 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6064 |
label := displayLabel := activeHelpText := nil. |
2359 | 6065 |
|
6066 |
self enabled:(menuItem enabled). |
|
6067 |
self indication:(menuItem indication). |
|
6068 |
self choice:(menuItem choice). |
|
6069 |
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
|
6070 |
|
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6071 |
"/ 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
|
6072 |
"/ but ... ?? |
2359 | 6073 |
(lbl := menuItem labelImage value) isNil ifTrue:[ |
6074 |
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
|
6075 |
]. |
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6076 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6077 |
self submenu:(menuItem submenu). |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
6078 |
self label:lbl. |
388 | 6079 |
] |
1033
9badc22e3d03
oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents:
1032
diff
changeset
|
6080 |
|
1090
cf3d9f5648da
only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents:
1083
diff
changeset
|
6081 |
"Modified: / 22.8.1998 / 15:34:16 / cg" |
388 | 6082 |
! ! |
6083 |
||
2681 | 6084 |
!MenuPanel::Item methodsFor:'dependents access'! |
6085 |
||
6086 |
addDependencies |
|
6087 |
"add all dependencies |
|
6088 |
" |
|
6089 |
enableChannel isValueModel ifTrue:[enableChannel addDependent:self]. |
|
6090 |
isVisible isValueModel ifTrue:[isVisible addDependent:self]. |
|
6091 |
indication isValueModel ifTrue:[indication addDependent:self]. |
|
6092 |
choice isValueModel ifTrue:[choice addDependent:self]. |
|
6093 |
! |
|
6094 |
||
6095 |
removeDependencies |
|
6096 |
"remove all dependencies |
|
6097 |
" |
|
6098 |
enableChannel isValueModel ifTrue:[enableChannel removeDependent:self]. |
|
6099 |
isVisible isValueModel ifTrue:[isVisible removeDependent:self]. |
|
6100 |
indication isValueModel ifTrue:[indication removeDependent:self]. |
|
6101 |
choice isValueModel ifTrue:[choice removeDependent:self]. |
|
6102 |
! ! |
|
6103 |
||
388 | 6104 |
!MenuPanel::Item methodsFor:'drawing'! |
6105 |
||
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6106 |
draw |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6107 |
"redraw item |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6108 |
" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6109 |
|isSelected ownBgCol paint bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6110 |
x "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6111 |
y "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6112 |
w "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6113 |
h "{ Class:SmallInteger }" |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6114 |
| |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6115 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6116 |
self isVisible ifFalse:[^ self]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6117 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6118 |
self isSeparator ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6119 |
self drawSeparator. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6120 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6121 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6122 |
menuItem isButton ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6123 |
self drawButton. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6124 |
^ self |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6125 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6126 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6127 |
"/ DRAW A LABELED ENTRY; no button, no separator |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6128 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6129 |
isSelected := self isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6130 |
bgColor := menuPanel backgroundColor. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6131 |
paint := isSelected |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6132 |
ifTrue:[self activeBackgroundColor] |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6133 |
ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6134 |
(self isEnabled and:[ self isEntered ]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6135 |
menuPanel enteredBackgroundColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6136 |
] ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6137 |
bgColor |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6138 |
]]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6139 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6140 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6141 |
paint := ownBgCol |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6142 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6143 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6144 |
paint ~= bgColor ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6145 |
menuPanel paint:paint. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6146 |
menuPanel fillRectangle:layout. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6147 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6148 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6149 |
menuPanel showSeparatingLines ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6150 |
self drawSeparatingLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6151 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6152 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6153 |
self drawLabel. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6154 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6155 |
(ownBgCol notNil and:[isSelected]) ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6156 |
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
|
6157 |
ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6158 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6159 |
x := layout left. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6160 |
y := layout top. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6161 |
w := layout width. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6162 |
h := layout height. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6163 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6164 |
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
|
6165 |
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
|
6166 |
]. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6167 |
menuPanel drawLabelEdgeFor:self selected:isSelected. |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6168 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6169 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6170 |
drawButton |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6171 |
"draw as button |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6172 |
" |
2362 | 6173 |
|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
|
6174 |
x "{ Class:SmallInteger }" |
2143 | 6175 |
y "{ Class:SmallInteger }" |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6176 |
| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6177 |
drawObject := displayLabel. |
2362 | 6178 |
isEnabled := self enabled. |
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
6179 |
isSelected := self isSelected. |
2362 | 6180 |
|
6181 |
isSelected ifFalse:[ |
|
6182 |
"/ test whether button has pressed toggle behaviour |
|
6183 |
showSelected := (self isToggle and:[self indicationValue]). |
|
6184 |
] ifTrue:[ |
|
6185 |
showSelected := isSelected |
|
6186 |
]. |
|
6187 |
||
6188 |
showSelected ifTrue:[ |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6189 |
bg := self activeBackgroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6190 |
fg := self activeForegroundColor. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6191 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6192 |
self isEntered ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6193 |
bg := self buttonEnteredBackgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6194 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6195 |
bg := self backgroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6196 |
]. |
2059 | 6197 |
isEnabled ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6198 |
fg := menuPanel foregroundColor |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6199 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6200 |
fg := menuPanel disabledForegroundColor. |
2059 | 6201 |
etchFg := menuPanel disabledEtchedForegroundColor. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6202 |
drawObject := self disabledRawLabel |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6203 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6204 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6205 |
|
1708
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6206 |
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[ |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6207 |
bg := ownBgCol |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6208 |
]. |
cfaf55b9043d
bug fix in background color of button when derives from label(text)
ca
parents:
1707
diff
changeset
|
6209 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6210 |
"DRAW BACKGROUND" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6211 |
bg ~= menuPanel backgroundColor ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6212 |
menuPanel paint:bg. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6213 |
menuPanel fillRectangle:layout. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6214 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6215 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6216 |
x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset. |
2362 | 6217 |
|
6218 |
(drawObject isImage and:[menuPanel centerItems]) ifTrue:[ |
|
2337 | 6219 |
x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2). |
6220 |
]. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6221 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6222 |
isSelected ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6223 |
"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
|
6224 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6225 |
indication notNil ifTrue:[ |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6226 |
"button is indicator and set" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6227 |
isSelected := self indicationValue |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6228 |
] ifFalse:[ |
2359 | 6229 |
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
|
6230 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6231 |
]. |
2143 | 6232 |
y := 0. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6233 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6234 |
isSelected ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6235 |
level := menuPanel buttonActiveLevel. |
2142 | 6236 |
x := x + 1 "level abs". |
2143 | 6237 |
y := y + 1 "level abs". |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6238 |
] ifFalse:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6239 |
level := self isEntered ifTrue:[menuPanel buttonEnteredLevel] |
2219 | 6240 |
ifFalse:[menuPanel buttonPassiveLevel]. |
2059 | 6241 |
]. |
6242 |
||
2362 | 6243 |
drawObject isEmptyOrNil ifFalse:[ |
6244 |
etchFg notNil ifTrue:[ |
|
6245 |
self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg. |
|
6246 |
]. |
|
6247 |
self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg. |
|
6248 |
]. |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6249 |
self drawMenuIndicator. |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6250 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6251 |
level ~~ 0 ifTrue:[ |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6252 |
menuPanel drawButtonEdgesFor:self level:level |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6253 |
]. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6254 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6255 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6256 |
drawLabel |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6257 |
"draw a labeled entry; no button, no separator. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6258 |
" |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6259 |
|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
|
6260 |
isSelected isEnabled form |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6261 |
h "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6262 |
y "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6263 |
x "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6264 |
t "{ Class:SmallInteger }" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
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. |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6268 |
isSelected := self isSelected. |
2362 | 6269 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6270 |
isSelected ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6271 |
fg := self activeForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6272 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6273 |
isEnabled ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6274 |
self isEntered ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6275 |
fg := menuPanel enteredForegroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6276 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6277 |
fg := menuPanel foregroundColor |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6278 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6279 |
] ifFalse:[ |
2362 | 6280 |
fg := menuPanel disabledForegroundColor. |
6281 |
etchFg := menuPanel disabledEtchedForegroundColor. |
|
6282 |
drawObject := self disabledRawLabel |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6283 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6284 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6285 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6286 |
h := layout height. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6287 |
x := layout left + HorizontalInset. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6288 |
t := layout top. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6289 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6290 |
((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
|
6291 |
y := t + ((h - form height) // 2). |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6292 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6293 |
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
|
6294 |
x := x + 2 + form width. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6295 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6296 |
|
2362 | 6297 |
drawObject isEmptyOrNil ifFalse:[ |
6298 |
etchFg notNil ifTrue:[ |
|
6299 |
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg. |
|
6300 |
]. |
|
6301 |
self drawRawLabel:drawObject atX:x yOffset:0 paint:fg. |
|
6302 |
]. |
|
6303 |
||
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6304 |
self drawMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6305 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6306 |
"/ DRAW SHORTCUT KEY |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6307 |
|
2359 | 6308 |
( menuItem shortcutKey notNil |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6309 |
and:[(x := menuPanel shortKeyInset) ~~ 0 |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6310 |
and:[(scKey:= self shortcutKeyAsString) notNil]] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6311 |
) ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6312 |
x := layout left + x. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6313 |
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
|
6314 |
y := y + menuPanel font ascent. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6315 |
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
|
6316 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6317 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6318 |
"/ DRAW SUBMENU INDICATION |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6319 |
|
2362 | 6320 |
(menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[ |
6321 |
^ self |
|
6322 |
]. |
|
6323 |
arrow := menuPanel rightArrow. |
|
6324 |
x := layout right - arrow width - HorizontalInset. |
|
6325 |
y := t + (h - arrow height // 2). |
|
6326 |
||
6327 |
(menuPanel styleSheet is3D not |
|
6328 |
or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[ |
|
6329 |
^ menuPanel displayForm:arrow x:x y:y |
|
6330 |
]. |
|
6331 |
cLa := menuPanel shadowColor. |
|
6332 |
cLb := menuPanel lightColor. |
|
6333 |
||
6334 |
isSelected ifFalse:[ |
|
6335 |
fg := cLa. |
|
6336 |
cLa := cLb. |
|
6337 |
cLb := fg |
|
6338 |
]. |
|
6339 |
menuPanel paint:cLa. |
|
6340 |
menuPanel displayForm:arrow x:x y:y. |
|
6341 |
menuPanel paint:cLb. |
|
6342 |
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
|
6343 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6344 |
"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
|
6345 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6346 |
|
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6347 |
drawMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6348 |
"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
|
6349 |
" |
2220 | 6350 |
|x y icon bAbsLevel| |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6351 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6352 |
self hasDelayedMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6353 |
icon := MenuPanel delayedMenuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6354 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6355 |
self hasMenuIndicator ifTrue:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6356 |
icon := MenuPanel menuIndicator. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6357 |
] ifFalse:[ |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6358 |
^ self |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6359 |
] |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6360 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6361 |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6362 |
x := layout right - icon width. |
2460 | 6363 |
false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[ |
2220 | 6364 |
y := layout height - icon height // 2 + layout top. |
6365 |
] ifFalse:[ |
|
6366 |
y := layout bottom - icon height - 2. |
|
6367 |
]. |
|
6368 |
||
6369 |
bAbsLevel := 0. |
|
2359 | 6370 |
menuItem isButton ifTrue:[ |
2220 | 6371 |
self isSelected ifTrue:[ |
6372 |
x := x + 1. |
|
6373 |
y := y + 1. |
|
6374 |
]. |
|
6375 |
bAbsLevel := menuPanel maxAbsoluteButtonLevel. |
|
6376 |
x := x - bAbsLevel. |
|
6377 |
y := y - bAbsLevel. |
|
6378 |
]. |
|
6379 |
x := x - 1 "- HorizontalInset". |
|
6380 |
||
6381 |
(self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[ |
|
6382 |
icon := menuPanel lightenedImageOnDevice:icon |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6383 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6384 |
icon displayOn:menuPanel x:x y:y. |
2220 | 6385 |
|
2234 | 6386 |
(false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ]) |
2220 | 6387 |
ifTrue:[ |
6388 |
menuPanel paint:menuPanel buttonShadowColor. |
|
6389 |
menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2. |
|
6390 |
menuPanel paint:menuPanel buttonLightColor. |
|
6391 |
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2. |
|
6392 |
]. |
|
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6393 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
6394 |
|
2059 | 6395 |
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6396 |
"draw a labeled entry; no button, no separator. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6397 |
" |
2614 | 6398 |
|mfont labelExtent |
1727 | 6399 |
y "{ Class:SmallInteger }" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6400 |
y0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6401 |
x0 "{ Class:SmallInteger }" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6402 |
| |
2059 | 6403 |
|
2373 | 6404 |
mfont := menuPanel setFont:(self font). |
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6405 |
"/ fontAscent := menuPanel font ascent. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6406 |
menuPanel paint:fg. |
2614 | 6407 |
labelExtent := self displayLabelExtent. |
6408 |
||
6409 |
y := layout top + (layout height - labelExtent y // 2) + yOffset. |
|
2337 | 6410 |
"/ menuPanel centerItems ifTrue:[self halt]. |
2675
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6411 |
aLabel isArray ifFalse:[ |printLabel| |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6412 |
aLabel isText ifTrue:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6413 |
"/background of label already drawn |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6414 |
printLabel := aLabel withoutEmphasis:#backgroundColor. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6415 |
] ifFalse:[ |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6416 |
printLabel := aLabel. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6417 |
]. |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6418 |
y := y + (printLabel ascentOn:menuPanel). |
7a090a030736
bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents:
2659
diff
changeset
|
6419 |
printLabel displayOn:menuPanel x:x y:y. |
1727 | 6420 |
] ifTrue:[ |
2337 | 6421 |
aLabel do:[:el| |
6422 |
el notNil ifTrue:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6423 |
y0 := y + (el ascentOn:menuPanel). |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6424 |
"/ el isImageOrForm ifFalse:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6425 |
"/ y0 := y + fontAscent |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6426 |
"/ ] ifTrue:[ |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6427 |
"/ y0 := y |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6428 |
"/ ]. |
2614 | 6429 |
x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2). |
2337 | 6430 |
el displayOn:menuPanel x:x0 y:y0. |
6431 |
y := y + 1 + (el heightOn:menuPanel) |
|
6432 |
] ifFalse:[ |
|
2485
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
6433 |
y := y + (self spaceBetweenEmptyLines) |
2337 | 6434 |
] |
6435 |
]. |
|
1727 | 6436 |
]. |
6437 |
menuPanel setFont:mfont |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6438 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6439 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6440 |
drawSeparatingLines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6441 |
"draw separating lines |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6442 |
" |
2059 | 6443 |
|myIndex lfSep rtSep items prevItem nextItem |
6444 |
lightColor shadowColor |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6445 |
l "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6446 |
t "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6447 |
r "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6448 |
b "{ Class:SmallInteger }" |
706 | 6449 |
| |
2059 | 6450 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6451 |
items := menuPanel items. |
2059 | 6452 |
myIndex := items identityIndexOf:self. |
6453 |
||
6454 |
prevItem := items at:(myIndex - 1) ifAbsent:nil. |
|
6455 |
lfSep := prevItem notNil and:[prevItem isButton not]. |
|
6456 |
||
6457 |
nextItem := items at:(myIndex + 1) ifAbsent:nil. |
|
6458 |
rtSep := nextItem notNil and:[nextItem isButton not]. |
|
6459 |
||
6460 |
(lfSep or:[rtSep]) ifFalse:[ |
|
2219 | 6461 |
^ self |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6462 |
]. |
2059 | 6463 |
|
6464 |
lightColor := menuPanel lightColor. |
|
6465 |
shadowColor := menuPanel shadowColor. |
|
6466 |
||
6467 |
menuPanel paint:lightColor. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6468 |
|
608 | 6469 |
l := layout left. |
6470 |
t := layout top. |
|
6471 |
r := layout right. |
|
6472 |
b := layout bottom. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6473 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6474 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6475 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1]. |
6476 |
rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1]. |
|
6477 |
||
6478 |
menuPanel paint:shadowColor. |
|
6479 |
lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2]. |
|
6480 |
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
|
6481 |
] ifFalse:[ |
2219 | 6482 |
lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b]. |
6483 |
rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b]. |
|
6484 |
||
6485 |
menuPanel paint:shadowColor. |
|
6486 |
lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b]. |
|
6487 |
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
|
6488 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6489 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6490 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6491 |
drawSeparator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6492 |
"draw as separator |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6493 |
" |
2059 | 6494 |
|type lightColor shadowColor isDouble |
6495 |
left top |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6496 |
x0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6497 |
x1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6498 |
y0 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6499 |
y1 "{ Class:SmallInteger }" |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6500 |
| |
2059 | 6501 |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6502 |
type := self separatorType. |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6503 |
(type isNil or:[type == #blankLine]) ifTrue:[ |
2219 | 6504 |
^ self |
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6505 |
]. |
2059 | 6506 |
|
6507 |
isDouble := type == #doubleLine. |
|
6508 |
||
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6509 |
lightColor := menuPanel lightColor. |
2059 | 6510 |
shadowColor := menuPanel shadowColor. |
6511 |
menuPanel paint:shadowColor. |
|
6512 |
||
6513 |
left := layout left. |
|
6514 |
top := layout top. |
|
1707
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6515 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6516 |
menuPanel verticalLayout ifTrue:[ |
2219 | 6517 |
x0 := left + HorizontalInset. |
6518 |
x1 := layout right - HorizontalInset. |
|
6519 |
y0 := top - 1 + (layout height // 2). |
|
6520 |
isDouble ifTrue:[y0 := y0 - 2]. |
|
6521 |
||
6522 |
menuPanel displayLineFromX:x0 y:y0 toX:x1 y:y0. |
|
6523 |
isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4]. |
|
6524 |
||
6525 |
menuPanel paint:lightColor. |
|
6526 |
menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1. |
|
6527 |
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
|
6528 |
|
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6529 |
] ifFalse:[ |
2219 | 6530 |
y1 := layout bottom. |
6531 |
x0 := left - 1 + (layout width // 2). |
|
6532 |
y0 := top. |
|
6533 |
isDouble ifTrue:[x0 := x0 - 2]. |
|
6534 |
||
6535 |
menuPanel displayLineFromX:x0 y:y0 toX:x0 y:y1. |
|
6536 |
isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1]. |
|
6537 |
||
6538 |
menuPanel paint:lightColor. |
|
6539 |
menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1. |
|
6540 |
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
|
6541 |
] |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6542 |
! |
4354f516e937
add some comment to methods; split draw routines for buttons labels ..
ca
parents:
1705
diff
changeset
|
6543 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6544 |
invalidate |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6545 |
|
2362 | 6546 |
layout isNil ifTrue:[^ self]. |
6547 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6548 |
(displayLabel notNil and:[menuPanel notNil]) ifTrue:[ |
2362 | 6549 |
menuPanel invalidateItem:self repairNow:false |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6550 |
] |
388 | 6551 |
! ! |
6552 |
||
6553 |
!MenuPanel::Item methodsFor:'initialization'! |
|
6554 |
||
6555 |
destroy |
|
616 | 6556 |
"destroy submenus, remove dependencies |
388 | 6557 |
" |
616 | 6558 |
self submenu:nil. |
2681 | 6559 |
self removeDependencies. |
616 | 6560 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6561 |
menuPanel := nil. |
616 | 6562 |
! |
6563 |
||
794 | 6564 |
in:aPanel |
6565 |
"create item in a menuPanel |
|
6566 |
" |
|
6567 |
menuPanel := aPanel. |
|
2359 | 6568 |
|
6569 |
menuItem isNil ifTrue:[ |
|
6570 |
self halt. |
|
6571 |
menuItem := MenuItem new |
|
6572 |
]. |
|
6573 |
! |
|
6574 |
||
6575 |
initialize |
|
6576 |
menuItem := MenuItem new. |
|
1811 | 6577 |
! |
6578 |
||
6579 |
reinitStyle |
|
6580 |
||
6581 |
subMenu notNil ifTrue:[ |
|
2219 | 6582 |
subMenu reinitStyle |
1811 | 6583 |
]. |
6584 |
||
6585 |
"Created: / 17.8.2000 / 17:57:07 / cg" |
|
6586 |
"Modified: / 17.8.2000 / 18:00:08 / cg" |
|
794 | 6587 |
! ! |
6588 |
||
6589 |
!MenuPanel::Item methodsFor:'label basics'! |
|
6590 |
||
6591 |
disabledRawLabel |
|
6592 |
"returns the label used if the item is disabled |
|
6593 |
" |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6594 |
|block form image| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6595 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6596 |
disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6597 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6598 |
disabledDisplayLabel := displayLabel ? ''. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6599 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6600 |
disabledDisplayLabel isString ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6601 |
^ disabledDisplayLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6602 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6603 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6604 |
block := [:el| |rslt| |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6605 |
(rslt := el) notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6606 |
el isImageOrForm ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6607 |
el colorMap notNil ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6608 |
rslt := menuPanel lightenedImageOnDevice:el |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6609 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6610 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6611 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6612 |
((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
|
6613 |
form := menuPanel lightenedImageOnDevice:form |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6614 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6615 |
((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
|
6616 |
image := menuPanel lightenedImageOnDevice:image |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6617 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6618 |
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
|
6619 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6620 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6621 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6622 |
rslt |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6623 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6624 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6625 |
displayLabel isArray ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6626 |
disabledDisplayLabel := Array new:(displayLabel size). |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6627 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6628 |
displayLabel keysAndValuesDo:[:anIndex :aLabel| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6629 |
disabledDisplayLabel at:anIndex put:(block value:aLabel) |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6630 |
] |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6631 |
] ifFalse:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6632 |
disabledDisplayLabel := block value:displayLabel |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6633 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6634 |
^ disabledDisplayLabel |
794 | 6635 |
! |
6636 |
||
1829 | 6637 |
fetchDeviceResources |
2373 | 6638 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6639 |
disabledDisplayLabel := nil. |
1829 | 6640 |
self fetchImages. |
6641 |
! |
|
6642 |
||
616 | 6643 |
fetchImages |
6644 |
"fetch images |
|
6645 |
" |
|
2118
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6646 |
|icon| |
89d02ebc5b65
optimize #labels: and #fetchImages in Item. discard block
ca
parents:
2113
diff
changeset
|
6647 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6648 |
(displayLabel isNil or:[displayLabel isString]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6649 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6650 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6651 |
displayLabel isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6652 |
displayLabel := menuPanel imageOnMyDevice:displayLabel. |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6653 |
^ self. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6654 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6655 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6656 |
(displayLabel isKindOf:LabelAndIcon) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6657 |
(icon := displayLabel image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6658 |
displayLabel image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6659 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6660 |
(icon := displayLabel icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6661 |
displayLabel icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6662 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6663 |
^ self |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6664 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6665 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6666 |
displayLabel isArray ifFalse:[^ self]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6667 |
|
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6668 |
displayLabel keysAndValuesDo:[:i :el| |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6669 |
(el notNil and:[el isString not]) ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6670 |
el isImageOrForm ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6671 |
displayLabel at:i put:(menuPanel imageOnMyDevice:el). |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6672 |
] ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6673 |
el class == LabelAndIcon ifTrue:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6674 |
(icon := el image) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6675 |
el image:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6676 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6677 |
(icon := el icon) notNil ifTrue:[ |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
6678 |
el icon:(menuPanel imageOnMyDevice:icon) |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6679 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6680 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6681 |
] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6682 |
] |
1078 | 6683 |
]. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6684 |
! |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6685 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6686 |
updateAccessCharacterFor:aLabel |
2550
1dc3745fc313
do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents:
2545
diff
changeset
|
6687 |
"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
|
6688 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6689 |
|s i rest label pos| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6690 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6691 |
(accessCharacter notNil or:[aLabel isNil]) ifTrue:[ |
2359 | 6692 |
^ aLabel |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6693 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6694 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6695 |
aLabel isString ifFalse:[ |
2359 | 6696 |
aLabel class == LabelAndIcon ifTrue:[ |
6697 |
aLabel string:(self updateAccessCharacterFor:(aLabel string)) |
|
6698 |
]. |
|
6699 |
^ aLabel |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6700 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6701 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6702 |
s := aLabel size. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6703 |
i := 1. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6704 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6705 |
label := aLabel. |
2359 | 6706 |
pos := menuItem accessCharacterPosition. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6707 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6708 |
[((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[ |
2359 | 6709 |
rest := label copyFrom:(i+1). |
6710 |
||
6711 |
i == 1 ifTrue:[label := rest] |
|
6712 |
ifFalse:[label := (label copyFrom:1 to:(i-1)), rest]. |
|
6713 |
||
6714 |
(label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i]. |
|
6715 |
s := s - 1. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6716 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6717 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6718 |
(pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[ |
2359 | 6719 |
^ label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6720 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6721 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6722 |
label isText ifFalse:[ |
2359 | 6723 |
label := Text string:label |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6724 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6725 |
label emphasisAt:pos add:#underline. |
2359 | 6726 |
^ label |
388 | 6727 |
! ! |
6728 |
||
1573 | 6729 |
!MenuPanel::Item methodsFor:'printing & storing'! |
6730 |
||
6731 |
displayString |
|
1690
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6732 |
^ self class name, '[', label printString, ']' |
38b23fb1a931
add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents:
1688
diff
changeset
|
6733 |
|
1573 | 6734 |
! ! |
6735 |
||
388 | 6736 |
!MenuPanel::Item methodsFor:'private'! |
6737 |
||
650 | 6738 |
activeBackgroundColor |
6739 |
"returns the active background color derived from menuPanel |
|
6740 |
" |
|
2359 | 6741 |
menuItem isButton ifTrue:[ |
6742 |
^ menuPanel buttonActiveBackgroundColor |
|
6743 |
]. |
|
6744 |
^ menuPanel activeBackgroundColor |
|
650 | 6745 |
! |
6746 |
||
6747 |
activeForegroundColor |
|
6748 |
"returns the active foreground color derived from menuPanel |
|
6749 |
" |
|
6750 |
||
6751 |
^menuPanel activeForegroundColor |
|
6752 |
! |
|
6753 |
||
727 | 6754 |
backgroundColor |
6755 |
"returns the background color derived from menuPanel |
|
6756 |
" |
|
2359 | 6757 |
menuItem isButton ifTrue:[ |
6758 |
^ menuPanel buttonPassiveBackgroundColor |
|
6759 |
]. |
|
6760 |
^ menuPanel backgroundColor |
|
727 | 6761 |
! |
6762 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6763 |
backgroundColorFromLabel |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6764 |
"returns the background color derived from label or nil |
388 | 6765 |
" |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6766 |
|run| |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6767 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6768 |
label isText ifFalse:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6769 |
run := label emphasis. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6770 |
run size == 0 ifTrue:[^ nil ]. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6771 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6772 |
run := run first. |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6773 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6774 |
run size == 0 ifTrue:[ |
2145 | 6775 |
(run value isColor and:[run key == #backgroundColor]) ifTrue:[ |
6776 |
^ run value |
|
6777 |
] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6778 |
] ifFalse:[ |
2145 | 6779 |
run do:[:r| |
6780 |
(r value isColor and:[r key == #backgroundColor]) ifTrue:[ |
|
6781 |
^ r value |
|
6782 |
] |
|
6783 |
] |
|
388 | 6784 |
]. |
6785 |
^ nil |
|
6786 |
! |
|
6787 |
||
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6788 |
buttonEnteredBackgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6789 |
"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
|
6790 |
derived from menuPanel |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6791 |
" |
2359 | 6792 |
menuItem isButton ifTrue:[ |
6793 |
^ menuPanel buttonEnteredBackgroundColor |
|
6794 |
]. |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6795 |
^ menuPanel backgroundColor |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6796 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6797 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6798 |
choiceForm |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6799 |
"returns choice form or nil |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6800 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6801 |
|isOn| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6802 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6803 |
choice isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6804 |
|
2359 | 6805 |
isOn := (choice value = menuItem choiceValue). |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6806 |
self enabled ifFalse:[ |
2359 | 6807 |
^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn] |
6808 |
ifFalse:[menuPanel iconRadioGroupDisabledOff] |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6809 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6810 |
^ isOn ifTrue:[menuPanel iconRadioGroupOn] |
2359 | 6811 |
ifFalse:[menuPanel iconRadioGroupOff] |
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6812 |
! |
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6813 |
|
663 | 6814 |
findSubMenuIn:aRecv |
1051
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6815 |
"ask the receiver for a submenu aspect, sending it |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6816 |
#aspectFor: first; then trying the selector itself. |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6817 |
Ignore the error if that message is not understood |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6818 |
(but not other message-not-understoods)" |
a448c854fcbb
catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents:
1048
diff
changeset
|
6819 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6820 |
|subm sel numArgs| |
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6821 |
|
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6822 |
aRecv isNil ifTrue:[^ nil]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6823 |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6824 |
sel := menuItem submenuChannel. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6825 |
sel isString ifFalse:[^ nil]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6826 |
sel := sel asSymbol. |
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6827 |
numArgs := sel numArgs. |
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6828 |
|
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6829 |
numArgs == 0 ifTrue:[ |
2359 | 6830 |
MessageNotUnderstood handle:[:ex | |
6831 |
|selector| |
|
6832 |
||
6833 |
((selector := ex message selector) == sel |
|
6834 |
or:[selector == #aspectFor:]) ifFalse:[ |
|
6835 |
ex reject |
|
6836 |
]. |
|
6837 |
] do:[ |
|
6838 |
subm := aRecv aspectFor:sel. |
|
6839 |
]. |
|
6840 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6841 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6842 |
|
2043 | 6843 |
(Array with:(aRecv) with:(aRecv class)) |
6844 |
do:[:aPossibleReceiver | |
|
2359 | 6845 |
MessageNotUnderstood handle:[:ex| |
6846 |
ex message selector == sel ifFalse:[ ex reject ] |
|
6847 |
] do:[ |
|
6848 |
numArgs == 0 ifTrue:[ |
|
6849 |
subm := aPossibleReceiver perform:sel |
|
6850 |
] ifFalse:[ |
|
6851 |
numArgs == 1 ifTrue:[ |
|
6852 |
subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel) |
|
6853 |
] ifFalse:[ |
|
6854 |
subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel |
|
6855 |
] |
|
6856 |
] |
|
6857 |
]. |
|
6858 |
subm notNil ifTrue:[^ subm]. |
|
1795
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6859 |
]. |
6afd0e768267
submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents:
1793
diff
changeset
|
6860 |
|
663 | 6861 |
^ subm |
2043 | 6862 |
|
6863 |
"Modified: / 30.10.2001 / 13:28:25 / cg" |
|
663 | 6864 |
! |
6865 |
||
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6866 |
indicationValue |
524 | 6867 |
"returns indication value or nil in case of no indication |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6868 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6869 |
|numArgs sel recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6870 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6871 |
indication isNil ifTrue:[^ nil]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6872 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6873 |
indication isSymbol ifFalse:[ |
2359 | 6874 |
^ indication value == true "block or model" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6875 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6876 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6877 |
(numArgs := indication numArgs) == 2 ifTrue:[ |
2359 | 6878 |
recv := menuPanel receiver. |
6879 |
||
6880 |
(recv isValueModel) ifFalse:[ |
|
6881 |
(recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[ |
|
6882 |
sel := indication copyFrom:1 to:(indication indexOf:$:). |
|
6883 |
sel := sel asSymbol. |
|
6884 |
||
6885 |
MessageNotUnderstood handle:[:ex| |
|
6886 |
ex message selector == sel ifFalse:[ |
|
6887 |
ex reject |
|
6888 |
]. |
|
6889 |
] do:[ |
|
6890 |
sel := recv perform:sel with:(menuItem argument) |
|
6891 |
] |
|
6892 |
]. |
|
6893 |
]. |
|
6894 |
^ sel value == true |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6895 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6896 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6897 |
numArgs ~~ 0 ifTrue:[ |
2359 | 6898 |
sel := (indication copyWithoutLast:1) asSymbol |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6899 |
] ifFalse:[ |
2359 | 6900 |
sel := indication |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6901 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6902 |
sel := self aspectAt:sel. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6903 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6904 |
sel isValueModel ifTrue:[ |
2359 | 6905 |
indication := sel. |
6906 |
indication addDependent:self. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6907 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6908 |
^ sel value == true |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6909 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6910 |
|
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6911 |
indicationValue:aValue |
1218 | 6912 |
"set the indication value |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6913 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6914 |
|numArgs recv| |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6915 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6916 |
indication isNil ifTrue:[^ self]. "no indication specified" |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6917 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6918 |
indication isSymbol ifFalse:[ |
2359 | 6919 |
indication perform:#value: with:aValue ifNotUnderstood:nil. "block or model" |
6920 |
^ self |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6921 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6922 |
|
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6923 |
(numArgs := indication numArgs) == 0 ifTrue:[ "no arguments to selector; cannot set" |
2359 | 6924 |
^ self |
1218 | 6925 |
]. |
6926 |
||
524 | 6927 |
recv := menuPanel receiver. |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6928 |
recv isValueModel ifTrue:[^ self]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6929 |
|
1218 | 6930 |
recv isNil ifTrue:[ |
2359 | 6931 |
recv := menuPanel application. |
6932 |
recv isNil ifTrue:[^ self]. |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6933 |
]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6934 |
|
2069
7891c7d3af69
use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents:
2064
diff
changeset
|
6935 |
MessageNotUnderstood handle:[:ex| |
2359 | 6936 |
(ex message selector ~~ indication) ifTrue:[ |
6937 |
ex reject |
|
6938 |
]. |
|
6939 |
self ifNotInUIBuilderInfoPrintCR: |
|
2545
e838be7f2c83
Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents:
2505
diff
changeset
|
6940 |
('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
|
6941 |
bindWith:recv className with:indication). |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6942 |
] do:[ |
2359 | 6943 |
numArgs == 1 ifTrue:[ |
6944 |
recv perform:indication with:aValue |
|
6945 |
] ifFalse:[ |
|
6946 |
recv perform:indication with:(menuItem argument ? self) with:aValue |
|
6947 |
] |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6948 |
]. |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6949 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6950 |
|
1074
25e3910947de
added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents:
1068
diff
changeset
|
6951 |
indicatorForm |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6952 |
"returns indication form or nil |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6953 |
" |
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6954 |
|val| |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6955 |
|
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6956 |
indication isNil ifTrue:[^ nil]. |
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
6957 |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6958 |
val := self indicationValue. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6959 |
self enabled ifFalse:[ |
2219 | 6960 |
^ val == true |
6961 |
ifTrue:[menuPanel iconIndicationDisabledOn] |
|
6962 |
ifFalse:[menuPanel iconIndicationDisabledOff] |
|
1798
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6963 |
]. |
08ae92e6fdf3
extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents:
1797
diff
changeset
|
6964 |
^ val == true |
2219 | 6965 |
ifTrue:[menuPanel iconIndicationOn] |
6966 |
ifFalse:[menuPanel iconIndicationOff] |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6967 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
6968 |
|
1081
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6969 |
isEntered |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6970 |
"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
|
6971 |
" |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6972 |
^ menuPanel enteredItem == self |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6973 |
|
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6974 |
"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
|
6975 |
! |
fd67c198eeea
added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents:
1080
diff
changeset
|
6976 |
|
464 | 6977 |
separatorType |
6978 |
"returns type of separator line or nil |
|
388 | 6979 |
" |
390 | 6980 |
|c lbl| |
388 | 6981 |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6982 |
self isSeparator ifFalse:[ |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6983 |
^ nil |
388 | 6984 |
]. |
6985 |
||
390 | 6986 |
(lbl := label value) isNil ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6987 |
^ #singleLine |
388 | 6988 |
]. |
6989 |
||
390 | 6990 |
lbl size == 1 ifTrue:[ |
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6991 |
c := lbl first. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6992 |
c == $- ifTrue:[^ #singleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6993 |
c == $= ifTrue:[^ #doubleLine]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6994 |
]. |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
6995 |
^ #blankLine |
1130 | 6996 |
! |
6997 |
||
6998 |
setupSubmenu |
|
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
6999 |
|appl master recv submenuHolder submenu submenuEncoding channel| |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7000 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7001 |
channel := menuItem submenuChannel value. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7002 |
channel isNil ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7003 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7004 |
subMenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7005 |
menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7006 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7007 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7008 |
channel isSymbol ifFalse:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7009 |
submenuHolder := channel |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7010 |
] ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7011 |
appl := menuPanel application. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7012 |
appl isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7013 |
appl := menuPanel receiver. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7014 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7015 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7016 |
[submenuHolder isNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7017 |
and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7018 |
and:[master ~~ appl]]] whileTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7019 |
appl := master. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7020 |
submenuHolder := self findSubMenuIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7021 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7022 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7023 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7024 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7025 |
submenuHolder isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7026 |
(submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7027 |
(recv := menuPanel receiver) ~~ appl ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7028 |
appl := recv. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7029 |
submenuHolder := self findSubMenuIn:appl |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7030 |
] |
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7031 |
] |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7032 |
] |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7033 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7034 |
|
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7035 |
(submenu := submenuHolder value) isArray ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7036 |
submenuEncoding := submenu. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7037 |
submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7038 |
"/ cg: linked menus also may contain translations ... |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7039 |
submenu notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7040 |
appl notNil ifTrue:[ |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7041 |
submenu findGuiResourcesIn:appl. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7042 |
] |
2232
5784671fb497
when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
7043 |
]. |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7044 |
]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7045 |
"/ appl notNil ifTrue:[submenu application:appl]. |
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7046 |
self submenu:submenu. |
1130 | 7047 |
^ subMenu |
7048 |
||
7049 |
"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
|
7050 |
! |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7051 |
|
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7052 |
spaceBetweenEmptyLines |
b3d92f4a5f7b
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2482
diff
changeset
|
7053 |
^ 3 |
388 | 7054 |
! ! |
7055 |
||
7056 |
!MenuPanel::Item methodsFor:'queries'! |
|
7057 |
||
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7058 |
canChangeVisibility |
1699 | 7059 |
"return true if I am not always visible; can only be changed by a selector |
7060 |
otherwise there is a change notification raised if the model changed |
|
7061 |
" |
|
7062 |
^ isVisible isSymbol |
|
7063 |
"/ ^ isVisible notNil and:[isVisible ~~ true] |
|
1217
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7064 |
! |
c6a4c536aa8c
care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
7065 |
|
388 | 7066 |
canSelect |
1699 | 7067 |
"returns true if item is selectable; no separator, visible and enabled. |
7068 |
in case of a choice (RadioButton) i have to check for the choiceValue |
|
388 | 7069 |
" |
2362 | 7070 |
self isSeparator ifTrue:[^ false]. |
7071 |
||
7072 |
(self isVisible and:[self enabled]) ifTrue:[ |
|
2359 | 7073 |
(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[ |
7074 |
^ true |
|
7075 |
]. |
|
1078 | 7076 |
]. |
7077 |
^ false |
|
388 | 7078 |
! |
7079 |
||
2046 | 7080 |
containsPoint:aPoint |
7081 |
"returns true if aPoint is contained in my layout |
|
7082 |
" |
|
7083 |
(self isVisible and:[layout notNil]) ifTrue:[ |
|
2219 | 7084 |
^ layout containsPoint:aPoint |
2046 | 7085 |
]. |
7086 |
^ false |
|
7087 |
||
7088 |
"Created: / 13.11.2001 / 13:55:31 / cg" |
|
7089 |
! |
|
7090 |
||
388 | 7091 |
containsPointX:x y:y |
7092 |
"returns true if point is contained in my layout |
|
7093 |
" |
|
712 | 7094 |
(self isVisible and:[layout notNil]) ifTrue:[ |
2219 | 7095 |
^ layout containsPointX:x y:y |
505 | 7096 |
]. |
7097 |
^ false |
|
388 | 7098 |
! |
7099 |
||
2199 | 7100 |
hasDelayedMenu |
7101 |
"returns true if a delayed menu exists |
|
7102 |
" |
|
2360 | 7103 |
self hasSubmenu ifFalse:[ |
2326
a8447d6449eb
show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents:
2269
diff
changeset
|
7104 |
^ false |
2199 | 7105 |
]. |
2360 | 7106 |
menuItem itemValue notNil ifTrue:[ ^ true ]. |
7107 |
||
7108 |
(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
|
7109 |
^ false |
2199 | 7110 |
]. |
7111 |
^ true |
|
7112 |
! |
|
7113 |
||
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7114 |
hasDelayedMenuIndicator |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7115 |
"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
|
7116 |
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
|
7117 |
" |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7118 |
menuPanel isPopUpView ifFalse:[ |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7119 |
^ self hasDelayedMenu |
2214
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7120 |
]. |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7121 |
^ false |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7122 |
! |
8eefad87cf62
drawing delayed menu indicators... first try not yet finished
ca
parents:
2199
diff
changeset
|
7123 |
|
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7124 |
hasIndication |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7125 |
"returns true if on/off indication exists |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7126 |
" |
1726
a4733a8b51e1
support labeled arrays; printing vertical (font not yet supported)
ca
parents:
1723
diff
changeset
|
7127 |
^ indication notNil |
407
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7128 |
! |
40554a07d5aa
fix bugs; implement indication; text with backgroundColor
ca
parents:
399
diff
changeset
|
7129 |
|
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7130 |
hasMenuIndicator |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7131 |
"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
|
7132 |
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
|
7133 |
" |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7134 |
menuPanel isPopUpView ifFalse:[ |
2360 | 7135 |
^ self hasSubmenu and:[menuItem isButton] |
2344
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7136 |
]. |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7137 |
^ false |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7138 |
! |
d8a5d00c004e
different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
7139 |
|
388 | 7140 |
hasSubmenu |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7141 |
"returns true if the item is configured as an subMenu entry |
388 | 7142 |
" |
2364
c72f35819bda
remove attribute submenuChannel - derives from menuItem
ca
parents:
2362
diff
changeset
|
7143 |
^ subMenu notNil or:[menuItem submenuChannel notNil] |
388 | 7144 |
! |
7145 |
||
7146 |
isEnabled |
|
7147 |
"returns enabled state |
|
7148 |
" |
|
7149 |
^ self enabled |
|
7150 |
! |
|
7151 |
||
608 | 7152 |
isSeparator |
7153 |
"returns true if item is a separator |
|
7154 |
" |
|
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7155 |
^ displayLabel isNil |
608 | 7156 |
! |
7157 |
||
2159
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7158 |
isToggle |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7159 |
"returns true if on/off indication exists |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7160 |
" |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7161 |
^ self hasIndication and:[ self isButton ] |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7162 |
! |
1eac041aeb3d
toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents:
2145
diff
changeset
|
7163 |
|
712 | 7164 |
isVisible |
7165 |
"returns the visibility state |
|
7166 |
" |
|
7167 |
|state| |
|
7168 |
||
7169 |
isVisible isSymbol ifTrue:[ |
|
2219 | 7170 |
state := self aspectAt:isVisible. |
7171 |
||
7172 |
state isValueModel ifTrue:[ |
|
7173 |
isVisible := state. |
|
7174 |
isVisible addDependent:self. |
|
7175 |
state := isVisible. |
|
7176 |
] |
|
712 | 7177 |
] ifFalse:[ |
2219 | 7178 |
state := isVisible |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7179 |
]. |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7180 |
^ state value ~~ false |
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7181 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7182 |
"Modified: / 5.10.1998 / 12:08:28 / cg" |
712 | 7183 |
! |
7184 |
||
7185 |
isVisible:something |
|
7186 |
"change the state; if the state changed, a redraw is performed |
|
7187 |
" |
|
7188 |
|oldState newState| |
|
7189 |
||
7190 |
isVisible isNil ifTrue:[ |
|
2219 | 7191 |
oldState := true |
712 | 7192 |
] ifFalse:[ |
2219 | 7193 |
oldState := isVisible value. |
7194 |
isVisible isValueModel ifTrue:[ |
|
7195 |
isVisible removeDependent:self |
|
7196 |
] |
|
712 | 7197 |
]. |
7198 |
isVisible := something. |
|
7199 |
||
7200 |
isVisible isNil ifTrue:[ |
|
2219 | 7201 |
newState := true |
712 | 7202 |
] ifFalse:[ |
2219 | 7203 |
isVisible isValueModel ifTrue:[ |
7204 |
isVisible addDependent:self |
|
7205 |
] ifFalse:[ |
|
7206 |
isVisible isSymbol ifTrue:[^ self] |
|
7207 |
]. |
|
7208 |
menuPanel shown ifFalse:[^ self]. |
|
7209 |
newState := isVisible value. |
|
712 | 7210 |
]. |
7211 |
||
7212 |
newState ~~ oldState ifTrue:[ |
|
2219 | 7213 |
menuPanel mustRearrange |
712 | 7214 |
] |
1164
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7215 |
|
e6e9633abf48
kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
7216 |
"Modified: / 5.10.1998 / 12:12:04 / cg" |
712 | 7217 |
! |
7218 |
||
2433
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7219 |
needsItemSpaceWhenDrawing |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7220 |
^ self isSeparator not and:[menuItem isButton not] |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7221 |
! |
49341ed11830
rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents:
2407
diff
changeset
|
7222 |
|
388 | 7223 |
shortcutKeyAsString |
7224 |
"converts shortcutKey to a text object |
|
7225 |
" |
|
2359 | 7226 |
|nm prefix shortcutKey| |
7227 |
||
7228 |
shortcutKey := menuItem shortcutKey. |
|
1609 | 7229 |
|
7230 |
shortcutKey isNil ifTrue:[ |
|
2359 | 7231 |
^ nil |
1609 | 7232 |
]. |
7233 |
||
7234 |
shortcutKey isCharacter ifTrue:[ |
|
2359 | 7235 |
nm := shortcutKey asString |
388 | 7236 |
] ifFalse:[ |
2359 | 7237 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
7238 |
"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier |
|
7239 |
"/ Ask the devices keyboardMap for the backtranslation. |
|
7240 |
||
7241 |
nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey. |
|
7242 |
"/ |
|
7243 |
"/ some modifier-key combination ? |
|
7244 |
"/ |
|
7245 |
(nm startsWith:#Cmd) ifTrue:[ |
|
7246 |
prefix := #Cmd. |
|
7247 |
] ifFalse:[(nm startsWith:#Alt) ifTrue:[ |
|
7248 |
prefix := #Alt. |
|
7249 |
] ifFalse:[(nm startsWith:#Meta) ifTrue:[ |
|
7250 |
prefix := #Meta. |
|
7251 |
] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[ |
|
7252 |
prefix := #Ctrl. |
|
7253 |
]]]]. |
|
7254 |
prefix notNil ifTrue:[ |
|
7255 |
nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1)) |
|
7256 |
] ifFalse:[ |
|
7257 |
nm := nm asString |
|
7258 |
] |
|
388 | 7259 |
]. |
608 | 7260 |
^ nm |
388 | 7261 |
|
987 | 7262 |
"Modified: / 17.7.1998 / 11:56:40 / cg" |
388 | 7263 |
! |
7264 |
||
7265 |
shortcutKeyPrefixFor:aModifier |
|
7266 |
"returns prefix assigned to a modifier |
|
7267 |
" |
|
7268 |
|m| |
|
7269 |
||
7270 |
m := menuPanel device modifierKeyTopFor:aModifier. |
|
7271 |
m notNil ifTrue:[ |
|
2145 | 7272 |
^ m , '-' |
388 | 7273 |
]. |
987 | 7274 |
^ aModifier , '-'. |
7275 |
||
7276 |
"Modified: / 17.7.1998 / 11:56:46 / cg" |
|
388 | 7277 |
! ! |
7278 |
||
7279 |
!MenuPanel::Item methodsFor:'selection'! |
|
7280 |
||
7281 |
isSelected |
|
7282 |
"returns true if item is selected |
|
7283 |
" |
|
1998 | 7284 |
|
7285 |
^ menuPanel notNil and:[menuPanel selection == self] |
|
388 | 7286 |
! |
7287 |
||
2249 | 7288 |
isSelected:isSelected |
1473
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7289 |
"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
|
7290 |
submenu and perform a redraw |
1f62652f146e
use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents:
1472
diff
changeset
|
7291 |
" |
2249 | 7292 |
(isSelected and:[menuPanel notNil]) ifFalse:[ |
7293 |
self invalidate. |
|
7294 |
self hideSubmenu. |
|
2359 | 7295 |
^ self |
2249 | 7296 |
]. |
7297 |
||
2199 | 7298 |
menuPanel realized ifFalse:[ ^ self ]. |
7299 |
||
2359 | 7300 |
(indication isNil or:[menuItem isButton not]) ifTrue:[ |
2249 | 7301 |
self invalidate |
2199 | 7302 |
]. |
7303 |
self hasSubmenu ifFalse:[ ^ self]. |
|
7304 |
||
7305 |
self hasDelayedMenu ifTrue:[ |
|
2249 | 7306 |
menuPanel openDelayed:self |
2199 | 7307 |
] ifFalse:[ |
2249 | 7308 |
subMenu := self setupSubmenu. |
2374 | 7309 |
subMenu notNil ifTrue:[ self openSubmenu ]. |
1701 | 7310 |
]. |
388 | 7311 |
! ! |
7312 |
||
2692 | 7313 |
!MenuPanel::Item::Adornment methodsFor:'accessing'! |
7314 |
||
7315 |
argument2 |
|
7316 |
||
7317 |
^ argument2 |
|
7318 |
! |
|
7319 |
||
7320 |
argument2:anArgumentOrNil |
|
7321 |
||
7322 |
argument2 := anArgumentOrNil |
|
7323 |
! ! |
|
7324 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7325 |
!MenuPanel::ScrollActivity class methodsFor:'default icons'! |
2016 | 7326 |
|
2018 | 7327 |
icon |
2016 | 7328 |
"This resource specification was automatically generated |
7329 |
by the ImageEditor of ST/X." |
|
7330 |
||
7331 |
"Do not manually edit this!! If it is corrupted, |
|
7332 |
the ImageEditor may not be able to read the specification." |
|
7333 |
||
7334 |
" |
|
2018 | 7335 |
self icon inspect |
7336 |
ImageEditor openOnClass:self andSelector:#icon |
|
2016 | 7337 |
" |
7338 |
||
7339 |
<resource: #image> |
|
7340 |
||
7341 |
^Icon |
|
2219 | 7342 |
constantNamed:#'MenuPanel::Scrolling class icon' |
7343 |
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 | 7344 |
! ! |
7345 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7346 |
!MenuPanel::ScrollActivity class methodsFor:'instance creation'! |
2016 | 7347 |
|
7348 |
new |
|
7349 |
^ self basicNew initialize |
|
7350 |
! ! |
|
7351 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7352 |
!MenuPanel::ScrollActivity methodsFor:'accessing'! |
2016 | 7353 |
|
7354 |
activeMenu |
|
7355 |
"returns the active menu the scrolling is activated on; nil |
|
7356 |
is returned if scrolling is deactivated |
|
7357 |
" |
|
7358 |
^ activeMenu |
|
7359 |
! |
|
7360 |
||
7361 |
direction |
|
7362 |
"returns the scroll-direction |
|
7363 |
" |
|
7364 |
^ direction |
|
7365 |
! |
|
7366 |
||
7367 |
iconAt:aDirection on:aMenu |
|
2018 | 7368 |
|icon device index| |
2016 | 7369 |
|
7370 |
device := aMenu device. |
|
7371 |
||
7372 |
aDirection == #PREV ifTrue:[ |
|
2219 | 7373 |
aMenu verticalLayout ifTrue:[index := 3] "/ 3 - 1 * 90 180 |
7374 |
ifFalse:[index := 2] "/ 2 - 1 * 90 90 |
|
2018 | 7375 |
] ifFalse:[ |
2219 | 7376 |
aMenu verticalLayout ifTrue:[index := 1] "/ 1 - 1 * 90 0 |
7377 |
ifFalse:[index := 4] "/ 4 - 1 * 90 270 |
|
2018 | 7378 |
]. |
7379 |
||
7380 |
icon := icons at:index. |
|
7381 |
||
7382 |
(icon isNil or:[icon device ~~ device]) ifTrue:[ |
|
2219 | 7383 |
icon := self class icon. |
7384 |
index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ] |
|
7385 |
ifFalse:[ icon := icon copy ]. |
|
7386 |
||
7387 |
icon := icon onDevice:device. |
|
7388 |
icon clearMaskedPixels. |
|
7389 |
icons at:index put:icon |
|
2018 | 7390 |
]. |
7391 |
^ icon |
|
2016 | 7392 |
! ! |
7393 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7394 |
!MenuPanel::ScrollActivity methodsFor:'initialization'! |
2016 | 7395 |
|
7396 |
initialize |
|
7397 |
||
7398 |
semaLock := RecursionLock new. |
|
2018 | 7399 |
icons := Array new:4. |
2016 | 7400 |
! ! |
7401 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7402 |
!MenuPanel::ScrollActivity methodsFor:'queries'! |
2016 | 7403 |
|
7404 |
isActive |
|
7405 |
"returns true if scrolling is activated |
|
7406 |
" |
|
7407 |
^ activeMenu notNil |
|
7408 |
! ! |
|
7409 |
||
2137
0aaeeab0811d
renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
7410 |
!MenuPanel::ScrollActivity methodsFor:'user operations'! |
2016 | 7411 |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7412 |
startIfRequiredAt:aDirection on:aMenu |
2016 | 7413 |
"start scrolling; returns true if scrolling is activated |
7414 |
" |
|
7415 |
|bounds index| |
|
7416 |
||
7417 |
semaLock critical:[ |
|
2219 | 7418 |
self stop. |
7419 |
||
7420 |
( aDirection notNil |
|
7421 |
and:[aMenu notNil |
|
7422 |
and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]] |
|
7423 |
) ifTrue:[ |
|
7424 |
activeMenu := aMenu. |
|
7425 |
direction := aDirection. |
|
7426 |
||
7427 |
index := aMenu indexOfItemAtScroller:aDirection. |
|
7428 |
||
7429 |
index ~~ 0 ifTrue:[ |
|
7430 |
scrollTask := |
|
7431 |
[ |
|
7432 |
|item step| |
|
7433 |
||
7434 |
[ |
|
7435 |
step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1]. |
|
7436 |
( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[ |
|
7437 |
aMenu makeItemVisible:item. |
|
7438 |
index := index + step. |
|
7439 |
]. |
|
7440 |
||
7441 |
Delay waitForSeconds:(ButtonController defaultInitialDelay). |
|
7442 |
||
7443 |
[ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[ |
|
7444 |
aMenu makeItemVisible:item. |
|
7445 |
Delay waitForSeconds:(ButtonController defaultRepeatDelay). |
|
7446 |
index := index + step. |
|
7447 |
]. |
|
7448 |
item := nil. |
|
7449 |
] ensure:[ |
|
7450 |
scrollTask := nil. |
|
7451 |
||
7452 |
item notNil ifTrue:[ |
|
7453 |
"/ process was killed |
|
7454 |
aMenu invalidate:bounds |
|
7455 |
] |
|
7456 |
] |
|
7457 |
] forkAt:8. |
|
7458 |
] |
|
7459 |
] |
|
2016 | 7460 |
]. |
7461 |
^ bounds notNil |
|
2047
62de65e3a61b
initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
7462 |
|
2048 | 7463 |
"Created: ca" |
7464 |
||
7465 |
"Modified: / 13.11.2001 / 20:15:52 / cg" |
|
2016 | 7466 |
! |
7467 |
||
7468 |
stop |
|
7469 |
"stop scrolling; returns true if the scrolling was activated otherwise false |
|
7470 |
" |
|
7471 |
|task resp| |
|
7472 |
||
7473 |
activeMenu isNil ifTrue:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7474 |
^ false |
2016 | 7475 |
]. |
7476 |
semaLock critical:[ |
|
2231
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7477 |
resp := activeMenu notNil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7478 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7479 |
(task := scrollTask) notNil ifTrue:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7480 |
scrollTask := nil. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7481 |
|
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7482 |
Error handle:[:ex| |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7483 |
] do:[ |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7484 |
task terminateWithAllSubprocessesInGroup. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7485 |
task waitUntilTerminated. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7486 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7487 |
]. |
65cec3d10fb1
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
2220
diff
changeset
|
7488 |
activeMenu := direction := nil. |
2016 | 7489 |
]. |
7490 |
^ resp |
|
7491 |
! ! |
|
7492 |
||
388 | 7493 |
!MenuPanel class methodsFor:'documentation'! |
7494 |
||
7495 |
version |
|
2731
7382424af8d9
Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents:
2729
diff
changeset
|
7496 |
^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.395 2004-07-13 08:46:33 stefan Exp $' |
388 | 7497 |
! ! |
2199 | 7498 |
|
388 | 7499 |
MenuPanel initialize! |